diff --git a/app/ante/eth.go b/app/ante/eth.go index c5fe3db95a..35d49dbcdd 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -88,7 +88,6 @@ func (avd EthAccountVerificationDecorator) AnteHandle( if acct == nil { acc := avd.ak.NewAccountWithAddress(ctx, from) avd.ak.SetAccount(ctx, acc) - acct = statedb.NewEmptyAccount() } else if acct.IsContract() { return ctx, errorsmod.Wrapf(errortypes.ErrInvalidType, "the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash) diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index 17224d0bac..7764483aa7 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -27,7 +27,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/ethereum/go-ethereum/common" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/legacystatedb" @@ -140,11 +139,13 @@ func (k *Keeper) SetBalance(ctx sdk.Context, addr common.Address, amount *big.In } func (k *Keeper) SetAccountLegacy(ctx sdk.Context, addr common.Address, account legacystatedb.Account) error { - k.SetAccount(ctx, addr, statedb.Account{ + if err := k.SetAccount(ctx, addr, statedb.Account{ Nonce: account.Nonce, CodeHash: account.CodeHash, AccountNumber: 0, - }) + }); err != nil { + return err + } return k.SetBalance(ctx, addr, account.Balance) } @@ -200,10 +201,6 @@ func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account stated return nil } -func (k *Keeper) getDenomAddressPrefixStore(ctx sdk.Context, denom string) prefix.Store { - return prefix.NewStore(ctx.KVStore(k.bankStoreKey), banktypes.CreateDenomAddressPrefix(denom)) -} - func (k *Keeper) GetAccountNumber(ctx sdk.Context, addr common.Address) (uint64, bool) { cosmosAddr := sdk.AccAddress(addr.Bytes()) acct := k.accountKeeper.GetAccount(ctx, cosmosAddr) @@ -266,7 +263,9 @@ func (k *Keeper) ReassignAccountNumbers(ctx sdk.Context, addrs []common.Address) } // set account number - ethAcct.SetAccountNumber(accountNumberStart + uint64(i)) + if err := ethAcct.SetAccountNumber(accountNumberStart + uint64(i)); err != nil { + return err + } k.accountKeeper.SetAccount(ctx, acct) } diff --git a/x/evm/statedb/ctx.go b/x/evm/statedb/ctx.go index aca487fe2b..0b8c5179e0 100644 --- a/x/evm/statedb/ctx.go +++ b/x/evm/statedb/ctx.go @@ -55,7 +55,7 @@ func (c *SnapshotCommitCtx) CurrentSnapshot() (CtxSnapshot, bool) { } // Snapshot creates a new branched context with the specified snapshot ID. -func (c *SnapshotCommitCtx) Snapshot(snapshotId int) { +func (c *SnapshotCommitCtx) Snapshot(snapshotID int) { // Branch off a new CacheMultiStore + write function newCtx, newWrite := c.CurrentCtx().CacheContext() @@ -65,7 +65,7 @@ func (c *SnapshotCommitCtx) Snapshot(snapshotId int) { // Save the new snapshot to the list c.snapshots = append(c.snapshots, CtxSnapshot{ - id: snapshotId, + id: snapshotID, ctx: newCtx, write: newWrite, }) diff --git a/x/evm/statedb/journal.go b/x/evm/statedb/journal.go index e27b20ccef..31c4b36f49 100644 --- a/x/evm/statedb/journal.go +++ b/x/evm/statedb/journal.go @@ -168,7 +168,7 @@ func (ch suicideChange) Dirtied() *common.Address { return ch.account } -func (ch balanceChange) Revert(s *StateDB) { +func (ch balanceChange) Revert(_ *StateDB) { // Do nothing, balance is reverted by SnapshotCommitCtx }