diff --git a/constraints b/constraints index d855c03e..445209f0 160000 --- a/constraints +++ b/constraints @@ -1 +1 @@ -Subproject commit d855c03e15d22859175970d99d8b79646988ce49 +Subproject commit 445209f0ad75d5b29b7e6924508dd2579a42508a diff --git a/contracts/src/verifiers/PlonkVerifierMainnetFull.sol b/contracts/src/verifiers/PlonkVerifierMainnetFull.sol index 92c64ee1..4062d242 100644 --- a/contracts/src/verifiers/PlonkVerifierMainnetFull.sol +++ b/contracts/src/verifiers/PlonkVerifierMainnetFull.sol @@ -43,10 +43,10 @@ contract PlonkVerifierMainnetFull { uint256 private constant VK_INV_DOMAIN_SIZE = 21888242219518804655518433051623070663413851959604507555939307129453691614729; uint256 private constant VK_OMEGA = 19200870435978225707111062059747084165650991997241425080699860725083300967194; - uint256 private constant VK_QL_COM_X = 16763721632302187064245116535318993406793422693670709276397395043117985043396; - uint256 private constant VK_QL_COM_Y = 21704519434294991344748680408475309717320132372621249588391334885901175870089; - uint256 private constant VK_QR_COM_X = 4659174267124804103032945565127374540672993228651562455767923366230378925207; - uint256 private constant VK_QR_COM_Y = 10075466426568401715266713487428009727978964696508926491453956484207585528204; + uint256 private constant VK_QL_COM_X = 19140160744730932168843702983189796718246703028852332924599880595140340744294; + uint256 private constant VK_QL_COM_Y = 16186514129294932389859278650990364364369281954479520668556508665052023533527; + uint256 private constant VK_QR_COM_X = 19941542879445624812979727787710043915366017402350479530185724916143710325553; + uint256 private constant VK_QR_COM_Y = 7601250913608609305104269620204410936660457632846454493447045082466166696693; uint256 private constant VK_QM_COM_X = 5553410513240938543232634851474389708189012141911611575921923499176928976035; uint256 private constant VK_QM_COM_Y = 21267989559503205894532435033155162591528358593663117280327683708498106399392; uint256 private constant VK_QO_COM_X = 13140407506194185536762256003490074009791461766528862809770970563406607579309; diff --git a/contracts/src/verifiers/PlonkVerifierSepoliaFull.sol b/contracts/src/verifiers/PlonkVerifierSepoliaFull.sol index 35e65db9..b8bd1695 100644 --- a/contracts/src/verifiers/PlonkVerifierSepoliaFull.sol +++ b/contracts/src/verifiers/PlonkVerifierSepoliaFull.sol @@ -43,10 +43,10 @@ contract PlonkVerifierSepoliaFull { uint256 private constant VK_INV_DOMAIN_SIZE = 21888242219518804655518433051623070663413851959604507555939307129453691614729; uint256 private constant VK_OMEGA = 19200870435978225707111062059747084165650991997241425080699860725083300967194; - uint256 private constant VK_QL_COM_X = 3511624111547342756712450888649315655574299737071572931449186092917508751115; - uint256 private constant VK_QL_COM_Y = 4450925408361574070118070087893406410804142563998631907603248600269055878587; - uint256 private constant VK_QR_COM_X = 16811709085260881363700682541955322953859105829393419176289064014786813158854; - uint256 private constant VK_QR_COM_Y = 12615843206799133624845320265059938705761455976479029844654559305921656138535; + uint256 private constant VK_QL_COM_X = 15582055358398575274260084414301435523487074126491256668699193658331738500814; + uint256 private constant VK_QL_COM_Y = 296011539922014006856424812425425139435424569757635039765507738877437690528; + uint256 private constant VK_QR_COM_X = 9395841435160250695501254616439674208546449862664033280720259728433672759330; + uint256 private constant VK_QR_COM_Y = 10693368561927368724840503813958338497457185198111248652756192647263040471483; uint256 private constant VK_QM_COM_X = 5553410513240938543232634851474389708189012141911611575921923499176928976035; uint256 private constant VK_QM_COM_Y = 21267989559503205894532435033155162591528358593663117280327683708498106399392; uint256 private constant VK_QO_COM_X = 13140407506194185536762256003490074009791461766528862809770970563406607579309; diff --git a/contracts/test/hardhat/_testData/betaV1_4/postRelease/proof/17865638-17865747-getZkAggregatedProof.json b/contracts/test/hardhat/_testData/betaV1_4/postRelease/proof/17865638-17865747-getZkAggregatedProof.json index cb0d4c74..0b76eff0 100644 --- a/contracts/test/hardhat/_testData/betaV1_4/postRelease/proof/17865638-17865747-getZkAggregatedProof.json +++ b/contracts/test/hardhat/_testData/betaV1_4/postRelease/proof/17865638-17865747-getZkAggregatedProof.json @@ -1,44 +1,45 @@ { - "finalShnarf": "0xc6bd71cc98f5ff2c1efffaf749b13cf7d1b13b86f9b4074da60079cab9c7f068", - "parentAggregationFinalShnarf": "0x34e6f29838a27a3621773b58efc778ada8ad0626a660f8bbcf7f2315f97fcd14", - "aggregatedProof": "0x1a1fc4101b83d093cb5547d909c1de5464f3b2aa12b2040f8de33f8358caf0c71a7b6177c2d2010dec09541eea7c665c2dabd0c0005fde862917bef43de1dd1625798f450eaf4a8271fefdb762a0a2d0113fadea8190181ee9040dcd4dccdc8c29f40f06b1ae60df4fa1f1f4f0f67035b82695699d79f596fc17c2fad7f6d4ac2b6fe21cfe8922f83cb6d05e9012a9c85dd0f30cf82a4af885e47abc028ee7990f19363737210b70a91017c118103bfe83990176bd747fbb149ed28c08d8567d171a871a47a566aba5d9353d0be6d589da4951ee8ed9a104d93e2c5d3cc8aa3e05eec8e44d1e2abbe355fe500acdb50855488c3ba59019d3b77fb9eaae5cb3b0035c8f14e2d7cb10f3d5892f34bd9193939688907935cacc2d383b35e869539321fd9227aebb4f87d6efc10edb7e72a5b6ac890bbacbaaea056f24e8d5e009151f2dfa8e346da714c2b4b785927ddb2f830d128f1edc9085c88ea9d5bfe040d508eeb8d3b149418e416b8ac03db1c3e652e0d7be0cdc3da2cb6a5d1caa6b80522e41edd4eef3aa3632f55da78d32f2573cc7892ca77b166cf20ccd39635b195a1e280a8b26642df465cdedfecdef416ec62316cca8f52d93031c86aa2787381f02a80cc97178727fc8b7779f721f250b6ce1930ffa615662e479c7e89eb2abc025ef2e00672d93a85554c562cf5fe3861d106d9d2f7769c0ff79196b970541722953e7411257e826e9be62d67fbe7540256ace84998201bc0b1f81d74d1b77a125e05509651dacb90bd5ee7a6aceeb3bcdfe422b48dfdd807847dda2c0bbc3491bd05ee349d2c78219fcdbaa489545c5c5d11af4b30685c1b06ad20e9eaad93b28074bb7b1d3173275347e537c0672b021c334cb4a3e568f55f6154afff733ab27ade7044f6ef43b2de54592ba27035e25844c2e550f4957858ef614c61c0900236d40a58ee0edd904eb1527b02d8c01a43c55507909a5e5c9c2465a5cad7db10f34aa8a2626310c93d8f17253ceda8f259b4fe71bc03621564c49ce86c718e21fe96f4fd599ae79574de2fff3ba8d5e9549fc433f7c2134d2cdfc6989e7f34e2d02d93ddeb0ba05dc56c31ae36f5ef59b88db465a1c5793ee063b091bb64a231c3c95a3dcdb9e08b1b274aeab2e61bb33525e2d091d8070f71cdb7edcb256131a6b96a605dcca291ff285568ad2a63c992d63f0b1aaea1245e0c7677378ce25", - "aggregatedProverVersion": "5.0.2", - "aggregatedVerifierIndex": 1, - "aggregatedProofPublicInput": "0x183bc76cd3a4282e86cc93d62b2b2527bdbcd60f3c13b32ed599f2e8bb9bfc65", - "dataHashes": [ - "0x019e44b475cf05ca347516891e17260dff2412275509aef778c024a497c7e2a4", - "0x01fa1a8d120e026e6377cdfb9632bbd68456bf2ecc23af50450d20a7c01dc41a", - "0x01d162e6ecf3bcf28ae4f881c333477b00353b17bcb31b8f3334b1a9acafd8a1", - "0x01d715d0e82b6e86a879eac16ace09a1e94b96931b630c4356bd10df0f00a6c9", - "0x019a910e87c05baa04238585af6060788328470fb4593acba1f2ce9e19222600", - "0x01330f4997c36a73900d0e9342ad51824995229fa51c7a6b5c9ddf9281fe5716", - "0x018272c603f97c2033c4b30f52d87a896f0787580a61be50b116ee66bc2619e4", - "0x018a4625acdc76c4545068a3e7e57a10e7106b7ed811bcb2eed76b946cb28047", - "0x0184a7ce85f4f376e7abde1640680cfaf9f90b6b6466e5c3ada9850ecf65fdd7", - "0x010621dcac35228ed31399e848dc2f1219ff8df85c86212004a37870890309b9", - "0x01c1ff87d5e8189b456513f40da2f35843ec4349aca460f499b1d1660a0bde4e", - "0x01c491ac4c44bf3f3ca3dce3eb538314de834003d7065ae75f438957bca3f54d", - "0x018d54800edc45d622454c6237624842de3f278642cce52ed67f5484b008f7ba", - "0x01a03ddeb3bca9a6f2e8c840111982fccf41eae9e9658c918a79c89cfd86dbab", - "0x01d32e99f8f2b1c8bff3146a2a1436dca70d5671bdf19ead3abdaacf64ee6b56", - "0x01732fdd98bc572032135ba9aeaf293b0f8066d51ca33bbf2369e68bcad587e0", - "0x01a3013d06d4cdbf3be3010ef1c1277b57acfcf4471e54313e5834319af4fd42", - "0x0122304911d6cd6d501b4ee49c5703cfd4bd06669c81fda2cf7b840cd940780d", - "0x017a3f3a158e514c2054803f510fb3eeaaa010e3f76fd6b58c2fc31296d42723", - "0x019213dfa9c3ad91bf7e3ba15296e06e4128a476234cf876dd5ae6fd0cbc566e", - "0x01b789c8b27d3c02656ed95117e1efa39f4a5a0e312200b7a2ae7c7b7a1f149a" - ], - "dataParentHash": "0x0103e5484c3b431ba5b51cd097739a8da2a37d97bff0b9a932739369d02a57a8", - "parentStateRootHash": "0x00f63f481879c7682c1eacfcca3626e0e9b3bc26d38d734925c2706c4d6fd2ac", - "parentAggregationLastBlockTimestamp": 1744196722, - "lastFinalizedBlockNumber": 17865637, - "finalTimestamp": 1744196953, - "finalBlockNumber": 17865747, - "l1RollingHash": "0x14b1f596bf51d4cfcaf194c498f53c40a94bcebddb5a892c52c3fc5e713c46ed", - "l1RollingHashMessageNumber": 737506, - "l2MerkleRoots": [], - "l2MerkleTreesDepth": 5, - "l2MessagingBlocksOffsets": "0x", - "parentAggregationLastL1RollingHash": "0x14b1f596bf51d4cfcaf194c498f53c40a94bcebddb5a892c52c3fc5e713c46ed", - "parentAggregationLastL1RollingHashMessageNumber": 737506 -} + "finalShnarf": "0xc6bd71cc98f5ff2c1efffaf749b13cf7d1b13b86f9b4074da60079cab9c7f068", + "parentAggregationFinalShnarf": "0x34e6f29838a27a3621773b58efc778ada8ad0626a660f8bbcf7f2315f97fcd14", + "aggregatedProof": "0x01c926f5b24d874914acc6f0e7fae09e8d501954babe9ac2fe464063c0d33f9e178c1b3c59e35d29c39177cac3b1ed24b7e7cc9177668f9e1016b825a4cef4b70dd0c38b4e59b5c4fe7b2d6489687d37391513faed34ccb49c4c10b363f0100418f68607cf7f36558c041c0b8462c965e779681d88c5ca34ca64607273bfb9c507f8620bdfa21cf9379037e4044960de08eddc8e9cdafe26d876e5881f1e5e020629359a34f913d93670f204ee7317c087fa40213d8e10a6efdd91c7af5b6a8407c6206273b1a51565b02c306596a9d5ea4af51c526fe080a2f2cb218412d37927ee9a212add17fd9318340ddba99e808dc44bc8ed8742e4053a36e7a1e15d161ade19122fad1910150da410dcc499b6887ed950558c3a551c4aa5ef3a9bf87a245a8300946a410bb4d9ba61a1892b0d96084de11c446994f3b8c94962fa8fb6016b4cefe5b0d83c2eb7fe02f58bdca601ff3960fd33b4b44d4aa19797da203b2c0628d7957b943d2068c8ef5110c91cc10286a0f86c16378d5a43cda6bf1d1f09183891002ee7fe16d63097dc2658fddc3e91dfd2cd8db82d21c503e21b20bb1c09748909982bba093f69392a59e0fe0e6589466a9e7412fc65763d69e084222e3304ed34c7c2da52bcb897ff3a8dabf5ca3fa0578b451c219bc6d3014f22cd2ecb244c8b48c238c6c6dbbf8232ff63cf154fc0693e9c39fa3509503e3e22ff0f23060b21f1ad7e06fdb0a570483bfd84512e96bd9cf9100d6148024dbb55320dea365dda3504f07ce1af4d08214930ffae3fcf1840814d71babaeac99acad81c299bd777664fadba91032308bfcdc9acdd2f9c61c7c0e753006679f703923509072dc5cbd7bda93ad5b0924e687698adaff00d6cd82f283174c7df19a504c82b7aabc2f4f3ca9ed1e6b03a00a819230acb87ad6edca48b048e88fbc23fc6df0747e577bdda59a8397a1d05a5c0fb418d801e7df1f7f58ce504086628ecb58b04350fa4e329ade9589507bec1ac48e2c655142a8d49bab3f07e4c4e15c4bd681db481af72d8ff5c3199c6226c9b1e181c76775525f5ccd865a7f2103a81271a042abe387b143be70dedda3bf6ecfc4fa276170c6c3e25d73e66d86a6cecd49404b61401ad15c8fb8724ef6578cd2dd7b1f8bf59b00e325ff5499c02a7d089ec2b31f528834f880efc61289609b506a0f3123d471ce279c3cb3f18a958b3349e", + "aggregatedProverVersion": "5.1.1", + "aggregatedVerifierIndex": 1, + "aggregatedProofPublicInput": "0x183bc76cd3a4282e86cc93d62b2b2527bdbcd60f3c13b32ed599f2e8bb9bfc65", + "dataHashes": [ + "0x019e44b475cf05ca347516891e17260dff2412275509aef778c024a497c7e2a4", + "0x01fa1a8d120e026e6377cdfb9632bbd68456bf2ecc23af50450d20a7c01dc41a", + "0x01d162e6ecf3bcf28ae4f881c333477b00353b17bcb31b8f3334b1a9acafd8a1", + "0x01d715d0e82b6e86a879eac16ace09a1e94b96931b630c4356bd10df0f00a6c9", + "0x019a910e87c05baa04238585af6060788328470fb4593acba1f2ce9e19222600", + "0x01330f4997c36a73900d0e9342ad51824995229fa51c7a6b5c9ddf9281fe5716", + "0x018272c603f97c2033c4b30f52d87a896f0787580a61be50b116ee66bc2619e4", + "0x018a4625acdc76c4545068a3e7e57a10e7106b7ed811bcb2eed76b946cb28047", + "0x0184a7ce85f4f376e7abde1640680cfaf9f90b6b6466e5c3ada9850ecf65fdd7", + "0x010621dcac35228ed31399e848dc2f1219ff8df85c86212004a37870890309b9", + "0x01c1ff87d5e8189b456513f40da2f35843ec4349aca460f499b1d1660a0bde4e", + "0x01c491ac4c44bf3f3ca3dce3eb538314de834003d7065ae75f438957bca3f54d", + "0x018d54800edc45d622454c6237624842de3f278642cce52ed67f5484b008f7ba", + "0x01a03ddeb3bca9a6f2e8c840111982fccf41eae9e9658c918a79c89cfd86dbab", + "0x01d32e99f8f2b1c8bff3146a2a1436dca70d5671bdf19ead3abdaacf64ee6b56", + "0x01732fdd98bc572032135ba9aeaf293b0f8066d51ca33bbf2369e68bcad587e0", + "0x01a3013d06d4cdbf3be3010ef1c1277b57acfcf4471e54313e5834319af4fd42", + "0x0122304911d6cd6d501b4ee49c5703cfd4bd06669c81fda2cf7b840cd940780d", + "0x017a3f3a158e514c2054803f510fb3eeaaa010e3f76fd6b58c2fc31296d42723", + "0x019213dfa9c3ad91bf7e3ba15296e06e4128a476234cf876dd5ae6fd0cbc566e", + "0x01b789c8b27d3c02656ed95117e1efa39f4a5a0e312200b7a2ae7c7b7a1f149a" + ], + "dataParentHash": "0x0103e5484c3b431ba5b51cd097739a8da2a37d97bff0b9a932739369d02a57a8", + "parentStateRootHash": "0x00f63f481879c7682c1eacfcca3626e0e9b3bc26d38d734925c2706c4d6fd2ac", + "parentAggregationLastBlockTimestamp": 1744196722, + "lastFinalizedBlockNumber": 17865637, + "finalTimestamp": 1744196953, + "finalBlockNumber": 17865747, + "l1RollingHash": "0x14b1f596bf51d4cfcaf194c498f53c40a94bcebddb5a892c52c3fc5e713c46ed", + "l1RollingHashMessageNumber": 737506, + "l2MerkleRoots": [], + "l2MerkleTreesDepth": 5, + "l2MessagingBlocksOffsets": "0x", + "parentAggregationLastL1RollingHash": "0x14b1f596bf51d4cfcaf194c498f53c40a94bcebddb5a892c52c3fc5e713c46ed", + "parentAggregationLastL1RollingHashMessageNumber": 737506 + } + \ No newline at end of file diff --git a/go-corset b/go-corset index 36d66c65..ee34d9eb 160000 --- a/go-corset +++ b/go-corset @@ -1 +1 @@ -Subproject commit 36d66c65a94b4a1f95b681538b3ff7209e16d93c +Subproject commit ee34d9eb60bf369958fcaae6b97a0c53502092fc diff --git a/prover/Makefile b/prover/Makefile index f209c58b..d31eb81a 100644 --- a/prover/Makefile +++ b/prover/Makefile @@ -61,7 +61,7 @@ copy-prover-assets: aws s3 sync --exclude "*prover/dev*" --exclude "*05b9ef1*" --exclude "*05b9ef1*" --exclude "*96e3a19*" --exclude "*a9e4681*" prover-assets s3://zk-uat-prover/prover-assets/ --profile=zk-uat-s3-access download-srs: - aws s3 sync s3://gnark-ignition/with_lines/ ./prover-assets/kzgsrs --exclude "*" --include "*.memdump" + aws s3 sync s3://prover-assets/kzgsrs/ ./prover-assets/kzgsrs --exclude "*" --include "*.memdump" ### ### Controller diff --git a/prover/config/config-devnet-full.toml b/prover/config/config-devnet-full.toml new file mode 100644 index 00000000..d979584d --- /dev/null +++ b/prover/config/config-devnet-full.toml @@ -0,0 +1,135 @@ +environment = "devnet" +version = "5.0.2" # TODO @gbotrel hunt all version definitions. +assets_dir = "./prover-assets" +log_level = 4 # TODO @gbotrel will be refactored with new logger. + +[controller] +retry_delays = [0, 1] + +[execution] +prover_mode = "full" +conflated_traces_dir = "./" +requests_root_dir = "./" +ignore_compatibility_check=true + +[blob_decompression] +prover_mode = "full" + +[aggregation] +prover_mode = "full" +requests_root_dir = "/home/ubuntu/sepolia-testing-full/prover-aggregation" +num_proofs = [10, 20, 50, 100, 200, 400] +allowed_inputs = ["execution-dummy", "execution", "execution-large", "blob-decompression-dummy", "blob-decompression-v0", "blob-decompression-v1"] +verifier_id = 0 + +[public_input_interconnection] +max_nb_decompression = 400 +max_nb_execution = 400 +max_nb_circuits = 400 +execution_max_nb_msg = 16 +l2_msg_merkle_depth = 5 +l2_msg_max_nb_merkle = 200 + +[layer2] +chain_id = 59139 +message_service_contract = "0x33bf916373159a8c1b54b025202517bfdbb7863d" + +[traces_limits] +ADD = 524288 +BIN = 262144 +BLAKE_MODEXP_DATA = 16384 +BLOCK_DATA = 4096 +BLOCK_HASH = 512 +EC_DATA = 262144 +EUC = 65536 +EXP = 16384 +EXT = 1048576 +GAS = 65536 +HUB = 2097152 +LOG_DATA = 65536 +LOG_INFO = 4096 +MMIO = 4194304 +MMU = 4194304 +MOD = 131072 +MUL = 65536 +MXP = 524288 +OOB = 262144 +RLP_ADDR = 4096 +RLP_TXN = 131072 +RLP_TXN_RCPT = 65536 +ROM = 4194304 +ROM_LEX = 1024 +SHAKIRA_DATA = 32768 +SHF = 65536 +STP = 16384 +TRM = 32768 +TXN_DATA = 8192 +WCP = 262144 +PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 128 +PRECOMPILE_SHA2_BLOCKS = 671 +PRECOMPILE_RIPEMD_BLOCKS = 0 +PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8 +PRECOMPILE_ECADD_EFFECTIVE_CALLS = 16384 +PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64 +PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16 +PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64 +PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 64 +PRECOMPILE_BLAKE_EFFECTIVE_CALLS = 0 +PRECOMPILE_BLAKE_ROUNDS = 0 +BLOCK_KECCAK = 8192 +BLOCK_L1_SIZE = 1000000 +BLOCK_L2_L1_LOGS = 16 +BLOCK_TRANSACTIONS = 200 +BIN_REFERENCE_TABLE = 262144 +SHF_REFERENCE_TABLE = 4096 +INSTRUCTION_DECODER = 512 + +[traces_limits_large] +ADD = 1048576 +BIN = 524288 +BLAKE_MODEXP_DATA = 32768 +BLOCK_DATA = 8192 +BLOCK_HASH = 1024 +EC_DATA = 524288 +EUC = 131072 +EXP = 16384 +EXT = 2097152 +GAS = 131072 +HUB = 4194304 +LOG_DATA = 131072 +LOG_INFO = 8192 +MMIO = 8388608 +MMU = 8388608 +MOD = 262144 +MUL = 131072 +MXP = 1048576 +OOB = 524288 +RLP_ADDR = 8192 +RLP_TXN = 262144 +RLP_TXN_RCPT = 131072 +ROM = 8388608 +ROM_LEX = 2048 +SHAKIRA_DATA = 65536 +SHF = 131072 +STP = 32768 +TRM = 65536 +TXN_DATA = 16384 +WCP = 524288 +PRECOMPILE_ECRECOVER_EFFECTIVE_CALLS = 256 +PRECOMPILE_SHA2_BLOCKS = 671 +PRECOMPILE_RIPEMD_BLOCKS = 0 +PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 8 +PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768 +PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64 +PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32 +PRECOMPILE_ECPAIRING_MILLER_LOOPS = 128 +PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 128 +PRECOMPILE_BLAKE_EFFECTIVE_CALLS = 0 +PRECOMPILE_BLAKE_ROUNDS = 0 +BLOCK_KECCAK = 8192 +BLOCK_L1_SIZE = 1000000 +BLOCK_L2_L1_LOGS = 16 +BLOCK_TRANSACTIONS = 200 +BIN_REFERENCE_TABLE = 262144 +SHF_REFERENCE_TABLE = 4096 +INSTRUCTION_DECODER = 512 diff --git a/prover/config/config-mainnet-full.toml b/prover/config/config-mainnet-full.toml index a549cc12..02df651c 100644 --- a/prover/config/config-mainnet-full.toml +++ b/prover/config/config-mainnet-full.toml @@ -1,5 +1,5 @@ environment = "mainnet" -version = "5.0.2" # TODO @gbotrel hunt all version definitions. +version = "5.1.1" # TODO @gbotrel hunt all version definitions. assets_dir = "./prover-assets" log_level = 4 # TODO @gbotrel will be refactored with new logger. @@ -8,18 +8,18 @@ retry_delays = [0, 1] [execution] prover_mode = "full" -conflated_traces_dir = "/home/ubuntu/testing-mainnet-beta-v2/conflated" -requests_root_dir = "/home/ubuntu/testing-mainnet-beta-v2/prover-execution" +conflated_traces_dir = "/home/ubuntu/mainnet-test-2/conflated" +requests_root_dir = "/home/ubuntu/mainnet-test-2/v2/execution" [blob_decompression] prover_mode = "full" -requests_root_dir = "/home/ubuntu/testing-mainnet-beta-v2/prover-compression" +requests_root_dir = "/home/ubuntu/mainnet-test-2/v2/compression" dict_paths = ["lib/compressor/compressor_dict.bin", "lib/compressor/dict/25-04-21.bin"] [aggregation] prover_mode = "full" -requests_root_dir = "/home/ubuntu/testing-mainnet-beta-v2/prover-aggregation" +requests_root_dir = "/home/ubuntu/mainnet-test-2/v2/aggregation" num_proofs = [10, 20, 50, 100, 200, 400] allowed_inputs = ["execution-dummy", "execution", "execution-large", "blob-decompression-dummy", "blob-decompression-v0", "blob-decompression-v1"] verifier_id = 1 @@ -72,7 +72,7 @@ PRECOMPILE_SHA2_BLOCKS = 200 PRECOMPILE_RIPEMD_BLOCKS = 0 PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 32 PRECOMPILE_ECADD_EFFECTIVE_CALLS = 1024 -PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 32 +PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 40 PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 16 PRECOMPILE_ECPAIRING_MILLER_LOOPS = 64 PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 64 @@ -122,7 +122,7 @@ PRECOMPILE_SHA2_BLOCKS = 400 PRECOMPILE_RIPEMD_BLOCKS = 0 PRECOMPILE_MODEXP_EFFECTIVE_CALLS = 64 PRECOMPILE_ECADD_EFFECTIVE_CALLS = 32768 -PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 64 +PRECOMPILE_ECMUL_EFFECTIVE_CALLS = 80 PRECOMPILE_ECPAIRING_FINAL_EXPONENTIATIONS = 32 PRECOMPILE_ECPAIRING_MILLER_LOOPS = 128 PRECOMPILE_ECPAIRING_G2_MEMBERSHIP_CALLS = 128 diff --git a/prover/config/config-sepolia-full.toml b/prover/config/config-sepolia-full.toml index ddeef770..5c6e2957 100644 --- a/prover/config/config-sepolia-full.toml +++ b/prover/config/config-sepolia-full.toml @@ -1,5 +1,5 @@ environment = "sepolia" -version = "5.0.2" # TODO @gbotrel hunt all version definitions. +version = "5.1.1" # TODO @gbotrel hunt all version definitions. assets_dir = "./prover-assets" log_level = 4 # TODO @gbotrel will be refactored with new logger. @@ -8,18 +8,18 @@ retry_delays = [0, 1] [execution] prover_mode = "full" -conflated_traces_dir = "/home/ubuntu/testing-sepolia-0.8.0-rc8.1/traces/conflated" -requests_root_dir = "/home/ubuntu/testing-sepolia-0.8.0-rc8.1/prover-execution" +conflated_traces_dir = "/home/ubuntu/testing-sepolia-beta-v2" +requests_root_dir = "/home/ubuntu/testing-sepolia-beta-v2/prover-execution" [blob_decompression] prover_mode = "full" -requests_root_dir = "/home/ubuntu/testing-sepolia-0.8.0-rc8.1/prover-compression" +requests_root_dir = "/home/ubuntu/mainnet-test-2/v1/prover-compression" dict_paths = ["lib/compressor/compressor_dict.bin", "lib/compressor/dict/25-04-21.bin"] [aggregation] prover_mode = "full" -requests_root_dir = "/home/ubuntu/testing-sepolia-0.8.0-rc8.1/prover-aggregation" +requests_root_dir = "/home/ubuntu/mainnet-test-2/v1/prover-aggregation" num_proofs = [10, 20, 50, 100, 200, 400] allowed_inputs = ["execution-dummy", "execution", "execution-large", "blob-decompression-dummy", "blob-decompression-v0", "blob-decompression-v1"] verifier_id = 1 diff --git a/prover/go.mod b/prover/go.mod index 4c86f093..c0ed00d5 100644 --- a/prover/go.mod +++ b/prover/go.mod @@ -10,7 +10,7 @@ require ( github.com/consensys/compress v0.2.5 github.com/consensys/gnark v0.11.1-0.20250107100237-2cb190338a01 github.com/consensys/gnark-crypto v0.14.1-0.20250515163241-5b554443cce2 - github.com/consensys/go-corset v1.0.3 + github.com/consensys/go-corset v1.0.7 github.com/crate-crypto/go-kzg-4844 v1.1.0 github.com/dlclark/regexp2 v1.11.2 github.com/fxamacker/cbor/v2 v2.7.0 diff --git a/prover/go.sum b/prover/go.sum index 1c424c4d..23587350 100644 --- a/prover/go.sum +++ b/prover/go.sum @@ -100,8 +100,8 @@ github.com/consensys/gnark v0.11.1-0.20250107100237-2cb190338a01 h1:YCHI04nMKFC6 github.com/consensys/gnark v0.11.1-0.20250107100237-2cb190338a01/go.mod h1:8YNyW/+XsYiLRzROLaj/PSktYO4VAdv6YW1b1P3UsZk= github.com/consensys/gnark-crypto v0.14.1-0.20250515163241-5b554443cce2 h1:N3OCv+VoCn4CEvhRc3vKXyE3S1Si7OSoFTO3bv6ZEgQ= github.com/consensys/gnark-crypto v0.14.1-0.20250515163241-5b554443cce2/go.mod h1:ePFa23CZLMRMHxQpY5nMaiAZ3yuEIayaB8ElEvlwLEs= -github.com/consensys/go-corset v1.0.3 h1:CZ04qi9NaMkMJnfv19UUHGhEXJZwpDNrAo5fwDbT1OM= -github.com/consensys/go-corset v1.0.3/go.mod h1:JKJTywyjBE0Goco4DokW4BAkF6R+jtoo3XgkICwxrcw= +github.com/consensys/go-corset v1.0.7 h1:Ym3vjHtVSk59/q7p9/VFvwQkIqyCy1m61DgkNcKlyg4= +github.com/consensys/go-corset v1.0.7/go.mod h1:JKJTywyjBE0Goco4DokW4BAkF6R+jtoo3XgkICwxrcw= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= diff --git a/prover/traces_shomei_isolation_test.go b/prover/traces_shomei_isolation_test.go new file mode 100644 index 00000000..d1b75ce5 --- /dev/null +++ b/prover/traces_shomei_isolation_test.go @@ -0,0 +1 @@ +package prover diff --git a/prover/zkevm/arithmetization/zkevm.bin b/prover/zkevm/arithmetization/zkevm.bin index 2c9bcc8b..c3c8b9ea 100644 Binary files a/prover/zkevm/arithmetization/zkevm.bin and b/prover/zkevm/arithmetization/zkevm.bin differ diff --git a/prover/zkevm/prover/statemanager/statesummary/arithmetization_connector.go b/prover/zkevm/prover/statemanager/statesummary/arithmetization_connector.go index df58051d..88336f28 100644 --- a/prover/zkevm/prover/statemanager/statesummary/arithmetization_connector.go +++ b/prover/zkevm/prover/statemanager/statesummary/arithmetization_connector.go @@ -70,6 +70,7 @@ func (ss *Module) assignArithmetizationLink(run *wizard.ProverRuntime) { ss.arithmetizationLink.scpSelector.ComputeSelectorEmptySTValueNextLo, ss.arithmetizationLink.scpSelector.ComputeSelectorSTKeyDiffHi, ss.arithmetizationLink.scpSelector.ComputeSelectorSTKeyDiffLo, + ss.arithmetizationLink.scpSelector.ComputeSelectorAccountAddressDiff, ss.arithmetizationLink.scpSelector.ComputeSelectorBlockNoDiff, }) @@ -127,6 +128,9 @@ type scpSelector struct { // storage key difference selectors SelectorSTKeyDiffHi, SelectorSTKeyDiffLo ifaces.Column ComputeSelectorSTKeyDiffHi, ComputeSelectorSTKeyDiffLo wizard.ProverAction + // Account Address Diff + SelectorAccountAddressDiff ifaces.Column + ComputeSelectorAccountAddressDiff wizard.ProverAction // block number key difference selectors SelectorBlockNoDiff ifaces.Column ComputeSelectorBlockNoDiff wizard.ProverAction @@ -182,6 +186,16 @@ func newScpSelector(comp *wizard.CompiledIOP, smc HubColumnSet) scpSelector { column.Shift(smc.KeyLO, -1), ), ) + + // compute selectors for the ethereum address difference + SelectorAccountAddressDiff, ComputeSelectorAccountAddressDiff := dedicated.IsZero( + comp, + sym.Sub( + smc.Address, + column.Shift(smc.Address, -1), + ), + ) + // compute selectors for the block number difference SelectorBlockNoDiff, ComputeSelectorBlockNoDiff := dedicated.IsZero( comp, @@ -211,6 +225,9 @@ func newScpSelector(comp *wizard.CompiledIOP, smc HubColumnSet) scpSelector { SelectorSTKeyDiffLo: SelectorSTKeyDiffLo, ComputeSelectorSTKeyDiffHi: ComputeSelectorSTKeyDiffHi, ComputeSelectorSTKeyDiffLo: ComputeSelectorSTKeyDiffLo, + // Address Number Diff, account address difference selectors + SelectorAccountAddressDiff: SelectorAccountAddressDiff, + ComputeSelectorAccountAddressDiff: ComputeSelectorAccountAddressDiff, // Block Number Diff SelectorBlockNoDiff: SelectorBlockNoDiff, ComputeSelectorBlockNoDiff: ComputeSelectorBlockNoDiff, @@ -260,13 +277,13 @@ func accountIntegrationDefineInitial(comp *wizard.CompiledIOP, ss Module, smc Hu } ) - // comp.InsertInclusionDoubleConditional(0, - // "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_INIT_ACCOUNT", - // stateSummaryTable, - // arithTable, - // filterSummary, - // filterArith, - // ) + comp.InsertInclusionDoubleConditional(0, + "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_INIT_ACCOUNT", + stateSummaryTable, + arithTable, + filterSummary, + filterArith, + ) comp.InsertInclusionDoubleConditional(0, "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_INIT_ACCOUNT_REVERSED", @@ -364,7 +381,7 @@ func accountIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC smc.ExistsNew, } - // comp.InsertInclusionDoubleConditional(0, "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_FINAL_ACCOUNT", stateSummaryTable, arithTable, filterSummary, filterArith) + comp.InsertInclusionDoubleConditional(0, "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_FINAL_ACCOUNT", stateSummaryTable, arithTable, filterSummary, filterArith) comp.InsertInclusionDoubleConditional(0, "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_FINAL_ACCOUNT_REVERSED", arithTable, stateSummaryTable, filterArith, filterSummary) // Now we define the constraints for our filters @@ -435,8 +452,6 @@ func storageIntegrationDefineInitial(comp *wizard.CompiledIOP, ss Module, smc Hu filterArithReversed := comp.InsertCommit(0, "FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_INITIAL_ARITHMETIZATION_REVERSED", smc.AddressHI.Size()) - isExceptionalOperation := comp.Columns.GetHandle("hub.scp_EXCEPTIONAL_OPERATION") - summaryTable := []ifaces.Column{ ss.Account.Address, ss.Storage.Key.Hi, @@ -453,14 +468,14 @@ func storageIntegrationDefineInitial(comp *wizard.CompiledIOP, ss Module, smc Hu smc.ValueLOCurr, smc.BlockNumber, } - // comp.InsertInclusionDoubleConditional( - // 0, - // "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_INIT_STORAGE", - // summaryTable, - // arithTable, - // filterSummary, - // filterArith, - // ) + comp.InsertInclusionDoubleConditional( + 0, + "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_INIT_STORAGE", + summaryTable, + arithTable, + filterSummary, + filterArith, + ) comp.InsertInclusionDoubleConditional( 0, "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_INIT_STORAGE_REVERSE", @@ -470,6 +485,7 @@ func storageIntegrationDefineInitial(comp *wizard.CompiledIOP, ss Module, smc Hu filterSummary, ) + filterEphemeralAccounts := defineEphemeralAccountFilterStorage(comp, smc, sc) // Now we define the constraints for our filters comp.InsertGlobal( 0, @@ -480,10 +496,7 @@ func storageIntegrationDefineInitial(comp *wizard.CompiledIOP, ss Module, smc Hu sc.SelectorMinDeplBlock, smc.PeekAtStorage, smc.FirstKOCBlock, - sym.Sub( - 1, - isExceptionalOperation, - ), + filterEphemeralAccounts, ), ), ) @@ -531,20 +544,13 @@ func storageIntegrationAssignInitial(run *wizard.ProverRuntime, ss Module, smc H } svSelectorMinDeplBlock := smartvectors.NewRegular(selectorMinDeplBlock) - isExceptionalOperation := run.Spec.Columns.GetHandle("hub.scp_EXCEPTIONAL_OPERATION") - isNotExceptionalOperation := make([]field.Element, smc.AddressHI.Size()) - - for i := range isNotExceptionalOperation { - fieldOne := field.One() - isExceptionElem := isExceptionalOperation.GetColAssignmentAt(run, i) - isNotExceptionalOperation[i].Sub(&fieldOne, &isExceptionElem) - } + filterEphemeralAccounts := assignEphemeralAccountFilterStorage(run, smc) filterArith := smartvectors.Mul( svSelectorMinDeplBlock, smc.PeekAtStorage.GetColAssignment(run), smc.FirstKOCBlock.GetColAssignment(run), - smartvectors.NewRegular(isNotExceptionalOperation), + filterEphemeralAccounts, ) run.AssignColumn( "FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_INITIAL_ARITHMETIZATION", @@ -604,19 +610,17 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC ss.Account.Address.Size(), ) - filterAccountInsert = comp.InsertCommit(0, - "FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_INSERT_FILTER", - smc.AddressHI.Size(), - ) + filterAccountInsert = defineInsertionFilterForFinalStorage(comp, smc, sc) + filterEphemeralAccounts = comp.Columns.GetHandle("FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_EPHEMERAL_FILTER") ) - // comp.InsertInclusionDoubleConditional(0, - // "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_FINAL_STORAGE", - // summaryTable, - // arithTable, - // filterSummary, - // filterArith, - // ) + comp.InsertInclusionDoubleConditional(0, + "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_FINAL_STORAGE", + summaryTable, + arithTable, + filterSummary, + filterArith, + ) comp.InsertInclusionDoubleConditional(0, "LOOKUP_STATE_MGR_ARITH_TO_STATE_SUMMARY_FINAL_STORAGE_REVERSED", @@ -626,9 +630,6 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC filterSummary, ) - isSLoad := comp.Columns.GetHandle("hub.scp_SLOAD_OPERATION") - isExceptionalOperation := comp.Columns.GetHandle("hub.scp_EXCEPTIONAL_OPERATION") - comp.InsertGlobal( 0, ifaces.QueryIDf("CONSTRAINT_FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_ARITHMETIZATION"), @@ -639,16 +640,7 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC smc.PeekAtStorage, smc.LastKOCBlock, filterAccountInsert, - sym.Sub( - 1, - sym.Mul( - // in this paranthesis, we have a filter for SLOADS that generate exceptions, - // and will not appear on Shomei's side. Currently, the SSTORE behavior seems to match - // betwen HUB and Shomei, so we do not filter or create separate lookups for SSTOREs - isSLoad, - isExceptionalOperation, - ), - ), + filterEphemeralAccounts, ), ), ) @@ -677,6 +669,61 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC ), ), ) +} + +/* +storageIntegrationAssignFinal assigns the columns used to check initial storage data consistency using the lookups from StorageIntegrationDefineFinal +*/ +func storageIntegrationAssignFinal(run *wizard.ProverRuntime, ss Module, smc HubColumnSet) { + selectorMaxDeplBlock := make([]field.Element, smc.AddressHI.Size()) + for index := range selectorMaxDeplBlock { + maxDeplBlock := smc.MaxDeplBlock.GetColAssignmentAt(run, index) + deplNumber := smc.DeploymentNumber.GetColAssignmentAt(run, index) + if maxDeplBlock.Equal(&deplNumber) { + selectorMaxDeplBlock[index].SetOne() + } + } + svSelectorMaxDeplBlock := smartvectors.NewRegular(selectorMaxDeplBlock) + + filterSummary := smartvectors.Mul( + ss.IsStorage.GetColAssignment(run), + ss.IsFinalDeployment.GetColAssignment(run), + ) + run.AssignColumn("FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_SUMMARY", filterSummary) + + // assign the insertion filter + filterAccountInsert := assignInsertionFilterForFinalStorage(run, smc) + filterEphemeralAccounts := run.GetColumn("FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_EPHEMERAL_FILTER") + + filterArith := smartvectors.Mul( + svSelectorMaxDeplBlock, + smc.PeekAtStorage.GetColAssignment(run), + smc.LastKOCBlock.GetColAssignment(run), + filterAccountInsert, + filterEphemeralAccounts, + ) + run.AssignColumn("FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_ARITHMETIZATION", filterArith) + + filterArithReversed := smartvectors.Mul( + svSelectorMaxDeplBlock, + smc.PeekAtStorage.GetColAssignment(run), + smc.LastKOCBlock.GetColAssignment(run), + ) + run.AssignColumn("FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_ARITHMETIZATION_REVERSED", filterArithReversed) + +} + +/* +defineInsertionFilterForFinalStorage defines an insertion filter for the edge case of +missing storage keys that get created but then wiped when an account that did not exist is +not added to the state +*/ +func defineInsertionFilterForFinalStorage(comp *wizard.CompiledIOP, smc HubColumnSet, sc scpSelector) ifaces.Column { + // create the filter + filterAccountInsert := comp.InsertCommit(0, + "FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_INSERT_FILTER", + smc.AddressHI.Size(), + ) // constraint the insertion selector filter // on storage rows, we enforce that filterAccountInsert is 0 then (existsFirstInBlock = 0 and existsFinalInBlock = 1) @@ -702,11 +749,14 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC ), ) // if the filter is set to 0, then all the emoty value selectors must be 1. + // but this only must be true for the last values seen in the relevant segment. + // afterwards the keys are allowed to fluctuate comp.InsertGlobal( 0, ifaces.QueryIDf("GLOBAL_CONSTRAINT_FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_INSERT_FILTER_VALUE_ZEROIZATION"), sym.Mul( smc.PeekAtStorage, + smc.LastKOCBlock, // Very important, only check the wiping on the last row of the storage key sym.Sub( 1, filterAccountInsert, @@ -714,8 +764,6 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC sym.Sub( 1, sym.Mul( - sc.SelectorEmptySTValueHi, - sc.SelectorEmptySTValueLo, sc.SelectorEmptySTValueNextHi, sc.SelectorEmptySTValueNextLo, ), @@ -723,16 +771,18 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC ), ) // filter must be constant as long as the storage key does not change + // and the address and block number also does not change comp.InsertGlobal( 0, ifaces.QueryIDf("GLOBAL_CONSTRAINT_HUB_STATE_SUMMARY__ACCOUNT_INSERT_FILTER_CONSTANCY"), sym.Mul( - sc.SelectorSTKeyDiffHi, // 1 if ST key HI is the same as in the previous index - sc.SelectorSTKeyDiffLo, // 1 if ST key LO is the same as in the previous index - sc.SelectorBlockNoDiff, // 1 if the block number is the same, meaning that we are in the same storage key segment + sc.SelectorSTKeyDiffHi, // 1 if ST key HI is the same as in the previous index + sc.SelectorSTKeyDiffLo, // 1 if ST key LO is the same as in the previous index + sc.SelectorAccountAddressDiff, // 1 if the account address is the same, meaning that our storage segment is within the same account segment + sc.SelectorBlockNoDiff, // 1 if the block number is the same, meaning that we are in the same storage key segment sym.Sub( filterAccountInsert, - column.Shift(filterAccountInsert, -1), // the filter remains constant if the ST key is the same, and block is the same + column.Shift(filterAccountInsert, -1), // the filter remains constant if the ST key is the same, account address, and block is the same ), ), ) @@ -752,28 +802,16 @@ func storageIntegrationDefineFinal(comp *wizard.CompiledIOP, ss Module, smc HubC ) // constrain the filter to be binary mustBeBinary(comp, filterAccountInsert) + + return filterAccountInsert } /* -storageIntegrationAssignFinal assigns the columns used to check initial storage data consistency using the lookups from StorageIntegrationDefineFinal +assignInsertionFilterForFinalStorage assigns the insertion filter for the edge case of +missing storage keys that get created but then wiped when an account that did not exist is +not added to the state */ -func storageIntegrationAssignFinal(run *wizard.ProverRuntime, ss Module, smc HubColumnSet) { - selectorMaxDeplBlock := make([]field.Element, smc.AddressHI.Size()) - for index := range selectorMaxDeplBlock { - maxDeplBlock := smc.MaxDeplBlock.GetColAssignmentAt(run, index) - deplNumber := smc.DeploymentNumber.GetColAssignmentAt(run, index) - if maxDeplBlock.Equal(&deplNumber) { - selectorMaxDeplBlock[index].SetOne() - } - } - svSelectorMaxDeplBlock := smartvectors.NewRegular(selectorMaxDeplBlock) - - filterSummary := smartvectors.Mul( - ss.IsStorage.GetColAssignment(run), - ss.IsFinalDeployment.GetColAssignment(run), - ) - run.AssignColumn("FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_SUMMARY", filterSummary) - +func assignInsertionFilterForFinalStorage(run *wizard.ProverRuntime, smc HubColumnSet) smartvectors.SmartVector { // compute the filter that detects account inserts in order to exclude those key reads from the // arithmetization to state summary lookups. filterAccountInsert := make([]field.Element, smc.AddressHI.Size()) @@ -793,19 +831,11 @@ func storageIntegrationAssignFinal(run *wizard.ProverRuntime, ss Module, smc Hub if lastKOCBlock.IsOne() && existsAtBlockEnd.IsOne() { existsAtBlockStart := smc.ExistsFirstInBlock.GetColAssignmentAt(run, lastSegmentStart) if existsAtBlockStart.IsZero() { - // we are indeed dealing with an insertion segment, check if indeed all the storage values are 0 - allStorageIsZero := true - for j := lastSegmentStart; j <= index; j++ { - valueCurrentHi := smc.ValueHICurr.GetColAssignmentAt(run, j) - valueCurrentLo := smc.ValueLOCurr.GetColAssignmentAt(run, j) - valueNextHi := smc.ValueHINext.GetColAssignmentAt(run, j) - valueNextLo := smc.ValueLONext.GetColAssignmentAt(run, j) - if !valueCurrentHi.IsZero() || !valueCurrentLo.IsZero() || !valueNextHi.IsZero() || !valueNextLo.IsZero() { - allStorageIsZero = false - } - } - - if allStorageIsZero { + // we are indeed dealing with an insertion segment + // now check if indeed all the storage values on the last row are 0 + valueNextHi := smc.ValueHINext.GetColAssignmentAt(run, index) + valueNextLo := smc.ValueLONext.GetColAssignmentAt(run, index) + if valueNextHi.IsZero() && valueNextLo.IsZero() { // indeed we are dealing with a zeroed insertion segment for j := lastSegmentStart; j <= index; j++ { // set the filter to zeros on the insertion segment @@ -829,32 +859,117 @@ func storageIntegrationAssignFinal(run *wizard.ProverRuntime, ss Module, smc Hub // svfilterAccountInsert := smartvectors.NewConstant(field.One(), smc.AddressHI.Size()) run.AssignColumn("FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_INSERT_FILTER", svfilterAccountInsert) - - isSLoad := run.Spec.Columns.GetHandle("hub.scp_SLOAD_OPERATION") - isExceptionalOperation := run.Spec.Columns.GetHandle("hub.scp_EXCEPTIONAL_OPERATION") - isNotExceptionalSLoad := make([]field.Element, smc.AddressHI.Size()) - - for i := range isNotExceptionalSLoad { - fieldOne := field.One() - isExceptionElem := isExceptionalOperation.GetColAssignmentAt(run, i) - isSLoadElem := isSLoad.GetColAssignmentAt(run, i) - multiplied := new(field.Element).Mul(&isSLoadElem, &isExceptionElem) - isNotExceptionalSLoad[i].Sub(&fieldOne, multiplied) - } - - filterArith := smartvectors.Mul( - svSelectorMaxDeplBlock, - smc.PeekAtStorage.GetColAssignment(run), - smc.LastKOCBlock.GetColAssignment(run), - svfilterAccountInsert, - smartvectors.NewRegular(isNotExceptionalSLoad), - ) - run.AssignColumn("FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_ARITHMETIZATION", filterArith) - - filterArithReversed := smartvectors.Mul( - svSelectorMaxDeplBlock, - smc.PeekAtStorage.GetColAssignment(run), - smc.LastKOCBlock.GetColAssignment(run), - ) - run.AssignColumn("FILTER_CONNECTOR_SUMMARY_ARITHMETIZATION_STORAGE_FINAL_ARITHMETIZATION_REVERSED", filterArithReversed) + return svfilterAccountInsert +} + +/* +defineEphemeralAccountFilterStorage defines an ephemeral filter for the edge case of +missing storage keys that belogn to accounts which do not exist at the beginning/end of +a block, but exist in-between +*/ +func defineEphemeralAccountFilterStorage(comp *wizard.CompiledIOP, smc HubColumnSet, sc scpSelector) ifaces.Column { + // create the filter + filterEphemeralAccounts := comp.InsertCommit(0, + "FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_EPHEMERAL_FILTER", + smc.AddressHI.Size(), + ) + + // constraint the ephemeral selector filter + // on storage rows, we enforce that filterEphemeralAccounts is 0 then (existsFirstInBlock = 0 and existsFinalInBlock = 0) + // security of the following constraint relies on the fact that the underlying marker columns are binary + comp.InsertGlobal( + 0, + ifaces.QueryIDf("GLOBAL_CONSTRAINT_FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_EPHEMERAL_FILTER"), + sym.Mul( + smc.PeekAtStorage, // when we are dealing with storage segments + sym.Mul( + sym.Sub( + 1, + filterEphemeralAccounts, + ), // if filterEphemeralAccounts = 0 it must be that the conditions of the filter are both satisfied + sym.Add( + smc.ExistsFirstInBlock, + smc.ExistsFinalInBlock, + ), + ), + ), + ) + + // filter must be constant as long as the storage key does not change + // and the address and block number also does not change + comp.InsertGlobal( + 0, + ifaces.QueryIDf("GLOBAL_CONSTRAINT_HUB_STATE_SUMMARY__ACCOUNT_EPHEMERAL_FILTER_CONSTANCY"), + sym.Mul( + sc.SelectorSTKeyDiffHi, // 1 if ST key HI is the same as in the previous index + sc.SelectorSTKeyDiffLo, // 1 if ST key LO is the same as in the previous index + sc.SelectorAccountAddressDiff, // 1 if the account address is the same, meaning that our storage segment is within the same account segment + sc.SelectorBlockNoDiff, // 1 if the block number is the same, meaning that we are in the same storage key segment + sym.Sub( + filterEphemeralAccounts, + column.Shift(filterEphemeralAccounts, -1), // the filter remains constant if the ST key is the same, account address, and block is the same + ), + ), + ) + comp.InsertGlobal( + 0, + ifaces.QueryIDf("GLOBAL_CONSTRAINT_FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_EPHEMERAL_FILTER_NON_ZEROIZATION"), + sym.Mul( + sym.Sub( + 1, + smc.PeekAtStorage, + ), // when we are not dealing with storage segments + sym.Sub( + 1, + filterEphemeralAccounts, + ), // filterEphemeralAccounts must be 1 + ), + ) + + // constrain the filter to be binary + mustBeBinary(comp, filterEphemeralAccounts) + + return filterEphemeralAccounts +} + +/* +assignEphemeralAccountFilterStorage assigns a filter that removes the storage from ephemeral accounts +that do not exist at the beginning&end of a block, but are deployed inside. +The filter will be 0 when the keys must be removed, and 1 elsewhere +*/ +func assignEphemeralAccountFilterStorage(run *wizard.ProverRuntime, smc HubColumnSet) smartvectors.SmartVector { + // compute the filter that detects storage keys of ephemeral accounts to exclude those key reads from the + // arithmetization to state summary lookups. + filterEphemeralAccounts := make([]field.Element, smc.AddressHI.Size()) + lastSegmentStart := 0 + for index := range filterEphemeralAccounts { + filterEphemeralAccounts[index].SetOne() // always set the filter as one, unless we detect an insertion segment + isStorage := smc.PeekAtStorage.GetColAssignmentAt(run, index) + if isStorage.IsOne() { + firstKOCBlock := smc.FirstKOCBlock.GetColAssignmentAt(run, index) + lastKOCBlock := smc.LastKOCBlock.GetColAssignmentAt(run, index) + existsAtBlockEnd := smc.ExistsFinalInBlock.GetColAssignmentAt(run, index) + + if firstKOCBlock.IsOne() { + // remember when the segment starts + lastSegmentStart = index + } + if lastKOCBlock.IsOne() && existsAtBlockEnd.IsZero() { + existsAtBlockStart := smc.ExistsFirstInBlock.GetColAssignmentAt(run, lastSegmentStart) + if existsAtBlockStart.IsZero() { + // we are indeed dealing with an ephemeral account, that does not exist + // at the beginning of the block, nor at the end + // indeed we are dealing with a zeroed ephemeral segment + for j := lastSegmentStart; j <= index; j++ { + // set the filter to zeros on the ephemeral segment + filterEphemeralAccounts[j].SetZero() + } + } + + } + } + } + svFilterEphemeralAccounts := smartvectors.NewRegular(filterEphemeralAccounts) + run.AssignColumn("FILTER_CONNECTOR_HUB_STATE_SUMMARY_ACCOUNT_EPHEMERAL_FILTER", svFilterEphemeralAccounts) + return svFilterEphemeralAccounts } diff --git a/prover/zkevm/prover/statemanager/traces_shomei_isolation_test.go b/prover/zkevm/prover/statemanager/traces_shomei_isolation_test.go new file mode 100644 index 00000000..5f746418 --- /dev/null +++ b/prover/zkevm/prover/statemanager/traces_shomei_isolation_test.go @@ -0,0 +1 @@ +package statemanager