Skip to content

solana-cli: read v1 transactions in shreds payments - #4304

Merged
martinsander00 merged 3 commits into
mainfrom
ms/shreds-payments-read-v1
Sep 9, 2026
Merged

solana-cli: read v1 transactions in shreds payments#4304
martinsander00 merged 3 commits into
mainfrom
ms/shreds-payments-read-v1

Conversation

@martinsander00

@martinsander00 martinsander00 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • doublezero-solana shreds payments asks the Solana node for version 1 when it fetches a landed fund.
  • The listing reads the JsonParsed instruction list so a v1 body still yields the funded amount.

Testing

  • Fetch a seat that has a landed fund and run doublezero-solana shreds payments --device-code <code> --client-ip <ip>.

A payer who funds with a v1 transaction currently fails the whole listing with error -32015.
@martinsander00
martinsander00 requested review from a team and a lite review from Copilot September 9, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new instruction account filter has a string comparison bug and the amount conversion can overflow and produce incorrect negative values.

Pull request overview

This PR updates the offchain doublezero-solana shreds payments command so it can parse funding events from Solana v1 transactions by requesting transaction version 1 and reading JsonParsed instruction data.

Changes:

  • Request JsonParsed transactions and set max_supported_transaction_version to 1 when fetching transactions for escrow signatures.
  • Add a payment_events helper that extracts funding events from partially decoded JsonParsed instructions.
  • Add unit tests for v1 JsonParsed fund parsing, plus add bs58 as a dependency and document the behavior change in the changelog.
File summaries
File Description
offchain/crates/solana-cli/src/command/shreds/payments.rs Switch transaction fetch config, add payment_events parser, and add unit tests for v1 JsonParsed bodies.
offchain/crates/solana-cli/CHANGELOG.md Document the shreds payments v1 + JsonParsed behavior change.
offchain/crates/solana-cli/Cargo.toml Add bs58 dependency for base58 instruction data decode/encode.
Review details

Suppressed comments (2)

offchain/crates/solana-cli/src/command/shreds/payments.rs:123

  • Issue
    The escrow filter compares a newly allocated string to *account, which moves a value out of a reference and can fail to compile.

Context
The command scans many instructions per transaction, so the current nested loop also allocates one string per escrow key for every account entry.

Proposed Fix
Build a set of escrow key strings once per transaction and use contains to test each instruction account.

            .expect("discriminator serialization");
        let config = RpcProgramAccountsConfig {
            filters: Some(vec![
                RpcFilterType::Memcmp(Memcmp::new_raw_bytes(0, escrow_disc_bytes)),
                RpcFilterType::Memcmp(Memcmp::new_raw_bytes(

offchain/crates/solana-cli/src/command/shreds/payments.rs:133

  • Issue
    The code casts a u64 amount to i64 with as, so large values can wrap and become negative.

Context
A v1 fund instruction can encode an amount above i64::MAX, which makes the running balance incorrect.

Proposed Fix
Convert the amount with i64::try_from and skip the event when the value does not fit.

                encoding: Some(UiAccountEncoding::Base64),
                ..Default::default()
            },
            ..Default::default()
        };
  • Files reviewed: 4/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@martinsander00
martinsander00 enabled auto-merge (squash) September 9, 2026 19:55
@martinsander00
martinsander00 merged commit 3a6f76c into main Sep 9, 2026
39 checks passed
@martinsander00
martinsander00 deleted the ms/shreds-payments-read-v1 branch September 9, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants