-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Solidity verification of light client proofs with Plonk #28
Conversation
0822881
to
172f620
Compare
172f620
to
0941c5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good! I haven't tested it locally yet but the code seems good to me.
We might want to merge argumentcomputer/sphinx#49 before this PR since that will require us to update the circuit artifacts
Docs are still a TODO, but that's fine for now
import {Inclusion} from "../src/Inclusion.sol"; | ||
import {EpochChange} from "../src/EpochChange.sol"; | ||
|
||
struct SP1ProofFixtureJson { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We should eventually rename this to SphinxProofFixtureJson
Yes, adding documentation, renaming SP1 -> Sphinx (in sphinx-contracts as well) and introducing CI for the Solidity testing are still a TODO |
* feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx
* feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx
* feat: Update Sphinx and replace Groth16 with Plonk (#23) * feat: Solidity verification of light client proofs with Plonk (#28) * feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx * chore: Add README for Solidity verification * feat: Add CI configuration for Solidity * ci: solidity tests on all PR Signed-off-by: Thomas Chataigner <[email protected]> * chore: update programs Signed-off-by: Thomas Chataigner <[email protected]> * docs: move documentation to mdBook Signed-off-by: Thomas Chataigner <[email protected]> --------- Signed-off-by: Thomas Chataigner <[email protected]> Co-authored-by: wwared <[email protected]> Co-authored-by: Thomas Chataigner <[email protected]>
* feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx
* feat: Update Sphinx and replace Groth16 with Plonk (#23) * feat: Solidity verification of light client proofs with Plonk (#28) * feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx * chore: Add README for Solidity verification * feat: Add CI configuration for Solidity * ci: solidity tests on all PR Signed-off-by: Thomas Chataigner <[email protected]> * chore: update programs Signed-off-by: Thomas Chataigner <[email protected]> * docs: move documentation to mdBook Signed-off-by: Thomas Chataigner <[email protected]> --------- Signed-off-by: Thomas Chataigner <[email protected]> Co-authored-by: wwared <[email protected]> Co-authored-by: Thomas Chataigner <[email protected]>
* feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx
* feat: Update Sphinx and replace Groth16 with Plonk (#23) * feat: Solidity verification of light client proofs with Plonk (#28) * feat: Add scaffolding for Plonk verification in Solidity * feat: Add Plonk contract * tests: Add more negative Solidity testing * feat: Add Rust program for Solidity contract generating * chore: Update Cargo.lock * chore: Update Plonk contract according to 'e48c01ec' tag of Sphinx * chore: Formatting * feat: Introduce downloading from our AWS private bucket * feat: Update Foundry project to use sphinx-contracts dependency * chore: Rename SP1 -> Sphinx * chore: Add README for Solidity verification * feat: Add CI configuration for Solidity * ci: solidity tests on all PR Signed-off-by: Thomas Chataigner <[email protected]> * chore: update programs Signed-off-by: Thomas Chataigner <[email protected]> * docs: move documentation to mdBook Signed-off-by: Thomas Chataigner <[email protected]> --------- Signed-off-by: Thomas Chataigner <[email protected]> Co-authored-by: wwared <[email protected]> Co-authored-by: Thomas Chataigner <[email protected]>
This PR adds Foundry project for verification the Plonk proofs of light client programs (epoch-change and inclusion) using Solidity contract from Sphinx artefacts.
The
solidity
folder now contains two subfolders:contracts
(Foundry project with Solidity code);fixture-generator
(Rust program for generating a so-called fixture - a JSON file with the encoded proof, public values and vk necessary for the verification).Currently, executing Solidity verification should give tentatively following:
Two positive tests that demonstrate Plonk verification of epoch-change and inclusion proofs at ~318k gas are successful and two negative tests if fake proofs are used are successful.
There are also additionally four negative tests - when fake public values or wrong vk are used - that are currently failed. That means essentially that current version of Plonk contract (
e48c01ec
tag from Sphinx) allows submitting those fake input. I have checked that in recent versions of SP1 (in v1.0.7-testnet) it is fixed, so we in theory should get those tests passing once forward porting latest SP1 changes to sphinx.If you want to use custom fixture, you can regenerate it with
fixture-generator
program:This will run either inclusion or epoch_change proving (depending on
--program
flag value) and will end up with fixture JSON file replaced the current one inaptos/solidity/contracts/src/plonk_fixtures
.We have set own private AWS S3 bucket (
s3://sphinx-plonk-params
) for Plonk parameters distribution. Anyone from us can use it via requesting the access from @samuelburnham. Alsoaws
cli needs to be installed. I uploaded the valid artefacts fore48c01ec
tag of Sphinx to AWS, so with recent commit they can now be downloaded by artifacts program from sphinx-contracts repository.