opcode create2 does not meet eip-1014
Closed this issue · 2 comments
Hi there,
please note that this is an issue tracker reserved for bug reports and feature requests.
System information
PlatON version: 0.1.13_alpha
OS & Version: Windows/Linux/OSX
Commit hash : (if develop
)
Expected behaviour
Opcode create2 should follow https://eips.ethereum.org/EIPS/eip-1014.
Actual behaviour
Platon crypto.go
func CreateAddress2(b common.Address, salt [32]byte, code []byte) common.Address { return common.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt[:], Keccak256(code))[12:]) }
eth-go crypto.go
func CreateAddress2(b common.Address, salt [32]byte, inithash []byte) common.Address { return common.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt[:], inithash)[12:]) }
Steps to reproduce the behaviour
See contract bellow, after executing createChild, we expect field ccc equals the return value of getAddress. But it's not.
pragma solidity =0.5.13; contract Child { function say() external pure returns (uint) { return 88; } } contract Parent { address public ccc; function createChild() external returns (address _ccc) { bytes32 salt = keccak256('test'); bytes memory bytecode = type(Child).creationCode; assembly { _ccc := create2(0, add(bytecode, 32), mload(bytecode), salt) } ccc = _ccc; } function getAddress() external view returns (address) { bytes32 salt = keccak256('test'); bytes memory bytecode = type(Child).creationCode; address addr = address(uint(keccak256(abi.encodePacked( hex'ff', address(this), salt, keccak256(bytecode) )))); return addr; } }
Backtrace
[backtrace]
Closed due to lack of feedback for a long time