Skip to content

Commit

Permalink
Merge branch 'main' into yiren/revert-gas-refund-change
Browse files Browse the repository at this point in the history
  • Loading branch information
blindchaser authored Nov 26, 2024
2 parents ded2293 + 5b53230 commit 49dd3f6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
26 changes: 26 additions & 0 deletions x/evm/migrations/migrate_eip_1559_max_base_fee_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package migrations_test

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper"
"github.com/sei-protocol/sei-chain/x/evm/migrations"
"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/proto/tendermint/types"
)

func TestMigrateEip1559MaxBaseFee(t *testing.T) {
k := testkeeper.EVMTestApp.EvmKeeper
ctx := testkeeper.EVMTestApp.NewContext(false, tmtypes.Header{})

keeperParams := k.GetParams(ctx)
keeperParams.MaximumFeePerGas = sdk.NewDec(123)

// Perform the migration
err := migrations.MigrateEip1559MaxFeePerGas(ctx, &k)
require.NoError(t, err)

// Ensure that the new EIP-1559 parameters were migrated and the old ones were not changed
require.Equal(t, keeperParams.MaximumFeePerGas, sdk.NewDec(123))
}
2 changes: 1 addition & 1 deletion x/evm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (am AppModule) ExportGenesisStream(ctx sdk.Context, cdc codec.JSONCodec) <-
}

// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 14 }
func (AppModule) ConsensusVersion() uint64 { return 15 }

// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
Expand Down
2 changes: 1 addition & 1 deletion x/evm/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestModuleExportGenesis(t *testing.T) {
func TestConsensusVersion(t *testing.T) {
k, _ := testkeeper.MockEVMKeeper()
module := evm.NewAppModule(nil, k)
assert.Equal(t, uint64(14), module.ConsensusVersion())
assert.Equal(t, uint64(15), module.ConsensusVersion())
}

func TestABCI(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions x/evm/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ func TestValidateParamsInvalidDeliverTxHookWasmGasLimit(t *testing.T) {
require.Contains(t, err.Error(), "invalid deliver_tx_hook_wasm_gas_limit: must be greater than 0")
}

func TestValidateParamsInvalidMaxFeePerGas(t *testing.T) {
params := types.DefaultParams()
params.MaximumFeePerGas = sdk.NewDec(-1) // Set to invalid negative value

err := params.Validate()
require.Error(t, err)
require.Contains(t, err.Error(), "negative max fee per gas")
}

func TestValidateParamsValidDeliverTxHookWasmGasLimit(t *testing.T) {
params := types.DefaultParams()

Expand Down

0 comments on commit 49dd3f6

Please sign in to comment.