-
Notifications
You must be signed in to change notification settings - Fork 64
Feat/lean rainbowstaking #36
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
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5a1db53
skeleton structure for staker
gorondan 95b6f7e
Added Staker as a protocol object. Added the Attester, Includer and P…
vlladin de4079f
Update src/lean_spec/subspecs/containers/staker.py
gorondan 2368966
Update src/lean_spec/subspecs/staker/config.py
gorondan 38b9054
Update src/lean_spec/subspecs/staker/config.py
gorondan 93726c6
Fixed conflicts
vlladin 04293f8
added Staker Container docstring
gorondan 42d4210
Update src/lean_spec/subspecs/staker/config.py
gorondan 2ed0b4b
fixed typo in Staker Container docstring
gorondan 4c30294
fixed type in chain config
gorondan bc40df9
Use BaseStrictMode, List and Byte where needed. Removed Byte1.
vlladin e3417fc
Staker files format fix.
vlladin 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,65 @@ | ||
| """ | ||
| Staker Container | ||
|
|
||
| Lean Consensus participants are part of a unified pool of stakers, | ||
| as described in this [3TS design proposal]( | ||
| https://ethresear.ch/t/three-tier-staking-3ts-unbundling-attesters-includers | ||
| -and-execution-proposers/21648/1). | ||
|
|
||
| Each slot, the **Staker** chooses from three different available roles: | ||
| - Attester | ||
| - Includer | ||
| - (Execution) Proposer | ||
|
|
||
| Each staker explicitly opts into the role(s) that they wish to take as | ||
| protocol participants. | ||
| One, two, or all three roles can be chosen, based on the stakers preferences | ||
| and level of sophistication. | ||
| Mixing and matching multiple roles is possible, under certain constraints. | ||
|
|
||
| Each role can be delegated to a target staker and each role can be set as | ||
| delegatable for other stakers to execute as operators. | ||
| The staker can update the staking configuration at any time. | ||
| """ | ||
|
|
||
| from pydantic import Field | ||
| from typing_extensions import Annotated | ||
|
|
||
| from lean_spec.subspecs.staker import AttesterRole, IncluderRole, ProposerRole, StakerSettings | ||
| from lean_spec.types import StrictBaseModel | ||
|
|
||
|
|
||
| class Staker(StrictBaseModel): | ||
| """The consensus staker object.""" | ||
|
|
||
| role_config: Annotated[ | ||
| list[StakerSettings], | ||
| Field(min_length=3, max_length=3), | ||
| ] | ||
| """The list contains the settings for each of the roles the staker can | ||
| activate.""" | ||
|
|
||
| attester_role: AttesterRole | ||
| """ | ||
| Contains the state related to the Attester role. | ||
|
|
||
| This role is responsible for providing economic security by voting on the | ||
| validity of blocks. This field tracks all attestation-specific data. | ||
| """ | ||
|
|
||
| includer_role: IncluderRole | ||
| """ | ||
| Contains the state related to the Includer role. | ||
|
|
||
| This role upholds censorship resistance by creating inclusion lists (ILs) | ||
| that constrain block producers. This field tracks all inclusion-specific | ||
| data. | ||
| """ | ||
|
|
||
| proposer_role: ProposerRole | ||
| """ | ||
| Contains the state related to the Execution Proposer role. | ||
|
|
||
| This role focuses on performance by building and proposing valuable | ||
| execution blocks, including transaction ordering and MEV extraction. | ||
| """ | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| """ | ||
| Specifications for the staker's protocol participation roles and | ||
| settings. | ||
| """ | ||
|
|
||
| from .config import DEVNET_STAKER_CONFIG | ||
| from .role import AttesterRole, IncluderRole, ProposerRole | ||
| from .settings import StakerSettings | ||
|
|
||
| __all__ = ["DEVNET_STAKER_CONFIG", "AttesterRole", "IncluderRole", "ProposerRole", "StakerSettings"] |
This file contains hidden or 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,23 @@ | ||
| """This file defines the parameters used for the Staker and staking.""" | ||
|
|
||
| from typing_extensions import Final | ||
|
|
||
| from lean_spec.types import StrictBaseModel, Uint64 | ||
|
|
||
| DELEGATIONS_REGISTRY_LIMIT: Uint64 = Uint64(2**12) | ||
| """The maximum number of delegations that can be stored in the state, per staker role.""" | ||
|
|
||
|
|
||
| class _StakerConfig(StrictBaseModel): | ||
| """ | ||
| A model holding the canonical, immutable configuration constants | ||
| for the Staker and staking. | ||
| """ | ||
|
|
||
| delegations_registry_limit: Uint64 | ||
|
|
||
|
|
||
| DEVNET_STAKER_CONFIG: Final = _StakerConfig( | ||
| delegations_registry_limit=DELEGATIONS_REGISTRY_LIMIT, | ||
| ) | ||
| """The Devnet Staker Configuration.""" |
Oops, something went wrong.
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.
We should be able to use
ListorVectornow that we have them.See https://github.com/leanEthereum/leanSpec/blob/main/src/lean_spec/types/collections.py and usage over the codebase.