Repository navigation
feat: add ledger-indexed balance checkpoints - #1268
Open
blvckmamba81-sketch wants to merge 1 commit into
Open
blvckmamba81-sketch wants to merge 1 commit into
blvckmamba81-sketch wants to merge 1 commit into
Conversation
Record `Checkpoint { ledger, balance }` vectors per (holder, key_id) and
per key so governance, dividends and gating can read the balance in force
at a past ledger. Balance and supply writes now append (or replace, when
already written this ledger) a checkpoint and extend its TTL; new
`balance_at` / `supply_at` views binary-search the history, and `compact`
/ `compact_supply` trim old entries while keeping the latest preceding one.
Governance snapshot weights, dividend distributions and holder snapshots
read through the checkpoints, with a live balance fallback for legacy
state that predates checkpoint history.
Closes accesslayerorg#1261
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@blvckmamba81-sketch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Member
✅ PR Ready for ReviewDue to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging. This PR has passed all automated checks:
Next step: Please share this PR link in our Telegram group so a maintainer can review and merge it: https://t.me/c/accesslayerorg/8514 |
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
Implements ledger-indexed balance checkpoints to support efficient historical balance and token supply lookups.
This enhancement enables governance voting and dividend distribution to use accurate historical balances instead of relying solely on current balance information.
Changes Made
Checkpoint { ledger, balance }structure for recording historical balance changes.(holder, key_id)pair.balance_at(holder, key_id, ledger)using binary search to retrieve historical balances efficiently.supply_at(key_id, ledger)for historical total supply lookups.compact(holder, key_id, before_ledger)to manage checkpoint history while preserving the latest checkpoint preceding the cutoff.Testing
Security and Correctness
Scope
This PR focuses on historical balance tracking, historical supply queries, checkpoint compaction, and integration with governance and dividend calculations.
Closes #1261