diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index eeeb297ce6..a8d3eca55a 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -423,7 +423,7 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { if dec.To == nil { return errors.New("missing required field 'to' in transaction") } - itx.To = *dec.To + itx.To = dec.To if dec.Gas == nil { return errors.New("missing required field 'gas' for txdata") } diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 60adac82d5..c42d88ceac 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -520,7 +520,7 @@ func opSload(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by } func opSstore(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - if interpreter.evm.TxContext.Is5806 && (scope.Contract.CodeHash == (common.Hash{}) || scope.Contract.CodeHash == types.EmptyCodeHash) { + if interpreter.evm.TxContext.Is5806 && interpreter.evm.Origin == scope.Contract.self.Address() { return nil, ErrEip5806Write } if interpreter.readOnly { @@ -578,7 +578,7 @@ func opGas(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte } func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - if interpreter.evm.TxContext.Is5806 && (scope.Contract.CodeHash == (common.Hash{}) || scope.Contract.CodeHash == types.EmptyCodeHash) { + if interpreter.evm.TxContext.Is5806 && interpreter.evm.Origin == scope.Contract.self.Address() { return nil, ErrEip5806Write } if interpreter.readOnly { @@ -622,7 +622,7 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b } func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - if interpreter.evm.TxContext.Is5806 && (scope.Contract.CodeHash == (common.Hash{}) || scope.Contract.CodeHash == types.EmptyCodeHash) { + if interpreter.evm.TxContext.Is5806 && interpreter.evm.Origin == scope.Contract.self.Address() { return nil, ErrEip5806Write } if interpreter.readOnly { @@ -806,7 +806,7 @@ func opStop(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt } func opSelfdestruct(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - if interpreter.evm.TxContext.Is5806 && (scope.Contract.CodeHash == (common.Hash{}) || scope.Contract.CodeHash == types.EmptyCodeHash) { + if interpreter.evm.TxContext.Is5806 && interpreter.evm.Origin == scope.Contract.self.Address() { return nil, ErrEip5806Write } if interpreter.readOnly { @@ -824,7 +824,7 @@ func opSelfdestruct(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext } func opSelfdestruct6780(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - if interpreter.evm.TxContext.Is5806 && (scope.Contract.CodeHash == (common.Hash{}) || scope.Contract.CodeHash == types.EmptyCodeHash) { + if interpreter.evm.TxContext.Is5806 && interpreter.evm.Origin == scope.Contract.self.Address() { return nil, ErrEip5806Write } if interpreter.readOnly {