diff --git a/CHANGELOG.md b/CHANGELOG.md index a831e32b58..ba97e44ae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (evm) [#740](https://github.com/crypto-org-chain/ethermint/pull/740) fix: missing tx context during vm initialisation * (evm) [#742](https://github.com/crypto-org-chain/ethermint/pull/742) fix: prevent nil pointer dereference in tracer hooks * (evm) [#728](https://github.com/crypto-org-chain/ethermint/pull/728) feat: support preinstalls +* (evm) [#722](https://github.com/crypto-org-chain/ethermint/pull/722) feat: support EIP-2935 ## [v0.22.0] - 2025-08-12 diff --git a/proto/ethermint/evm/v1/params.proto b/proto/ethermint/evm/v1/params.proto index 48c0c944ce..f4e8482f7a 100644 --- a/proto/ethermint/evm/v1/params.proto +++ b/proto/ethermint/evm/v1/params.proto @@ -24,4 +24,7 @@ message Params { bool allow_unprotected_txs = 6; // header_hash_num is the number of header hash to persist. uint64 header_hash_num = 7; + // historyServeWindow for EIP 2935 + uint64 history_serve_window = 8; + } \ No newline at end of file diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index d41f613a5b..603f0b9edf 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -16,6 +16,7 @@ package keeper import ( + "encoding/binary" "math/big" "github.com/ethereum/go-ethereum/crypto" @@ -31,7 +32,7 @@ import ( "github.com/ethereum/go-ethereum/core/tracing" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" + ethparams "github.com/ethereum/go-ethereum/params" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" @@ -39,7 +40,7 @@ import ( ) // CustomContractFn defines a custom precompiled contract generator with ctx, rules and returns a precompiled contract. -type CustomContractFn func(sdk.Context, params.Rules) vm.PrecompiledContract +type CustomContractFn func(sdk.Context, ethparams.Rules) vm.PrecompiledContract // GasNoLimit is the value for keeper.queryMaxGasLimit in case there is no limit const GasNoLimit = 0 @@ -216,7 +217,7 @@ func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg *core.Message, receipt *e } // Tracer return a default vm.Tracer based on current keeper state -func (k Keeper) Tracer(ctx sdk.Context, msg core.Message, ethCfg *params.ChainConfig) *tracing.Hooks { +func (k Keeper) Tracer(ctx sdk.Context, msg core.Message, ethCfg *ethparams.ChainConfig) *tracing.Hooks { return types.NewTracer(k.tracer, msg, ethCfg, ctx.BlockHeight(), uint64(ctx.BlockTime().Unix())) //#nosec G115 -- int overflow is not a concern here } @@ -278,7 +279,7 @@ func (k *Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) // - `nil`: london hardfork not enabled. // - `0`: london hardfork enabled but feemarket is not enabled. // - `n`: both london hardfork and feemarket are enabled. -func (k Keeper) GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int { +func (k Keeper) GetBaseFee(ctx sdk.Context, ethCfg *ethparams.ChainConfig) *big.Int { return k.getBaseFee(ctx, types.IsLondon(ethCfg, ctx.BlockHeight())) } @@ -322,18 +323,57 @@ func (k Keeper) AddTransientGasUsed(ctx sdk.Context, gasUsed uint64) (uint64, er // SetHeaderHash stores the hash of the current block header in the store. func (k Keeper) SetHeaderHash(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - height, err := ethermint.SafeUint64(ctx.BlockHeight()) - if err != nil { - panic(err) + acct := k.GetAccount(ctx, ethparams.HistoryStorageAddress) + if acct != nil && acct.IsContract() { + window := types.DefaultHistoryServeWindow + params := k.GetParams(ctx) + if params.HistoryServeWindow > 0 { + window = params.HistoryServeWindow + } + // set current block hash in the contract storage, compatible with EIP-2935 + ringIndex := uint64(ctx.BlockHeight()) % window //nolint:gosec // G115 // won't exceed uint64 + var key common.Hash + binary.BigEndian.PutUint64(key[24:], ringIndex) + k.SetState(ctx, ethparams.HistoryStorageAddress, key, ctx.HeaderHash()) + } else { + // fallback old implementation + store := ctx.KVStore(k.storeKey) + height, err := ethermint.SafeUint64(ctx.BlockHeight()) + if err != nil { + panic(err) + } + store.Set(types.GetHeaderHashKey(height), ctx.HeaderHash()) } - store.Set(types.GetHeaderHashKey(height), ctx.HeaderHash()) } -// GetHeaderHash retrieves the hash of a block header from the store by height. -func (k Keeper) GetHeaderHash(ctx sdk.Context, height uint64) []byte { +// GetHeaderHash sets block hash into EIP-2935 compatible storage contract. +func (k Keeper) GetHeaderHash(ctx sdk.Context, height uint64) common.Hash { + // check if history contract has been deployed + acct := k.GetAccount(ctx, ethparams.HistoryStorageAddress) + if acct != nil && acct.IsContract() { + window := types.DefaultHistoryServeWindow + params := k.GetParams(ctx) + if params.HistoryServeWindow > 0 { + window = params.HistoryServeWindow + } + + ringIndex := height % window + var key common.Hash + binary.BigEndian.PutUint64(key[24:], ringIndex) + hash := k.GetState(ctx, ethparams.HistoryStorageAddress, key) + + if hash.Cmp(common.Hash{}) != 0 { + return hash + } + } + // fall back to old behavior for retro compatibility + // TODO can be removed along with DeleteHeaderHash once HistoryStorage has been filled up in next protocol upgrade store := ctx.KVStore(k.storeKey) - return store.Get(types.GetHeaderHashKey(height)) + hashByte := store.Get(types.GetHeaderHashKey(height)) + if len(hashByte) > 0 { + return common.BytesToHash(hashByte) + } + return common.Hash{} } // DeleteHeaderHash removes the hash of a block header from the store by height diff --git a/x/evm/keeper/keeper_test.go b/x/evm/keeper/keeper_test.go index bde3244214..67f820c128 100644 --- a/x/evm/keeper/keeper_test.go +++ b/x/evm/keeper/keeper_test.go @@ -4,6 +4,7 @@ import ( _ "embed" "math" "math/big" + "strings" "testing" sdkmath "cosmossdk.io/math" @@ -127,7 +128,11 @@ func (suite *KeeperTestSuite) TestGetAccountStorage() { if tc.malleate != nil { contractAddr = tc.malleate() } - i := 0 + + var results []struct { + addr common.Address + storage types.Storage + } suite.App.AccountKeeper.IterateAccounts(suite.Ctx, func(account sdk.AccountI) bool { ethAccount, ok := account.(ethermint.EthAccountI) if !ok { @@ -137,21 +142,39 @@ func (suite *KeeperTestSuite) TestGetAccountStorage() { addr := ethAccount.EthAddress() storage := suite.App.EvmKeeper.GetAccountStorage(suite.Ctx, addr) + results = append(results, struct { + addr common.Address + storage types.Storage + }{addr, storage}) + return false + }) + + isPreinstall := func(addr common.Address) bool { + for _, p := range types.DefaultPreinstalls { + if strings.EqualFold(addr.Hex(), p.Address) { + return true + } + } + return false + } - if addr == contractAddr { - s.Require().NotEqual(0, len(storage), - "expected account %d to have non-zero amount of storage slots, got %d", - i, len(storage), + for _, r := range results { + if isPreinstall(r.addr) { + // skip preinstall + continue + } + if r.addr == contractAddr { + suite.Require().NotEqual(0, len(r.storage), + "expected account address %s to have non-zero amount of storage slots, got %d", + r.addr.Hex(), len(r.storage), ) } else { - s.Require().Len(storage, 0, - "expected account %d to have %d storage slots, got %d", - i, 0, len(storage), + suite.Require().Len(r.storage, 0, + "expected account address %s to have %d storage slots, got %d", + r.addr.Hex(), 0, len(r.storage), ) } - i++ - return false - }) + } }) } } diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 938efebabb..22835f08f5 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -21,6 +21,8 @@ import ( "math/big" "sort" + cmttypes "github.com/cometbft/cometbft/types" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -29,7 +31,6 @@ import ( "github.com/evmos/ethermint/x/evm/types" "github.com/holiman/uint256" - cmttypes "github.com/cometbft/cometbft/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/tracing" @@ -95,8 +96,8 @@ func (k *Keeper) NewEVM( // GetHashFn implements vm.GetHashFunc for Ethermint. It returns hash for 3 cases: // 1. The requested height matches current block height from the context. -// 2. The requested height is within the valid range, retrieve the hash from GetHeaderHash for heights after sdk50. -// 3. The requested height is within the valid range, retrieve the hash from GetHistoricalInfo for heights before sdk50. +// 2. The requested height is below current block height, follow EIP-2935. +// 3. The requested height is above current block height, return empty func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { return func(num64 uint64) common.Hash { h, err := ethermint.SafeInt64(num64) @@ -114,31 +115,36 @@ func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { } } // Align check with https://github.com/ethereum/go-ethereum/blob/release/1.11/core/vm/instructions.go#L433 - headerNum := k.GetParams(ctx).HeaderHashNum var lower uint64 + headerNum := k.GetParams(ctx).HeaderHashNum if upper <= headerNum { lower = 0 } else { lower = upper - headerNum } - if num64 < lower || num64 >= upper { - return common.Hash{} - } - hash := k.GetHeaderHash(ctx, num64) - if len(hash) > 0 { - return common.BytesToHash(hash) - } - histInfo, err := k.stakingKeeper.GetHistoricalInfo(ctx, h) - if err != nil { - k.Logger(ctx).Debug("historical info not found", "height", h, "err", err.Error()) - return common.Hash{} - } - header, err := cmttypes.HeaderFromProto(&histInfo.Header) - if err != nil { - k.Logger(ctx).Error("failed to cast tendermint header from proto", "error", err) - return common.Hash{} + + if upper > num64 { + // The requested height is historical, query EIP-2935 contract storage + headerHash := k.GetHeaderHash(ctx, num64) + if headerHash.Cmp(common.Hash{}) != 0 { + return headerHash + } else if num64 >= lower { + // Pre upgrade case + // In case EIP-2935 is not supported and data cannot be found, we fetch historical info + histInfo, err := k.stakingKeeper.GetHistoricalInfo(ctx, h) + if err != nil { + k.Logger(ctx).Debug("historical info not found", "height", h, "err", err.Error()) + return common.Hash{} + } + header, err := cmttypes.HeaderFromProto(&histInfo.Header) + if err != nil { + k.Logger(ctx).Error("failed to cast tendermint header from proto", "error", err) + return common.Hash{} + } + return common.BytesToHash(header.Hash()) + } } - return common.BytesToHash(header.Hash()) + return common.Hash{} } } diff --git a/x/evm/keeper/state_transition_test.go b/x/evm/keeper/state_transition_test.go index 2a525158b7..5bcc3c6f7b 100644 --- a/x/evm/keeper/state_transition_test.go +++ b/x/evm/keeper/state_transition_test.go @@ -169,12 +169,6 @@ func (suite *StateTransitionTestSuite) TestGetHashFn() { func(_ int64) {}, common.Hash{}, }, - { - "height less than header hash num range", - height - evmtypes.DefaultHeaderHashNum - 1, - func(_ int64) {}, - common.Hash{}, - }, { "header not found in stores", height - 1, diff --git a/x/evm/migrations/v4/types/params_v4.pb.go b/x/evm/migrations/v4/types/params_v4.pb.go index 2d74ed4b13..3a93df5dd6 100644 --- a/x/evm/migrations/v4/types/params_v4.pb.go +++ b/x/evm/migrations/v4/types/params_v4.pb.go @@ -6,12 +6,11 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - v0types "github.com/evmos/ethermint/x/evm/migrations/v0/types" proto "github.com/cosmos/gogoproto/proto" + v0types "github.com/evmos/ethermint/x/evm/migrations/v0/types" io "io" math "math" math_bits "math/bits" - ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 2dd5563988..29c0f30ae6 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -36,6 +36,8 @@ var ( DefaultEnableCall = true // DefaultHeaderHashNum defines the default number of header hash to persist. DefaultHeaderHashNum = uint64(256) + // DefaultHistoryServeWindow DefaultHeaderHashNum defines the default number of hystorical value to serve for EIP2935. + DefaultHistoryServeWindow = uint64(8192) // same as EIP-2935 ) // NewParams creates a new Params instance @@ -61,6 +63,7 @@ func DefaultParams() Params { ChainConfig: config, AllowUnprotectedTxs: DefaultAllowUnprotectedTxs, HeaderHashNum: DefaultHeaderHashNum, + HistoryServeWindow: DefaultHistoryServeWindow, } } diff --git a/x/evm/types/params.pb.go b/x/evm/types/params.pb.go index 165d458898..3329c1cac6 100644 --- a/x/evm/types/params.pb.go +++ b/x/evm/types/params.pb.go @@ -41,6 +41,8 @@ type Params struct { AllowUnprotectedTxs bool `protobuf:"varint,6,opt,name=allow_unprotected_txs,json=allowUnprotectedTxs,proto3" json:"allow_unprotected_txs,omitempty"` // header_hash_num is the number of header hash to persist. HeaderHashNum uint64 `protobuf:"varint,7,opt,name=header_hash_num,json=headerHashNum,proto3" json:"header_hash_num,omitempty"` + // historyServeWindow for EIP 2935 + HistoryServeWindow uint64 `protobuf:"varint,8,opt,name=history_serve_window,json=historyServeWindow,proto3" json:"history_serve_window,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -125,6 +127,13 @@ func (m *Params) GetHeaderHashNum() uint64 { return 0 } +func (m *Params) GetHistoryServeWindow() uint64 { + if m != nil { + return m.HistoryServeWindow + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "ethermint.evm.v1.Params") } @@ -132,34 +141,36 @@ func init() { func init() { proto.RegisterFile("ethermint/evm/v1/params.proto", fileDescriptor_e7d3c06c1322f20f) } var fileDescriptor_e7d3c06c1322f20f = []byte{ - // 423 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x41, 0x8b, 0xd3, 0x40, - 0x18, 0x86, 0x1b, 0x5b, 0xeb, 0x76, 0xba, 0x8b, 0xeb, 0x58, 0x65, 0x58, 0xd8, 0x24, 0x44, 0x58, - 0x72, 0x4a, 0xe8, 0x7a, 0x10, 0x04, 0x41, 0x53, 0x2b, 0x7a, 0x91, 0x25, 0xe8, 0xc5, 0xcb, 0x30, - 0x4d, 0x3f, 0x9b, 0xc0, 0x4c, 0x26, 0x64, 0xa6, 0xb1, 0xfb, 0x2f, 0x3c, 0xfb, 0x8b, 0xf6, 0xb8, - 0x47, 0x4f, 0x41, 0xda, 0x7f, 0xd0, 0x5f, 0x20, 0x99, 0xd4, 0x76, 0xd5, 0xdb, 0x7c, 0xdf, 0xf3, - 0xbe, 0x1f, 0xcc, 0xfb, 0xa2, 0x73, 0xd0, 0x29, 0x94, 0x22, 0xcb, 0x75, 0x08, 0x95, 0x08, 0xab, - 0x71, 0x58, 0xb0, 0x92, 0x09, 0x15, 0x14, 0xa5, 0xd4, 0x12, 0x9f,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, 0x69, 0x54, 0x13, 0x23, 0x8a, 0x7a, 0x37, 0xb5, 0xd3, 0x89, 0x87, 0xc9, 0x61, 0x85, 0x2f, - 0xd1, 0x13, 0xc6, 0xb9, 0xfc, 0x46, 0x97, 0x79, 0x93, 0x28, 0x24, 0x1a, 0xe6, 0x54, 0xaf, 0x14, - 0xe9, 0x37, 0xbf, 0x89, 0x1f, 0x1b, 0xf8, 0xf9, 0xc0, 0x3e, 0xad, 0x14, 0xbe, 0x40, 0x0f, 0x53, - 0x60, 0x73, 0x28, 0x69, 0xca, 0x54, 0x4a, 0xf3, 0xa5, 0x20, 0x0f, 0x5c, 0xcb, 0xef, 0xc5, 0x27, - 0xed, 0xfa, 0x3d, 0x53, 0xe9, 0xc7, 0xa5, 0x88, 0x5e, 0xdf, 0xac, 0x6d, 0xeb, 0x76, 0x6d, 0x5b, - 0xbf, 0xd6, 0xb6, 0xf5, 0x7d, 0x63, 0x77, 0x6e, 0x37, 0x76, 0xe7, 0xe7, 0xc6, 0xee, 0x7c, 0xb9, - 0x58, 0x64, 0x3a, 0x5d, 0xce, 0x82, 0x44, 0x8a, 0xa6, 0x5c, 0xa9, 0xc2, 0x43, 0xd9, 0x2b, 0x53, - 0xb7, 0xbe, 0x2e, 0x40, 0xcd, 0xfa, 0xa6, 0xe5, 0xe7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, - 0xa5, 0x92, 0x40, 0x53, 0x02, 0x00, 0x00, + // 451 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x18, 0x86, 0x1b, 0x5b, 0x6b, 0x3b, 0xdd, 0xc5, 0x75, 0xac, 0x12, 0x16, 0x36, 0x09, 0x11, 0x96, + 0x9c, 0x12, 0xbb, 0x1e, 0x04, 0x41, 0xd0, 0xd4, 0x8a, 0x5e, 0x64, 0x89, 0x8a, 0xe0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, 0x7a, 0x39, 0x4d, 0x55, 0x32, + 0x1b, 0xfb, 0xb1, 0xe0, 0x75, 0x1d, 0x84, 0x0c, 0x0e, 0xf5, 0x58, 0xe8, 0x82, 0xa8, 0x65, 0x0e, + 0x72, 0xdc, 0xd6, 0xbd, 0x78, 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x94, 0xe9, 0x25, 0xb7, 0x85, + 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -182,6 +193,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.HistoryServeWindow != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.HistoryServeWindow)) + i-- + dAtA[i] = 0x40 + } if m.HeaderHashNum != 0 { i = encodeVarintParams(dAtA, i, uint64(m.HeaderHashNum)) i-- @@ -298,6 +314,9 @@ func (m *Params) Size() (n int) { if m.HeaderHashNum != 0 { n += 1 + sovParams(uint64(m.HeaderHashNum)) } + if m.HistoryServeWindow != 0 { + n += 1 + sovParams(uint64(m.HistoryServeWindow)) + } return n } @@ -556,6 +575,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoryServeWindow", wireType) + } + m.HistoryServeWindow = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoryServeWindow |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])