Skip to content

Commit

Permalink
modular_verifier interface update, added eta value checks #81 NilFoun…
Browse files Browse the repository at this point in the history
  • Loading branch information
vo-nil committed Nov 7, 2023
1 parent 8a9206e commit 6174fe2
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 3 deletions.
36 changes: 35 additions & 1 deletion contracts/zkllvm/circuit1/commitment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 140722672363728;
uint256 constant lookup_point = 0;
bytes constant points_ids = hex"01010101010101010303010100000000";
uint256 constant omega = 14450201850503471296781915119640920297985789873634237091629829669980153907901;
uint256 constant _etha = 14062721881273474090606415031361994540585550571695842571456013353340629726555;
Expand Down Expand Up @@ -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;

Expand Down
36 changes: 35 additions & 1 deletion contracts/zkllvm/circuit2/commitment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 140722672363648;
uint256 constant lookup_point = 0;
bytes constant points_ids = hex"02020202020202020404020200010101";
uint256 constant omega = 14788168760825820622209131888203028446852016562542525606630160374691593895118;
uint256 constant _etha = 12217208067492249031102872072655908974751031861422067257283053495957748658893;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion contracts/zkllvm/circuit2/proof.bin

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions contracts/zkllvm/circuit3/commitment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
42 changes: 42 additions & 0 deletions contracts/zkllvm/circuit4/commitment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
42 changes: 42 additions & 0 deletions contracts/zkllvm/circuit6/commitment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 6174fe2

Please sign in to comment.