Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Apr 2, 2024
1 parent fb9095a commit 52641e0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
}

// We need to setup an empty gas config so that the gas is consistent with Ethereum.
ctx, err = SetupEthContext(ctx, options.EvmKeeper)
ctx, err = SetupEthContext(ctx)
if err != nil {
return ctx, err
}
Expand Down
2 changes: 1 addition & 1 deletion app/ante/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

// SetupEthContext is adapted from SetUpContextDecorator from cosmos-sdk, it ignores gas consumption
// by setting the gas meter to infinite
func SetupEthContext(ctx sdk.Context, evmKeeper EVMKeeper) (newCtx sdk.Context, err error) {
func SetupEthContext(ctx sdk.Context) (newCtx sdk.Context, err error) {
// We need to setup an empty gas config so that the gas is consistent with Ethereum.
newCtx = ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()).
WithKVGasConfig(storetypes.GasConfig{}).
Expand Down
2 changes: 1 addition & 1 deletion app/ante/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (suite *AnteTestSuite) TestEthSetupContextDecorator() {

for _, tc := range testCases {
suite.Run(tc.name, func() {
ctx, err := ante.SetupEthContext(suite.ctx, suite.app.EvmKeeper)
ctx, err := ante.SetupEthContext(suite.ctx)

if tc.expPass {
suite.Require().NoError(err)
Expand Down
8 changes: 4 additions & 4 deletions tests/importer/importer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func (suite *ImporterTestSuite) TestImportBlocks() {
applyDAOHardFork(vmdb)
}

for _, tx := range block.Transactions() {
for i, tx := range block.Transactions() {

receipt, gas, err := applyTransaction(
ctx, chainConfig, chainContext, nil, gp, suite.app.EvmKeeper, vmdb, header, tx, usedGas, vmConfig,
ctx, chainConfig, chainContext, nil, gp, suite.app.EvmKeeper, vmdb, header, tx, usedGas, vmConfig, i

Check failure on line 150 in tests/importer/importer_test.go

View workflow job for this annotation

GitHub Actions / test-importer

missing ',' before newline in argument list
)
suite.Require().NoError(err, "failed to apply tx at block %d; tx: %X; gas %d; receipt:%v", block.NumberU64(), tx.Hash(), gas, receipt)
suite.Require().NotNil(receipt)
Expand Down Expand Up @@ -230,7 +230,7 @@ func applyDAOHardFork(vmdb ethvm.StateDB) {
func applyTransaction(
ctx sdk.Context, config *ethparams.ChainConfig, bc ethcore.ChainContext, author *common.Address,
gp *ethcore.GasPool, evmKeeper *evmkeeper.Keeper, vmdb *statedb.StateDB, header *ethtypes.Header,
tx *ethtypes.Transaction, usedGas *uint64, cfg ethvm.Config,
tx *ethtypes.Transaction, usedGas *uint64, cfg ethvm.Config, index uint,
) (*ethtypes.Receipt, uint64, error) {
msg, err := ethcore.TransactionToMessage(tx, ethtypes.MakeSigner(config, header.Number), sdkmath.ZeroInt().BigInt())
if err != nil {
Expand Down Expand Up @@ -271,7 +271,7 @@ func applyTransaction(
receipt.Bloom = ethtypes.CreateBloom(ethtypes.Receipts{receipt})
receipt.BlockHash = header.Hash()
receipt.BlockNumber = header.Number
receipt.TransactionIndex = uint(evmKeeper.GetTxIndexTransient(ctx))
receipt.TransactionIndex = index

return receipt, execResult.UsedGas, err
}

0 comments on commit 52641e0

Please sign in to comment.