Skip to content

Test SPDD generation through StakeAddress map that's initialized in accounts state #492

@lowhung

Description

@lowhung

Context

The Acropolis Cardano node bootstraps from snapshot files containing new epoch state information. These snapshots include delegation state, pulsing reward updates/snapshot, pool registrations, and stake account information. The snapshot bootstrap process must correctly parse and interpret this data to generate accurate Stake Pool Delegation Distribution (SPDD) and initialize the node with state that matches the Cardano ledger.

Problem

The snapshot bootstrap was using incorrect reward data for stake calculations. Specifically:

  1. Wrong data source: Using instantaneous reward account balances from DState instead of the reward snapshot from pulsing_rew_update in NewEpochState
  2. Inaccurate stake distribution: Generated SPDD didn't match cardano-db-sync epoch_stake data

This resulted in the node starting with incorrect stake distribution, which could affect consensus and validation going forward.

Acceptance Criteria

  • Rewards are extracted from pulsing_rew_update snapshot instead of DState
  • Parser handles both pulsing (in-progress) and completed reward update variants
  • Generated SPDD matches cardano-db-sync epoch_stake table for test epochs
  • Rewards verifier matches up expected rewards with actual rewards
  • Bootstrap process correctly aggregates rewards per stake credential

Testing Requirements

  • Verification test comparing generated SPDD against db-sync epoch_stake data
  • Use accounts_state/verifier.rs method along with csv containing rewards to ensure rewards match up

Definition of Done

  • SPDD output verified against cardano-db-sync for at least 2 different epochs
  • No regressions in booting from snapshot

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions