diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go index 1f9184ad0d..b73e211cd5 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 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 +} + // 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 ad8d4f0d8a..aa6b0845bb 100644 --- a/x/evm/types/state_transition.go +++ b/x/evm/types/state_transition.go @@ -109,7 +109,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") }