-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement chunk validator assignment (#9983)
Implements chunk validator assignment as described in - the docs linked from the [Stateless Validation Organizer](https://docs.google.com/document/d/1gFv3GzPHR5CAX7_X2l5MpuMg7GIjW4Ne8e_3kZLnZQQ/edit#heading=h.d4bbvnvyxo9f) - this [zulip conversation](https://near.zulipchat.com/#narrow/stream/407237-pagoda.2Fcore.2Fstateless-validation/topic/validator.20seat.20assignment) ### The term _seat_ In `nearcore` it is already used: - [`seat_price`](https://github.com/near/nearcore/blob/6f324e84a7a7162956f0b9985094ee146919f5ae/core/primitives/src/epoch_manager.rs#L710-L716) is the minimum stake required to become a validator. - [`NumSeats`](https://github.com/near/nearcore/blob/02f06d1c844296d9b7ea01289ea9e1842f404dd1/core/primitives-core/src/types.rs#L39C1-L40) is the number of seats available for block producers. This might lead to conflicts and confusion with the concept of _seat_ to be introduced for chunk validator assignment. To avoid that, this PR uses the term _mandate_ for now. Accordingly the stake of chunk validators is splitt into _mandates_ which are randomly shuffled and assigned to shards. I’m happy to rename _mandate_ to anything else, though if possible I would try to avoid conflicts with the existing usage of _seat_. ### Overview - Introduces `EpochInfoV4` which contains the epoch’s `ValidatorMandates`. - Adds `EpochInfo::sample_chunk_validators` which allows sampling for a given height. - Module `core::primitives::validator_mandates` encapsulates splitting validator stake into mandates, shuffling them, and assigning them to shards. ### Follow-up concerns As discussed offline ([ref](https://near.zulipchat.com/#narrow/stream/407237-pagoda.2Fcore.2Fstateless-validation/topic/validator.20seat.20assignment/near/396265731)), the following are separate concerns: - Properly integrating stateless validator assignment with the rest of the system. - Dynamically calculating and updating `stake_per_mandate` and `min_mandates_per_shard`. Hence there are some open `TODO`s in the diff, they are marked with #10014.
- Loading branch information
Showing
14 changed files
with
562 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
Oops, something went wrong.