Skip to content

Conversation

@bfish713
Copy link
Contributor

@bfish713 bfish713 commented Nov 18, 2025

This PR:

Populates all the accounts in the Reward Merkle tree with 0 balance. This prevents us from sending a catchup request for every account the first time it gets some rewards.

This PR does not:

This doesn't prevent catchup from occurring later on, or change the amount of rewards accumulated.

Key places to review:

The code to actually add 0 balance to every potential leader and delegator in the current stake table.

@bfish713 bfish713 changed the title pre populate all accounts with 0 when rewards start Prepopulate all Reward Accounts with 0 after Upgrade Nov 20, 2025
@bfish713 bfish713 marked this pull request as ready for review November 20, 2025 15:23

// If we just upgraded to V4 from any version we should pre-populate the merkle tree
// with accounts from the stake table, giving each address 0 initial balance
if version >= DrbAndHeaderUpgradeVersion::version()
Copy link
Contributor

@imabdulbasit imabdulbasit Dec 3, 2025

Choose a reason for hiding this comment

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

oh I think this should be before

let leader = get_leader_and_fetch_missing_rewards(
        instance_state,
        validated_state,
        parent_leaf,
        view_number,
    )
    .await?;

so that get_leader_and_fetch_missing_rewards doesn't trigger catchup

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.

4 participants