Skip to content

Commit

Permalink
Resolve lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
drklee3 committed Apr 15, 2024
1 parent e474b39 commit f408bac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion app/ante/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 7 additions & 8 deletions x/evm/keeper/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions x/evm/statedb/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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,
})
Expand Down
2 changes: 1 addition & 1 deletion x/evm/statedb/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit f408bac

Please sign in to comment.