Skip to content

Compile solana - #204

Open
midenotch wants to merge 2 commits into
wraith-protocol:developfrom
midenotch:compile-solana
Open

midenotch wants to merge 2 commits into
wraith-protocol:developfrom
midenotch:compile-solana

Conversation

@midenotch

@midenotch midenotch commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Compile the Solana contract guide snippets against a reference Anchor workspace,
and check the program IDs and account layouts against the canonical program
sources and the chain-generated deployment record.

Rebased onto develop; contains only the Solana work (the Rust quickstart
stack lives in #203).

Related Issue

Closes #190

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring
  • Other (CI + validation tooling)

Changes Made

  • snippets/solana-contracts/ — an Anchor 0.32 workspace with three program
    crates (wraith-announcer, wraith-sender, wraith-names) mirroring the
    shape of the canonical programs. Each crate carries the real deployed devnet
    program ID in declare_id!.
  • contracts/solana.mdx — no-check removed from all Rust fences. The only
    remaining no-check is the bare PDA seeds = … attribute fragment, which
    is allowlisted with a reason.
  • scripts/check-solana-contracts.ts — compares the guide and the workspace
    against the canonical program sources and the deployment record:
    1. every checked fence is a verbatim excerpt of its crate, and every crate
      item is covered by the guide;
    2. declare_id! matches the pinned SDK's getDeployment("solana") manifest
      and the chain-generated deployments/solana/solana-devnet.json;
    3. instruction signatures, account contexts, account layouts, events, and
      error codes match the canonical program sources;
    4. instruction discriminators match the SDK's *_DISC sighash constants.
  • CI (snippets.yml): Rust toolchain pinned to 1.89 (the dependency floor for
    anchor-lang 0.32) with rustfmt, plus cargo check --workspace --locked,
    cargo fmt --check --all, and pnpm run check:solana-contracts.

Scope of these checks: they are structural — they compare published API
shape and program IDs. They do not execute or deploy the programs and do not
verify runtime on-chain behaviour. The workspace is a documentation fixture;
instruction bodies are abbreviated or omitted.

Corrected claims: the wraith-names fixture no longer claims that
production verifies a secp256k1 ownership signature. The canonical program
validates the name format, stores the supplied meta-address as-is, and binds
record ownership to the registrant's Solana wallet. The guide now states this
explicitly.

Testing

  • cargo check --workspace --locked and cargo fmt --check --all — pass
  • pnpm run check:solana-contracts — 19 fences, 3 programs compared against
    guide, workspace, SDK manifest, canonical programs, deployment record
  • pnpm run check:snippets-extended — no regressions (Rust fences on this page
    are excluded from bare rustc and reported as Crate-checked)
  • All required CI checks green on this head

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if applicable)
  • Tests added/updated (if applicable)
  • No new warnings or errors
  • Commit messages follow conventional commits
  • Author and committer identity match GitHub account

@midenotch
midenotch requested a review from truthixify as a code owner October 17, 2026 20:55
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@midenotch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify truthixify 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.

This branch includes the still-failing Rust quickstart stack, so the required snippet job fails. The Solana workspace itself is never invoked by snippets.yml: the commit adds only the workspace files, despite the PR description claiming cargo check and fmt steps. It also uses placeholder program IDs and contains no comparison against generated IDs or account-layout artifacts required by issue #190. Rebase to isolate this PR, add required workspace check/format tests, and validate IDs and layouts against the canonical generated artifacts.

@truthixify truthixify 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.

The new compiled fixture makes a false security claim. snippets/solana-contracts/programs/wraith-names/src/lib.rs:33-36 says the full production program verifies a secp256k1 signature proving ownership of meta_address, but the pinned canonical wraith-names program only validates the name and stores the supplied 64 bytes; it performs no such signature verification. The checker passes because it compares instruction signatures/account layouts, not bodies. Remove the claim or implement/verify the real invariant, and describe the checker as structural rather than implying the fixture matches production logic. Local cargo check, fmt, and check:solana-contracts otherwise pass.

@truthixify truthixify 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.

The false security claim remains on current head 7845aee. snippets/solana-contracts/programs/wraith-names/src/lib.rs:33-36 still says production verifies a secp256k1 ownership signature, while the canonical program pinned by this PR does no such verification and stores the supplied meta-address after name validation.

The online checker, offline checker, Cargo workspace check, and formatting all pass locally because compareModels validates signatures and layouts, not instruction bodies or prose claims. Remove the claim or implement and verify the actual invariant, and describe this fixture/checker as structural rather than as validation of production behavior. This head also conflicts with develop and has no CI result.

@midenotch midenotch mentioned this pull request Oct 22, 2026
8 of 13 tasks
@midenotch

Copy link
Copy Markdown
Contributor Author

The false security claim remains on current head 7845aee. snippets/solana-contracts/programs/wraith-names/src/lib.rs:33-36 still says production verifies a secp256k1 ownership signature, while the canonical program pinned by this PR does no such verification and stores the supplied meta-address after name validation.

The online checker, offline checker, Cargo workspace check, and formatting all pass locally because compareModels validates signatures and layouts, not instruction bodies or prose claims. Remove the claim or implement and verify the actual invariant, and describe this fixture/checker as structural rather than as validation of production behavior. This head also conflicts with develop and has no CI result.

fixed

@truthixify truthixify 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.

Security blocker from remote-only review: scripts/check-solana-contracts.ts:436-440 extracts text from the installed @wraith-protocol/sdk bundle and executes it with new Function. This turns a dependency-controlled npm artifact into code executed by the required docs CI job. Do not dynamically evaluate the bundle. Read a structured exported artifact, parse the relevant syntax without execution (for example with an AST), or compare against a checked-in/generated JSON manifest. Add a malicious-expression fixture proving the checker never executes bundle text.

This branch has not been deployed

No deployments
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.

[Wave 10] Compile the Solana contract guide snippets

2 participants