[NC-1747] CREATE2 should use the recipient address when calculating the new contract address (#72)

Adrian Sutton 6 years ago committed by GitHub
parent 05b8f1fab1
commit 793f149f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/vm/operations/Create2Operation.java
  2. 74
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/vm/BlockchainReferenceTestTools.java
  3. 66
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/vm/GeneralStateReferenceTestTools.java
  4. 2
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/vm/operations/Create2OperationTest.java

@ -19,7 +19,7 @@ public class Create2Operation extends AbstractCreateOperation {
@Override
protected Address targetContractAddress(final MessageFrame frame) {
final Address sender = frame.getSenderAddress();
final Address sender = frame.getRecipientAddress();
final UInt256 offset = frame.getStackItem(1).asUInt256();
final UInt256 length = frame.getStackItem(2).asUInt256();
final Bytes32 salt = frame.getStackItem(3);

@ -76,92 +76,21 @@ public class BlockchainReferenceTestTools {
params.blacklist("Callcode1024BalanceTooLow_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Call1024BalanceTooLow_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Call1024PreCalls_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2InitCodes_d4g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2InitCodes_d5g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Create2OnDepth1023_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d6g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d7g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"create2collisionSelfdestructedRevert_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionStorage_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionStorage_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"create2collisionSelfdestructedRevert_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"create2collisionSelfdestructedRevert_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionStorage_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d7g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("RevertInCreateInInitCreate2_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"call_outsize_then_create2_successful_then_returndatasize_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d10g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d11g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d9g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d5g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CreateMessageReverted_d0g1v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d4g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d5g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionNonce_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionNonce_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"Create2OOGafterInitCodeReturndata2_d0g1v0_Constantinople\\[Constantinople\\]");
params.blacklist("Create2Recursive_d0g1v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2SmartInitCode_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2SmartInitCode_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"returndatasize_following_successful_create_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionCode_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("RevertDepthCreate2OOG_d1g1v1_Constantinople\\[Constantinople\\]");
params.blacklist("create2InitCodes_d8g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d3g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("RevertDepthCreateAddressCollision_d1g1v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2InitCodes_d6g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2InitCodes_d7g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2InitCodes_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2checkFieldsInInitcode_d4g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2checkFieldsInInitcode_d5g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("RevertDepthCreateAddressCollision_d1g1v1_Constantinople\\[Constantinople\\]");
params.blacklist("create2checkFieldsInInitcode_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Create2Recursive_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2checkFieldsInInitcode_d6g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionBalance_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructedOOG_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("RevertDepthCreate2OOG_d1g1v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionBalance_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionCode_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2noCash_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2callPrecompiles_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionNonce_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructed_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Create2OnDepth1024_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionCode2_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionCode2_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructed2_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructed2_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructed_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d3g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CreateMessageRevertedOOGInInit_d0g1v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"call_then_create2_successful_then_returndatasize_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructed_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CREATE2_Suicide_d8g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Create2OOGafterInitCode_d0g1v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"returndatacopy_0_0_following_successful_create_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2checkFieldsInInitcode_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionBalance_d2g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionBalance_d3g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructedOOG_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionSelfdestructedOOG_d1g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Call1024OOG_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Call1024PreCalls_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("CallRecursiveBombPreCall_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Delegatecall1024_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Call1024BalanceTooLow_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("create2collisionCode_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("Call1MB1024Calldepth_d0g1v0_Constantinople\\[Constantinople\\]");
params.blacklist("LoopCallsThenRevert_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("LoopCallsDepthThenRevert2_d0g0v0_Constantinople\\[Constantinople\\]");
@ -181,9 +110,6 @@ public class BlockchainReferenceTestTools {
params.blacklist("CallRecursiveBomb1_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist(
"CallRecursiveBomb0_OOG_atMaxCallDepth_d0g0v0_Constantinople\\[Constantinople\\]");
params.blacklist("suicideStorageCheckVCreate2_Constantinople\\[Constantinople\\]");
params.blacklist(
"create2collisionwithSelfdestructSameBlock_Constantinople\\[Constantinople\\]");
}
public static Collection<Object[]> generateTestParametersForConfig(final String[] filePath) {

@ -144,84 +144,18 @@ public class GeneralStateReferenceTestTools {
params.blacklist("Callcode1024BalanceTooLow-Constantinople");
params.blacklist("Call1024PreCalls-Constantinople");
params.blacklist("CallRecursiveBombLog2-Constantinople");
params.blacklist("CREATE2_Suicide-Constantinople\\[10\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[11\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[1\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[3\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[5\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[7\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[8\\]");
params.blacklist("CREATE2_Suicide-Constantinople\\[9\\]");
params.blacklist("create2collisionSelfdestructed2-Constantinople\\[0\\]");
params.blacklist("create2collisionSelfdestructed2-Constantinople\\[1\\]");
params.blacklist("create2collisionSelfdestructedRevert-Constantinople\\[0\\]");
params.blacklist("create2collisionSelfdestructedRevert-Constantinople\\[1\\]");
params.blacklist("create2collisionSelfdestructedRevert-Constantinople\\[2\\]");
params.blacklist("create2collisionNonce-Constantinople\\[0\\]");
params.blacklist("create2collisionNonce-Constantinople\\[1\\]");
params.blacklist("create2collisionNonce-Constantinople\\[2\\]");
params.blacklist("RevertInCreateInInitCreate2-Constantinople");
params.blacklist("create2InitCodes-Constantinople\\[0\\]");
params.blacklist("create2InitCodes-Constantinople\\[4\\]");
params.blacklist("create2InitCodes-Constantinople\\[5\\]");
params.blacklist("create2InitCodes-Constantinople\\[6\\]");
params.blacklist("create2InitCodes-Constantinople\\[7\\]");
params.blacklist("create2InitCodes-Constantinople\\[8\\]");
params.blacklist("create2collisionCode-Constantinople\\[0\\]");
params.blacklist("create2collisionCode-Constantinople\\[1\\]");
params.blacklist("create2collisionCode-Constantinople\\[2\\]");
params.blacklist("returndatacopy_0_0_following_successful_create-Constantinople");
params.blacklist("Create2OnDepth1024-Constantinople");
params.blacklist("CreateMessageRevertedOOGInInit-Constantinople\\[1\\]");
params.blacklist("RevertDepthCreate2OOG-Constantinople\\[6\\]");
params.blacklist("RevertDepthCreate2OOG-Constantinople\\[7\\]");
params.blacklist("create2noCash-Constantinople\\[1\\]");
params.blacklist("create2collisionCode2-Constantinople\\[0\\]");
params.blacklist("create2collisionCode2-Constantinople\\[1\\]");
params.blacklist("returndatasize_following_successful_create-Constantinople");
params.blacklist("RevertDepthCreateAddressCollision-Constantinople\\[6\\]");
params.blacklist("RevertDepthCreateAddressCollision-Constantinople\\[7\\]");
params.blacklist("call_outsize_then_create2_successful_then_returndatasize-Constantinople");
params.blacklist("create2callPrecompiles-Constantinople\\[0\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[1\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[2\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[3\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[4\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[5\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[6\\]");
params.blacklist("create2callPrecompiles-Constantinople\\[7\\]");
params.blacklist("create2checkFieldsInInitcode-Constantinople\\[0\\]");
params.blacklist("create2checkFieldsInInitcode-Constantinople\\[2\\]");
params.blacklist("create2checkFieldsInInitcode-Constantinople\\[4\\]");
params.blacklist("create2checkFieldsInInitcode-Constantinople\\[5\\]");
params.blacklist("create2checkFieldsInInitcode-Constantinople\\[6\\]");
params.blacklist("create2collisionBalance-Constantinople\\[0\\]");
params.blacklist("create2collisionBalance-Constantinople\\[1\\]");
params.blacklist("create2collisionBalance-Constantinople\\[2\\]");
params.blacklist("create2collisionBalance-Constantinople\\[3\\]");
params.blacklist("Create2OnDepth1023-Constantinople");
params.blacklist("Create2Recursive-Constantinople\\[0\\]");
params.blacklist("Create2Recursive-Constantinople\\[1\\]");
params.blacklist("create2SmartInitCode-Constantinople\\[0\\]");
params.blacklist("create2SmartInitCode-Constantinople\\[1\\]");
params.blacklist("create2collisionStorage-Constantinople\\[0\\]");
params.blacklist("create2collisionStorage-Constantinople\\[1\\]");
params.blacklist("create2collisionStorage-Constantinople\\[2\\]");
params.blacklist("CreateMessageReverted-Constantinople\\[1\\]");
params.blacklist("create2collisionSelfdestructedOOG-Constantinople\\[0\\]");
params.blacklist("create2collisionSelfdestructedOOG-Constantinople\\[1\\]");
params.blacklist("create2collisionSelfdestructedOOG-Constantinople\\[2\\]");
params.blacklist("Create2OOGafterInitCodeReturndata2-Constantinople\\[1\\]");
params.blacklist("call_then_create2_successful_then_returndatasize-Constantinople");
params.blacklist("create2collisionSelfdestructed-Constantinople\\[0\\]");
params.blacklist("create2collisionSelfdestructed-Constantinople\\[1\\]");
params.blacklist("create2collisionSelfdestructed-Constantinople\\[2\\]");
params.blacklist("Call1024OOG-Constantinople");
params.blacklist("Delegatecall1024OOG-Constantinople");
params.blacklist("CallRecursiveBombPreCall-Constantinople");
params.blacklist("Call1024PreCalls-Constantinople");
params.blacklist("Delegatecall1024-Constantinople");
params.blacklist("Create2OOGafterInitCode-Constantinople\\[1\\]");
params.blacklist("Call1MB1024Calldepth-Constantinople\\[1\\]");
params.blacklist("LoopCallsDepthThenRevert3-Constantinople");
params.blacklist("LoopCallsDepthThenRevert-Constantinople");

@ -101,7 +101,7 @@ public class Create2OperationTest {
@Before
public void setUp() {
when(messageFrame.getSenderAddress()).thenReturn(Address.fromHexString(sender));
when(messageFrame.getRecipientAddress()).thenReturn(Address.fromHexString(sender));
final Bytes32 memoryOffset = Bytes32.fromHexString("0xFF");
final BytesValue codeBytes = BytesValue.fromHexString(code);
final UInt256 memoryLength = UInt256.of(codeBytes.size());

Loading…
Cancel
Save