From 5f20ccbf74d69fb7eef212c9e2417d99a57f5efb Mon Sep 17 00:00:00 2001 From: KamiD Date: Wed, 20 Jan 2021 16:17:56 +0800 Subject: [PATCH 1/6] open eip2028 when Istanbul version enabled --- x/evm/types/chain_config.go | 10 ++++++++++ x/evm/types/state_transition.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index c3725c5a5..dc1bb3c90 100644 --- a/x/evm/types/chain_config.go +++ b/x/evm/types/chain_config.go @@ -66,6 +66,16 @@ func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { } } +// IsIstanbul returns whether the Istanbul version enabled. +func (cc ChainConfig) IsIstanbul() bool { + return getBlockValue(cc.IstanbulBlock) != nil +} + +// IsIstanbul returns whether the Istanbul version enabled. +func (cc ChainConfig) IsHomestead() bool { + return getBlockValue(cc.HomesteadBlock) != nil +} + // String implements the fmt.Stringer interface func (cc ChainConfig) String() string { out, _ := yaml.Marshal(cc) diff --git a/x/evm/types/state_transition.go b/x/evm/types/state_transition.go index 793320698..f9a5ffd87 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") } From 1d7c886bf9f6b0f26554e2fc4aa24600fc1af34a Mon Sep 17 00:00:00 2001 From: KamiD <44460798+KamiD@users.noreply.github.com> Date: Thu, 21 Jan 2021 10:34:48 +0800 Subject: [PATCH 2/6] Update x/evm/types/chain_config.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- x/evm/types/chain_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index dc1bb3c90..86d8b40d3 100644 --- a/x/evm/types/chain_config.go +++ b/x/evm/types/chain_config.go @@ -66,7 +66,7 @@ func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { } } -// IsIstanbul returns whether the Istanbul version enabled. +// IsIstanbul returns whether the Istanbul version is enabled. func (cc ChainConfig) IsIstanbul() bool { return getBlockValue(cc.IstanbulBlock) != nil } From 67292a2fbc587a1a242a2a4e7ce0c077afc7c2d9 Mon Sep 17 00:00:00 2001 From: KamiD <44460798+KamiD@users.noreply.github.com> Date: Thu, 21 Jan 2021 10:34:55 +0800 Subject: [PATCH 3/6] Update x/evm/types/chain_config.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- x/evm/types/chain_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index 86d8b40d3..9d0f1ec79 100644 --- a/x/evm/types/chain_config.go +++ b/x/evm/types/chain_config.go @@ -71,7 +71,7 @@ func (cc ChainConfig) IsIstanbul() bool { return getBlockValue(cc.IstanbulBlock) != nil } -// IsIstanbul returns whether the Istanbul version enabled. +// IsHomestead returns whether the Homestead version is enabled. func (cc ChainConfig) IsHomestead() bool { return getBlockValue(cc.HomesteadBlock) != nil } From 4b5668d88e0dd721e7f6aed81bc6960959efdd13 Mon Sep 17 00:00:00 2001 From: KamiD Date: Mon, 25 Jan 2021 14:21:25 +0800 Subject: [PATCH 4/6] add change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 263afeda2..bccfd67d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (evm) [\#730](https://github.com/cosmos/ethermint/issues/730) Fix 'EIP2028' not open when Istanbul version has been enabled. * (evm) [\#687](https://github.com/cosmos/ethermint/issues/687) Fix nonce check to explicitly check for the correct nonce, rather than a simple 'greater than' comparison. * (api) [\#687](https://github.com/cosmos/ethermint/issues/687) Returns error for a transaction with an incorrect nonce. * (evm) [\#674](https://github.com/cosmos/ethermint/issues/674) Reset all cache after account data has been committed in `EndBlock` to make sure every node state consistent. From e25fad31670e5e6a32b9dd318b332c2c16075da4 Mon Sep 17 00:00:00 2001 From: KamiD Date: Thu, 28 Jan 2021 14:44:08 +0800 Subject: [PATCH 5/6] update development --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae3d50408..34a56864a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (evm) [\#749](https://github.com/cosmos/ethermint/issues/749) Fix panic in AnteHandler when gas price larger than 100000 * (evm) [\#747](https://github.com/cosmos/ethermint/issues/747) Fix format errors in String() of QueryETHLogs * (evm) [\#742](https://github.com/cosmos/ethermint/issues/742) Add parameter check for evm query func. * (evm) [\#687](https://github.com/cosmos/ethermint/issues/687) Fix nonce check to explicitly check for the correct nonce, rather than a simple 'greater than' comparison. From 174039ccf232ef33de71b1789b4ec154219be0bb Mon Sep 17 00:00:00 2001 From: KamiD Date: Thu, 28 Jan 2021 14:59:56 +0800 Subject: [PATCH 6/6] fix rpc test error --- tests/rpc_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/rpc_test.go b/tests/rpc_test.go index c1813dfe9..b69f90ae6 100644 --- a/tests/rpc_test.go +++ b/tests/rpc_test.go @@ -558,7 +558,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) {