From a9ddd4c2b8ce3d2f9250f0211c9bdab41312e3f9 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 30 Oct 2024 12:29:58 -0700 Subject: [PATCH] readme lint --- README.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 27bf7b8..7384249 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This crate verifies Groth16 proofs generated with SP1, leveraging Solana's BN254 > [!CAUTION] > -> This repository is under active development and is not yet ready for production use. +> This repository is not audited for production use. ## Repository Overview @@ -21,14 +21,15 @@ The `sp1-solana` library itself is in the [`verifier`](verifier) directory. [`ex - Rust - Edge Solana CLI - - Install with the following command: + - Install with the following command: + ```shell sh -c "$(curl -sSfL https://release.anza.xyz/edge/install)" ``` ## Example usage -The [example](./example) demonstrates how to use the `sp1-solana` crate to verify a proof generated by SP1 on Solana. +The [example](./example) demonstrates how to use the `sp1-solana` crate to verify a proof generated by SP1 on Solana. Running the script will perform the following steps: 1. Load an SP1 [`SP1ProofWithPublicValues`](https://docs.rs/sp1-sdk/2.0.0/sp1_sdk/proof/struct.SP1ProofWithPublicValues.html) @@ -36,10 +37,10 @@ from the pre-generated proof [`fibonacci_proof.bin`](../proofs/fibonacci_proof.b proves that the 20th fibonacci number is 6765. Optionally, this proof can be freshly generated from the [`sp1-program`](../sp1-program). -2. Extract the proof and public inputs from the `SP1ProofWithPublicValues`. +2. Extract the proof and public inputs from the `SP1ProofWithPublicValues`. -* The `proof` is the Groth16 proof, serialized in [SP1's standard format](https://docs.rs/sp1-sdk/2.0.0/sp1_sdk/proof/struct.SP1ProofWithPublicValues.html#method.bytes) -* The `sp1_public_inputs` are the public inputs to the underlying sp1 program. +- The `proof` is the Groth16 proof, serialized in [SP1's standard format](https://docs.rs/sp1-sdk/2.0.0/sp1_sdk/proof/struct.SP1ProofWithPublicValues.html#method.bytes) +- The `sp1_public_inputs` are the public inputs to the underlying sp1 program. Here is a snippet from the [example script](./example/script/src/main.rs) that demonstrates this. @@ -66,10 +67,10 @@ let groth16_proof = SP1Groth16Proof { run_verify_instruction(groth16_proof).await; ``` -3. Using the [`solana-program-test`](https://docs.rs/solana-program-test/latest/solana_program_test/) framework, send the `SP1Groth16Proof` to the +3. Using the [`solana-program-test`](https://docs.rs/solana-program-test/latest/solana_program_test/) framework, send the `SP1Groth16Proof` to the [`fibonacci-verifier-contract`](./example/program). This smart contract will verify the proof using the `sp1-solana` crate against the fibonacci SP1 program vkey and print out the public inputs. Here is a snippet that demonstrates -how to perform the verification and read the public inputs on chain. +how to perform the verification and read the public inputs on chain. ```rust // Derived by running `vk.bytes32()` on the program's vkey. @@ -110,14 +111,14 @@ pub fn process_instruction( ### Running the script -To load the pregenerated proof and verify it on `solana-program-test`, run the following commands. +To load the pregenerated proof and verify it on `solana-program-test`, run the following commands. ```shell cd script RUST_LOG=info cargo run --release ``` -To generate a fresh proof from the program in `sp1-program`, run the following commands. +To generate a fresh proof from the program in `sp1-program`, run the following commands. ```shell cd script @@ -128,7 +129,7 @@ RUST_LOG=info cargo run --release -- --prove Run the following commands to build and deploy the example solana program to devnet. These commands assume you've already created a Solana keypair locally, and you have the edge solana CLI tools. -Request [devnet sol](https://faucet.solana.com/) as necessary. +Request [devnet sol](https://faucet.solana.com/) as necessary. ```shell cd example/program @@ -143,8 +144,9 @@ Add `sp1-solana` to your `Cargo.toml`: ```toml [dependencies] -sp1-solana = { git = "https://github.com/succinctlabs/groth16-solana" } +sp1-solana = { git = "https://github.com/succinctlabs/sp1-solana" } ``` ## Acknowledgements + This crate uses the [`groth16-solana`](https://github.com/Lightprotocol/groth16-solana/) crate from Light Protocol Labs for the Groth16 proof verification, and the [`ark-bn254`](https://github.com/arkworks-rs/algebra) crate for the elliptic curve operations.