Repository navigation
fix(zetatool): refuse incomplete staking and distribution input in snapshot - #4647
Merged
kingpinXD merged 5 commits intoOct 15, 2026
Merged
Conversation
…apshot The snapshot now reads distribution and refuses, as hard errors that --supply-check=false cannot skip: - unpaid rewards or commission, or a distribution module balance other than the community pool - staking records that do not add up: share sums, duplicates, unknown validators, invalid status, negative values, excess share dust - staking pools that do not exactly match validator tokens and unbonding entries - a pin on a staking pool, or a remainder its categories do not explain The summary prints the remainder by category and the 18->9 conversion dust. Attribution and the CSV output are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--for-zero-height and the distribution module are now required by zetatool snapshot, so the README and the export script say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…precedence - Compute refuses a bank supply that differs from the sum of bank balances with its own message. The remainder identity check is now a backstop, tested through finalize directly. - A test pins the zero address and a module account, and checks the pin wins over both categories. - The summary's non-std line says its amount is liquid only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
usmaneth
approved these changes
Oct 15, 2026
usmaneth
left a comment
There was a problem hiding this comment.
solid. the pool checks match what the sdk enforces on genesis import, and i walked the remainder categories against supply by hand - pools cancel against validator tokens + unbonding entries, so the backstop really is a backstop. lint red is just golangci timing out on the schema fetch, not the code.
morde08
reviewed
Oct 15, 2026
morde08
left a comment
Collaborator
There was a problem hiding this comment.
One documentation issue remains, also flagged by Greptile. I found no additional correctness issues in the changed code. Validated the pool accounting against the pinned Cosmos SDK implementation and ran go test ./cmd/zetatool/snapshot ./cmd/zetatool/cli successfully. CI still has a missing-changelog failure and a lint schema-download timeout.
--supply-check=false now downgrades only three output checks. The bank sum vs supply check fails in Compute before anything is written, so the README, the command help and the flag help say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
morde08
approved these changes
Oct 15, 2026
s2imonovic
approved these changes
Oct 15, 2026
This was referenced Oct 15, 2026
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.
Summary
zetatool snapshotnow refuses an export it can't fully account for. Delegation shares must add up per validator, both staking pools must match exactly (the same rule the SDK applies on genesis import), and distribution must be in zero-height state, with the module holding only the community pool. These are hard errors, so--supply-check=falsedoesn't turn them off.snapshot_db.csvcomes out byte-identical (sha256bd62b8bd…ecb93).Part of #4646 (SNAP-01). Targets
feat/snapshot-export(#4613), notmain.The PR appears safe to merge, with a non-blocking correction needed in the flag documentation.
Findings
Fix with agent prompt
Summary
This PR adds hard checks before building the migration snapshot.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Read bank, staking, and distribution] --> B[Check distribution rewards and balance] B --> C[Check delegation totals and staking pools] C --> D[Attribute balances and classify remainder] D --> E[Check supply and remainder categories] E --> F[Write CSV files] F --> G[Run optional output checks] G --> H[Print summary]Reviews (1) · Last reviewed commit: "fix(zetatool): name a supply mismatch an..." · Reviewed by Greptile