add --dry-run flag to generate merkle tree#1718
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 Test Coverage Report
|
There was a problem hiding this comment.
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-runCLI option and advertises it in the script help output. - Skips the database transaction when
--dry-runis provided. - Renames the Merkle input array variable from
valuestoleavesto 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 CSVseasonis 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",
]);
| 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 |
There was a problem hiding this comment.
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.
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-runflag in oder to write the claims data to the comps app db.