Skip to content

Commit

Permalink
Update verifier sdk docs
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzni2 committed Feb 8, 2025
1 parent 7308f5e commit 72f6477
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion contracts/crates/chainlink-solana-data-streams/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ let config_account = VerifierInstructions::get_config_pda(&signed_report, verifi
#### Creating Instructions
```rust
use verify_sdk::VerifierInstructions;
use snap::raw::Encoder;

// Reports must be compressed with snappy format prior to being sent to the verifier program
let mut encoder = Encoder::new();
let compressed_report = encoder.compress_vec(&signed_report).expect("Compression failed");

// Create a verify instruction
let ix = VerifierInstructions::verify(
Expand All @@ -28,7 +33,7 @@ let ix = VerifierInstructions::verify(
&access_controller, // Access controller account pubkey
&user, // User account (must be signer)
&config_account, // Report Config PDA derived from report bytes (prevously derived PDA)
signed_report, // Report bytes from Data Streams Off-Chain Server
compressed_report, // Report bytes from Data Streams DON compressed in snappy format
);
```

Expand Down
6 changes: 3 additions & 3 deletions contracts/crates/chainlink-solana-data-streams/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ impl VerifierInstructions {
/// * `program_id` - The public key of the verifier program.
/// * `verifier_account` - The public key of the verifier account. The function [`Self::get_verifier_config_pda`] can be used to calculate this.
/// * `access_controller_account` - The public key of the access controller account.
/// * `user` - The public key of the user - this account must be a signer
/// * `user` - The public key of the user - this account must be a signer.
/// * `report_config_account` - The public key of the report configuration account. The function [`Self::get_config_pda`] can be used to calculate this.
/// * `signed_report` - The signed report data as a vector of bytes. Returned from data streams API/WS
/// * `signed_report` - Report bytes from Data Streams DON compressed in snappy format
///
/// # Returns
///
Expand Down Expand Up @@ -82,7 +82,7 @@ impl VerifierInstructions {
}

/// Helper to compute the report config PDA account. This uses the first 32 bytes of the
/// uncompressed report as the seed. This is validated within the verifier program
/// raw uncompressed report as the seed. This is validated within the verifier program
pub fn get_config_pda(report: &[u8], program_id: &Pubkey) -> Pubkey {
Pubkey::find_program_address(&[&report[..32]], program_id).0
}
Expand Down

0 comments on commit 72f6477

Please sign in to comment.