diff --git a/core/state_transition.go b/core/state_transition.go index e96b99de50..fb03c48aab 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -281,7 +281,8 @@ func (st *StateTransition) preCheck() error { msg.From.Hex(), stNonce) } // Make sure the sender is an EOA - if codeHash := st.state.GetCodeHash(msg.From); codeHash != types.EmptyCodeHash { + codeHash := st.state.GetCodeHash(msg.From) + if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash { return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA, msg.From.Hex(), codeHash) } diff --git a/core/vm/evm.go b/core/vm/evm.go index 6e832c262f..2c6cc7d484 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -436,7 +436,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, } // Ensure there's no existing contract already at the designated address contractHash := evm.StateDB.GetCodeHash(address) - if evm.StateDB.GetNonce(address) != 0 || contractHash != types.EmptyCodeHash { + if evm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) { return nil, common.Address{}, 0, ErrContractAddressCollision } // Create a new account on the state