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

SIMD-0180: Leader Schedule Migration #180

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions proposals/0180-leader-schedule-migration.md
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
Copy link
Contributor

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.

Copy link
Contributor Author

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

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.
Loading