From: Ardis Lu Date: Sun, 12 Jul 2026 06:30:27 +0000 (-0700) Subject: Add comments to note stack state X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=980d15614068d1ced3c3e57cc5f54a4d43035431;p=minimal-create2 Add comments to note stack state As per geas comment convention --- diff --git a/create2-deployment.eas b/create2-deployment.eas index e90b16a..3fc9d4c 100644 --- a/create2-deployment.eas +++ b/create2-deployment.eas @@ -1,12 +1,12 @@ ;; Store create2.evm compiled bytecode into memory -PUSH 0x365f5f375f516020360360205ff5 -PUSH0 -MSTORE +PUSH 0x365f5f375f516020360360205ff5 ; [value] +PUSH0 ; [offset, value] +MSTORE ; [] ;; Return create2.evm compiled bytecode -PUSH 14 -PUSH 18 -RETURN +PUSH 14 ; [size] +PUSH 18 ; [offset, size] +RETURN ; [] -;; This contract, compiled: -;; 6d365f5f375f516020360360205ff55f52600e6012f3 +;;; This contract, compiled: +;;; 6d365f5f375f516020360360205ff55f52600e6012f3 diff --git a/create2.eas b/create2.eas index a551a43..5e8e6fd 100644 --- a/create2.eas +++ b/create2.eas @@ -1,22 +1,22 @@ ;; Copy calldata to memory offset 0 -CALLDATASIZE -PUSH0 -PUSH0 -CALLDATACOPY +CALLDATASIZE ; [size] +PUSH0 ; [offset, size] +PUSH0 ; [destOffset, offset, size] +CALLDATACOPY ; [] ;; First 32 bytes of calldata is the salt -PUSH0 -MLOAD +PUSH0 ; [offset] +MLOAD ; [salt] ;; Remaining calldata is the creation bytecode -PUSH 32 -CALLDATASIZE -SUB +PUSH 32 ; [b, salt] +CALLDATASIZE ; [a, b, salt] +SUB ; [size, salt] ;; Call CREATE2 -PUSH 32 -PUSH0 -CREATE2 +PUSH 32 ; [offset, size, salt] +PUSH0 ; [value, offset, size, salt] +CREATE2 ; [] -;; This contract, compiled: -;; 365f5f375f516020360360205ff5 +;;; This contract, compiled: +;;; 365f5f375f516020360360205ff5 diff --git a/minimal-contract-deployment.eas b/minimal-contract-deployment.eas index f01dc05..f61e895 100644 --- a/minimal-contract-deployment.eas +++ b/minimal-contract-deployment.eas @@ -1,13 +1,13 @@ ;; This is the minimal bytecode that can be used to deploy a new smart contract -CODESIZE -PUSH0 -DUP2 -DUP2 -MSTORE8 -RETURN +CODESIZE ; [size] +PUSH0 ; [offset, size] +DUP2 ; [size, offset, size] +DUP2 ; [offset, size, offset, size] +MSTORE8 ; [offset, size] +RETURN ; [] -;; This smart contract, compiled: -;; 385f818153f3 +;;; This smart contract, compiled: +;;; 385f818153f3 -;; When sent to EVM, this smart contract will deploy a new smart contract with bytecode: -;; 060000000000 +;;; When sent to EVM, this smart contract will deploy a new smart contract with bytecode: +;;; 060000000000