Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Aug 15, 2024
1 parent 5346abb commit 2f96588
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/ante/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
// it's safe because there's no store branching in the ante handlers.
type AccountGetter func(sdk.AccAddress) sdk.AccountI

func NewAccountGetter(ctx sdk.Context, ak evmtypes.AccountKeeper) AccountGetter {
func NewCachedAccountGetter(ctx sdk.Context, ak evmtypes.AccountKeeper) AccountGetter {
accounts := make(map[string]sdk.AccountI, 1)
return func(addr sdk.AccAddress) sdk.AccountI {
acc := accounts[string(addr)]
Expand Down
6 changes: 3 additions & 3 deletions app/ante/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (suite *AnteTestSuite) TestNewEthAccountVerificationDecorator() {
tc.malleate()
suite.Require().NoError(vmdb.Commit())

accountGetter := ante.NewAccountGetter(suite.ctx, suite.app.AccountKeeper)
accountGetter := ante.NewCachedAccountGetter(suite.ctx, suite.app.AccountKeeper)
err := ante.VerifyEthAccount(suite.ctx.WithIsCheckTx(tc.checkTx), tc.tx, suite.app.EvmKeeper, evmtypes.DefaultEVMDenom, accountGetter)

if tc.expPass {
Expand Down Expand Up @@ -148,7 +148,7 @@ func (suite *AnteTestSuite) TestEthNonceVerificationDecorator() {
for _, tc := range testCases {
suite.Run(tc.name, func() {
tc.malleate()
accountGetter := ante.NewAccountGetter(suite.ctx, suite.app.AccountKeeper)
accountGetter := ante.NewCachedAccountGetter(suite.ctx, suite.app.AccountKeeper)
err := ante.CheckAndSetEthSenderNonce(suite.ctx.WithIsReCheckTx(tc.reCheckTx), tc.tx, suite.app.AccountKeeper, false, accountGetter)

if tc.expPass {
Expand Down Expand Up @@ -538,7 +538,7 @@ func (suite *AnteTestSuite) TestEthIncrementSenderSequenceDecorator() {
for _, tc := range testCases {
suite.Run(tc.name, func() {
tc.malleate()
accountGetter := ante.NewAccountGetter(suite.ctx, suite.app.AccountKeeper)
accountGetter := ante.NewCachedAccountGetter(suite.ctx, suite.app.AccountKeeper)

if tc.expPanic {
suite.Require().Panics(func() {
Expand Down
2 changes: 1 addition & 1 deletion app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {

// AccountGetter cache the account objects during the ante handler execution,
// it's safe because there's no store branching in the ante handlers.
accountGetter := NewAccountGetter(ctx, options.AccountKeeper)
accountGetter := NewCachedAccountGetter(ctx, options.AccountKeeper)

if err := VerifyEthAccount(ctx, tx, options.EvmKeeper, evmDenom, accountGetter); err != nil {
return ctx, err
Expand Down

0 comments on commit 2f96588

Please sign in to comment.