From 2289ff51af39e5f25e45fc56e82f9d1da7326aef Mon Sep 17 00:00:00 2001 From: Freddy Li Date: Wed, 14 Apr 2021 13:52:46 -0400 Subject: [PATCH] merge pr #730 --- CHANGELOG.md | 1 + tests/rpc_test.go | 2 +- x/evm/types/chain_config.go | 10 ++++++++++ x/evm/types/state_transition.go | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93f083327..b96e571ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -208,6 +208,7 @@ corresponding Ethereum API namespace: ### Bug Fixes +* (evm) [\#730](https://github.com/cosmos/ethermint/issues/730) Fix 'EIP2028' not open when Istanbul version has been enabled. * (rpc) [\#305](https://github.com/cosmos/ethermint/issues/305) Update `eth_getTransactionCount` to check for account existence before getting sequence and return 0 as the nonce if it doesn't exist. * (`x/evm`) [\#319](https://github.com/cosmos/ethermint/pull/319) Fix `SetBlockHash` that was setting the incorrect height during `BeginBlock`. * (`x/evm`) [\#176](https://github.com/cosmos/ethermint/issues/176) Updated Web3 transaction hash from using RLP hash. Now all transaction hashes exposed are amino hashes: diff --git a/tests/rpc_test.go b/tests/rpc_test.go index 98e657e8a..0f5f26ce2 100644 --- a/tests/rpc_test.go +++ b/tests/rpc_test.go @@ -562,7 +562,7 @@ func TestEth_EstimateGas_ContractDeployment(t *testing.T) { err := json.Unmarshal(rpcRes.Result, &gas) require.NoError(t, err, string(rpcRes.Result)) - require.Equal(t, "0x1c2c4", gas.String()) + require.Equal(t, "0x1a724", gas.String()) } func TestEth_GetBlockByNumber(t *testing.T) { diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index 31ecd453e..8515212ac 100644 --- a/x/evm/types/chain_config.go +++ b/x/evm/types/chain_config.go @@ -125,3 +125,13 @@ func validateBlock(block sdk.Int) error { return nil } + +// IsIstanbul returns whether the Istanbul version is enabled. +func (cc ChainConfig) IsIstanbul() bool { + return getBlockValue(cc.IstanbulBlock) != nil +} + +// IsHomestead returns whether the Homestead version is enabled. +func (cc ChainConfig) IsHomestead() bool { + return getBlockValue(cc.HomesteadBlock) != nil +} diff --git a/x/evm/types/state_transition.go b/x/evm/types/state_transition.go index e3cf30df5..e8bba1c6a 100644 --- a/x/evm/types/state_transition.go +++ b/x/evm/types/state_transition.go @@ -115,7 +115,7 @@ func (st StateTransition) newEVM( func (st StateTransition) TransitionDb(ctx sdk.Context, config ChainConfig) (*ExecutionResult, error) { contractCreation := st.Recipient == nil - cost, err := core.IntrinsicGas(st.Payload, contractCreation, true, false) + cost, err := core.IntrinsicGas(st.Payload, contractCreation, config.IsHomestead(), config.IsIstanbul()) if err != nil { return nil, sdkerrors.Wrap(err, "invalid intrinsic gas for transaction") }