Skip to content

spl_token: migrate private InstructionView to shared core::InstructionView #380

Description

Context

PR #367 introduced a shared core::InstructionView (in src/chain_parsers/visualsign-solana/src/core/mod.rs) and removed its data: Vec<u8> field in commit 21d478b because no IDL preset consumed it. However, the spl_token preset was not migrated to the shared struct and still carries its own private InstructionView with two divergences from the canonical implementation:

  1. Dead allocation: data: context.data().to_vec() — clones the full instruction payload on every instruction. spl_token is the only caller so this is not caught by the core fix.
  2. Stale fallback arm: None => "unknown".to_string() instead of None => format!("unresolved(oob:{i})") — inconsistent with the canonical infallible form.

Relevant code: src/chain_parsers/visualsign-solana/src/presets/spl_token/mod.rs, lines ~60–89.

Fix

Migrate spl_token to use crate::core::InstructionView for program ID and account resolution, and access context.data() directly for the bytes it needs to decode (TokenInstruction::unpack). This removes the private struct and the unnecessary to_vec() clone.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions