evm: fix EndBlock
panic (#51)
This commit is contained in:
parent
73dac6f5b1
commit
0805bf80e5
@ -230,7 +230,7 @@ func NewEthermintApp(
|
||||
cdc := encodingConfig.Amino
|
||||
interfaceRegistry := encodingConfig.InterfaceRegistry
|
||||
|
||||
// NOTE we use custom Injective transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
|
||||
// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
|
||||
bApp := baseapp.NewBaseApp(
|
||||
appName,
|
||||
logger,
|
||||
@ -383,7 +383,7 @@ func NewEthermintApp(
|
||||
ibc.NewAppModule(app.IBCKeeper),
|
||||
params.NewAppModule(app.ParamsKeeper),
|
||||
transferModule,
|
||||
// Injective app modules
|
||||
// Ethermint app modules
|
||||
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.BankKeeper),
|
||||
)
|
||||
|
||||
@ -413,7 +413,7 @@ func NewEthermintApp(
|
||||
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName,
|
||||
slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName,
|
||||
ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, ibctransfertypes.ModuleName,
|
||||
// Injective modules
|
||||
// Ethermint modules
|
||||
evmtypes.ModuleName,
|
||||
|
||||
// NOTE: crisis module must go at the end to check for invariants on each module
|
||||
@ -457,7 +457,7 @@ func NewEthermintApp(
|
||||
app.SetInitChainer(app.InitChainer)
|
||||
app.SetBeginBlocker(app.BeginBlocker)
|
||||
|
||||
// use Injective's custom AnteHandler
|
||||
// use Ethermint's custom AnteHandler
|
||||
app.SetAnteHandler(
|
||||
ante.NewAnteHandler(
|
||||
app.AccountKeeper, app.BankKeeper, app.EvmKeeper,
|
||||
|
@ -4,16 +4,13 @@ package client
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
|
||||
@ -47,8 +44,6 @@ import (
|
||||
evmtypes "github.com/cosmos/ethermint/x/evm/types"
|
||||
|
||||
"github.com/cosmos/ethermint/cmd/ethermintd/config"
|
||||
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -136,7 +131,7 @@ func InitTestnet(
|
||||
) error {
|
||||
|
||||
if chainID == "" {
|
||||
chainID = fmt.Sprintf("injective-%d", tmrand.Int63n(9999999999999)+1)
|
||||
chainID = fmt.Sprintf("ethermint-%d", tmrand.Int63n(9999999999999)+1)
|
||||
}
|
||||
|
||||
if !chaintypes.IsValidChainID(chainID) {
|
||||
@ -297,9 +292,6 @@ func InitTestnet(
|
||||
}
|
||||
|
||||
config.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appConfig)
|
||||
|
||||
ethPrivKey, err := keyring.NewUnsafe(kb).UnsafeExportPrivKeyHex(nodeDirName)
|
||||
initPeggo(outputDir, nodeDirName, []byte(strings.ToUpper(ethPrivKey)))
|
||||
}
|
||||
|
||||
if err := initGenFiles(clientCtx, mbm, chainID, coinDenom, genAccounts, genBalances, genFiles, numValidators); err != nil {
|
||||
@ -318,32 +310,6 @@ func InitTestnet(
|
||||
return nil
|
||||
}
|
||||
|
||||
func initPeggo(outputDir string, nodeDirName string, privKey []byte) {
|
||||
peggoDir := filepath.Join(outputDir, nodeDirName, "peggo")
|
||||
if envdata, _ := ioutil.ReadFile("./templates/peggo_config.template"); len(envdata) > 0 {
|
||||
s := bufio.NewScanner(bytes.NewReader(envdata))
|
||||
for s.Scan() {
|
||||
parts := strings.Split(s.Text(), "=")
|
||||
if len(parts) != 2 {
|
||||
continue
|
||||
} else {
|
||||
content := []byte(s.Text())
|
||||
if parts[0] == "PEGGY_COSMOS_PRIVKEY" {
|
||||
content = append([]byte(parts[0]+"="), privKey...)
|
||||
} else if parts[0] == "PEGGY_ETH_PRIVATE_KEY" {
|
||||
newPrivkey, _ := ethsecp256k1.GenerateKey()
|
||||
privKeyStr := common.Bytes2Hex(newPrivkey.GetKey())
|
||||
privKeyBytes := []byte(strings.ToUpper(privKeyStr))
|
||||
content = append([]byte(parts[0]+"="), privKeyBytes...)
|
||||
}
|
||||
if err := appendToFile(fmt.Sprintf("config.env"), peggoDir, content); err != nil {
|
||||
fmt.Println("Error writing peggo config", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func initGenFiles(
|
||||
clientCtx client.Context,
|
||||
mbm module.BasicManager,
|
||||
|
@ -1,7 +1,7 @@
|
||||
// This is a test utility for Ethermint's Web3 JSON-RPC services.
|
||||
//
|
||||
// To run these tests please first ensure you have the injectived running
|
||||
// and have started the RPC service with `injectived rest-server`.
|
||||
// To run these tests please first ensure you have the ethermintd running
|
||||
// and have started the RPC service with `ethermintd rest-server`.
|
||||
//
|
||||
// You can configure the desired HOST and MODE as well
|
||||
package rpc
|
||||
|
@ -45,6 +45,7 @@ func (k Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.Valid
|
||||
// Gas costs are handled within msg handler so costs should be ignored
|
||||
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
|
||||
k.CommitStateDB.WithContext(ctx)
|
||||
k.WithContext(ctx)
|
||||
|
||||
// Update account balances before committing other parts of state
|
||||
k.CommitStateDB.UpdateAccounts()
|
||||
|
Loading…
Reference in New Issue
Block a user