diff --git a/EIPS/eip-7997.md b/EIPS/eip-7997.md index 79fcd2f021a16a..f667c5fcbe41c0 100644 --- a/EIPS/eip-7997.md +++ b/EIPS/eip-7997.md @@ -2,7 +2,7 @@ eip: 7997 title: Deterministic Factory Contract description: A minimal `CREATE2` factory shared by EVM chains. -author: Francisco Giordano (@frangio), Toni Wahrstätter (@nerolation), Nick Johnson (@Arachnid) +author: Francisco Giordano (@frangio), Toni Wahrstätter (@nerolation), Nick Johnson (@Arachnid), Jochem Brouwer (@jochem-brouwer) discussions-to: https://ethereum-magicians.org/t/eip-7997-deterministic-factory-predeploy/24998 status: Draft type: Standards Track @@ -44,41 +44,46 @@ A chain may satisfy this requirement by any means that results in the account ab This is a contract that invokes the `CREATE2` instruction ([EIP-1014](./eip-1014.md)) with a salt equal to the first 32 bytes of the call's input data, init code equal to the remaining data, and value equal to the call's value. If input data is smaller than 32 bytes, the contract will attempt to copy close to 2^256 bytes of calldata and should revert as a result. If contract creation fails (`CREATE2` outputs `0`), the call reverts with empty return data. When successful, the address is returned in exactly 20 bytes of data with no padding. -The bytecode above decodes to the following mnemonics: - -``` -[00] PUSH32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0 -[21] CALLDATASIZE -[22] ADD -[23] PUSH1 0x00 -[25] DUP2 -[26] PUSH1 0x20 -[28] DUP3 -[29] CALLDATACOPY -[2a] DUP1 -[2b] CALLDATALOAD -[2c] DUP3 -[2d] DUP3 -[2e] CALLVALUE -[2f] CREATE2 -[30] DUP1 -[31] ISZERO -[32] ISZERO -[33] PUSH1 0x39 -[35] JUMPI -[36] DUP2 -[37] DUP3 -[38] REVERT -[39] JUMPDEST -[3a] DUP1 -[3b] DUP3 -[3c] MSTORE -[3d] POP -[3e] POP -[3f] POP -[40] PUSH1 0x14 -[42] PUSH1 0x0c -[44] RETURN +The above runtime bytecode disassembles to the following: + +```asm +push32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0 +calldatasize +add + +push1 0x00 +dup2 +push1 0x20 +dup3 +calldatacopy + +dup1 +calldataload + +dup3 +dup3 +callvalue +create2 +dup1 +iszero +iszero +push1 0x39 +jumpi + +dup2 +dup3 +revert + +jumpdest +dup1 +dup3 +mstore +pop +pop +pop +push1 0x14 +push1 0x0c +return ``` ## Rationale