-
Notifications
You must be signed in to change notification settings - Fork 47
/
vars.zkasm
94 lines (87 loc) · 5.58 KB
/
vars.zkasm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
; Input variables
VAR GLOBAL oldStateRoot ; Previous state-tree root
VAR GLOBAL oldAccInputHash ; Previous accumulated input hash
VAR GLOBAL globalExitRoot ; Global exit-tree root
VAR GLOBAL oldNumBatch ; Previous batch processed
VAR GLOBAL sequencerAddr ; Coinbase address which will receive the fees
VAR GLOBAL batchHashData ; batchHashData = H_keccak( transactions )
VAR GLOBAL timestamp ; Current batch timestamp
VAR GLOBAL chainID ; Current batch chain id
VAR GLOBAL forkID ; Fork identifier
; Output variables
VAR GLOBAL newAccInputHash ; Final accumulated input hash. newAccInputHash = H_keccak( oldAccInputHash | batchHashData | globalExitRoot | timestamp | sequencerAddr )
VAR GLOBAL newLocalExitRoot ; Updated local exit tree root
VAR GLOBAL newNumBatch ; Current batch processed
VAR GLOBAL batchL2DataParsed ; Number of bytes read when decoding RLP transactions. Computed during RLP loop
VAR GLOBAL pendingTxs ; Number of transactions decoded in RLP block
VAR GLOBAL lastCtxUsed ; Last context that has been used
VAR GLOBAL ctxTxToUse ; First context to be used when processing transactions
VAR GLOBAL lastHashKIdUsed ; Last hash address used
VAR GLOBAL nextHashPId ; Next poseidon hash address available
VAR GLOBAL batchL2DataLength ; Transactions bytes read from the input
VAR GLOBAL batchHashDataId ; hash address used when adding bytes to batchHashData
VAR GLOBAL batchHashPos ; hash batchHashData position
VAR GLOBAL currentCTX ; keeps track of the context used
VAR GLOBAL originAuxCTX ; keeps track of the previous context when a new one is created
VAR GLOBAL gasCalldata ; gas spent by the calldata
VAR GLOBAL gasCall ; total gas forwarded when creating a new context
VAR GLOBAL addrCall ; address parameter when creating a new context
VAR GLOBAL valueCall ; value parameter when creating a new context
VAR GLOBAL argsLengthCall ; size of the calldata creating a new context
VAR GLOBAL txSrcOriginAddr ; origin address of a tx
VAR GLOBAL txGasPrice ; transaction parameter: 'gasPrice' global var
VAR GLOBAL depth ; Current depth execution
VAR GLOBAL cntKeccakPreProcess ; Number of keccak counters needed to finish the batch
VAR GLOBAL nextFreeLogIndex ; pointer to the next free slot to store information in LOG opcode
VAR GLOBAL originSR ; State root before processing each transaction
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 pointer 'SP'
VAR GLOBAL auxSR ; auxiliary variable. Temporary state root
VAR GLOBAL txRLPLength ; transaction RLP list length
VAR GLOBAL txDataRead ; aux variable to check transaction 'data' left that needs to be read
VAR GLOBAL isLoadingRLP ; flag to determine if the function is called from RLP loop
VAR CTX txGasLimit ; transaction parameter: 'gas limit'
VAR CTX txDestAddr ; transaction parameter: 'to'
VAR CTX storageAddr ; address which the storage will be modified
VAR CTX txValue ; transaction parameter: 'value'
VAR CTX txNonce ; transaction parameter: nonce
VAR CTX txGasPriceRLP ; transaction parameter: 'gasPrice' decoded from the RLP
VAR CTX txChainId ; transaction parameter: 'chainId'
VAR CTX txS ; transaction parameter: ecdsa signature S
VAR CTX txR ; transaction parameter: ecdsa signature R
VAR CTX txV ; transaction parameter: ecdsa signature V
VAR CTX txSrcAddr ; address that sends a transaction 'message.sender'
VAR CTX txHash ; signed tx hash
VAR CTX txCalldataLen ; calldata length
VAR CTX isCreateContract ; flag to determine if a transaction will create a new contract
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 memLength ; current memory size
VAR CTX lastMemLength ; length of bytes to copy to memory
VAR CTX lastMemoryExpansionCost ; cost of the last memory expansion
VAR CTX lastMemOffset ; offset to copy to memory
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 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 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
VAR CTX isCreate2 ; flag to determine if a new context comes from a CREATE2 opcode
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 dataStarts; hash position where de transaction 'data' starts in the batchHashData
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