### Counters legend: S: steps P: Poseidons Pa: Padding A: Arith B: Binaries K: Keccaks M: Mem align ### Constants: MCP: 257P - Maximmun counters poseidon in a SLOAD/SSTORE operation ### Typing rules function/input/constant/counter ## Common in all batches **batchProcessing**: initBatchProcessing + failAssert + consolidateBlock + finishBatchProcessing - initBatchProcessing: MCP + 100S + divArith + batchL2DataLength/136K + K - failAssert: 2S - consolidateBlock: 2\*MCP + 20S - finishBatchProcessing: MCP + 200S ## Common in all transactions - rlpParsing: 250S + 3B + addBatchHashData\*21 + checkNonLeadingZeros\*7 + divArith + txRLPLength/136K + txRLPLength/56P + txRLPLength/56D + addHashTx\*9 + addHashTx\*txDataLen/32 + addL2HashTx\*8 + addL2HashTx\*txDataLen/32 + addBatchHashByteByByte\*txDataLen/32 + SHLarith + ecrecoverTx - decodeChangeL2BlockTx: 20S + addBatchHashData\*3 - processTx: 300S + 12B + 14\*MCP + 5D + isColdAddress\*2 + 2A + addARITH\*3 + subARITH + 1K + divArith + mulARITH\*4 + fillBlockInfoTreeWithTxReceipt + processContractCall - processTxDeploy: 400S + 5\*MCP + 3B + checkBytecodeStartsEF + hashPoseidonLinearFromMemory ## Functions: ### Arithmetic opAdd: 10S + 1B opMul: 10S + mulArith opSub: 10S + 1B opDiv: 15S + divArith opSDiv: 25S + 1B + abs\*2 + divArith opMod: 20S + divArith opSMod: 20S + 1B + abs\*2 + divArith opAddMod: 30S + 3B +1A opMulMod: 10S + utilMulMod opExp: 10S + getLenBytes opSignExtend: 30S + 6B ### Block opBlockHash: MCP + K + 15S opCoinbase: 5S opTimestamp: 5S opNumber: 5S opDifficulty: 5S opGasLimit: 5S opChainId: 5S ### Calldata-Return-Code opCalldataLoad: 15S + readFromCalldataOffset opCalldataSize: 10S opCalldataCopy: 100S + 2B + saveMem + opCalldataCopyLoop\*X + readFromCalldataOffset + MStoreX\*2 opCalldataCopyLoop: ### Utils saveMem: 50S + 5B + mulArith + divArith readFromCalldataOffset: 25S + MLoadX utilMulMod: 50S + 4B + 2A + mulArith abs:10S + 2B ecrecoverTx: 1600B + 1100A + 6400S + K processContractCall: 40S + 2B + 1P + 1D + 2\*MCP + moveBalances + bytecodeLength/56P + bytecodeLength/56D + divArith moveBalances: 25S + 3B + 4\*MCP fillBlockInfoTreeWithTxReceipt: 20S + 3\*MCP divArith: 50S + 3B + 1A addBatchHashData: 10S checkNonLeadingZeros: 6S + getLenBytes getLenBytes: 20S + txDataLenS\*890 + txDataLenB\*89 + SHRarith\*txDataLen\*89 *The 89 value is obtained form the max values of each param that can get as input to getLenBytes function* SHRarith: 50S + 2B + 1A + divArith SHLarith: 100S + 4B + 2A addHashTx: 10S addL2HashTx: 10S addBatchHashByteByByte: 1610S + 32B isColdAddress: 100S + 2B + 2\*MCP addARITH: 10S + 1B subARITH: 10S + 1B checkBytecodeStartsEF: 50S hashPoseidonLinearFromMemory: 50S + 1B + 1Pa + (size/56)\*P + (size/32)\*(50S + MLoad32) + MLoadX + SHRarith MLoad32: 100S + 2B + 1M + offsetUtil MLoadX: 100S + 2B + 1M + offsetUtil + SHRarith + SHLarith offsetUtil: 20S + 1B mulARITH: 50S + 1A + 1B ### Inputs txDataLen: length of a transaction in bytes txRLPLength: length of raw rlp tx in bytes batchL2DataLength: length of batchL2Data in bytes bytecodeLength: length of the called smart contract's bytecode ## Arithmetic #### OpAdd counters_add + counters_oog