-
Notifications
You must be signed in to change notification settings - Fork 102
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
SIMD-0180: Leader Schedule Migration #180
Open
jstarry
wants to merge
2
commits into
solana-foundation:main
Choose a base branch
from
jstarry:leader-schedule-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
simd: '0180' | ||
title: Leader Schedule Migration | ||
authors: Justin Starry (Anza) | ||
category: Standard | ||
type: Core | ||
status: Draft | ||
created: 2024-10-03 | ||
feature: (fill in with feature tracking issues once accepted) | ||
--- | ||
|
||
## Summary | ||
|
||
The epoch leader schedule for block production will be migrated from using | ||
validator identity addresses to using vote account addresses. The expected | ||
block signer for a given slot will be determined by the vote account's | ||
designated validator identity. | ||
|
||
## Motivation | ||
|
||
Using validator identity addresses in the leader schedule means there is no | ||
straightforward way to map a block producer to a particular vote account and its | ||
delegated stake. This is becuase the same validator identity could be designated | ||
by multiple vote accounts. By migrating to the vote account address, we know | ||
exactly what delegated stake led to a validator's leader schedule slot | ||
allocation. This will make certain protocol improvements much easier to design | ||
like how to distribute block rewards and how to slash validators that produce | ||
duplicate blocks. | ||
|
||
## New Terminology | ||
|
||
NA | ||
|
||
## Detailed Design | ||
|
||
### Leader Schedule Generation | ||
|
||
When generating the leader schedule at epoch boundaries, rather than | ||
accumulating all stake by the node id, stake should be accumulated according to | ||
vote pubkey. Then use the existing stake weighted randomized leader schedule | ||
generation using vote pubkeys and their delegated stake rather than node id | ||
pubkeys and the accumulated delegated stake across (potentially more than one) | ||
vote accounts. As before, only valid and initialized vote accounts should be | ||
used during leader schedule generation. | ||
|
||
### Node Id Lookup | ||
|
||
Block shreds should still be signed by a node pubkey and block rewards should | ||
still be collected into the node id account (also known as fee collection | ||
account). However, after the migration this node pubkey will need to be looked | ||
up by first finding the vote account for the designated vote pubkey for a | ||
particular leader slot in bank epoch stakes. Bank epoch stakes are keyed by | ||
leader schedule epoch and therefore the vote account state should be retrieved | ||
by looking up the epoch stakes for the current epoch. Since only valid vote | ||
accounts are used during leader schedule generation, a valid vote account is | ||
guaranteed to exist in epoch stakes and its node pubkey can be fetched from its | ||
account state. | ||
|
||
### RPC Migration | ||
|
||
Existing leader schedule and slot leader RPC endpoints should continue returning | ||
the resolved node id to avoid breaking downstream users of these endpoints that | ||
expect the leader schedule to have node pubkeys. However, new RPC endpoints | ||
for fetching the new leader schedule using vote pubkeys should be added. | ||
|
||
## Alternatives Considered | ||
|
||
Alternatively, the protocol could create a strict one-to-one mapping between | ||
node pubkeys and vote accounts. However this would require quite a lot of | ||
onchain program and account state changes to be able to enforce this mapping. | ||
And migrating existing one-to-many relationships is not very straightforward and | ||
would likely require validators to manually migrate which could take a long | ||
time. | ||
|
||
## Impact | ||
|
||
Negligible impact expected. There will be some extra overhead to looking up / | ||
caching the node pubkey for each vote pubkey. | ||
|
||
## Security Considerations | ||
|
||
NA | ||
|
||
## Drawbacks *(Optional)* | ||
|
||
NA | ||
|
||
## Backwards Compatibility *(Optional)* | ||
|
||
Feature gate will be required to enable this migration since leader schedule | ||
generation will be different. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming my understanding that this shouldn't cause an issue at epoch boundary:
Since the leader schedule is generated an epoch before, if we receive a shred from epoch E + 1, we can still use the root bank from epoch E to perform the vote account -> node pubkey lookup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. We can only validate shreds for epoch E + 1 once we have a root bank in epoch E