feat(solana): add Drift Protocol visualizer preset (rebased #239)#366
Merged
Conversation
Rebased onto current main and adapted to the post-refactor APIs: - config.rs and the local named-accounts map use BTreeMap (deterministic ordering for stable metadata hashing), not HashMap - visualize_tx_commands uses the current VisualizerContext API (resolve_program_id / resolve_accounts / data) instead of the removed current_instruction() - preset is auto-registered by build.rs via the directory drop-in; no presets/mod.rs edit - test module carries the standard clippy unwrap/expect/panic allow Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot started reviewing on behalf of
shahan-khatchadourian-anchorage
June 12, 2026 01:40
View session
3 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Solana preset visualizer for Drift Protocol v2 that decodes instructions via a vendored Anchor IDL and renders condensed/expanded preview layouts with a raw-data fallback.
Changes:
- Introduces
DriftVisualizerpreset that parses Drift instructions using an embeddeddrift.jsonIDL and renders preview fields. - Adds
DriftConfigintegration config wiring the Drift program ID into the preset selection map.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/chain_parsers/visualsign-solana/src/presets/drift/mod.rs |
Implements the Drift IDL-backed instruction visualization and associated unit tests. |
src/chain_parsers/visualsign-solana/src/presets/drift/config.rs |
Registers the Drift program ID in SolanaIntegrationConfigData so the preset can be selected. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+154
to
+164
| if let Ok(f) = create_text_field("Program", "Drift") { | ||
| condensed_fields.push(f); | ||
| } | ||
| if let Ok(f) = create_text_field("Instruction", &parsed.instruction_name) { | ||
| condensed_fields.push(f); | ||
| } | ||
| for (key, value) in &parsed.program_call_args { | ||
| if let Ok(f) = create_text_field(key, &format_arg_value(value)) { | ||
| condensed_fields.push(f); | ||
| } | ||
| } |
prasanna-anchorage
approved these changes
Jun 12, 2026
prasanna-anchorage
added a commit
that referenced
this pull request
Jun 17, 2026
Reviewed merged PRs since the v0.646.0-v0.649.0 wave and added curated, per-release entries across the streams. Versions resolved via the first release tag containing each merge commit. - Solana: Drift Protocol preset (#366, v0.769.0); decoder hardening (#319/#324/#336/#321, v0.722.0-v0.730.0). Also corrected the surfpool entry — tests use a local fork backed by live RPC, not "no live cluster". - Ethereum: replace the stub with broader EVM decoding (ABI type awareness + proxy resolution #347, all Universal Router versions #368, ERC-1155 #354) and trust-model/swap hardening (#326/#327/#329/#335, #320/#330/#333/#323). - Sui: replace the stub with PTB decoding fixes and DoS hardening (#318/#322/#325). - Tron: replace the stub with parser_cli wiring + v2 staking (#314). - Core: signature binding + signing-path charset hardening (#331/#332/#355), gateway prod parity (#338), per-chain feature flags in parser_app (#302), and Nitro PCR tooling + self-hosted TEE docs (#300). Added Attestation to the tag filter line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
prasanna-anchorage
added a commit
that referenced
this pull request
Jun 18, 2026
#296) * docs: add Changelog and Blog tabs powered by Mintlify Update component Adds two new top-level Mintlify tabs: - /changelog with stacked <Update> blocks for curated release notes, backfilled with three entries covering the Solana preset wave, HTTP-gateway chain_metadata + digests, and surfpool mainnet-fork tests. - /blog with one Update stub linking to the launch essay "Composable by design: how Solana presets stack" — a concept piece anchored in the build-time preset registry and the InstructionVisualizer composition seams. Both surfaces ship subscribable RSS at /changelog/rss.xml and /blog/rss.xml using Mintlify's built-in <Update>-driven feed generation — no custom generator script or CI diff check. Adds docs/changelog/_drafts/ with a README documenting the in-PR fragment workflow: contributors drop draft fragments here, maintainers batch them into Update blocks at curation time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: add containerized Mintlify CLI for local validation Adds a minimal Containerfile that installs the `mint` CLI (npm package `mint`, the official Mintlify CLI) on top of node:20-alpine. The docs directory is bind-mounted at runtime so edits show up live in the dev server — the image only carries the CLI. Adds docs/Makefile with `make dev`, `make broken-links`, `make shell`, and `make rss` targets. ENGINE defaults to docker; set ENGINE=podman to swap. PORT defaults to 3000. Updates docs/CLAUDE.md to point at `make -C docs dev` as the simplest way to start the dev server, with a fallback note for host-installed CLI users. Verified locally: image builds in ~50s, `mint --version` returns 4.2.560. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(changelog): split into chain-parsers and fundamentals streams Breaks the single changelog page into: - /changelog -- landing/index with CardGroup linking to both streams and a short orientation (release tagging, authoring workflow, tag vocabulary). - /changelog/chain-parsers -- Solana preset wave (v0.646.0 -- v0.649.0) and Surfpool fuzz integration (v0.647.0). - /changelog/fundamentals -- HTTP gateway chain_metadata + content digests (v0.648.0). Each `<Update>` block now carries `description="v0.X.Y"` pointing to the first release tag that contains the change (looked up via `git tag --contains <sha> --sort=v:refname | head -1`). Two separate RSS feeds: - /changelog/chain-parsers/rss.xml - /changelog/fundamentals/rss.xml Subscribers pick the stream they care about: wallet integrators may follow fundamentals only; preset authors follow chain-parsers. Updates the _drafts/README.md fragment format to require a `category` field (chain-parsers | fundamentals) and explains how the maintainer fills `description` with the release tag at curation time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(changelog): split chain-parsers stream into per-chain pages `chain_parsers` is the repo directory; readers care about the chain. Replaces /changelog/chain-parsers with one page per supported chain, each with its own RSS feed: - /changelog/solana (Solana preset wave + Surfpool moved here) - /changelog/ethereum (stub; populates with next meaningful release) - /changelog/sui (stub) - /changelog/tron (stub) - /changelog/fundamentals (unchanged) The landing /changelog now shows a CardGroup with all five streams. docs.json groups the Changelog tab into Overview, Chain streams, and Fundamentals so each surface is discoverable in the sidebar. Drops the chain name from `tags={...}` on per-chain Update blocks since the page already conveys the chain. Updates _drafts/README.md so the fragment `category` field is one of solana | ethereum | sui | tron | fundamentals. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(changelog): rename fundamentals stream to core `core` is clearer than `fundamentals` and matches the language already used to describe `src/visualsign/` elsewhere in the docs (Core types, core library, etc.). Avoids the branding overload that "VisualSign" would have, since the entire repo is VisualSign. - /changelog/fundamentals -> /changelog/core - Card label "Fundamentals" -> "Core" - nav group "Fundamentals" -> "Core" - _drafts/README.md category vocabulary updated Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(blog): correct preset architecture claims from review Address Copilot review feedback, verified against the codebase: - Count: "Fourteen protocols" was inconsistent with the list (17 preset directories across 9 protocol families). Now "17 presets across nine protocols" in both the essay and blog stub. - Preset registration: adding a preset also appends a `pub mod <dir>;` line to src/presets/mod.rs; build.rs only generates the visualizer Vec. Stop claiming "nothing else moved" / "no list to drift". - IDL view: presets receive a VisualizerContext with the raw instruction plus the IDL registry and call parse_instruction_with_idl themselves; they are not handed a precomputed typed view. - available_visualizers() returns Vec<Box<dyn InstructionVisualizer>>, not a slice. - build.rs design-intent line is now paraphrased, not quoted. - Ethereum LayeredRegistry wallet token overrides are a TODO today (create_layered_registry uses defaults only) — framed as the existing seam plus planned wiring, not a shipped capability. - Surfpool tests run against a local mainnet fork backed by live RPC, so they need network access but never broadcast to a live cluster. - blog stub third primitive: "layered registries" -> "build-time registry" to match the essay; note audience tags in the tag model. - _drafts/README: point the curation target at the per-chain/core pages, not the now-index ../changelog.mdx. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(blog): plainer prose, drop "seams" motif and antithesis tics Editing pass for voice, no factual changes: - Rename "The seams are the product" section and drop the recurring "seams" metaphor (also in the wallet/LayeredRegistry paragraph). - Remove "X rather than Y" / "not X but Y" / "X but never Y" constructions ("loudly rather than silently", "rather than hand-rolling byte parsing", "an addition rather than a rewrite", "need network access but never broadcast", "That's not luck"). - Lead with the plain statement instead of the negation in the build-time registry and "nothing else moved" paragraphs. - Keep the count consistent (seventeen) in the closing section. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(blog): add "Composing with ClearSign" section Tie the composable-preset design to Solana's clear-signing proposal, SRFC 39 (solana-foundation/SRFCs discussion #4): - VisualSign is the reader side of the standard — protocols enrich IDLs with display metadata, the IDL parser consumes it, presets overlay protocol-specific display. Same dapp-describes/wallet-renders split the vision-roadmap already starts from. - Cover the verifier stance from our SRFC comment (#discussioncomment- 15500615): caller IDLs are untrusted, display-only input rendered on an attested path; the wallet verifies, decoupled from the dapp. - Note the same arc on Ethereum via ERC-7730, and that each new chain widens the surface these standards cover. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: address review (Shahan) + add IDL verification to blog Blog essay (Shahan, editorial): - Open with "Across April and May 2026" instead of "In the last few weeks" so it doesn't read stale. - Drop the inline "(PR #287)" / "(PR #202)" parentheticals. - Replace the internal `solana-add-idl` skill mention with a pointer to the "Adding a Solana preset" guide. Blog essay (new content): - Add a short paragraph in "Composing with ClearSign" on IDL verification as a function of the wallet's business and threat model: curator-key ed25519 signatures bound to program id checked against an allowlist, graceful degradation for unsigned IDLs, wallets relaying on-chain IDLs to verify against the program authority, a shared auditor/curator signer, and unsigned IDLs for fast testnet/dev loops. Docs infrastructure (Shahan): - Pin the Mintlify CLI to mint@4.2.626 instead of @latest, matching the "bump deliberately" comment. - Remove the duplicate "contributing" page from the Chain Development tab; it stays under Adding Visualizations > Contributing. - Drop the Chain tag category from _drafts/README so it matches changelog.mdx (audience + theme only) and the per-chain page model. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(blog): reference tracking issue #376 instead of "TODO" Replace the inline "still a TODO" wording in the wallet-integration paragraph with a descriptive link to the wallet-side overlay tracking issue (#376), and keep the code pointer as "uses defaults only for now". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(changelog): backfill curated entries from merged PRs Reviewed merged PRs since the v0.646.0-v0.649.0 wave and added curated, per-release entries across the streams. Versions resolved via the first release tag containing each merge commit. - Solana: Drift Protocol preset (#366, v0.769.0); decoder hardening (#319/#324/#336/#321, v0.722.0-v0.730.0). Also corrected the surfpool entry — tests use a local fork backed by live RPC, not "no live cluster". - Ethereum: replace the stub with broader EVM decoding (ABI type awareness + proxy resolution #347, all Universal Router versions #368, ERC-1155 #354) and trust-model/swap hardening (#326/#327/#329/#335, #320/#330/#333/#323). - Sui: replace the stub with PTB decoding fixes and DoS hardening (#318/#322/#325). - Tron: replace the stub with parser_cli wiring + v2 staking (#314). - Core: signature binding + signing-path charset hardening (#331/#332/#355), gateway prod parity (#338), per-chain feature flags in parser_app (#302), and Nitro PCR tooling + self-hosted TEE docs (#300). Added Attestation to the tag filter line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: replace verbose RSS subscribe line with a compact RSS icon Mintlify auto-generates the feeds but renders no RSS icon of its own, so the "Subscribe via RSS at <url>" sentence was the only affordance — and read as noise. Replace it with a small <Icon icon="rss" /> link on each stream page and the blog index, keeping the filter-by-tag hint. Drop the now-redundant per-card RSS links on the changelog index (each card already links to its stream page). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: label the RSS link "Subscribe" next to the RSS logo Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(blog): add pastel Mermaid diagrams for dispatch flow and ClearSign Two native Mermaid diagrams, validated in the local Mintlify preview: - Dispatch fold: raw instruction -> IDL parser -> visualize_with_any dispatch -> presets (unknown_program catch-all last) -> field builders -> SignablePayload. - ClearSign trust model: protocol publishes IDL + display metadata (SRFC 39) -> VisualSign verifier on the attested path, with the trust root (unsigned / curator-key + allowlist / on-chain authority) set by the wallet's threat model -> wallet renders -> user signs. Nodes use a pastel classDef palette with dark text for contrast on both light and dark site themes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Supersedes #239 — rebases @prasanna-anchorage's Drift Protocol v2 preset onto current
mainand adapts it to the post-refactor APIs so it builds, lints, and tests cleanly.Summary
Adds an IDL-based visualizer preset for Drift Protocol v2 (
dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH), decoding instructions via the embedded Anchor IDL and rendering a condensed/expanded preview with named accounts, falling back to a raw-data view on decode failure.Changes vs #239
The original branch was ~168 commits behind
mainand predated two refactors, so it no longer compiled. Fixed:config.rs/ named-accounts map useBTreeMap, notHashMap—SolanaIntegrationConfigData.programsis nowBTreeMap, and the local account map needs deterministic ordering for stable metadata hashing.presets/mod.rsedit — since build(solana,sui): auto-generate presets/mod.rs from filesystem to eliminate per-PR conflicts #278 that file is auto-generated bybuild.rsfrom the directory listing; the preset auto-registers as a directory drop-in.visualize_tx_commandsuses the currentVisualizerContextAPI (resolve_program_id/resolve_accounts/data) — the previouscurrent_instruction()was removed upstream.#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]soclippy -D warningspasses.Test plan
cargo clippy -p visualsign-solana --all-targets -- -D warnings— cleancargo test -p visualsign-solana— all pass, including the pre-existingsemantic_drift_deposit(stays on the generic IDL path; preset correctly does not intercept its random program id)drift::DriftVisualizeris auto-registered in the generatedavailable_visualizers()Note for reviewers
The parser already embeds a Drift IDL (
embedded_idls::DRIFT_IDLviaProgramType::Drift), so the bundleddrift.jsonis a second copy. This matches the existing preset convention (every IDL preset vendors its own JSON;jupiter_swapis the same situation), so it is kept for consistency and per-program IDL version independence rather than changed here.🤖 Generated with Claude Code