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: Use agreement round when estimating a node's proposal interval #6136

Closed
wants to merge 3 commits into from

Conversation

jannotti
Copy link
Contributor

@jannotti jannotti commented Sep 18, 2024

This PR is intended to fix some bugs in the block incentive scheme related to detecting when an account is absent.

  1. If a node goes online with much more stake than the current total online stake, it could be immediately suspended because it appears to be "absent" in the very round in which it joins.

  2. Because keyreg sets LastHeartbeat to fv, if a txn takes a while to get onto the chain, the account may already be absent.

  3. After going online, a node can't vote for 320 rounds. So, if it joins with, say, 5% of stake, then after 200 rounds it is already absent.

This is a draft for now as it does not address everything yet.

  1. Was caused because we were calculating the expected interval using the node's new online balance, as a fraction of the old total balance. Since we don't know the new total balance yet (because we are processing absentee and challenge kickoffs), the fix was to move to comparing balances in the agreement round rather than current round. This makes more sense anyway, since the interval in effect at round n is really based on the stake ratio at n-320 anyway.

  2. Can be fixed by using the current round instead of FirstValid for the account's LastHeartbeat during keyreg, but see next point...

  3. Is partially fixed because of change 1. All during the 320 rounds after keyreg, the account's online balance is 0, so it won't be absent after 200 rounds. But it would be considered absent as soon as it becomes truly eligible to vote (320 rounds after keyreg). The online balance would be high, it should have voted at least once in the last 200 rounds (but couldn't) so it would be marked absent then. Is completely fixed by adding the agreement round lookback to the LastHeartbeat that is put in place during keyreg. That is, if an account registers in round 1500, we write 1820 to the account's LastHeartbeat, thus making it immune from the 10x interval check until after it actually has a chance to start proposing. Furthermore, once it is truly ready to vote in round 1820, it needs to "last seen" in the last 200 rounds, and the heartbeat will count.

@jannotti jannotti self-assigned this Sep 18, 2024
@jannotti jannotti changed the title Use agreement round when estimating a node's proposal interval Incentives: Use agreement round when estimating a node's proposal interval Sep 18, 2024
@jannotti
Copy link
Contributor Author

This changes many of the same tests that are being changed by a simultaneous enhancement that gets high stake accounts to be marked absent precisely when they become absent (instead of waiting to see them appear in a block). So I'm not going to adjust the currently failing tests until that is merged.

@jannotti jannotti requested a review from cce September 25, 2024 17:21
@jannotti
Copy link
Contributor Author

jannotti commented Nov 4, 2024

Closing this, PRing to feature/heartbeats instead.

@jannotti jannotti closed this Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant