Skip to content

Carry pending points in the migration snapshot - #4

Merged
daedboi merged 1 commit into
mainfrom
snapshot-pending-points
Jul 21, 2026
Merged

Carry pending points in the migration snapshot#4
daedboi merged 1 commit into
mainfrom
snapshot-pending-points

Conversation

@daedboi

@daedboi daedboi commented Jul 21, 2026

Copy link
Copy Markdown
Member

What

snapshotPoints in each merkle leaf now includes pending un-compounded points (bonusBmxTracker.claimable) on top of staked points, read at the same pinned snapshot block (2026-07-21 17:00 EEST). New root: 0x6fc870a6d7ff5d2be147104da95d5da54c564c673151c150245a7547f277fa32, 280 leaves.

Why

All 280 snapshot stakers had claimable bnBMX they never compounded - 431,524.41 points in total, 18.7% on top of the staked-points total, with individual cases as large as 58k (one staker had never compounded once and would have carried zero). These would have compounded eventually, so the snapshot carries them rather than punishing stakers for not pressing compound before the freeze.

Changes

  • readStakedPoints/aggregate: read claimable alongside depositBalances; leaf points = staked + pending; snapshot.csv gains the two component columns
  • validate: sample re-reads cover the pending component; the exact totalDepositSupply reconciliation stays on the staked component (pending has no on-chain aggregate, so it is verified per-account and by the independent verifier)
  • verifyBaseStaking: same leaf definition through its own discovery + read path
  • prod-2026-07-21/: regenerated artifacts (root, tree, proofs, community CSV, verification record, staker cache)

Verification

  • Fresh end-to-end run: full staker rediscovery from the tracker deploy block (879 candidates), no reused caches
  • Staked components still reconcile exactly against totalDepositSupply on both trackers
  • Independent verifier (different discovery path, single-call reads) produced a byte-identical root
  • Per-account three-way check: new points == old points + pending for all 280 leaves
  • npm run validate all green, incl. pool coverage (2,709,469.8 migratable vs 2,711,068 pool)

Reviewer notes

  • The staked-only root from d9fd9b9 (0x277d5544...ccd895) is superseded and was never set on-chain; setMerkleRoot must use the new root only
  • The community CSV previously circulated is stale - reshare prod-2026-07-21/community-snapshot.csv

Summary by CodeRabbit

  • New Features

    • Snapshot calculations now include both staked and pending reward points.
    • Account eligibility and verification checks now recognize pending points.
    • Snapshot exports provide clearer breakdowns of staked and pending amounts.
  • Bug Fixes

    • Improved reconciliation ensures totals remain consistent without overlooking excluded addresses.
    • Updated verification materials, proofs, and Merkle data to reflect corrected point balances.
  • Documentation

    • Clarified snapshot eligibility, point composition, and validation requirements.
    • Refreshed production snapshot details and verification results.

Stakers who never pressed compound were losing their claimable bnBMX in
the migration carry - 431,524 points across 280 stakers, 18.7% on top of
the staked total. snapshotPoints is now staked points plus
bonusBmxTracker.claimable, both read at the same pinned block.

- readStakedPoints/aggregate: read claimable alongside depositBalances;
  leaf points = staked + pending; snapshot.csv gains the two component
  columns
- validate: sample re-reads cover claimable; the exact totalDepositSupply
  reconciliation stays on the staked component (pending has no on-chain
  aggregate, so it is checked per-account and by the independent verifier)
- verifyBaseStaking: same leaf definition, so its independently derived
  root must still match byte-for-byte
- prod-2026-07-21: regenerated at the same pinned blocks (17:00 EEST),
  new root 0x6fc870a6d7ff5d2be147104da95d5da54c564c673151c150245a7547f277fa32,
  280 leaves. The staked-only root from the previous commit was never
  published on-chain.
@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR Summary

High Risk
One-shot merkle root for on-chain migration: wrong or disputed point inclusion would misallocate carried voter points for all 280 stakers; operators must not use the superseded root.

Overview
Migration snapshot leaves now count un-compounded bonusBmxTracker.claimable points on top of staked points, so snapshotPoints reflects staked + pending at the pinned block. That replaces the prior staked-only definition and changes the published merkle root to 0x6fc870a6…77fa32 (still 280 leaves); staked BMX and staked-points totals still reconcile to tracker totalDepositSupply.

Docs and publish artifacts are updated accordingly: README describes the new leaf formula and that validate (b) reconciles only the staked-points component (pending is checked per-account / via verifyBaseStaking). prod-2026-07-21/ is regenerated—base-staking-verification.json adds sumPendingPoints (~431k points wei) and sumStakedPoints, and community-snapshot.csv voter_points values rise across stakers; base-stakers.json is a discovery-order refresh at the same block.

Reviewed by Cursor Bugbot for commit afe5639. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f690358-dec0-4e47-b84a-0379e4824d5d

📥 Commits

Reviewing files that changed from the base of the PR and between 77af04b and afe5639.

⛔ Files ignored due to path filters (1)
  • snapshot/prod-2026-07-21/community-snapshot.csv is excluded by !**/*.csv
📒 Files selected for processing (11)
  • snapshot/README.md
  • snapshot/prod-2026-07-21/base-stakers.json
  • snapshot/prod-2026-07-21/base-staking-verification.json
  • snapshot/prod-2026-07-21/proofs.json
  • snapshot/prod-2026-07-21/root.txt
  • snapshot/prod-2026-07-21/tree.json
  • snapshot/src/aggregate.ts
  • snapshot/src/clients.ts
  • snapshot/src/readStakedPoints.ts
  • snapshot/src/validate.ts
  • snapshot/src/verifyBaseStaking.ts

📝 Walkthrough

Walkthrough

The snapshot pipeline now includes pending, un-compounded points in Merkle leaves. Readers, aggregation, validation, verification outputs, and the July 21 production snapshot artifacts were updated accordingly.

Changes

Pending points snapshot pipeline

Layer / File(s) Summary
Point collection and aggregation
snapshot/src/clients.ts, snapshot/src/readStakedPoints.ts, snapshot/src/aggregate.ts
Adds claimable reads, tracks staked and pending points separately, includes pending-only accounts, and computes combined snapshotPoints.
Verification and validation
snapshot/src/verifyBaseStaking.ts, snapshot/src/validate.ts
Validates each point component per account, reconciles staked totals on-chain, and checks combined snapshot totals.
Production snapshot refresh
snapshot/prod-2026-07-21/*, snapshot/README.md
Refreshes stakers, Merkle tree data, proofs, root, verification metadata, and pending-inclusive documentation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant verifyBaseStaking
  participant feeBmxTracker
  participant bonusBmxTracker
  participant validate
  verifyBaseStaking->>feeBmxTracker: Read staked points
  verifyBaseStaking->>bonusBmxTracker: Read pending points
  verifyBaseStaking->>validate: Verify combined leaf points
  validate->>feeBmxTracker: Reconcile aggregate staked points
Loading

Possibly related PRs

Poem

A rabbit hops through leaves so bright,
With pending points tucked in tight.
Staked and bonus, side by side,
March beneath the Merkle guide.
New roots bloom beneath the moon.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding pending points to the migration snapshot.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afe56392b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread snapshot/src/aggregate.ts
@daedboi
daedboi merged commit 86c4733 into main Jul 21, 2026
4 checks passed
@daedboi
daedboi deleted the snapshot-pending-points branch July 21, 2026 20:00
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.

1 participant