From 082cff422dddf26573281346e91187f67db2058f Mon Sep 17 00:00:00 2001 From: Yuwen Zhang <yuwen01@gmail.com> Date: Fri, 18 Oct 2024 17:26:43 -0700 Subject: [PATCH] fix: vkey hash (#10) --- README.md | 12 ++++++++++-- example/program/src/lib.rs | 2 +- proofs/fibonacci_proof.bin | Bin 1450 -> 1450 bytes 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 27bf7b8..c7d0543 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,16 @@ 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 [`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. +crate against the fibonacci SP1 program vkey and print out the public inputs. + +> [!NOTE] +> In this example, a Groth16 proof and public values are directly passed into the contract as transaction data. +> In real use cases, this may not be reasonable, since the upper limit for transaction data is 1232 bytes. +> Groth16 proofs themselves are already 260 bytes, and public inputs can potentially be very large. +> See [this article](https://solana.com/developers/courses/program-optimization/lookup-tables) for a discussion +> on how to handle this. + +Here is a snippet that demonstrates how to perform the verification and read the public inputs on chain. ```rust // Derived by running `vk.bytes32()` on the program's vkey. diff --git a/example/program/src/lib.rs b/example/program/src/lib.rs index f713e0e..24b8b7d 100644 --- a/example/program/src/lib.rs +++ b/example/program/src/lib.rs @@ -20,7 +20,7 @@ entrypoint!(process_instruction); /// let vkey_hash = vk.bytes32(); /// ``` const FIBONACCI_VKEY_HASH: &str = - "0x0083e8e370d7f0d1c463337f76c9a60b62ad7cc54c89329107c92c1e62097872"; + "0x0054c0e58911dd8b993c6d8f249aa50a2e523114ec4b7ef9dd355c5f6bfbf3ce"; /// The instruction data for the program. #[derive(BorshDeserialize, BorshSerialize)] diff --git a/proofs/fibonacci_proof.bin b/proofs/fibonacci_proof.bin index 97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