feat(solana): add Marinade Finance visualizer preset#350
Draft
kyle-anchorage wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Why this PR exists
Solana stake-pool transactions to Marinade Finance (program
MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD) fell through to the unknown-program catch-all visualizer. Signers saw raw instruction bytes instead of a human-readable instruction name, decoded arguments, and named accounts.No ticket.
2. What changed
marinade_financeunderchain_parsers/visualsign-solana/src/presets/, scaffolded from the program's on-chain Anchor IDL (bundled asmarinade_finance.jsonviainclude_str!).MarinadeFinanceVisualizerdecodes each instruction by its 8-byte discriminator using the sharedparse_instruction_with_idlpath, then renders a preview layout: condensed view (program + instruction name) and expanded view (program id, instruction, discriminator, IDL-named accounts, and decoded args, all alphabetically sorted), with a raw-data field appended.config.rsregisters the program with a wildcard("*", ["*"])instruction allow-list.presets/mod.rsor the visualizer registry: both are auto-generated bybuild.rsfrom the directory listing, so the preset is wired in purely by the directory drop-in (struct nameMarinadeFinanceVisualizermatches the pascal-cased directory name).3. Why this is safe
unknown_programcatch-all; the catch-all still runs last (build.rs partitions it after all specific visualizers), so only Marinade-program instructions are newly claimed. No existing preset behavior changes.solana_parserIDL machinery (decode_idl_data,parse_instruction_with_idl) already used by other presets. The IDL is parsed once and cached in aOnceLock. Field construction uses the mandatedcreate_text_field/create_raw_data_fieldbuilders.unwrap/expect/panicin non-test code, satisfying the workspace lint policy.Checks run (by agent)
cargo test -p visualsign-solana marinade— 4 tests pass (IDL loads, all discriminators are 8 bytes, unknown discriminator errors, short data errors).cargo clippy -p visualsign-solana --all-targets -- -D warnings— clean.Manual steps needed (by human)
None — fully automated by CI.
4. How this is maintainable
presets/mod.rsand enforced bybuild.rs; a fresh developer adds a chain integration by creating apresets/<name>/directory with a<Name>Visualizer, no registry edits.kamino_vault,orca_whirlpool), so patterns are consistent across the crate.🤖 Generated with Claude Code