Skip to content

Commit

Permalink
Use Poseidon2 for recursion hashing (risc0#1414)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: capossele <[email protected]>
  • Loading branch information
tzerrell and capossele authored Feb 9, 2024
1 parent 88ec08b commit b954a71
Show file tree
Hide file tree
Showing 52 changed files with 260,155 additions and 300,337 deletions.
4 changes: 2 additions & 2 deletions bonsai/ethereum/contracts/groth16/ControlID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
pragma solidity ^0.8.9;

library ControlID {
uint256 public constant CONTROL_ID_0 = 0x447d7e12291364db4bc5421164880129;
uint256 public constant CONTROL_ID_1 = 0x12c49ad247d28a32147e13615c6c81f9;
uint256 public constant CONTROL_ID_0 = 0x39ff805954f4eb2868d338764408f76d;
uint256 public constant CONTROL_ID_1 = 0x15cf3a5f4097269e3a6d921c18625531;
}
28 changes: 14 additions & 14 deletions bonsai/ethereum/contracts/groth16/Groth16Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ contract Groth16Verifier {
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
uint256 constant deltax1 = 7693487429026351977103582346623702458502994930724273067160489676068253241122;
uint256 constant deltax2 = 18083587067730303898088465773541035809657139089748028791075809901844080381583;
uint256 constant deltay1 = 7359384703862385660061748803901931167856917172356103761995576336394013820206;
uint256 constant deltay2 = 19155327851717349610711498610928624259731705665803906701543914342469719520424;
uint256 constant deltax1 = 20637939757332191985219466750514112514830176492003070298908178796582256423445;
uint256 constant deltax2 = 21015870987554935578856562994563796394452175083269944606559673949460277152483;
uint256 constant deltay1 = 7308971620370004609743038871778988943972318366181842608509263947408591078846;
uint256 constant deltay2 = 19578762133483017273429849028797807252406479590275449312036317638112265649126;

uint256 constant IC0x = 3946965800586156692981925338368207536736705930062938727478976206429630223321;
uint256 constant IC0y = 9960693350301697546955796394716396930467039081099556382890913872882520616640;
uint256 constant IC0x = 4595639739788529313135927846153489513260052783364743523344328896305419933627;
uint256 constant IC0y = 13577843718844184042346095806470311065274840502864234728407198439361979518223;

uint256 constant IC1x = 12558970553567495705160565934359147265891951005223735094684712986779479012425;
uint256 constant IC1y = 6199258869647841500919704073457246710601253972070160340767955790036898000135;
uint256 constant IC1x = 19125733112813331880180112762042920784001527126678496097978721184513458499861;
uint256 constant IC1y = 470495054354753477176064253439657941845200056447070007550476843795069859530;

uint256 constant IC2x = 16706808935575787802711250967470306094414582323642394044367277865965614549578;
uint256 constant IC2y = 4311171349764489922968166376528109775195413405587105360819319395803197119429;
uint256 constant IC2x = 9798632009143333403145042225641105799474060066926099950339875153142594918323;
uint256 constant IC2y = 15467851970301286525906423722646678659414362276892586739627188622113917076355;

uint256 constant IC3x = 18597303695576860451572687600097059285572952378680993135977532372976749998241;
uint256 constant IC3y = 21723251549997210319914312194189948104957781222830842952199420842095495134729;
uint256 constant IC3x = 4677856832410602822119633312864839150180396112709578634305606190993420950086;
uint256 constant IC3y = 21413789555508871663216491538642005537595601774930793267108872091881334409985;

uint256 constant IC4x = 12164939688015960624286304530289921602116255917351297336606146584068755512927;
uint256 constant IC4y = 17036398532634379807038707418819848170237695473144751623976431755966389161373;
uint256 constant IC4x = 17622463197037705164686879153818888337611670039316323149958751021262085916949;
uint256 constant IC4y = 10546326028888365743245970980969672597991412490319907398941581639510925080455;

// Memory data
uint16 constant pVk = 0;
Expand Down
6 changes: 3 additions & 3 deletions bonsai/ethereum/test/TestReceipt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pragma solidity ^0.8.13;

library TestReceipt {
bytes public constant SEAL =
hex"102866064c0a93f24ab85854cbb1f2904f3e345bdd567e1f0ef36e819c5441aa24cd64818e919f0cb611b69f717421dc0b859d748325506b76bd9f3b351869be1b0e3056568cbdfeadfbd01a6ca4bc84934f73137f9051e0a1968b132c7ae0460d37ee6b3eefb8cd9985612c81fbbef3e6e25aa2f2ebc35c23f882de07fa51090e96423125defa12ccf193e6bf2ed33ce3ea2085a40ed1c88af7dd1f71d7fec90c5905ea06c54c2f8f27be48dcd055836066f9706f8ab1c3984a321fc2e4f11d16c7e632d68f81dca000df105273ad45a22b03a69752ccb9d8ee2878166ff41a1de23df9c89ef27a77980f84d8d780890cb89fe983f812a4fb6222797c0e529f";
bytes32 public constant POST_DIGEST = bytes32(0x0c832dac05ecf2eaf58d3cfff95e3b51e18314d377483703fd1f08296365ea71);
hex"13c5374cbe30ae3a9e292ddaa04e4b17a033fbf16c20169ca7e8ea7e893317161eeb54246b11f5f731144543a5fdd384616fd06a72b851f9a5701a6d983469b90af561d4397deeca0264031f56d99c3ca224c31f59c5c50f80e0bb62c6bd28331a2a42156c883f9fcf197cd79d5c5d032d94fe5ccbe53dcf4a0b74a219c18ac71e9c0d476910e93fde55b6ec8e1b52c5e5f0a2110747e7c9fa257422d686b88617dd034c1d329efceaca91a87a4051f439098a2bfc0f7e466160b38a590a63d20d9ecda0df1b8ab7305ef509cc8dfbc6bbc6b5f82db20128b3c8d207838787a11943525ea3d27c503638890893872df5e012454e1e62c73e9a60eec09e504dd1";
bytes32 public constant POST_DIGEST = bytes32(0xdd9c6194587a2e082edf9b7086c5fc4555958668a4f6774243b921e6dade84a0);
bytes public constant JOURNAL = hex"";
bytes32 public constant IMAGE_ID = bytes32(0x59eeb99a627ecaf527fa51262e797fc39ba69ad9ff36e9b2f5a634edc9fc622d);
bytes32 public constant IMAGE_ID = bytes32(0x950df86e2dc6df7d98f4d2fd5468b30986721f87ef228b39f39d740fcbf5ac34);
}
4 changes: 2 additions & 2 deletions compact_proof/groth16/stark_verify.circom
Git LFS file not shown
2 changes: 1 addition & 1 deletion compact_proof/scripts/install_prover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eoux

docker build -f docker/build.Dockerfile . -t snark-build --output=groth16 --target outputs

wget https://risc0-artifacts.s3.us-west-2.amazonaws.com/zkey/2024-01-15/stark_verify_final.zkey.gz -O groth16/stark_verify_final.zkey.gz
wget https://risc0-artifacts.s3.us-west-2.amazonaws.com/zkey/2024-02-07/stark_verify_final.zkey.gz -O groth16/stark_verify_final.zkey.gz
(cd groth16; gzip -df stark_verify_final.zkey.gz)

docker build -f docker/prover.Dockerfile . -t risc0-groth16-prover
2 changes: 1 addition & 1 deletion risc0/build/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ mod test {
build("../../risc0/zkvm/methods/guest/Cargo.toml");
compare_image_id(
"risc0_zkvm_methods_guest/multi_test",
"231730a4e1e2186d2dd84e87d9c37621629252f2767c6710d9fe50dafd35443f",
"804c487280b17cff1dc244a43e7e0b3af889460c069a35a49831a93070c2981c",
);
compare_image_id(
"risc0_zkvm_methods_guest/hello_commit",
Expand Down
Loading

0 comments on commit b954a71

Please sign in to comment.