From 5172e6956df3961f43afc85dcd2a5c771f2023ac Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 01:23:36 +0000 Subject: [PATCH 1/6] update fixtures for pre-custom-serde --- sp1/contracts/src/fixtures/fixture.json | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index 18ca329..de3ef9d 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,8 +1,5 @@ { - "a": 6765, - "b": 10946, - "n": 20, - "vkey": "0x00307ac6ea935608a65cea9a739f1c678dc028267391566806be12953d865be8", - "publicValues": "0x00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000001a6d0000000000000000000000000000000000000000000000000000000000002ac2", - "proof": "0x801c66ac24a8c9c720fb536ab6d292c3f4bdd9ecfb8bbd58a094081a578dd19ec444d9170ce9d31a25163009ff046d03f74dc0212f0cc713454574a72e41ed4e7604087a180ce46f081dc855f9b952ddc3e42002da927b46b7c826e7dd9373695fc0aa152a3dc2bf70aa716243930edf99a1958345e94cc88fb3dd4acd9af75175fd1f1504805ba12b526663567b12475f1b940323c87e2246195de23a5e0be5d2abe3b41e99dbddefc673abc7038e71c19e1e7ec170d1b48a12e63c2657fbc5b96defab06a2347a8a095b44692536217bdc71787da3464ab717cfa6b5b74849469795510728acc0be593ce813059e33337bfd33d11ac03676c1a8cd508518d1ee3859af19ba893298a9b35ee3cd3346e2c6f8aa71fa58c225128693eee97ed1374535e30c8d107388bb500af98fe04a2ec60f0efe1026f90745e2cd157e95468cd5c8db16b99e8616eb444a6f89c7c31728c039c75f340e3b6a3ca621b0172fc400990f195a6b6dce88cae4604b354eb4eea15ea0e9f8a0837813f621d0b1289d90a0d812eaedc02934cc41c86f242123d8a753d308d8134f3f33b8168140b2ba612b9129d54b9566230974f9778e8cb3dcd0d187e32fcea5969855642190bd3416d65212d2ea3d785b8ddf7f477259a3d11e5326c3a14a1ffc1e121f38975a01fbba640a28cbf9d7f5b22be18cbbaf3442d9284eee0f632d0fce47475e7be13103f8ba1f8f4ebc25b73650969c53b13a35cc6943a331c689841a40325d23b6045f240803d1738e11c5c46999bb6e060ac823a865ddc4f7e83dfecffb6f0a822180a6db2eeb6e91e1d80d78a9350df39d142c462cce1ac9e36cd8ab682f167b13e690d522642cc4bde919a52f333a00700fccf2fa6212fd3cf49b430368e7fc6b80ab8c1e5b265ccdf8bb49174102224f419c437da1b1bbe892dad2039a3f98e7a328a702ab130b30b7d818efe388a6134fe3c085d213a5534d604b9b3335b8db4180991abb9efda23fa9be95c8c46dd270200ad00f114d830ae8a019b76a02aa2a69f50fa73605947b3e7640d90d481dbff96bf124c92691fdfa52358671a5a3ea355d0128af0521a8b783fff80caf13fd8dc30757bc5ef93fc5f7b0411f44ca5f15510c6cae1f1eeca8477aef5a6d5d4197dcd220536498706c553e86da5b91afd3900bea3e07838a9592c798e1c38674ab04e0d51badf80bb95331702db27dfb2347" -} + "vkey": "0x00d1c2d64c73d09ffe0defbf1c9b59fa36d9f808b8bc5aedc5e52ecfa4262474", + "publicValues": "0x42000000000000003078396532386431626166323839343438363438633561393631333737663961613038356139326339643366336632333734353761656431326165336635363661394200000000000000307836653139306162616465633133386236653539393938393533383936333339383933386462343531613463303133623262313532366362303434353332646233f842a8984c000000000000000b000000000000004d45524b4c455f434f4d4d30000000000000007a343f5c1d5e7c6f14e99611c2e3a0b9d9347fa4663a3d0bba4ee26804712879200000000000000005000000000000007f", + "proof": "2915676a503eaa20e7ef5bdd3096005d8e688126ac88177ac684b612c622b8f30c5c65ee10403ddff4957c844f292eba4a2646e37faad2119428724653bb66fd19fc4cc94f2685bb13edf485886d07ad31ab6af4a6aa8b0ea44cbb80b97562c81acaa1f269fd173b767b01a615f9c794d2ba04ebc5e75d6ca1cfed60da8a2cc00fcce259769275e67de533f538e570d5330e2a7f99d27a7152f0586789a60e2414814cc73c2f756eeeb81129618a6e80daca86cdf484d3d1e0d0d867585a6ff81e6cbc57e107fbf5df2d97e1eafad190ccb19434410967d58ca8a839d21f7b4317d412da5928a3d95929f651a1c8b84f36d295a20ac8157c8148e5dc7ec65b4e2d82dbc7feda28d964d833ae7db6cd1db463877c60f6f82565b525ddf9b6e0aa2b506693368152a808867015086c756b535eb1cdf7bd8679fe95bb9fc52edd3a07e9857551330c29e0e536c68fb91ec6ee9fc85cba31cd26d4b65fdbf857cb2e0c49a9b0a6d50bb27473ce7c6d0c3fd500e96db14de5da7ad402a84a5d5b9de31072044c53da455a7f854d0bfa7af5e96ecd2c01ff569df200014a63d7d83f2f292cb98ebacc37384866bb9a31cba00c627617fd2aa83f444eae340e273ef39729404b07cbc4e388b3cdfcb580acbdef82d08ef319fcfbcd4bd256b7f52ac5591279c0775f36e60b6c8833d72bb0a2a2344ec9bf9c88bb330fb66815b34805d800000007134a9aac8fd0ec8818dd8cb342aace6bb04489840a8ee1bff7f56e2eb122ecda077adadb220f77bf0bbee0bc39584520fff6cb88aef442527f3179974e3f1ec81472a869bb2eab08a7fe9e10da7c6dc09dab1055824e640f335bd39c3162705b28c77592a49e164075be633293b6f30400b68f0e48a62fc9128b9c1a5b21fc94260ea8bfd85a7aa95c4da1b994513cad0cc886389d1ecc811338eb77c4b3db8f01086791faf4fe2fc43a37ec623258251ff6b836e8d9489a8b5906a5f77595e2052374d965a32df68b33a6e5ad0c04c6d05a8f3674e8800dde4f720254302bf60c62dad5c4fcfc71dbce34767cc64255404bf5ae1066826994888cd01716095f05eb0211427daeba8f523b282e520675e76e1ace2368983c54caee8d347ac6e02d6d12eb759706ea395f57e741f4ad4f97fb0cb03453459d59c703decef262540000000105cd6220b03e98bce2c01e6b63e14df07b002c5b03a0653abc424ef2a9fc0cb51e9ae8a883c3318eb93e4c1446138108719ef3fe045b7312187efa56150ea593" +} \ No newline at end of file From 2eca493e3b08061f43beb041c6940f7373a5dfe5 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 02:06:22 +0000 Subject: [PATCH 2/6] update fixture --- sp1/contracts/src/fixtures/fixture.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index de3ef9d..217ba16 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,5 +1,5 @@ { - "vkey": "0x00d1c2d64c73d09ffe0defbf1c9b59fa36d9f808b8bc5aedc5e52ecfa4262474", - "publicValues": "0x42000000000000003078396532386431626166323839343438363438633561393631333737663961613038356139326339643366336632333734353761656431326165336635363661394200000000000000307836653139306162616465633133386236653539393938393533383936333339383933386462343531613463303133623262313532366362303434353332646233f842a8984c000000000000000b000000000000004d45524b4c455f434f4d4d30000000000000007a343f5c1d5e7c6f14e99611c2e3a0b9d9347fa4663a3d0bba4ee26804712879200000000000000005000000000000007f", - "proof": "2915676a503eaa20e7ef5bdd3096005d8e688126ac88177ac684b612c622b8f30c5c65ee10403ddff4957c844f292eba4a2646e37faad2119428724653bb66fd19fc4cc94f2685bb13edf485886d07ad31ab6af4a6aa8b0ea44cbb80b97562c81acaa1f269fd173b767b01a615f9c794d2ba04ebc5e75d6ca1cfed60da8a2cc00fcce259769275e67de533f538e570d5330e2a7f99d27a7152f0586789a60e2414814cc73c2f756eeeb81129618a6e80daca86cdf484d3d1e0d0d867585a6ff81e6cbc57e107fbf5df2d97e1eafad190ccb19434410967d58ca8a839d21f7b4317d412da5928a3d95929f651a1c8b84f36d295a20ac8157c8148e5dc7ec65b4e2d82dbc7feda28d964d833ae7db6cd1db463877c60f6f82565b525ddf9b6e0aa2b506693368152a808867015086c756b535eb1cdf7bd8679fe95bb9fc52edd3a07e9857551330c29e0e536c68fb91ec6ee9fc85cba31cd26d4b65fdbf857cb2e0c49a9b0a6d50bb27473ce7c6d0c3fd500e96db14de5da7ad402a84a5d5b9de31072044c53da455a7f854d0bfa7af5e96ecd2c01ff569df200014a63d7d83f2f292cb98ebacc37384866bb9a31cba00c627617fd2aa83f444eae340e273ef39729404b07cbc4e388b3cdfcb580acbdef82d08ef319fcfbcd4bd256b7f52ac5591279c0775f36e60b6c8833d72bb0a2a2344ec9bf9c88bb330fb66815b34805d800000007134a9aac8fd0ec8818dd8cb342aace6bb04489840a8ee1bff7f56e2eb122ecda077adadb220f77bf0bbee0bc39584520fff6cb88aef442527f3179974e3f1ec81472a869bb2eab08a7fe9e10da7c6dc09dab1055824e640f335bd39c3162705b28c77592a49e164075be633293b6f30400b68f0e48a62fc9128b9c1a5b21fc94260ea8bfd85a7aa95c4da1b994513cad0cc886389d1ecc811338eb77c4b3db8f01086791faf4fe2fc43a37ec623258251ff6b836e8d9489a8b5906a5f77595e2052374d965a32df68b33a6e5ad0c04c6d05a8f3674e8800dde4f720254302bf60c62dad5c4fcfc71dbce34767cc64255404bf5ae1066826994888cd01716095f05eb0211427daeba8f523b282e520675e76e1ace2368983c54caee8d347ac6e02d6d12eb759706ea395f57e741f4ad4f97fb0cb03453459d59c703decef262540000000105cd6220b03e98bce2c01e6b63e14df07b002c5b03a0653abc424ef2a9fc0cb51e9ae8a883c3318eb93e4c1446138108719ef3fe045b7312187efa56150ea593" + "vkey": "0x007f9f0f59840d09b9a754b516d6716ec30e45eb6a6423c3a3b51f6c84f955c0", + "publicValues": "0x420000000000000030783131323438633764376631386137373236663063373537343662643434396530373831363663373066396433383838663665623034353132653630303362326342000000000000003078366531393061626164656331333862366535393939383935333839363333393839333864623435316134633031336232623135323663623034343533326462339bf49a6a4c000000000000000b000000000000004d45524b4c455f434f4d4d3000000000000000b0f1b60f2db6ccd4c6d4d849c0afd14a0f7bbc32a714e292964b673e818cc1a120000000000000000500000000000000a9", + "proof": "1ec04271341e5d0fc7f48c3fbacd486b524d40b3b19e0f75f7dbdc9d1f8ebbf70080102bb430017a306d564506fca14c0fa1e9a126c98df8684e002f29ff292405997d007800d327226e94108d83640df331abcfaa50ced87b408c819d0528d021b0ef9b2b1260420e6e06a9a8469e4eb314a69e25e4933f2aee49ed9bd4d47823277aec005089be01aeb8bd053ec8870f0e5b1917c4ec209d4c8f723c041054147cd36ecae7021fca75a19935a229e0befa57354b3668e8c6ad5f724078147d27708691794eac0d3a8ce242e9e9f6dd66f0c941d5b0d76d9efb99a66d461e5716aff075050fe133729c2a4bf175a522294a478563b3b29e74626b6810c2d5761f0b1f4eccb9880e7926964f6db4fd75ea3b7e4afc697a19c75a9553b2c0a01a2ff3aa399b0fcb0f83c54c7073778b38677336be2de36c6cd10de457c6740b1c06aafc946d7894fd527eaadfa794be9e3d153bc11489fff59aeae6ee66c6bf9518a74db500fbdffc13344f2fa7a5242f54447d19fdee215e15c4b859cf12da9511857b2a23449b2a5dbb0933230e747c9c47a06beae8b241811bf103648788c51fdfb6e1fecfe711ba77f9b9858f4ebb644fff23982bd709dff0730cac62613b280a810d2ddeea23bb5f7057e3afadfaed4ea1fbf76a9aadd13f89147204e5531068f9a5717c2aefb82f602b7e973e08050d1bc29f6eacb86dc81edfa318e14a00000007289dc6193014965a8732a20549a7fac372e464e5a01a4e9106480e84b9342b9913c692a9e8d0296f221c2a56568cb0bcf98b01548b99791384bc385ed2ac14242dd02f3416fc9cae3793919843323d6e8c59dce11447cd0dc176814c923d22511d1c7a7830b989b31131aa7ef6010c51ac2a1041ac2ea0f60201bda77906c3991f93d4c18aaa387b0f20a25cb0458fae039b057307374fe4198ec71520f0fd2219e59239a3e4de757ec5e990d4c0d36ce4bff56edb29cf49411a636a0f2a1dc12bdd2c482327044c2bdecee2522250cf61c27f21ae108b995341deb1a5205e831362b4529dde7d98c147bfd8e7d4ca83e9854e0c1d501b9fd1a25ae40623c64f2b6d3b4a79c9106ab1e5fb06763b4750152ebfae0718f51fd08e374e2bd2c44f1692ea9d77f0d4544e29351c1a6b4c752f59bb3bdab7d19c0ea64175706f32b8000000012673d948555179a323521d42028fa13178699cd0fe9e1ae0673aa52e0215f8711243b84feea6386417a458d9364e6803f3262dd8c3a8aaadbe0dc5aa7fc5bed5" } \ No newline at end of file From 5aafaef8286f9adbc3f0f06a459afb1bff76d98c Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 10:52:31 +0800 Subject: [PATCH 3/6] update contracts and use sp1 v1.1.0 --- justfile | 2 +- sp1/contracts/lib/sp1-contracts | 2 +- .../{Fibonacci.sol => EspressoDerivation.sol} | 21 +++++++-------- ...bonacci.t.sol => EspressoDerivation.t.sol} | 26 +++++++------------ sp1/program/Cargo.toml | 2 +- sp1/script/Cargo.toml | 4 +-- 6 files changed, 24 insertions(+), 33 deletions(-) rename sp1/contracts/src/{Fibonacci.sol => EspressoDerivation.sol} (55%) rename sp1/contracts/test/{Fibonacci.t.sol => EspressoDerivation.t.sol} (60%) diff --git a/justfile b/justfile index c6e1a13..81498db 100644 --- a/justfile +++ b/justfile @@ -25,4 +25,4 @@ default: # Test SP1 contracts @sp1-test-contracts: echo "Testing SP1 contracts" - cd sp1/contracts && forge test -v + cd sp1/contracts && forge test -vv diff --git a/sp1/contracts/lib/sp1-contracts b/sp1/contracts/lib/sp1-contracts index 73c2a8d..ef134b7 160000 --- a/sp1/contracts/lib/sp1-contracts +++ b/sp1/contracts/lib/sp1-contracts @@ -1 +1 @@ -Subproject commit 73c2a8df0c816bf743e9d960e7b14b8e37635578 +Subproject commit ef134b7c141e03bb8a8854697422f770cc26dc74 diff --git a/sp1/contracts/src/Fibonacci.sol b/sp1/contracts/src/EspressoDerivation.sol similarity index 55% rename from sp1/contracts/src/Fibonacci.sol rename to sp1/contracts/src/EspressoDerivation.sol index b477a3f..22f2e82 100644 --- a/sp1/contracts/src/Fibonacci.sol +++ b/sp1/contracts/src/EspressoDerivation.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.20; import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol"; /// @title Fibonacci. -/// @author Succinct Labs +/// @author Espresso System /// @notice This contract implements a simple example of verifying the proof of a computing a /// fibonacci number. -contract Fibonacci { +contract EspressoDerivation { /// @notice The address of the SP1 verifier contract. /// @dev This can either be a specific SP1Verifier for a specific version, or the /// SP1VerifierGateway which can be used to verify proofs for any version of SP1. @@ -15,24 +15,21 @@ contract Fibonacci { /// https://github.com/succinctlabs/sp1-contracts/tree/main/contracts/deployments address public verifier; - /// @notice The verification key for the fibonacci program. - bytes32 public fibonacciProgramVkey; + /// @notice The verification key for the program. + bytes32 public vkey; - constructor(address _verifier, bytes32 _fibonacciProgramVkey) { + constructor(address _verifier, bytes32 _vkey) { verifier = _verifier; - fibonacciProgramVkey = _fibonacciProgramVkey; + vkey = _vkey; } - /// @notice The entrypoint for verifying the proof of a fibonacci number. + /// @notice Verify a derivation proof from a batch of Espresso blocks. /// @param proof The encoded proof. /// @param publicValues The encoded public values. - function verifyFibonacciProof(bytes calldata proof, bytes calldata publicValues) + function verifyDerivationProof(bytes calldata proof, bytes calldata publicValues) public view - returns (uint32, uint32, uint32) { - ISP1Verifier(verifier).verifyProof(fibonacciProgramVkey, publicValues, proof); - (uint32 n, uint32 a, uint32 b) = abi.decode(publicValues, (uint32, uint32, uint32)); - return (n, a, b); + ISP1Verifier(verifier).verifyProof(vkey, publicValues, proof); } } diff --git a/sp1/contracts/test/Fibonacci.t.sol b/sp1/contracts/test/EspressoDerivation.t.sol similarity index 60% rename from sp1/contracts/test/Fibonacci.t.sol rename to sp1/contracts/test/EspressoDerivation.t.sol index 4038603..6ce9491 100644 --- a/sp1/contracts/test/Fibonacci.t.sol +++ b/sp1/contracts/test/EspressoDerivation.t.sol @@ -3,23 +3,20 @@ pragma solidity ^0.8.20; import {Test, console} from "forge-std/Test.sol"; import {stdJson} from "forge-std/StdJson.sol"; -import {Fibonacci} from "../src/Fibonacci.sol"; -import {SP1Verifier} from "@sp1-contracts/v1.0.8-testnet/SP1Verifier.sol"; +import {EspressoDerivation} from "../src/EspressoDerivation.sol"; +import {SP1Verifier} from "@sp1-contracts/v1.1.0/SP1Verifier.sol"; struct SP1ProofFixtureJson { - uint32 a; - uint32 b; - uint32 n; - bytes proof; bytes publicValues; + bytes proof; bytes32 vkey; } -contract FibonacciTest is Test { +contract EspressoDerivationTest is Test { using stdJson for string; address verifier; - Fibonacci public fibonacci; + EspressoDerivation public es; function loadFixture() public view returns (SP1ProofFixtureJson memory) { string memory root = vm.projectRoot(); @@ -33,24 +30,21 @@ contract FibonacciTest is Test { SP1ProofFixtureJson memory fixture = loadFixture(); verifier = address(new SP1Verifier()); - fibonacci = new Fibonacci(verifier, fixture.vkey); + es = new EspressoDerivation(verifier, fixture.vkey); } - function test_ValidFibonacciProof() public view { + function test_ValidDerivationProof() public view { SP1ProofFixtureJson memory fixture = loadFixture(); - (uint32 n, uint32 a, uint32 b) = fibonacci.verifyFibonacciProof(fixture.proof, fixture.publicValues); - assert(n == fixture.n); - assert(a == fixture.a); - assert(b == fixture.b); + es.verifyDerivationProof(fixture.proof, fixture.publicValues); } - function testFail_InvalidFibonacciProof() public view { + function testFail_InvalidDerivationProof() public view { SP1ProofFixtureJson memory fixture = loadFixture(); // Create a fake proof. bytes memory fakeProof = new bytes(fixture.proof.length); - fibonacci.verifyFibonacciProof(fakeProof, fixture.publicValues); + es.verifyDerivationProof(fakeProof, fixture.publicValues); } } diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 20ca435..3dacb0a 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -8,4 +8,4 @@ committable = { workspace = true } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index a58ee46..c9e2238 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -20,8 +20,8 @@ jf-vid = { workspace = true } rand = "0.8" serde = { workspace = true } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } tracing = "0.1.40" [build-dependencies] -sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } From 58ce16dfd296875e1af9a88a53fab83589ebf2e6 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 04:21:40 +0000 Subject: [PATCH 4/6] fix fixture writer and contract logic --- Cargo.lock | 65 +++++++++++---------- sp1/contracts/src/fixtures/fixture.json | 4 +- sp1/contracts/test/EspressoDerivation.t.sol | 2 +- sp1/script/Cargo.toml | 1 + sp1/script/src/bin/prove.rs | 4 +- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a279b13..42c421c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1660,6 +1660,7 @@ dependencies = [ "clap", "committable", "espresso-derivation-utils", + "hex", "jf-merkle-tree", "jf-pcs", "jf-vid", @@ -2839,7 +2840,7 @@ dependencies = [ [[package]] name = "jf-pcs" version = "0.1.0" -source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#c602296feb05f524b0c956e45c81f65892a768bc" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#dde2c69bf818685a7e3dee78f51c049d5e435c92" dependencies = [ "ark-bn254", "ark-ec", @@ -2939,7 +2940,7 @@ dependencies = [ [[package]] name = "jf-vid" version = "0.1.0" -source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#c602296feb05f524b0c956e45c81f65892a768bc" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#dde2c69bf818685a7e3dee78f51c049d5e435c92" dependencies = [ "anyhow", "ark-ec", @@ -5128,8 +5129,8 @@ dependencies = [ [[package]] name = "sp1-build" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "cargo_metadata", @@ -5139,8 +5140,8 @@ dependencies = [ [[package]] name = "sp1-core" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "arrayref", @@ -5201,8 +5202,8 @@ dependencies = [ [[package]] name = "sp1-derive" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "proc-macro2", "quote", @@ -5211,8 +5212,8 @@ dependencies = [ [[package]] name = "sp1-helper" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "cargo_metadata", "chrono", @@ -5221,8 +5222,8 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -5232,8 +5233,8 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -5245,8 +5246,8 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -5282,8 +5283,8 @@ dependencies = [ [[package]] name = "sp1-recursion-circuit" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "bincode", "itertools 0.13.0", @@ -5305,8 +5306,8 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "backtrace", "itertools 0.13.0", @@ -5330,8 +5331,8 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "arrayref", "backtrace", @@ -5365,8 +5366,8 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "proc-macro2", "quote", @@ -5375,8 +5376,8 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -5400,8 +5401,8 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "itertools 0.13.0", "p3-air", @@ -5429,8 +5430,8 @@ dependencies = [ [[package]] name = "sp1-sdk" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "alloy-sol-types", "anyhow", @@ -5472,8 +5473,8 @@ dependencies = [ [[package]] name = "sp1-zkvm" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "bincode", "cfg-if", diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index 217ba16..c7e236e 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,5 +1,5 @@ { - "vkey": "0x007f9f0f59840d09b9a754b516d6716ec30e45eb6a6423c3a3b51f6c84f955c0", + "vkey": "0x00878da947d29df42252238b58a0e5f3dc5c1ba90c3b7616013772bcb85f514c", "publicValues": "0x420000000000000030783131323438633764376631386137373236663063373537343662643434396530373831363663373066396433383838663665623034353132653630303362326342000000000000003078366531393061626164656331333862366535393939383935333839363333393839333864623435316134633031336232623135323663623034343533326462339bf49a6a4c000000000000000b000000000000004d45524b4c455f434f4d4d3000000000000000b0f1b60f2db6ccd4c6d4d849c0afd14a0f7bbc32a714e292964b673e818cc1a120000000000000000500000000000000a9", - "proof": "1ec04271341e5d0fc7f48c3fbacd486b524d40b3b19e0f75f7dbdc9d1f8ebbf70080102bb430017a306d564506fca14c0fa1e9a126c98df8684e002f29ff292405997d007800d327226e94108d83640df331abcfaa50ced87b408c819d0528d021b0ef9b2b1260420e6e06a9a8469e4eb314a69e25e4933f2aee49ed9bd4d47823277aec005089be01aeb8bd053ec8870f0e5b1917c4ec209d4c8f723c041054147cd36ecae7021fca75a19935a229e0befa57354b3668e8c6ad5f724078147d27708691794eac0d3a8ce242e9e9f6dd66f0c941d5b0d76d9efb99a66d461e5716aff075050fe133729c2a4bf175a522294a478563b3b29e74626b6810c2d5761f0b1f4eccb9880e7926964f6db4fd75ea3b7e4afc697a19c75a9553b2c0a01a2ff3aa399b0fcb0f83c54c7073778b38677336be2de36c6cd10de457c6740b1c06aafc946d7894fd527eaadfa794be9e3d153bc11489fff59aeae6ee66c6bf9518a74db500fbdffc13344f2fa7a5242f54447d19fdee215e15c4b859cf12da9511857b2a23449b2a5dbb0933230e747c9c47a06beae8b241811bf103648788c51fdfb6e1fecfe711ba77f9b9858f4ebb644fff23982bd709dff0730cac62613b280a810d2ddeea23bb5f7057e3afadfaed4ea1fbf76a9aadd13f89147204e5531068f9a5717c2aefb82f602b7e973e08050d1bc29f6eacb86dc81edfa318e14a00000007289dc6193014965a8732a20549a7fac372e464e5a01a4e9106480e84b9342b9913c692a9e8d0296f221c2a56568cb0bcf98b01548b99791384bc385ed2ac14242dd02f3416fc9cae3793919843323d6e8c59dce11447cd0dc176814c923d22511d1c7a7830b989b31131aa7ef6010c51ac2a1041ac2ea0f60201bda77906c3991f93d4c18aaa387b0f20a25cb0458fae039b057307374fe4198ec71520f0fd2219e59239a3e4de757ec5e990d4c0d36ce4bff56edb29cf49411a636a0f2a1dc12bdd2c482327044c2bdecee2522250cf61c27f21ae108b995341deb1a5205e831362b4529dde7d98c147bfd8e7d4ca83e9854e0c1d501b9fd1a25ae40623c64f2b6d3b4a79c9106ab1e5fb06763b4750152ebfae0718f51fd08e374e2bd2c44f1692ea9d77f0d4544e29351c1a6b4c752f59bb3bdab7d19c0ea64175706f32b8000000012673d948555179a323521d42028fa13178699cd0fe9e1ae0673aa52e0215f8711243b84feea6386417a458d9364e6803f3262dd8c3a8aaadbe0dc5aa7fc5bed5" + "proof": "0xc430ff7f219349a8600513c3755bbd0c886782164b318efa39e3529e85483bff3917bb2e101bc0b36d479ca6e981db09604f068a0a83ff893d3935d9bf9d12aab25d8663123754cdafa3f98a1b5efd2e18571e8fb5753a070806624798a6cdf46a27854e094355079660660cb639020880645aa8b41ea1eea4244406cc383ffe862df8780173f12d2a568a652ca76e0aa38e440d81b2c58dbdb682a321aa7621b7b44fd8085dee1e045083280914b75684032ad21a3af762d4910f81a5c233d3af2b715b0d23a75746a231e3b57abeea2e7cd782a46a62a6ee1cb467640353a7c4723d5a27f6921fc70896c961c7633b8be57add2347ac13933f4842127f7910a4af15ef18035847bb3b7e382813725c7d62c70d425d179210ce654ed544330c4db2af0b0d44ecf0b9f81917da1ff791072fce1aba9c9ea559b435e4fa45b21a51665a80040fd1d1ad3efa0a21dad1ccc1a0bf7f5fed07094a04c80bade33cfe762e094f2ecd0d40107d44cdbc471f9491c4ec5da06e26a9349f421ae26f787cf515096022ca5d04207eddf7b30cb382e468fc94beffabb6c65ac3b7881fae3c91f5109822a430f9ca7f27185a908eb120c3785953979d1291a5fc6fc7f6ca2d4c5883832805092c0c9ad55c55cd2c98a0779ba3ac02ecf5c5f006d218d6bb84705af928240c8913a507604ccb91e0b3d54313b398eade0ff8286160a79c3c40570cba2202d690b34d2f4dd5fcc4bc1a75c73bc0e2d64de06b5a3ffa12389710bbb72b662fd0d98b4492bc742ce0fa71bb32f44b0100ff967bada30744e09476cf8e89002429a51df17ed41a03b8f2db372b25e21d935c3b4fc885dd79c3b9a9fd9770fb2df69f6685f85814eaa556249f83e98f01c04d450e1c4ad0c47d95be33acd5ba1d57a4cabe29262c308678089bcf184326b98ffa0e30e590c118374571f222b62011de8579fdde9a9a51e4f1e74a4fb2dfa6673be195ec44b1dbd409639730f7172a487e987d128011ffdf13eefbea13796b9b5c5f476f2b0e34ac4ca39c359b09689b4b45ff42f441c30984fbb026c3a0b5cf5aeeb675e461f747f64ae3ecc707ceb03c6b5f79da885d35c14aa65afa735dfd68dd8289d0ba63a71690e0efe323ea08b4b6aa5b20ca812eb5d2805b327bfbbcc74da6b5ef3d31ba106ceea46c1f9375edf8844b0b78bfc72a74f66b4c25a044d9585c2c02e62bab5893e9b21e" } \ No newline at end of file diff --git a/sp1/contracts/test/EspressoDerivation.t.sol b/sp1/contracts/test/EspressoDerivation.t.sol index 6ce9491..1c2150c 100644 --- a/sp1/contracts/test/EspressoDerivation.t.sol +++ b/sp1/contracts/test/EspressoDerivation.t.sol @@ -7,8 +7,8 @@ import {EspressoDerivation} from "../src/EspressoDerivation.sol"; import {SP1Verifier} from "@sp1-contracts/v1.1.0/SP1Verifier.sol"; struct SP1ProofFixtureJson { - bytes publicValues; bytes proof; + bytes publicValues; bytes32 vkey; } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index c9e2238..a8d3d7b 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -14,6 +14,7 @@ bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } espresso-derivation-utils = { path = "../utils" } +hex = "0.4.3" jf-merkle-tree = { workspace = true } jf-pcs = { workspace = true } jf-vid = { workspace = true } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index a4943d5..b608c8d 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -251,8 +251,8 @@ fn create_plonk_fixture(proof: &SP1ProofWithPublicValues, vk: &SP1VerifyingKey) // Create the testing fixture so we can test things end-to-end. let fixture = ProofFixture { vkey: vk.bytes32().to_string(), - public_values: proof.public_values.raw(), - proof: proof.raw(), + public_values: format!("0x{}", hex::encode(proof.public_values.as_slice())), + proof: format!("0x{}", hex::encode(proof.bytes())), }; // The verification key is used to verify that the proof corresponds to the From 1c1069a1cd4b80673e737116ef55ecb89b8dc2cc Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 04:22:59 +0000 Subject: [PATCH 5/6] add missing cargo-sort --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index e975541..cde4c2a 100644 --- a/flake.nix +++ b/flake.nix @@ -119,6 +119,7 @@ # Rust nightlyRustToolchain + cargo-sort ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ]; shellHook = '' From d9bf339d8e17660b46966d25dde0a323239e29b7 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Wed, 28 Aug 2024 09:41:57 -0400 Subject: [PATCH 6/6] Update README.md Co-authored-by: Anders Konring --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4a9d82..61535af 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme -- `block_derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. +- `block_derivation_proofs: Vec<(Range, BlockDerivationProof)>`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment`