Skip to content

Commit 8d20cae

Browse files
authored
Merge branch 'main' into datastreams-supported-networks-update
2 parents 2b0168d + d7c0ee5 commit 8d20cae

File tree

1 file changed

+23
-34
lines changed

1 file changed

+23
-34
lines changed

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

Lines changed: 23 additions & 34 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", subdir = "contracts/crates/chainlink-solana-data-streams" }
154-
data-streams-report = { git = "https://github.com/smartcontractkit/data-streams-sdk.git", subdir = "rust/crates/report" }
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" }
157+
chainlink-data-streams-report = "1.0.3"
158158
```
159159

160160
#### 4. Write the program
@@ -170,7 +170,7 @@ use anchor_lang::solana_program::{
170170
instruction::Instruction,
171171
};
172172
// NOTE: Adjust for your report version
173-
use data_streams_report::report::v3::ReportDataV3;
173+
use chainlink_data_streams_report::report::v3::ReportDataV3;
174174
use chainlink_solana_data_streams::VerifierInstructions;
175175

176176

@@ -282,27 +282,13 @@ Note how the `VerifierInstructions::verify` helper method automatically handles
282282
283283
#### 5. Deploy your program
284284

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

287287
```bash
288288
anchor build
289289
```
290290

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

307293
```bash
308294
anchor deploy
@@ -348,11 +334,7 @@ In this section, you'll write a client script to interact with your deployed pro
348334
anchor.setProvider(provider)
349335

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

357339
// Convert the hex string to a Uint8Array
358340
// This is an example report payload for a crypto stream
@@ -462,7 +444,14 @@ In this section, you'll write a client script to interact with your deployed pro
462444
yarn add snappy
463445
```
464446

465-
`snappy` is a compression library that is used to compress the report data.
447+
Also ensure you have the required TypeScript dependencies:
448+
449+
```bash
450+
yarn add @solana/web3.js
451+
yarn add -D ts-node typescript @types/node
452+
```
453+
454+
**Note**: `snappy` is a compression library used to compress the report data before sending it to the verifier.
466455

467456
1. Execute the test script to interact with your program:
468457

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

503492
#### Program Derived Addresses (PDAs)
504493

505-
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):
506495

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

543532
```rust
544-
use data_streams_report::report::v3::ReportDataV3;
533+
use chainlink_data_streams_report::report::v3::ReportDataV3;
545534
```
546535

547536
- For v8 schema:
548537

549538
```rust
550-
use data_streams_report::report::v8::ReportDataV8;
539+
use chainlink_data_streams_report::report::v8::ReportDataV8;
551540
```
552541

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

0 commit comments

Comments
 (0)