feat(cardano): log per-account epoch stake distribution - #1151
Conversation
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new Cardano archive log (AccountStakeLog) to persist per-account active stake distribution per epoch, enabling upcoming minibf endpoints (/epochs/{n}/stakes and /epochs/{n}/stakes/{pool}) to be served from Dolos’ data layer. The PR also tightens the sharded RUPD durability/resume semantics and adjusts stake snapshot accounting so per-pool StakeLog figures remain correct across restarts.
Changes:
- Introduces
AccountStakeLog(namespaceaccount-stakes) and wires it into the Cardano model/schema and thedolos data dump-logsCLI. - Updates RUPD to write per-shard per-account stake logs (archive) before advancing the shard progress cursor, and rebuilds per-pool
StakeLogrewards from persistedPendingRewardStateto avoid restart undercounts. - Extends
StakeSnapshotto track global per-pool delegator counts (computed in the globals pass) to keepStakeLog.delegators_countrestart-safe, and adds targeted tests for the new behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/bin/dolos/data/dump_logs.rs | Adds dump support and formatting for the new account-stakes archive namespace. |
| crates/core/src/work_unit.rs | Documents commit-phase durability ordering constraints for shard-resumable work units. |
| crates/cardano/src/rupd/work_unit.rs | Writes per-account stake logs per shard, reworks finalize-time pool aggregation to be restart-safe, and adds tests. |
| crates/cardano/src/rupd/mod.rs | Adds global pool_delegator_counts to StakeSnapshot and a helper accessor. |
| crates/cardano/src/rupd/loading.rs | Populates global per-pool delegator counts during the globals pass. |
| crates/cardano/src/model/mod.rs | Registers AccountStakeLog in the Cardano entity enum and schema. |
| crates/cardano/src/model/logs.rs | Defines the AccountStakeLog type and documents access patterns/tradeoffs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fn aggregate_pending_pool_rewards<S: StateStore>( | ||
| state: &S, | ||
| ) -> Result<HashMap<PoolHash, (u64, u64)>, DomainError> { | ||
| let mut out: HashMap<PoolHash, (u64, u64)> = HashMap::new(); | ||
|
|
||
| for record in state.iter_entities_typed::<PendingRewardState>(PendingRewardState::NS, None)? { | ||
| let (_, pending) = record?; |
|
@coderabbitai review |
✅ Action performedReview finished.
|
0e21525 to
11a289f
Compare
Data layer for
/epochs/{n}/stakes(#1082) and/epochs/{n}/stakes/{pool}(#1101). Endpoints follow in a separate PR.New
AccountStakeLog { amount, pool_id }, namespaceaccount-stakes, written by RUPD per shard.Required by:
/epochs/<number>/stakes#1082/epochs/<number>/stakes/<pool>#1101