Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incentives: update GetKnockOfflineCandidates to return current OnlineAccountData when rnd < 240 #6165

Conversation

cce
Copy link
Contributor

@cce cce commented Nov 6, 2024

Summary

@jannotti noticed that in #6159 the GetKnockOfflineCandidates function was not retrieving the current round's OnlineAccountData when 0 < rnd < 240 because it was still returning the genesis balances — this fixes that.

Test Plan

Updated TestDoubleLedgerGetKnockoffCandidates to change two balances in round 1 and assert it is returned afterwards for rounds < 240.

@cce cce changed the title incentives: GetKnockOfflineCandidates returns current rnd < 240 OnlineAccountData incentives: update GetKnockOfflineCandidates to return current OnlineAccountData when rnd < 240 Nov 6, 2024
Comment on lines 677 to 678
// fetch fresh data up to this round from online account cache. These accounts should all
// be in cache, as long as proto.StateProofTopVoters < onlineAccountsCacheMaxSize.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment makes me wonder why the genesis accounts are expected to be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The online account cache is loaded up with the output of AccountsReaderExt.OnlineAccountsAll at DB load / tracker initialization time (in onlineAccounts.initializeFromDisk)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I'll merge and clean up comment.

Copy link
Contributor Author

@cce cce Nov 6, 2024

Choose a reason for hiding this comment

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

Maybe you're wondering how genesis accounts get into the tracker DB tables like the accountbase and onlineaccounts tables in the first place — when trackerDBInitialize sets up a fresh ledger with genesis accounts, it uses them to populate the ledger DB.

@jannotti jannotti merged commit 0588296 into algorand:feature/heartbeats Nov 6, 2024
7 of 12 checks passed
@cce cce deleted the track-incentive-candidates-current-rnd-before-240 branch November 6, 2024 16:15
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.

2 participants