Skip to content

refactor(merkle-tree-token-claimer): Rust snapshot generator, drop the JS tooling - #772

Merged
dev-jodee merged 2 commits into
mainfrom
chore/merkle-generator-rust
Oct 28, 2026
Merged

dev-jodee merged 2 commits into
mainfrom
chore/merkle-generator-rust

Conversation

@dev-jodee

Copy link
Copy Markdown
Collaborator

The merkle-tree-token-claimer was the last anchor example with a package.json, kept only for its snapshot-to-proofs generator. AGENTS.md says anchor examples are Rust-only, so the generator moves to Rust.

Changes

  • New cargo example programs/merkle-tree-token-claimer/examples/generate_merkle_tree.rs: reads a snapshot JSON, skips invalid entries with a warning (bad address, non-u64 amount), builds the zero-hash-padded SHA-256 tree and writes the root plus a proof per claimant. serde and serde_json are added as dev-dependencies.
  • scripts/sample-snapshot.json moves next to the example.
  • Removed: scripts/generate-merkle-tree.ts, scripts/merkle.ts, package.json (with the leftover mocha/chai/litesvm deps), pnpm-lock.yaml, pnpm-workspace.yaml (overrides) and tsconfig.json.
  • README updated with the new command.

Testing

  • cargo run --example generate_merkle_tree -- examples/sample-snapshot.json out.json produces JSON identical to the old TypeScript generator's on the sample snapshot.
  • cargo fmt --check clean; cargo clippy --example generate_merkle_tree reports nothing for the example (the lib's two existing manual_is_multiple_of warnings are untouched).
  • The program tests are left to CI.

AI disclosure

  • No AI tooling was used beyond editor autocomplete.
  • AI tooling was used. Tool and extent: Claude Code ported the generator to Rust under maintainer direction.

…e JS tooling

The snapshot-to-proofs generator becomes a cargo example
(`cargo run --example generate_merkle_tree`) with serde/serde_json as
dev-dependencies, producing the same JSON output as the TypeScript
version. The anchor example no longer carries a package.json, lockfile,
pnpm overrides or tsconfig, matching the Rust-only anchor test stack.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous address-parsing issue is fixed.

Summary

Moves the snapshot generator from TypeScript to a Rust Cargo example.

  • A Rust example now turns claim snapshots into roots and proofs.

No new actionable issues were found in the changes since the previous review.

Reviews (2) · Last reviewed commit: "fix(merkle-tree-token-claimer): skip sna..." · Reviewed by Greptile

@dev-jodee
dev-jodee requested a review from amilz October 28, 2026 13:52
@dev-jodee
dev-jodee merged commit 1adcc10 into main Oct 28, 2026
27 checks passed
@dev-jodee
dev-jodee deleted the chore/merkle-generator-rust branch October 28, 2026 14: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.

2 participants