Skip to content

Commit da00e80

Browse files
committed
second pass, v2 upgrade
1 parent 4734673 commit da00e80

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

src/content/data-streams/tutorials/solana-onchain-report-verification.mdx

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ Before you begin, you should have:
8686

8787
To complete this tutorial, you'll need:
8888

89-
- **Rust and Cargo**: Install the latest version using [rustup](https://rustup.rs/). Run <CopyText text="rustc --version" code/> to verify your installation.
89+
- **Rust and Cargo**: Install Rust 1.79.0 or later using [rustup](https://rustup.rs/). Run <CopyText text="rustc --version" code/> to verify your installation.
9090

91-
- **Solana CLI tools**: Install the latest version following the [official guide](https://docs.solana.com/cli/install-solana-cli-tools). Run <CopyText text="solana --version" code/> to verify your installation.
91+
- **Solana CLI tools**: Install Solana CLI 2.0 or later following the [official guide](https://docs.solana.com/cli/install-solana-cli-tools). Run <CopyText text="solana --version" code/> to verify your installation.
9292

93-
- **Anchor Framework**: Follow the [official installation guide](https://www.anchor-lang.com/docs/installation). Run <CopyText text="anchor --version" code /> to verify your installation.
93+
- **Anchor Framework**: Install Anchor 0.31.0 or later following the [official installation guide](https://www.anchor-lang.com/docs/installation). Run <CopyText text="anchor --version" code /> to verify your installation.
94+
95+
**Important**: Using mismatched Anchor versions between your program and client can cause type incompatibilities and runtime errors.
9496

9597
- **Node.js and npm**: [Install Node.js 20 or later](https://nodejs.org/). Verify your installation with <CopyText text="node --version" code/>.
9698

@@ -150,11 +152,9 @@ In your program's manifest file (`programs/example_verify/Cargo.toml`), add the
150152

151153
```toml
152154
[dependencies]
153-
chainlink_solana_data_streams = { git = "https://github.com/smartcontractkit/chainlink-solana", branch = "develop" }
154-
chainlink_data_streams_report = { git = "https://github.com/smartcontractkit/data-streams-sdk.git" }
155-
156-
# Additional required dependencies
157-
anchor-lang = "0.29.0"
155+
anchor-lang = "0.31.0"
156+
chainlink_solana_data_streams = { git = "https://github.com/smartcontractkit/chainlink-data-streams-solana", branch = "feat/verifier-sdk-v2-solana" }
157+
chainlink-data-streams-report = "1.0.3"
158158
```
159159

160160
#### 4. Write the program
@@ -165,14 +165,15 @@ Navigate to your program main file (`programs/example_verify/src/lib.rs`). This
165165
// Import required dependencies for Anchor, Solana, and Data Streams
166166
use anchor_lang::prelude::*;
167167
use anchor_lang::solana_program::{
168-
instruction::Instruction,
169168
program::{get_return_data, invoke},
170169
pubkey::Pubkey,
170+
instruction::Instruction,
171171
};
172172
// NOTE: Adjust for your report version
173173
use chainlink_data_streams_report::report::v3::ReportDataV3;
174174
use chainlink_solana_data_streams::VerifierInstructions;
175175

176+
176177
declare_id!("<YOUR_PROGRAM_ID>");
177178

178179
#[program]
@@ -281,27 +282,13 @@ Note how the `VerifierInstructions::verify` helper method automatically handles
281282
282283
#### 5. Deploy your program
283284

284-
1. Run the following command to build your program:
285+
1. Build your program:
285286

286287
```bash
287288
anchor build
288289
```
289290

290-
**Note**: If you run into this error, set the `version` field at the top of your `cargo.lock` file to `3`.
291-
292-
```bash
293-
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
294-
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
295-
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
296-
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
297-
warning: .../example_verify/programs/example_verify/Cargo.toml: unused manifest key: dependencies.data-streams-report.subdir
298-
error: failed to parse lock file at: .../example_verify/Cargo.lock
299-
300-
Caused by:
301-
lock file version 4 requires `-Znext-lockfile-bump`
302-
```
303-
304-
1. Deploy your program to a Solana cluster (devnet in this example) using:
291+
1. Deploy your program to devnet:
305292

306293
```bash
307294
anchor deploy
@@ -347,11 +334,7 @@ In this section, you'll write a client script to interact with your deployed pro
347334
anchor.setProvider(provider)
348335

349336
// Initialize your program using the IDL and your program ID
350-
const program = new Program<ExampleVerify>(
351-
require("../target/idl/example_verify.json"),
352-
"<YOUR_PROGRAM_ID>",
353-
provider
354-
)
337+
const program = new Program<ExampleVerify>(require("../target/idl/example_verify.json"), provider)
355338

356339
// Convert the hex string to a Uint8Array
357340
// This is an example report payload for a crypto stream
@@ -455,13 +438,20 @@ In this section, you'll write a client script to interact with your deployed pro
455438

456439
**Note**: The Program IDs and Access Controller Accounts are available on the [Stream Addresses](/data-streams/crypto-streams) page.
457440

458-
1. Install the required dependencies for your project. Make sure the client-side `@coral-xyz/anchor` version matches your program's `anchor-lang` version (0.29.0):
441+
1. Add the `snappy` dependency to your project:
442+
443+
```bash
444+
yarn add snappy
445+
```
446+
447+
Also ensure you have the required TypeScript dependencies:
459448

460449
```bash
461-
yarn add @coral-xyz/[email protected] @solana/web3.js snappy
450+
yarn add @solana/web3.js
451+
yarn add -D ts-node typescript @types/node
462452
```
463453

464-
**Important**: Using mismatched Anchor versions between your program and client can cause type incompatibilities and runtime errors.
454+
**Note**: `snappy` is a compression library used to compress the report data before sending it to the verifier.
465455

466456
1. Execute the test script to interact with your program:
467457

@@ -501,7 +491,7 @@ In this section, you'll write a client script to interact with your deployed pro
501491

502492
#### Program Derived Addresses (PDAs)
503493

504-
The verification process relies on two important PDAs that are handled automatically by the [Chainlink Data Streams Solana SDK](https://github.com/smartcontractkit/chainlink-solana/tree/develop/contracts/crates/chainlink-solana-data-streams):
494+
The verification process relies on two important PDAs that are handled automatically by the [Chainlink Data Streams Solana SDK](https://github.com/smartcontractkit/chainlink-data-streams-solana):
505495

506496
- **Verifier config account PDA**:
507497
- Derived using the verifier program ID as a seed
@@ -540,13 +530,13 @@ When working with different versions of [Data Stream reports](/data-streams/refe
540530
- For v3 schema (as used in this example):
541531

542532
```rust
543-
use data_streams_report::report::v3::ReportDataV3;
533+
use chainlink_data_streams_report::report::v3::ReportDataV3;
544534
```
545535

546536
- For v8 schema:
547537

548538
```rust
549-
use data_streams_report::report::v8::ReportDataV8;
539+
use chainlink_data_streams_report::report::v8::ReportDataV8;
550540
```
551541

552542
1. **Update the decode function to use the correct schema version.** Examples:

0 commit comments

Comments
 (0)