Skip to content
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

fix: docs #9

Merged
merged 8 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ target/

test_serialized_fixture.bin

.DS_Store
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions example/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ use solana_program::entrypoint;
#[cfg(not(feature = "no-entrypoint"))]
entrypoint!(process_instruction);

// Derived by running `vk.bytes32()` on the program's vkey.
const FIBONACCI_VKEY_HASH: [u8; 32] =
hex_literal::hex!("0083e8e370d7f0d1c463337f76c9a60b62ad7cc54c89329107c92c1e62097872");
#[cfg(not(doctest))]
/// Derived as follows:
///
/// ```
/// let client = sp1_sdk::ProverClient::new();
/// let (pk, vk) = client.setup(YOUR_ELF_HERE);
/// let vkey_hash = vk.bytes32();
/// ```
const FIBONACCI_VKEY_HASH: &str =
"0x0083e8e370d7f0d1c463337f76c9a60b62ad7cc54c89329107c92c1e62097872";

/// The instruction data for the program.
#[derive(BorshDeserialize, BorshSerialize)]
Expand Down
9 changes: 8 additions & 1 deletion example/script/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ struct Cli {
prove: bool,
}

/// The ELF binary of the SP1 program.
const ELF: &[u8] = include_bytes!("../../sp1-program/elf/riscv32im-succinct-zkvm-elf");

/// Invokes the solana program using Solana Program Test.
async fn run_verify_instruction(groth16_proof: SP1Groth16Proof) {
let program_id = Pubkey::new_unique();

Expand Down Expand Up @@ -62,7 +64,12 @@ async fn main() {
if args.prove {
// Initialize the prover client
let client = ProverClient::new();
let (pk, _vk) = client.setup(ELF);
let (pk, vk) = client.setup(ELF);

println!(
"Program Verification Key Bytes {:?}",
sp1_sdk::HashableKey::bytes32(&vk)
);

// In our SP1 program, compute the 20th fibonacci number.
let mut stdin = SP1Stdin::new();
Expand Down
2 changes: 2 additions & 0 deletions verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ ark-serialize = "0.4.2"
ark-ff = "0.4.2"
groth16-solana = { git = "https://github.com/sp1-patches/groth16-solana", branch = "patch-v0.0.3" }
thiserror = "1.0.63"
hex = "0.4.3"

[dev-dependencies]
sp1-sdk = { version = "2.0.0", default-features = false}
hex-literal = "0.3.1"
num-traits = { version = "0.2.19" }
Loading