Skip to content

add --dry-run flag to generate merkle tree#1718

Merged
asutula merged 2 commits intomainfrom
asutula/merkle-tree-dry-run
Mar 23, 2026
Merged

add --dry-run flag to generate merkle tree#1718
asutula merged 2 commits intomainfrom
asutula/merkle-tree-dry-run

Conversation

@asutula
Copy link
Member

@asutula asutula commented Feb 18, 2026

This is just a nice to have in order to see the merkle root hash to compare to what is displayed in the fuul interface. After doing that, you'd run the script without the --dry-run flag in oder to write the claims data to the comps app db.

@vercel
Copy link
Contributor

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comps Ready Ready Preview, Comment Mar 20, 2026 10:30pm

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2026

📊 Test Coverage Report

Package Lines Statements Functions Branches
apps/api 2.51% 2.51% 43.70% 51.74%
apps/comps 0.26% 0.26% 37.66% 39.70%
packages/conversions 100.00% 100.00% 100.00% 100.00%
packages/db 4.30% 4.30% 20.86% 37.11%
packages/rewards 100.00% 100.00% 100.00% 100.00%
packages/services 52.82% 52.82% 66.91% 79.37%
packages/staking-contracts 100.00% 100.00% 100.00% 100.00%

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a --dry-run flag to the Merkle tree generation script so operators can generate/inspect the Merkle root and summary output without persisting allocations/metadata to the database.

Changes:

  • Introduces a new -d, --dry-run CLI option and advertises it in the script help output.
  • Skips the database transaction when --dry-run is provided.
  • Renames the Merkle input array variable from values to leaves to avoid name collision with parsed CLI args.
Comments suppressed due to low confidence (1)

apps/api/scripts/generate-merkle-tree.ts:295

  • The third leaf element is encoded as uint8, but CSV season is only validated as a non-negative integer. If a season value > 255 appears, Merkle tree encoding will fail later with a less clear error. Add an explicit upper-bound check during CSV validation (or switch the ABI type to a wider int if larger seasons are valid).
          const tree = StandardMerkleTree.of(leaves, [
            "address",
            "uint256",
            "uint8",
          ]);

Comment on lines 120 to 125
Usage: pnpm generate-merkle-tree.ts --filename <filename>

Options:
-f, --filename CSV filename, relative to ./scripts/data/, to process with format airdrop_<season-number>_<iso-timestamp>.csv (required)
-d, --dry-run Run without writing to database
-h, --help Show this help message
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help text’s invocation looks inconsistent with how this script is actually run (apps/api/package.json defines scripts:generate-merkle-tree as tsx scripts/generate-merkle-tree.ts). Consider updating the Usage/Examples in this help output to match the supported command (including how to pass args through pnpm scripts), so users don’t copy/paste a command that won’t work.

Copilot uses AI. Check for mistakes.
@asutula asutula merged commit 45f80f2 into main Mar 23, 2026
11 checks passed
@asutula asutula deleted the asutula/merkle-tree-dry-run branch March 23, 2026 04:47
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.

3 participants