From b3e63495a50a321bfffd6ff0b8311fd3a9c443d8 Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov <145333445+vo-nil@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:31:14 +0300 Subject: [PATCH] Interface update #81 nil-foundation/zkllvm-transpiler#45 (#82) * Interface update #81 nil-foundation/zkllvm-transpiler#45 * updated example circuits to new interface #81 * cleanup #81 NilFoundation/zkllvm-transpiler#45 * modular_verifier interface update, added eta value checks #81 NilFoundation/zkllvm-transpiler#46 --- contracts/interfaces/modular_verifier.sol | 4 +- contracts/zkllvm/circuit1/commitment.sol | 38 ++++++++++++++++- .../zkllvm/circuit1/modular_verifier.sol | 4 +- contracts/zkllvm/circuit2/commitment.sol | 38 ++++++++++++++++- .../zkllvm/circuit2/modular_verifier.sol | 4 +- contracts/zkllvm/circuit2/proof.bin | 2 +- contracts/zkllvm/circuit3/commitment.sol | 40 ++++++++++++++++++ .../zkllvm/circuit3/modular_verifier.sol | 12 +++--- contracts/zkllvm/circuit4/commitment.sol | 42 +++++++++++++++++++ .../zkllvm/circuit4/modular_verifier.sol | 12 +++--- contracts/zkllvm/circuit6/commitment.sol | 42 +++++++++++++++++++ .../zkllvm/circuit6/modular_verifier.sol | 12 +++--- 12 files changed, 226 insertions(+), 24 deletions(-) diff --git a/contracts/interfaces/modular_verifier.sol b/contracts/interfaces/modular_verifier.sol index 58e3a91..7624bbb 100644 --- a/contracts/interfaces/modular_verifier.sol +++ b/contracts/interfaces/modular_verifier.sol @@ -24,8 +24,8 @@ interface IModularVerifier { address commitment_contract_address ) external; - function verify( + function verify( bytes calldata blob, uint256[] calldata public_input - ) external view; + ) external view returns (bool result); } diff --git a/contracts/zkllvm/circuit1/commitment.sol b/contracts/zkllvm/circuit1/commitment.sol index 9864484..19e331f 100644 --- a/contracts/zkllvm/circuit1/commitment.sol +++ b/contracts/zkllvm/circuit1/commitment.sol @@ -37,7 +37,7 @@ library modular_commitment_scheme_circuit1 { uint256 constant unique_points = 4; uint256 constant permutation_point = 2; uint256 constant quotient_point = 0; - uint256 constant lookup_point = 140731511355664; + uint256 constant lookup_point = 0; bytes constant points_ids = hex"01010101010101010303010100000000"; uint256 constant omega = 14450201850503471296781915119640920297985789873634237091629829669980153907901; uint256 constant _etha = 14062721881273474090606415031361994540585550571695842571456013353340629726555; @@ -421,6 +421,40 @@ library modular_commitment_scheme_circuit1 { types.transcript_data memory tr_state; tr_state.current_challenge = transcript_state; commitment_state memory state; + + { + uint256 poly_at_eta; + /* 1 - 2*permutation_size */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 40);// 0 + if(poly_at_eta != 0x1f1737f0f9693494b37fd517f70fe4d844c0e4dd11e9df8639a0be9abfccb55b) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x68);// 0x1 + if(poly_at_eta != 0x1b7417b4df0e06e7817f2977d34f78391337465946f76b67edc9572bbeff8ac5) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xa8);// 0x2 + if(poly_at_eta != 0x94476885b462285877bcf57208d591d1b872dc6503b26d072945200bafdb5d7) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xe8);// 0x3 + if(poly_at_eta != 0x2e5650a9c85eac9ba56b0cb3a2c2bd9189a3e4df9127c2123ce59a03a6f48d33) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x128);// 0x4 + if(poly_at_eta != 0x1f1737f0f9693494b37fd517f70fe4d844c0e4dd11e9df8639a0be9abfccb55b) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x168);// 0x5 + if(poly_at_eta != 0x1b7417b4df0e06e7817f2977d34f78391337465946f76b67edc9572bbeff8ac5) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1a8);// 0x6 + if(poly_at_eta != 0x94476885b462285877bcf57208d591d1b872dc6503b26d072945200bafdb5d7) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1e8);// 0x7 + if(poly_at_eta != 0x2e5650a9c85eac9ba56b0cb3a2c2bd9189a3e4df9127c2123ce59a03a6f48d33) return false; + /* 2 - special selectors */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x248);// 0x8 + if(poly_at_eta != 0xf3114c664f481e6028c47f122b53b12f6aa455ea26f54aad80ad778950b2177) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2a8);// 0x9 + if(poly_at_eta != 0x2acd90c58b8637d005a76e69a474de1cc5f432a41724e855b2a0b19b71a52150) return false; + /* 3 - constant columns */ + /* 4 - selector columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2e8);// 0xa + if(poly_at_eta != 0x277b3d077e65208b010bc2f62957e87b900bd1f007ef61acf14649463be06cbb) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x328);// 0xb + if(poly_at_eta != 0x308efe88baf9b3bc3787b68d279234d783ef3e4064de84b20dc2a1d72eb2e0e3) return false; + } + + { uint256 offset; @@ -591,4 +625,4 @@ library modular_commitment_scheme_circuit1 { return true; } } - \ No newline at end of file + diff --git a/contracts/zkllvm/circuit1/modular_verifier.sol b/contracts/zkllvm/circuit1/modular_verifier.sol index 661ff7e..e9febc4 100644 --- a/contracts/zkllvm/circuit1/modular_verifier.sol +++ b/contracts/zkllvm/circuit1/modular_verifier.sol @@ -124,7 +124,7 @@ contract modular_verifier_circuit1 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view{ + ) public view returns (bool result) { verifier_state memory state; state.b = true; state.gas = gasleft(); @@ -164,6 +164,7 @@ contract modular_verifier_circuit1 is IModularVerifier{ state.F[2] = permutation_argument[2]; } + //4. Lookup library call //No lookups //5. Push permutation batch to transcript @@ -239,6 +240,7 @@ contract modular_verifier_circuit1 is IModularVerifier{ } console.log("Gas for verification:", state.gas-gasleft()); + result = state.b; } } \ No newline at end of file diff --git a/contracts/zkllvm/circuit2/commitment.sol b/contracts/zkllvm/circuit2/commitment.sol index 7b40438..5b6aa34 100644 --- a/contracts/zkllvm/circuit2/commitment.sol +++ b/contracts/zkllvm/circuit2/commitment.sol @@ -37,7 +37,7 @@ library modular_commitment_scheme_circuit2 { uint256 constant unique_points = 5; uint256 constant permutation_point = 3; uint256 constant quotient_point = 1; - uint256 constant lookup_point = 140731511355584; + uint256 constant lookup_point = 0; bytes constant points_ids = hex"02020202020202020404020200010101"; uint256 constant omega = 14788168760825820622209131888203028446852016562542525606630160374691593895118; uint256 constant _etha = 12217208067492249031102872072655908974751031861422067257283053495957748658893; @@ -424,6 +424,40 @@ library modular_commitment_scheme_circuit2 { types.transcript_data memory tr_state; tr_state.current_challenge = transcript_state; commitment_state memory state; + + { + uint256 poly_at_eta; + /* 1 - 2*permutation_size */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 40);// 0 + if(poly_at_eta != 0x1b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x68);// 0x1 + if(poly_at_eta != 0x4925359c68cba0ddaf87fd463f6daed7e844deb500155000cfe079de79e6639a) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xa8);// 0x2 + if(poly_at_eta != 0x304dd9fa371b70eeffd08ccb957867d20aeb86e7009bc009af235519554cb932) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xe8);// 0x3 + if(poly_at_eta != 0x6a45a7312e851bf898402981030726b3a4f5684b04458845c9f753b35519105c) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x128);// 0x4 + if(poly_at_eta != 0x1b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x168);// 0x5 + if(poly_at_eta != 0x3d9bd931d08eee60195862ede438d303f80e10fc9093f2a0920d1f3d2bed12c9) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1a8);// 0x6 + if(poly_at_eta != 0x5d118568c35ccff0c8e14aeb77fcd0a05ba585f78d646348b66c554b10625e60) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1e8);// 0x7 + if(poly_at_eta != 0x3a68771f10abc9d88dbdf7ce531cd3044141f573048011fdb1b76e4ec34435a6) return false; + /* 2 - special selectors */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x248);// 0x8 + if(poly_at_eta != 0x3f1b4adcabfaa14cf2ee7ec3990f58d91ae75bfaaefe1327313d89eb23baf96f) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2a8);// 0x9 + if(poly_at_eta != 0x662761bdeda7376d374c58b68475ecfa30064120c27daa97edfbda94eecaeaff) return false; + /* 3 - constant columns */ + /* 4 - selector columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2e8);// 0xa + if(poly_at_eta != 0x369369e984155e5f975bd41103c801ea569e500244152d768985604be0800b06) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x328);// 0xb + if(poly_at_eta != 0x3cd3d24de7686966f8fa3577ea539d516c0a16d46d0e2c283db58b157952ca53) return false; + } + + { uint256 offset; @@ -589,4 +623,4 @@ library modular_commitment_scheme_circuit2 { return true; } } - \ No newline at end of file + diff --git a/contracts/zkllvm/circuit2/modular_verifier.sol b/contracts/zkllvm/circuit2/modular_verifier.sol index 16019bf..8fcdd4c 100644 --- a/contracts/zkllvm/circuit2/modular_verifier.sol +++ b/contracts/zkllvm/circuit2/modular_verifier.sol @@ -124,7 +124,7 @@ contract modular_verifier_circuit2 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view{ + ) public view returns (bool result) { verifier_state memory state; state.b = true; state.gas = gasleft(); @@ -164,6 +164,7 @@ contract modular_verifier_circuit2 is IModularVerifier{ state.F[2] = permutation_argument[2]; } + //4. Lookup library call //No lookups //5. Push permutation batch to transcript @@ -239,6 +240,7 @@ contract modular_verifier_circuit2 is IModularVerifier{ } console.log("Gas for verification:", state.gas-gasleft()); + result = state.b; } } \ No newline at end of file diff --git a/contracts/zkllvm/circuit2/proof.bin b/contracts/zkllvm/circuit2/proof.bin index 4c0389a..43c934c 100644 --- a/contracts/zkllvm/circuit2/proof.bin +++ b/contracts/zkllvm/circuit2/proof.bin @@ -1 +1 @@ -0x03000000000000002091a24deca5f33c36716d63b3efdef4a021531971ae2a4932993fd86d327e7f8b000000000000002053e0f293c4148c17fcb628838b926349a1c6d07b1f7b432d114a58655ba9d42d0000000000000020a86c0157f1b47d9644a2fc1d831068c47880babf1e8a317ad2f5c875237f8de145d0dfc362dc8c41ccab654de5eff126da9cce707808ec2555ff886a9ddb9b09000000000000002645d0dfc362dc8c41ccab654de5eff126da9cce707808ec2555ff886a9ddb9b091b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd18ff810b0d91e0abcbc86501230837faab5315074845050959fcbaee51013d3b4925359c68cba0ddaf87fd463f6daed7e844deb500155000cfe079de79e6639a3b0edffa355fa76a5f40eaffeb97afd55b87ef2ff9e4c74275e91c853708ac9c304dd9fa371b70eeffd08ccb957867d20aeb86e7009bc009af235519554cb932419f29ddf8c51c100118e4e7544046c5857e9e46d5465ed4395fc7a7813cb8416a45a7312e851bf898402981030726b3a4f5684b04458845c9f753b35519105c45d0dfc362dc8c41ccab654de5eff126da9cce707808ec2555ff886a9ddb9b091b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd17c6249070d9a02eb0574ffaa1bc76b71c9c266051d914c4af1cedab1d4a53dc3d9bd931d08eee60195862ede438d303f80e10fc9093f2a0920d1f3d2bed12c93ea2b94c6e045cf5c52b67866917686b2d2ea63c488a4389c7f0c9f0f1b25bc75d118568c35ccff0c8e14aeb77fcd0a05ba585f78d646348b66c554b10625e605f06a62574f05fa88be0daed6d61ec4a57ff431cc1ad0efb66b4096c58f58e6e3a68771f10abc9d88dbdf7ce531cd3044141f573048011fdb1b76e4ec34435a6623d690e8f7ee8be193d01eea6c4b2ce66f06cba5c938bc905033c6eefe93a1607992bd8375f721682f2111f8474f5cd80616086576f02b2b1f668fd0a30bea03f1b4adcabfaa14cf2ee7ec3990f58d91ae75bfaaefe1327313d89eb23baf96f5fc06b9abc469502db8f45cb08c3c8d81168d7c8c0b46cac3edfe25d418d1aa560867648cd36b735195a450f6b58d85467db5529bac23ee1dd8f46088e141bbc662761bdeda7376d374c58b68475ecfa30064120c27daa97edfbda94eecaeaff2cc079a3f5ddbcae53a78309a1876543709b11cceefe1c0306216862c4679bb9369369e984155e5f975bd41103c801ea569e500244152d768985604be0800b0623ec5c68fee9b81d018c75eeaec08a97dc6e723175c713d762351842c04f81dd3cd3d24de7686966f8fa3577ea539d516c0a16d46d0e2c283db58b157952ca5309ea421afd9f4fbb8b425d7ff3d05e6e8da3da743af92cffb15406b1290e903442b8b56867ad879563ef12f5868604ea91ef9dd60daea94eb94cb1e680d800004ccbfa61d1cc8fcdc3f6ac0ee8705f4004de096913d79ebc0e00bafa868eb3b1702dec7d150f8efc7f608b9e7b23094eb763f04a697f6dc61ac5a2e7bdccef0302b1d40f219b7f5b29114e65232300ea7a89fe1ff40811d58f00a81f6b4c0693736857fb3f4b4f77940c85f754933a06ad090ca4ae9ebc5b2c1d2de0784502d32d42f2ee2af217e0e60b18e5b3c5f993b9442ecb913ac821d6f52710ee1571443a469e2fb761ebf502ebfe9604ae10aa9c0ca1806e32e0eb1fcc3186d4049d68296e400e63b3162c299f760401073e879434498014aeec89a75fb578664c1bb91320225c45c85b5bd33eae5b16f41f3be437474d672454b0e79120173101d76367a7d7d0fdc9d5e0c01090224a260df2d2307826fa46888be00b2f28efd7faa9138c2095457274fccf70a65b2bb66a5c922478986d0c5e222707c9348bbb50e40000000000000008000c010402010305000000000000001602020202020202020303020202010101020101010101000000000000000300000000000000206e4a5ae96c09295fa5bb0dac6c98a66a01a34b3ab144f3faf92e5bd3d79c12600000000000000020919dc690d9ee9d231610044aa828b27f3bfb5845f49cdc4d9d6d30b2a99a1208000000000000002059c7b7d799d0b56527400c75e9b60e2faf1249a08bc1147510cc020090c1b8590000000000000003010101000000000000002c48778b55856bf49320c8b3bf4746e7abf6a33e0d6b4dc2d87ee857bf1f2535122b761bfda43188b512712448c25af0595d1a65f594b099268117a83fe0dacaef2b8e3209ff7dbae518958a1acc68f59e6f802251ef26e3ef785a663dda04737a485f75492a1fc2631aa44ded3d38e266e43d81b110d7780f87a599c125fb8c8749080f9fa93521b345a316ab839b074a6505a8378a13838e4a78cbb2f61f28542ae597b380685b94ed96c15c8606d0baeeb7fbcb75ead870b587344c09e0d7ad2f81d010f9fdf6c61a8e3e9072b5d2f374310978c68f28e8094d91e8bada1a48446bd7422f9f868218ab997796ec0511df8c9a8a396f3316f6b26e164525e5b948778b55856bf49320c8b3bf4746e7abf6a33e0d6b4dc2d87ee857bf1f2535122b761bfda43188b512712448c25af0595d1a65f594b099268117a83fe0dacaef60a606994aabf43a3ea9682e2a2f7f15aef735c05ce74d598bce9bef864af896300cae5986f113c4005df0b288b94ad3bae9f3c32e43725e08b104a43eb8104b7123371e3778a0b0b12d0ad95a236c16ccd690a190f0e650bbf0fb8fadcc8d56599b4a41db9309e587806fcabaa33026cf365cc80800e9f054b020eddc9892753a27c25f74e298e2cff4393a327c4efc364a9f4d5780e98d621641cfeac276b2266d654bab924571044bddaccfb6ce872fe40eed3bfba1de5c5d28b1041827065c150360fb3844b0614e1afa218f297cb664cc870d8ab3f1c248bbe1605a888071e94abe1709916e4c5ff7744200a1bd8884113e4fd9b7231545bcd204bdc6e83da1b72fcb8f357b1cbb7a8b9985c1f55b05b6e9cba700aa952bc166136b0f0669feb446f01b547631ea9f04a3e5049021e3d023e8d34fb1e359797e590244ee4375195880e413893c8bb360fa68d0e23b6551b5379cf62e37c1aaf7d7a7604d37d7fa1eae9b1da6c7de8ed7e91b8d541c0b79d95c7fef15e9767428552d51c328347946a83fa126759fdcd844035a7cc43b8f5e191b8045a07dfda4c361259267aac753dcee64e834636fbfab161c80cdef95db6d190ad8c5d831ee97fc3961588612c02aa8e9ed5b36595fce6c9b105d27948b268efb39d6074fc454bf14b0253b9edd48396dd125345864d682127c50be3c68dd1f982357dfa09c167bc5930172107d1b68c434764c055366df6c01805266fb50a357f186fbf48641f4cd673091e3266be23a88d1b042c8f64456f4d97c3456a8932fdfcfd7ac5a294eb31516cfe7de665e8571665849305796bab181f9de2a72afb8f7a0b74a50259c6f1c088ade8911701185abc58ad4c403449b75e13464992fe9b538ac2c9737d3f9fa1787307b6b5cb679037a58f4d39722f01f53c32d913d2eb085a8e58934c4801b53e605385ad1a20c1daddb9ca2c4af7f2dd88ed490ecf41ed67b848702e3ac262124b0c16d19afba8ea3229558ab9d132cd9b3f7ff4080bb1e36e7eb621903cb65b0fbb9dd79883a3807514ee80800e0284ffcd1787d73ffa650c2ba3a2fb64029533a574907e9d3d15ea5e621f189b8963519f5d41be0bf2072f5d5c3b1c4cb629f099ef26b33a5a934a3e355934d7ee8ac87c6de113dc322eedd7981bd35304e20d484388bee51c09b28965f1294d6e1e1a8d2646dfe52735420a2e284be332e48308c51f120e0e79362842cb5953a15584299a21b91b112f1f1084f802f761812d8ec9f7b1e63429025fa33504f7bb3ccf39cb796f14a0ac729fa08eb7e3152ee776fa77bee538f045e89a077d5c20a108ffa6fafef85fc62460a4ac720951786b1de7fe5b59f15550bea6e49604ad02faa700214f3aee3f2bab43da4d6ec285bb2705952aa51f9fa7e45611757ebf9c0c932b7e6fd0e3d0e0b442a4410bb5a5fa566ce891ac1cb858d01d415ee65ec8683d928b9c9164a9bf4878e72d07d72e8415745a170ed63eee0acd6016b1dc1ce30affaea49332bc074f35faa786a000000000000000638348d81bd4502d0f00a1a85f868dd29f3b36d986c2f3667477da575a32efffd49be2f8a67bb56cc2604712094c7db8f8704741ec90a467f646e7ceeaf0022673148b30c4db9c64bb47616a03baf0fbd79949a33963db6034b32fcff8c4f39fd1dfc8af4c2c4c263b39913cebaf5c83e485240d9ac62530233113138a5c5edeb35b53e95b165f7de8c4d18b1bbb4fa53cbc67e1b50b1395800e88be5a2a634ae3c8a3c4374387d12c2ffa1e443d3e9d7856da79b4e76d5b38faac96371abbade000000000000000400000000000000270000000000000020b024bd12fb5b07a167bc8a510f274a06946eac1240e823dd682ec71d18e04b4e0000000000000007000000000000000100000000000000000000000000000020527d57cbc01a7a173a74bad70b33f708366bcb40cb22678f4bacf5733ca07b6f000000000000000100000000000000000000000000000020488078c1bc53814baecb8f4700a4d6261f39f6ac77eadee5275b5ff138f447d40000000000000001000000000000000000000000000000206cd7f59682dc55d91dadb529148e8ffb819cb7387a733fb4dc856744de61d89f0000000000000001000000000000000100000000000000205781471570a34296cafcc6dd1e6a633fc88729da8f0d55fc7bb320bcddcb78e50000000000000001000000000000000100000000000000209329417e4936e11df0051cd0626bd7f7ef081d32e3bb9bcfdbb72a61b096475e0000000000000001000000000000000000000000000000206addb5fc6e43b31d8575e4295b2d1e14344d5a8377dd15d5e73efdb9ec97a5fc000000000000000100000000000000010000000000000020564b02dc9ea4ce766caf42be67c77c94a3193983b90074fcc9626e7b3b0da7620000000000000027000000000000002091a24deca5f33c36716d63b3efdef4a021531971ae2a4932993fd86d327e7f8b000000000000000700000000000000010000000000000000000000000000002079c3d7d55220718005b53fea4405d0bcf1f959ef0abfab2c71f93ed7affe5929000000000000000100000000000000000000000000000020cd68e9eca32af61804846e28e5b72463770f2dfbe6fdb00e5cddc748593776d10000000000000001000000000000000000000000000000202cc68f14a738fbf0edb0d8e77570d4ed5f92af90f704923022eaab58f5eb1bcb000000000000000100000000000000010000000000000020b097291b498e61c82979176b8dc2459f467a0ce3eb980709ef8a11b08f728c00000000000000000100000000000000010000000000000020939268011ea9510e0d5d852e7da7a04a15894191e57492c69131213ec1af4d7b000000000000000100000000000000000000000000000020156cc4c70ae292070591d6b62346ea9c25376f38a679c2a0e9d5c14d97fd32480000000000000001000000000000000100000000000000207c93e892e8aa577d55afe0546e8e8bab8a2617abb66856934fde2049f05a3fba0000000000000027000000000000002053e0f293c4148c17fcb628838b926349a1c6d07b1f7b432d114a58655ba9d42d00000000000000070000000000000001000000000000000000000000000000205fa4d13daa139d2b9a5ffb1b3587a7581f344b6f3841c601ad886ab28570235a000000000000000100000000000000000000000000000020ad3916cdf0707062e0ab6971b54bb2d0950c5c24aaf4681da33094f06ea4700c00000000000000010000000000000000000000000000002071731d4d2160cdc3d7e84a956fc8421ab3c33b88ed636eec559449d1c993928a0000000000000001000000000000000100000000000000209e0c4c85867ce35a543b159dac6cfee5174ba0cb0623e70e4b5867f49fc1aac70000000000000001000000000000000100000000000000204761af8e8091dd268b89a58370f58951045d13f497e2b3d76f84439ffd9a3ce3000000000000000100000000000000000000000000000020678f60a5f6ac93503877627672b276bfd1d36f95189e8160b73861c469d9451f0000000000000001000000000000000100000000000000208e6d937e1c38da00986fb63eb129eadfdf91d0edadca32f1fe7671b3cf457a7400000000000000270000000000000020a86c0157f1b47d9644a2fc1d831068c47880babf1e8a317ad2f5c875237f8de10000000000000007000000000000000100000000000000000000000000000020df905a6ae6e9b13603ed63987bba690402ff984b0579c0fc9e1e26776e014ea60000000000000001000000000000000000000000000000202b9f47de464d08e6a61bdd2a25948f98ae375f036f7fe74fd12e1729d61d2d6000000000000000010000000000000000000000000000002034a7029145527646122ab97c665008df765651eadb97984d6bf093f08bd18bb9000000000000000100000000000000010000000000000020e7a745a2cdc632775ab535bb98d7e74b47d66423ced6bf516e0454b02584189f000000000000000100000000000000010000000000000020a7d12bba55037360fa5e2f426b0b23466ddc0e8aefcaa87545270cb5cf1e0b070000000000000001000000000000000000000000000000208d038fd7e86e48c3380e39036926b422b7a13a99bd2579ee22fc2f7174be72ef000000000000000100000000000000010000000000000020c32a8387bcfee336e4b58fb8098a94a1f164445697356ce0c9f6a1f16a6ed75a0000000000000003000000000000002700000000000000206e4a5ae96c09295fa5bb0dac6c98a66a01a34b3ab144f3faf92e5bd3d79c12600000000000000007000000000000000100000000000000000000000000000020710d182cfd5396737a97745167e05c2a37708bf6e8ccf71705d10ae92fc1b4c70000000000000001000000000000000000000000000000207fd24acf17a2998571192860b840943406148e013474d40cef242808a505f971000000000000000100000000000000000000000000000020399b057234bc20c75cc41eef5aa408fde3f18eacb9af0c49cab8447a2a98bfaf000000000000000100000000000000010000000000000020cbb61dc77cc709b95cc4d257650bc4b1792f5a894db2d24edf492a5147b21ffa000000000000000100000000000000010000000000000020c7dadc2df95915a04f308ceea75ed78b09f332cae2ac686971acab33cbf22b730000000000000001000000000000000000000000000000207a5d1bb719289835a058dbab9eba0a9f6fb7fc9eb9743855a093d62223aa817f000000000000000100000000000000010000000000000020b3fdeddca3b9ff5e1920fe4e3b01d8afcf72e2c04348c9641ee1f960e74a1c9700000000000000270000000000000020919dc690d9ee9d231610044aa828b27f3bfb5845f49cdc4d9d6d30b2a99a120800000000000000060000000000000001000000000000000000000000000000202e86362061a1a1d816c2116cadb19c1d1e3359774de0d520af74ba26ac34e31000000000000000010000000000000000000000000000002042f27578d0c6fac09d75b513e41bd0884da0e80fb8780d75741f922daee54aa500000000000000010000000000000000000000000000002070161fc8dc661792c255205fc748e6c8be32533fa4dda1c57ae3074a7fb9e2a1000000000000000100000000000000010000000000000020f65277ce5e2e53d3e012121acf2e01d0169a4de7d4123aaeec8999d0bf016bce000000000000000100000000000000010000000000000020c793f72e2750c7c796e0cc2275383d90cb369dbf608e80fadc7a74974b6b2c7300000000000000010000000000000000000000000000002051f18acde6488a632b651f5b94263a169ff0a9a812dc90beb27f5609b014904c0000000000000007000000000000002059c7b7d799d0b56527400c75e9b60e2faf1249a08bc1147510cc020090c1b8590000000000000005000000000000000100000000000000000000000000000020a49d7192f9a7b6be9ca8c30230348fbe82eb07156bb7b84c3523162ce77e5efb0000000000000001000000000000000000000000000000207cce96283b9799b19178610bb218098e631bce44d738dd5d6a647d95cc3d0c6800000000000000010000000000000000000000000000002058e392b999ecba4fb57bb9d5c45544a75b76b91fb203945a69db3bf783c086e5000000000000000100000000000000010000000000000020a302765ce71334e30e482ec1581b946411c9f93a62530d450f7110ac2fce8e1b0000000000000001000000000000000100000000000000203caaa80676586d03f1fa478c63d039600f595af2b8d574fc3ea6f49d424c0b1b0000000000000002391fbd6c92cf3a78a7a65d4affc47215a89a12db4f940785c849aaa48a28f7c605682588b302bd4132ed4c2276c48733e60b26a6939df5a61e19ba4b5ee8feae \ No newline at end of file +0x030000000000000020a9481a88dcb5222d52c68d295634ced8129a4b0711c426f5678d89772d477fe20000000000000020b512d5e1723b60d350f2c83179c1051dd01f0b1943c891a50969051c0bd88d6f000000000000002053c60cb628b515e490aa568f3cc8ca29891d9563b6cff13539314b5a7221711908983eda4d8c83f5c823195a9411f4dbc344aac7a8f33438d5f95aaac4be82f6000000000000002608983eda4d8c83f5c823195a9411f4dbc344aac7a8f33438d5f95aaac4be82f61b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd3c29b7f81ed79bb878f5b17a0c7db20256e0ab759ea66d8dd9d17aab613594ba4925359c68cba0ddaf87fd463f6daed7e844deb500155000cfe079de79e6639a495b11cf5b0cca32b50a523e3a8a560064ebc42e5691eae3f4ba5ab2a8771113304dd9fa371b70eeffd08ccb957867d20aeb86e7009bc009af235519554cb93231c6df5ed6e392422660df937340f9ed737bcd385e03fc3fb1187ae69b4177816a45a7312e851bf898402981030726b3a4f5684b04458845c9f753b35519105c08983eda4d8c83f5c823195a9411f4dbc344aac7a8f33438d5f95aaac4be82f61b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd3745efb7711754e6ed9337ec04c2dd1815ce41161d436ea45e5a0afe5352c63f3d9bd931d08eee60195862ede438d303f80e10fc9093f2a0920d1f3d2bed12c96898431c9ad254bd3e90b476871f8ed9097874da3b106727ea8e8af99a03ce305d118568c35ccff0c8e14aeb77fcd0a05ba585f78d646348b66c554b10625e60016f044ce3e3a2a1a4b9d3c122bc19247968c293a38cb8deb4d3c106af899e353a68771f10abc9d88dbdf7ce531cd3044141f573048011fdb1b76e4ec34435a61a49c21704e3faf3eebdbf7ca1bd95ce85bd034affa8f64d10657a048cc796c6012e0229800e317b4f95a23a9a5570a962fcb11f71fe5ac85106392f406eb9963f1b4adcabfaa14cf2ee7ec3990f58d91ae75bfaaefe1327313d89eb23baf96f4cf918e356aa96392c52753f8b866058054d9c843a86ad32b6f3cc45de86fd4401270624e54f5b858244ebdb4f7802a52d24992f47d11e9c86e0d4a67349e020662761bdeda7376d374c58b68475ecfa30064120c27daa97edfbda94eecaeaff5e5819220d06fcbde0018a1c97afa52d813d66c1e37b28146760ed7609dae194369369e984155e5f975bd41103c801ea569e500244152d768985604be0800b064ecd57045a9bc747a663a29b2862beb17075a302671266069ac62a09c7801d483cd3d24de7686966f8fa3577ea539d516c0a16d46d0e2c283db58b157952ca5330d0e87d5a90d42985d4b5da16c96ca2d6a70107fce35e91f6b3669d57f828e428b5b07e8d7fabe4f0671904e44e7095caad0ce87e4a1206ab02fcd1ee5f48122ff922d702799a98e2808d0412a6eb1d611c54f95c78b8dbd113d4785b8e49593af08b2d7d92860abc5dce65f91188b7a77bf1d3fb566ff578c99748a7b82e1e11993a80a285b2e1d39c24c7f1cbc8359af114243a13dd7cec7a76c6cec4bb5151d7fbdf97b80f63f2a13b7362e2b6eaa1716deeb1f5a9803382281ea63d658434724c28b78ae43ce6d61acb240e7fc29289b3a31071e8238b4307d7a2cf0ba43136a39f18e36cea081aa558e434e71274837f29bf43047f1ddd21edb9a66f6c672a0116495522c66ac4d368ec44e0e3f066b6e2f52828257441989076a0dd8b17128482ac08ae5cda683b00898bd8c8ad88d21dd9078558818303520c9474d454ba6455d2eb12b7092bfa2ecd2052ae85ced69033e7c5c4c483c55759f8a3fb35b23e240948c295f8005f8c45d58947237e7e8eeb8c10d4be76605a049477f20000000000000008000c010402010305000000000000001602020202020202020303020202010101020101010101000000000000000300000000000000207c555c3aa09898bcabb7854d82e0e828bc28d322bfc54e61f9d395928622c489000000000000002023b69f8f92ba3ead285acc6a688d8b22c3f3600fde34c782fe9d09b52f3f9bc900000000000000208f4176a895e1ccac9040370bc31ff98d07fe56a85183b1067a9198863bbeb9de0000000000000003010101000000000000002c1aa909b8f9797bc1d44db4c7e28c3f15cbfd4ee83f1b2499dbe21753938adf7459449d9a302401865eec2340271598ef87c0551ac0e33765241de8ab6c75208d46b19cbba8b4e5049ae6196f2833e193402f8456b9bfa436032ea34a08cc1c2b2d3c0a9780e898439853be98e16df672138e1fac463eb7c8fcd15cb4f733e3d61f24abd4f67c4dff6f6351e9f2e3caf172560e5314440d7e1646770a3d94c52954c8fb7e33212f48c3d6861e16be0d13e16795afebba4e80e9b988f4c26b3ad866130b7f93c8a4b3d87d655d9a98b494cc9cc0428dde02739bed4148af11641e0dda9bd395d4d8945abc72aa6f0923708720e3c07220598b6412beb650ee9be31aa909b8f9797bc1d44db4c7e28c3f15cbfd4ee83f1b2499dbe21753938adf7459449d9a302401865eec2340271598ef87c0551ac0e33765241de8ab6c75208d52061e3efce7d6a31c13adb6d32058c5e6f146e48bb62cc073c87c31947d2c57098075adfcf1b7a6c99a4162b11dc83f281d406cf941f0b333df0ea0d41918f819165cb1bef36c435f3cc0ce1670f796dc30fbf37d725244b35ed0068bf3eb0b6e6edc17ff8312bbea15c0acd860433b08b0780611745e64de96ca9086f2591f2b60a5c08b07811425a960d4011f29545b141179d7070f55c000de45e86a555f3e5f05bcd475ab6f415ff6d5973865f5a782325e0fc5100bc78b7faa51e9c95c678164c95551eb09e79cdd1a2bd563208567ddec90035da244ec56869a86018d0f72324e4b0ebd9cf57c82079cc9eca04ee13a23d09856ada685567c3b8d302a5dafb266d3e9f628388ec0e8d99c4c84fa35fa528304e52afc5445f3bb5bb1ba60a41dafb4b73a0bd7cf7b9dc0e4d2a518a76b75942c5fa7d3fb5e2ab95696d7474527427adda5b16a94aa3ab7f3a60a7ce8b9200bec2685dfaeb4f256a16e185b770570665379e8ca0bae6815730dfde681d04f8d5222554baec904fa3225e5497e0ae517d1c167367c08a568a0a10610d1878571cc356b84c1ca831ef6828271ebfbb2f6e61d05e865543c5b587058cd4896a3844a0f86249225bf862dbabc6231baa24a585f3ec6427708472393ae586f99809ce30fabefe085169832d4ce2093930948482e7fe2750237f8f0d5fbe138643c19ecc6f3c4274b467e4824c71cecd50528fd6bee44f7a8cfabe259b740d7433bafcc877efc371cb6e6d7a71d64e8715fdad47383c6c0aafc63ae2c34430eb8fc4b9d12cbd0dad78cbd7d5d4a365636099a836a818a413a4d94913253b90bf26b1cef39ac28f1accc37efc200586f114d9bbeedf7c1a160b43b3a7974ae7c95d96dfc72ac15a8db43ae8b2820035fc5992668f0fd135c7bec1eeb31ce142558a12f837fe3384964501a03e6975afb9166c9239109c54c9dfeb858bd92e6c0f779781cc60e829549d2aa5475176769fc26458d31307192b17e9274f06bdd7c5c775f69730b7438081c9137ef6c442f0503a6842f0e1d3cfb0bdb85575baa67641c7973ad3d3d5430c5b99717323a428252f15e396191a0b4405391d7205a9224fbdde8fc3651363b8ae315f2704fa488c95dc95c2c959e0b23630b9bc4f5464387f473b0e725223218238541fa2a43a522da4a4da3ca2b25c96fe1d9091f8d06e4ee2d4aac523735a48054cddd303a80bfb4e612e97a184be942d81845d65f6b4d11e46bdfd7312a96118eed83584d0ea09122cec8b47863d0f99f46ec0e8b718c9e303a1a5c60b08ed70cbb4d225e119a61042bbb62aa00bcc69395211ca74a228297d039506494dd1b681b930e07849f3844790937bf09ca0c62a81d9b4ea31f59a79333be368bec8f0a9fe32f1c5fcd5245decf7ac1a62550f09b790d3b488f30d7c3a34d36c01bbcac28ff6bc2970801a9ce846a02ef052a714e13f5d7fcf28a755a17c62aff3c5abb55914d83b80a61936198766d7184378ff7cc19b7f548182e6256f1316c1238c2e15a00000000000000064b9d7b4de6229a3032ab8366026dd422f2be937c1e6b6541e1d43693fd41d65b4b5392a75af0104d5564b00bc03c3be2460035dc21b5e3e65c2ce4c6539b3f8465ffdf7e7fd4f2d184d00c57cc64367d229b66cb784fad0d352ddccf4309ce9707e9e04f6affee8ac168d9b30d0303c3839fd321d4c1585272f359b05281f7d726c22f5e395d6029bfbc25977ceae65962fb21c3ba4ddc2ad8988c1b3672745c40095cb626202f85b75174525da458777823e9826cfef7b852066a18a12d85bd0000000000000004000000000000005a0000000000000020b024bd12fb5b07a167bc8a510f274a06946eac1240e823dd682ec71d18e04b4e00000000000000070000000000000001000000000000000100000000000000201dba87b548f296ea9efc52957e260ea1a785dd708b0458ff7f1ed74a3263a86d0000000000000001000000000000000000000000000000200670200ce8840d42c287eb3020f13a6f38a3edcce46c10cf3525c1dcb96d3f820000000000000001000000000000000100000000000000209dae199a4e50f8ed1b4aac58675d7c022a948d70707593b776f9ea726e1937230000000000000001000000000000000000000000000000208b4cfcd55a35f9bf1484306fbe9ca3c7d8eff4fdb35bf57fdbc04d2881ba460b00000000000000010000000000000000000000000000002089519a6d88a150b09627d8adb69500fcbed330b3fcd7c922d9d68ccafe3d00db000000000000000100000000000000010000000000000020c32a0d03207fdc70dd7f1a4f65654f7f921570d423753644507fb723e9043ef2000000000000000100000000000000000000000000000020a5791a4d1fb68b8c5de94b338a0e0ba2ce64eca86311b65648af6a74b0fb4d91000000000000005a0000000000000020a9481a88dcb5222d52c68d295634ced8129a4b0711c426f5678d89772d477fe2000000000000000700000000000000010000000000000001000000000000002057e970db724219567ba2cdc6e40d3680a038af0093b42a725998a6da508cfcbb000000000000000100000000000000000000000000000020d0b5511ef3caac40ccf24ed247fa21350b215940f877064ee479150c3683b6f9000000000000000100000000000000010000000000000020c8081ea46294607972fc8c86596d930de29118414bb71be4fd9ce2747216b8e70000000000000001000000000000000000000000000000209e872f337db431084da913380af75a1936330ca65781aa90bb01e69488f13b43000000000000000100000000000000000000000000000020ba6adcfeefd05bfff7195b821c0ce0c1077f3e96d104bfd13b71b98862f7f87d00000000000000010000000000000001000000000000002015438a12e36743f20ecc136a4275907220dadfc513469f7edc2a77ef3abc22d500000000000000010000000000000000000000000000002033d6144b36ca45503092f451d8ebc685cad2f8c90c97338dd2073fd2b54451be000000000000005a0000000000000020b512d5e1723b60d350f2c83179c1051dd01f0b1943c891a50969051c0bd88d6f0000000000000007000000000000000100000000000000010000000000000020bf4668138b85d2f7cd61d513e6b836bf0c91f937fb195e9b21ed307f3f0e2f3d000000000000000100000000000000000000000000000020b506484d8c0a32b2902c97440868b6fcf621f97ec3e5bc2db5e819ffed2a63ac0000000000000001000000000000000100000000000000207956fb7563d1d8edc1c31b0507a45ca963842945223b2968f306594124227d620000000000000001000000000000000000000000000000200f0911ff40841595361c7f29d46e3a2e6eef09a5e708506ca877eb6163630bf3000000000000000100000000000000000000000000000020d8e25d820866f2beb13183fff051de8ceae433e7812c5af04a607e1130331ed20000000000000001000000000000000100000000000000200bfd6d89c20023ffb75aca9182c12c60ff50a65edb29afd0302d0490c668264a000000000000000100000000000000000000000000000020bbd90a9748c45aeb7976c50f9539e6baebdee7c29eea9e71d3ad7ebeacb50710000000000000005a000000000000002053c60cb628b515e490aa568f3cc8ca29891d9563b6cff13539314b5a722171190000000000000007000000000000000100000000000000010000000000000020243dbc1ab00a1ab1191f8210672e7b79aac1565b35a6a6c860eb89e641d0e85d000000000000000100000000000000000000000000000020e2b8adf48734bbac00476e92b353eab57c23e6fb0876d7e9f99c9ef2f21ddee9000000000000000100000000000000010000000000000020d55dd3f7ae65c487983905054e9a5294f8f4e02f778e48ec14f4ed1e06a87be30000000000000001000000000000000000000000000000200aa814ddb3b1b15e14ba702f08a240dcc7293359374cbe0e8188bf67f7870f840000000000000001000000000000000000000000000000204eb0f206d6a791451818a1a49e295eece7842a33e540ecc18486e83537c399b0000000000000000100000000000000010000000000000020be12d559953f04b14fb4a5f2e37b32a6949f6e8508b4a7d711e178ff766d5dd10000000000000001000000000000000000000000000000201546a6e10b577d90c02af66694813cf010175cb9045f737037f8a14ddfe068260000000000000003000000000000005a00000000000000207c555c3aa09898bcabb7854d82e0e828bc28d322bfc54e61f9d395928622c4890000000000000007000000000000000100000000000000010000000000000020abc9732304eb58807e4a487dab4276b9ab3dbe3bb7499ee864f92aa08afea68d0000000000000001000000000000000000000000000000201e46badcd57f2392eeda85b567a9192e6e1a9bc66468e60315a2f75ddebea349000000000000000100000000000000010000000000000020a6c9ee8840d773f8b437a5223c886c3b7b55dc3a321ab6f661d6b2fcce55118400000000000000010000000000000000000000000000002075f02074ca216af09dd0367a42fea2bd162b137430e34607c0035f56d6986bb700000000000000010000000000000000000000000000002088dce71d2079b2b0950a4e3c3c0edc9db575729cec32f37684db1da0379727da000000000000000100000000000000010000000000000020e57828f96f3b73b9428a3c63af5a46099e67e84bf35ed87b3d55c2c7da46a61e0000000000000001000000000000000000000000000000203fac52a7d82b9409a1814d1265269607ef9c8d2077877dae9afbb42c5c0be8de000000000000001a000000000000002023b69f8f92ba3ead285acc6a688d8b22c3f3600fde34c782fe9d09b52f3f9bc90000000000000006000000000000000100000000000000010000000000000020a5bb91d42b166ed50abe53ab6b726ecfe9f66983d86acb5b99bcb2c4fa9116e6000000000000000100000000000000000000000000000020a1bf8d3962d804bbf9b6836530b939022e87b97ddacf718e1bffe99b5ba4fcf10000000000000001000000000000000100000000000000207274e676b35699e3fcbf016fc212b73430068ac868b0acd0dad2cb90142dcdf6000000000000000100000000000000000000000000000020cc3d62b02f3ad0810ece4920fbf5ad5452577124ebb6be1c31d3d7ec79b6e3eb00000000000000010000000000000000000000000000002018d9bdcd4619139084ac887d24402cf61913a18ac9c823e282227fc8c27349d6000000000000000100000000000000010000000000000020e075fd2c31e99181114bfb41171f749f0b62f75692b44ebbf7923bdb5f51b314000000000000001a00000000000000208f4176a895e1ccac9040370bc31ff98d07fe56a85183b1067a9198863bbeb9de0000000000000005000000000000000100000000000000010000000000000020d67042edbfbc11c2c791fe0a2ee1823064aeb1e7975853f5cc08513dfd4dc05500000000000000010000000000000000000000000000002031b4dbeed998c874bdee96dbb0edab3b842540b06380a5044c87c735dbac2972000000000000000100000000000000010000000000000020be0c6eac24c8089685c6c05d562e2546d0ec7ef7487cf2893903d4b6b86b0fef000000000000000100000000000000000000000000000020a4a120d887a780dc758f3b10fbc671fc563be5de180f9f7105091f664971150b000000000000000100000000000000000000000000000020097d565685c064f43d07e0e26545a84555d4027ccf4a558520d124c6b9c4327e00000000000000026d5c99b3c48d867bd523b8f8f2188b6b176e57a493a597f1154f7b196bcffd0d3ef3e4413ba5971273cd5d8815d104d647068755b951a1033a734e720c501996 \ No newline at end of file diff --git a/contracts/zkllvm/circuit3/commitment.sol b/contracts/zkllvm/circuit3/commitment.sol index 6887ab1..bfde500 100644 --- a/contracts/zkllvm/circuit3/commitment.sol +++ b/contracts/zkllvm/circuit3/commitment.sol @@ -425,6 +425,46 @@ library modular_commitment_scheme_circuit3 { types.transcript_data memory tr_state; tr_state.current_challenge = transcript_state; commitment_state memory state; + + { + uint256 poly_at_eta; + /* 1 - 2*permutation_size */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 40);// 0 + if(poly_at_eta != 0x343b8884869e63daf6dd0953387348368c7a4fe70ddf9f3c44b97c38fff8d0fe) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x68);// 0x1 + if(poly_at_eta != 0x529aa96a117f346d2512ea01a40691035492b93202a37bef2eaa968ffdc14f2) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xa8);// 0x2 + if(poly_at_eta != 0x19d054f12577c0621b95e92083420d510a6dd9dfa0d316babe954f0cff4c68ba) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xe8);// 0x3 + if(poly_at_eta != 0x111a8b5bb56c1ea89ed8da2904a4294ef980f6611857f6e86902966fc7e0ba0) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x128);// 0x4 + if(poly_at_eta != 0x343b8884869e63daf6dd0953387348368c7a4fe70ddf9f3c44b97c38fff8d0fe) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x168);// 0x5 + if(poly_at_eta != 0x529aa96a117f346d2512ea01a40691035492b93202a37bef2eaa968ffdc14f2) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1a8);// 0x6 + if(poly_at_eta != 0x19d054f12577c0621b95e92083420d510a6dd9dfa0d316babe954f0cff4c68ba) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1e8);// 0x7 + if(poly_at_eta != 0x111a8b5bb56c1ea89ed8da2904a4294ef980f6611857f6e86902966fc7e0ba0) return false; + /* 2 - special selectors */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x248);// 0x8 + if(poly_at_eta != 0x17751bf2a581542ee47b5ae7d4e0e02af7a71bc873c7f7385aba2bddea3a5ef6) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2a8);// 0x9 + if(poly_at_eta != 0x3dfbdbf08c58e4f3e916fa1a6f3e75208970c68882f242793123b14ab791cdf2) return false; + /* 3 - constant columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x308);// 0xa + if(poly_at_eta != 0x295b7fbed4e2420808d6b3101d2f0041fbb28c89a4e944619e14aae32632b0f2) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x368);// 0xb + if(poly_at_eta != 0x428994f647f501b7fa5a6746b98e0c986f9913eb8a053bc75ba3024743908f2) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x3c8);// 0xc + if(poly_at_eta != 0x2810d8e2f6270a1cd3890c3c5e5c18991066713e9329e8403c9707e7899494b6) return false; + /* 4 - selector columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x408);// 0xd + if(poly_at_eta != 0x3d0aef0e94c434b9a9f151793318c9a9630fcadac7a319832bdada96c3c81938) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x468);// 0xe + if(poly_at_eta != 0x2d84190e39619223887c598488c7e10b82ac1dc85d89981e13cedb079a6bb9e4) return false; + } + + { uint256 offset; diff --git a/contracts/zkllvm/circuit3/modular_verifier.sol b/contracts/zkllvm/circuit3/modular_verifier.sol index 28b005e..709a10d 100644 --- a/contracts/zkllvm/circuit3/modular_verifier.sol +++ b/contracts/zkllvm/circuit3/modular_verifier.sol @@ -117,14 +117,14 @@ contract modular_verifier_circuit3 is IModularVerifier{ // Input is proof_map.eval_proof_combined_value_offset if( result != basic_marshalling.get_uint256_be( - blob, 7366026047666159643 + blob, 448 )) check = false; } function verify( bytes calldata blob, uint256[] calldata public_input - ) public view{ + ) public view returns (bool result) { verifier_state memory state; state.b = true; state.gas = gasleft(); @@ -164,16 +164,17 @@ contract modular_verifier_circuit3 is IModularVerifier{ state.F[2] = permutation_argument[2]; } + //4. Lookup library call { uint256 lookup_offset = table_offset + quotient_offset + uint256(uint8(blob[z_offset + basic_marshalling.get_length(blob, z_offset - 0x8) *0x20 + 0xf])) * 0x20; uint256[4] memory lookup_argument; + uint256 lookup_commitment = basic_marshalling.get_uint256_be(blob, 0x81); ILookupArgument lookup_contract = ILookupArgument(_lookup_argument_address); (lookup_argument, tr_state.current_challenge) = lookup_contract.verify( -// (lookup_argument, tr_state.current_challenge) = modular_lookup_argument_circuit3.verify( blob[special_selectors_offset: table_offset + quotient_offset], blob[lookup_offset:lookup_offset + sorted_columns * 0x60], - basic_marshalling.get_uint256_be(blob, 0x81), + lookup_commitment, state.l0, tr_state.current_challenge ); @@ -257,6 +258,7 @@ contract modular_verifier_circuit3 is IModularVerifier{ } console.log("Gas for verification:", state.gas-gasleft()); + result = state.b; } } - \ No newline at end of file + diff --git a/contracts/zkllvm/circuit4/commitment.sol b/contracts/zkllvm/circuit4/commitment.sol index 013348c..2df775d 100644 --- a/contracts/zkllvm/circuit4/commitment.sol +++ b/contracts/zkllvm/circuit4/commitment.sol @@ -425,6 +425,48 @@ library modular_commitment_scheme_circuit4 { types.transcript_data memory tr_state; tr_state.current_challenge = transcript_state; commitment_state memory state; + + { + uint256 poly_at_eta; + /* 1 - 2*permutation_size */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 40);// 0 + if(poly_at_eta != 0x2f5497c3241d226f7a598e125b70d4977a432d3256a5cca609eecd9708197ef7) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x68);// 0x1 + if(poly_at_eta != 0x2ca6f6cfb491ac2d63bfc65bc93426f4fc7c1707955613eb6622712c287f7ad0) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xa8);// 0x2 + if(poly_at_eta != 0x1f42d20e86d85ce2f2bedfcaee04c2c88798a831cec778463324a315ca7d660d) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xe8);// 0x3 + if(poly_at_eta != 0x1c4e1a48a239d06ebdba5ef6a617cdea616e1700f74b6727cd5ccd92f472fe3f) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x128);// 0x4 + if(poly_at_eta != 0x2f5497c3241d226f7a598e125b70d4977a432d3256a5cca609eecd9708197ef7) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x168);// 0x5 + if(poly_at_eta != 0x2ca6f6cfb491ac2d63bfc65bc93426f4fc7c1707955613eb6622712c287f7ad0) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1a8);// 0x6 + if(poly_at_eta != 0x1f42d20e86d85ce2f2bedfcaee04c2c88798a831cec778463324a315ca7d660d) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1e8);// 0x7 + if(poly_at_eta != 0x1c4e1a48a239d06ebdba5ef6a617cdea616e1700f74b6727cd5ccd92f472fe3f) return false; + /* 2 - special selectors */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x248);// 0x8 + if(poly_at_eta != 0x213512f755aea8bd75050bd7d649b6613b649871744b991958a487efc18cae33) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2a8);// 0x9 + if(poly_at_eta != 0x1efa2279781ce1bd13c856bbc25d85030f7e4f6209ce07f8a25cc8572e6e973a) return false; + /* 3 - constant columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x308);// 0xa + if(poly_at_eta != 0x243c65637777d1ee46c13fa6d368a503c6ea125afaa809f6121faf4f7e8634ec) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x368);// 0xb + if(poly_at_eta != 0x10f4eb1c5290c61346203e82423cee59a6035bfd481bad6865fea0ccb30cc012) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x3c8);// 0xc + if(poly_at_eta != 0x3a73f59d35fce36e759ee3b753f2f4d97d01cf186f5e7c532c780e32ceef3b1d) return false; + /* 4 - selector columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x408);// 0xd + if(poly_at_eta != 0x294fd51015a092e0a6b142a1790ecb1bae622443b27626f464a54e0c2be735a0) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x448);// 0xe + if(poly_at_eta != 0x3fd0ca8f3234758577329d6c6758c49bf9aa4a2494805125375911931004ba96) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x4a8);// 0xf + if(poly_at_eta != 0x13cc23004f2aabbc9b7f05ca258e0b57a543e2bfb5ac023244bc9a46a0276b78) return false; + } + + { uint256 offset; diff --git a/contracts/zkllvm/circuit4/modular_verifier.sol b/contracts/zkllvm/circuit4/modular_verifier.sol index ce0ec7f..84f3176 100644 --- a/contracts/zkllvm/circuit4/modular_verifier.sol +++ b/contracts/zkllvm/circuit4/modular_verifier.sol @@ -117,14 +117,14 @@ contract modular_verifier_circuit4 is IModularVerifier{ // Input is proof_map.eval_proof_combined_value_offset if( result != basic_marshalling.get_uint256_be( - blob, 16664182129351154818 + blob, 512 )) check = false; } function verify( bytes calldata blob, uint256[] calldata public_input - ) public view{ + ) public view returns (bool result) { verifier_state memory state; state.b = true; state.gas = gasleft(); @@ -164,16 +164,17 @@ contract modular_verifier_circuit4 is IModularVerifier{ state.F[2] = permutation_argument[2]; } + //4. Lookup library call { uint256 lookup_offset = table_offset + quotient_offset + uint256(uint8(blob[z_offset + basic_marshalling.get_length(blob, z_offset - 0x8) *0x20 + 0xf])) * 0x20; uint256[4] memory lookup_argument; + uint256 lookup_commitment = basic_marshalling.get_uint256_be(blob, 0x81); ILookupArgument lookup_contract = ILookupArgument(_lookup_argument_address); (lookup_argument, tr_state.current_challenge) = lookup_contract.verify( -// (lookup_argument, tr_state.current_challenge) = modular_lookup_argument_circuit4.verify( blob[special_selectors_offset: table_offset + quotient_offset], blob[lookup_offset:lookup_offset + sorted_columns * 0x60], - basic_marshalling.get_uint256_be(blob, 0x81), + lookup_commitment, state.l0, tr_state.current_challenge ); @@ -257,6 +258,7 @@ contract modular_verifier_circuit4 is IModularVerifier{ } console.log("Gas for verification:", state.gas-gasleft()); + result = state.b; } } - \ No newline at end of file + diff --git a/contracts/zkllvm/circuit6/commitment.sol b/contracts/zkllvm/circuit6/commitment.sol index c541e26..7f2c406 100644 --- a/contracts/zkllvm/circuit6/commitment.sol +++ b/contracts/zkllvm/circuit6/commitment.sol @@ -428,6 +428,48 @@ library modular_commitment_scheme_circuit6 { types.transcript_data memory tr_state; tr_state.current_challenge = transcript_state; commitment_state memory state; + + { + uint256 poly_at_eta; + /* 1 - 2*permutation_size */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 40);// 0 + if(poly_at_eta != 0xd48b9f9a1f52577da4d5cb94d65e04052d79db412bde4a0173fa42abd6d4a45) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x68);// 0x1 + if(poly_at_eta != 0x26ba1e029c9bb574382cf9e82fd61417bef7b8854687e04db1103e8b3227358) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xa8);// 0x2 + if(poly_at_eta != 0xc1a2960d0f0a8b4518e0e188ef2e6476bad69a9a60a76184755138b7fac40b8) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0xe8);// 0x3 + if(poly_at_eta != 0x3c82cee414b34b8597c6467acabe7f651a6310503e344e7964a961b97e5d4398) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x128);// 0x4 + if(poly_at_eta != 0xd48b9f9a1f52577da4d5cb94d65e04052d79db412bde4a0173fa42abd6d4a45) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x168);// 0x5 + if(poly_at_eta != 0x26ba1e029c9bb574382cf9e82fd61417bef7b8854687e04db1103e8b3227358) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1a8);// 0x6 + if(poly_at_eta != 0xc1a2960d0f0a8b4518e0e188ef2e6476bad69a9a60a76184755138b7fac40b8) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x1e8);// 0x7 + if(poly_at_eta != 0x3c82cee414b34b8597c6467acabe7f651a6310503e344e7964a961b97e5d4398) return false; + /* 2 - special selectors */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x248);// 0x8 + if(poly_at_eta != 0x38fb1266f415fbd2618cfb2426d85025c3e9ac6c13d4ce1cb5709b216b4da6b2) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x2a8);// 0x9 + if(poly_at_eta != 0x1af710639a33a9ee25a99551d3fd807e70499333913a0f7ce486c5d6cd45a1b6) return false; + /* 3 - constant columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x308);// 0xa + if(poly_at_eta != 0x378ae8b217281e98232cf4c6dc2b21498547a11fd3025f8ab5fc7ade97636da7) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x368);// 0xb + if(poly_at_eta != 0x2fb0a4b594cb133a84d3b178be4595d031abfaaf17d83f3aa7f7c86c6477497e) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x3c8);// 0xc + if(poly_at_eta != 0x39f429a1fa53e4b8ea5cf81151d917a9c6df281fe390dd60fc915b3d85c942d2) return false; + /* 4 - selector columns */ + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x428);// 0xd + if(poly_at_eta != 0x24d458cd7f86fdba1387bf56c6d2174e370b3a80acf28f008c4d6010f5d0c592) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x468);// 0xe + if(poly_at_eta != 0x2c0ddd3571b65a3f78c96f8a052a2f5c1059f2586d8b149d986300e1c76cb79b) return false; + poly_at_eta = basic_marshalling.get_uint256_be(blob, 0x4a8);// 0xf + if(poly_at_eta != 0x24d458cd7f86fdba1387bf56c6d2174e370b3a80acf28f008c4d6010f5d0c592) return false; + } + + { uint256 offset; diff --git a/contracts/zkllvm/circuit6/modular_verifier.sol b/contracts/zkllvm/circuit6/modular_verifier.sol index 2ec8eb6..d2f786f 100644 --- a/contracts/zkllvm/circuit6/modular_verifier.sol +++ b/contracts/zkllvm/circuit6/modular_verifier.sol @@ -117,14 +117,14 @@ contract modular_verifier_circuit6 is IModularVerifier{ // Input is proof_map.eval_proof_combined_value_offset if( result != basic_marshalling.get_uint256_be( - blob, 8582637441169827780 + blob, 512 )) check = false; } function verify( bytes calldata blob, uint256[] calldata public_input - ) public view{ + ) public view returns (bool result) { verifier_state memory state; state.b = true; state.gas = gasleft(); @@ -164,16 +164,17 @@ contract modular_verifier_circuit6 is IModularVerifier{ state.F[2] = permutation_argument[2]; } + //4. Lookup library call { uint256 lookup_offset = table_offset + quotient_offset + uint256(uint8(blob[z_offset + basic_marshalling.get_length(blob, z_offset - 0x8) *0x20 + 0xf])) * 0x20; uint256[4] memory lookup_argument; + uint256 lookup_commitment = basic_marshalling.get_uint256_be(blob, 0x81); ILookupArgument lookup_contract = ILookupArgument(_lookup_argument_address); (lookup_argument, tr_state.current_challenge) = lookup_contract.verify( -// (lookup_argument, tr_state.current_challenge) = modular_lookup_argument_circuit6.verify( blob[special_selectors_offset: table_offset + quotient_offset], blob[lookup_offset:lookup_offset + sorted_columns * 0x60], - basic_marshalling.get_uint256_be(blob, 0x81), + lookup_commitment, state.l0, tr_state.current_challenge ); @@ -257,6 +258,7 @@ contract modular_verifier_circuit6 is IModularVerifier{ } console.log("Gas for verification:", state.gas-gasleft()); + result = state.b; } } - \ No newline at end of file +