diff --git a/main/process-tx.zkasm b/main/process-tx.zkasm index d74230f9..9e9efd66 100644 --- a/main/process-tx.zkasm +++ b/main/process-tx.zkasm @@ -271,19 +271,7 @@ nonce1byte: nonceIs0: 0x80 :HASHK(E) - -endContractAddress: - ; end contract address hash and get the 20 first bytes - HASHPOS :HASHKLEN(E) - $ => A :MLOAD(cntKeccakPreProcess) - %MAX_CNT_KECCAK_F - CNT_KECCAK_F - A - 1 :JMPN(outOfCountersKeccak) - $ => A :HASHKDIGEST(E) - :CALL(maskAddress) ; Mask address to 20 bytes - A :MSTORE(createContractAddress) - A :MSTORE(txDestAddr) - A :MSTORE(storageAddr) - ; TODO: Add check CREATE or deployment with constructor reverted - :JMP(deploy) + :JMP(endContractAddress) ;; compute new contract address as CREATE2 spec: keccak256(0xff ++ address ++ salt ++ keccak256(init_code))[12:] (https://eips.ethereum.org/EIPS/eip-1014) create2: @@ -341,6 +329,8 @@ create2end: B :HASHK(E) 32 => D C :HASHK(E) + +endContractAddress: HASHPOS :HASHKLEN(E) ; Check keccak counters diff --git a/main/vars.zkasm b/main/vars.zkasm index e3953dc2..98ce6fdd 100644 --- a/main/vars.zkasm +++ b/main/vars.zkasm @@ -43,8 +43,13 @@ VAR GLOBAL batchSR ; State root before processing any transaction VAR GLOBAL txCount ; Current transaction count VAR GLOBAL touchedSR ; touched tree root +VAR GLOBAL numTopics ; number of topics depending on LOG opcode call +VAR GLOBAL SPw ; aux variable to store Stack poimnter 'SP' +VAR GLOBAL hashContractTxDestAddr ; state-tree hash bytecode leaf value of the 'to' address +VAR GLOBAL auxSR ; auxiliaty variable. Temporary state root +VAR GLOBAL txRLPLength ; transaction RLP list length +VAR GLOBAL txDataRead ; aux varible to check transaction 'data' left that needs to be read -VAR CTX txRLPLength ; transaction RLP list length VAR CTX txGasLimit ; transaction parameter: 'gas limit' VAR CTX txDestAddr ; transaction parameter: 'to' VAR CTX storageAddr ; address which the storage will be modified @@ -62,24 +67,20 @@ VAR CTX createContractAddress ; address computed of a new contract VAR CTX lengthNonce ; 'nonce' length used when computing a new contract address VAR CTX gasRefund ; keeps track of the transaction gas refund VAR CTX initSR ; state-tree once the initial upfront cost is substracted and nonce is increased -VAR CTX txDataRead ; aux varible to check transaction 'data' left that needs to be read VAR CTX memLength ; current memory size VAR CTX lastMemLength ; length of bytes to copy to memory VAR CTX lastMemOffset ; offset to copy to memory -VAR CTX auxSR ; auxiliaty variable. Temporary state root VAR CTX retCallOffset ; initial pointer to begin store the return data VAR CTX retCallLength ; size of the return data VAR CTX retDataOffset ; pointer to previous context return data offset VAR CTX retDataLength ; pointer to previous context return data length VAR CTX retDataCTX ; pointer to context where the return data is stored VAR CTX argsOffsetCall ; pointer to the init slot where the calldata begins -VAR CTX hashContractTxDestAddr ; state-tree hash bytecode leaf value of the 'to' address VAR CTX bytecodeLength ; state-tree length bytecode leaf value of the 'to' address VAR CTX contractHashId ; hashP address used to store contract bytecode VAR CTX originCTX ; The source context of the current context VAR CTX lastSP ; Last stack pointer used of the previous context VAR CTX lastPC ; Last program counter used of the previous context -VAR CTX numTopics ; number of topics depending on LOG opcode call VAR CTX isStaticCall ; flag to determine if a new context comes from a STATICCALL opcode VAR CTX isCreate ; flag to determine if a new context comes from a CREATE opcode VAR CTX isDelegateCall ; flag to determine if a new context comes from a DELEGATECALL opcode @@ -88,6 +89,5 @@ VAR CTX salt ; CREATE2 parameter 'salt' used to compute new contract address VAR CTX gasCTX ; remaining gas in the origin CTX when a new context is created VAR CTX sigDataSize ; hash position for the ethereum transaction hash VAR CTX dataStarts; hash position where de transaction 'data' starts in the batchHashData -VAR CTX SPw ; aux variable to store Stack poimnter 'SP' VAR CTX isPreEIP155 ; flag to check if the current tx is legacy, previous to Spurious Dragon (EIP-155) VAR CTX initTouchedSR ; touched root once a new context begins \ No newline at end of file