-
Notifications
You must be signed in to change notification settings - Fork 40
aggregate all block signatures as naive list [devnet-1] #67
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
Merged
Merged
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
18cfdcc
aggregate all block siignatures
g11tech adecd99
updated spec
g11tech 8739640
update info
g11tech 4ffbfb1
typo
g11tech af89e1c
improvs
g11tech 505e7ce
further updates to forkchoice
g11tech e94357e
improvs
g11tech 84a7f7a
apply spec call feedback
g11tech 0636cde
fix the proposer vote construction and consumption
g11tech 603cf87
enroll validators in state
g11tech 92967fc
fix some issues
g11tech 715653c
fix the issue in code as well
g11tech 3d2de22
feat: init aggregate all block signatures as naive list
GrapeBaBa 855a00b
fix: fix state attestations processing
GrapeBaBa 8579814
fix: fix store process_block arg
GrapeBaBa 8fdefec
fix: fix store produce block
GrapeBaBa e712087
fix: fix test_state
GrapeBaBa 4cd664f
feat: update to `SignedBlockAndVote` structure
GrapeBaBa e702e4e
clean up proposer attestation data as not needed anymore
g11tech ae40ef3
Merge remote-tracking branch 'origin/main' into agg-block-sigs
g11tech 5a3051e
add clarification
g11tech 40d005d
removing redundancy in name to shorten it
g11tech 4209e52
add more clarification
g11tech fc73c2f
fix: fix review comment
GrapeBaBa 968dd55
fix: fix format
GrapeBaBa a97b671
fix: revert unexpected lint change
GrapeBaBa 6388aad
fix: fix lint issue
GrapeBaBa ae7e2d2
fix: revert test lint change
GrapeBaBa 6307180
fix: revert lint change
GrapeBaBa 97c9e96
fix: revert lint change
GrapeBaBa e75d0cc
Apply suggestion from @unnawut
GrapeBaBa f0c47f8
Apply suggestion from @unnawut
GrapeBaBa 53ca3fa
fix: revert linter
GrapeBaBa 102e03b
Update src/lean_spec/subspecs/containers/vote/vote.py
GrapeBaBa fc371c5
fix: fix vote target
GrapeBaBa 32f6bf8
update the produce block
g11tech 76d6220
ammed block proposal
g11tech b29a454
Update src/lean_spec/subspecs/forkchoice/store.py
GrapeBaBa 2f50980
Update src/lean_spec/subspecs/forkchoice/store.py
GrapeBaBa 3d7f527
fix: fix review comment
GrapeBaBa 84cd64f
Update src/lean_spec/subspecs/forkchoice/store.py
GrapeBaBa 8dd4319
fix; fix review comments
GrapeBaBa dde60f7
fix: fix review comment
GrapeBaBa c8cba25
Merge branch 'main' into agg-block-sigs
GrapeBaBa 50ef62c
fix: fix merge issue
GrapeBaBa 07a4776
fix: fix review comment
GrapeBaBa e1f882a
fix: fix review comments
GrapeBaBa 341b2f8
Update src/lean_spec/subspecs/containers/block/block.py
GrapeBaBa 190a1ff
Update src/lean_spec/subspecs/containers/attestation/attestation.py
GrapeBaBa 79513a9
Update src/lean_spec/subspecs/containers/attestation/attestation.py
GrapeBaBa febaaa6
fix: fix review comments
GrapeBaBa ebdf203
Merge branch 'main' into agg-block-sigs
GrapeBaBa 022e02e
fix: merge issue
GrapeBaBa c30e1af
fix: revert
GrapeBaBa cab98d9
fix: lint
GrapeBaBa 06aab37
Update tests/lean_spec/subspecs/containers/test_state.py
GrapeBaBa 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,41 @@ | ||
| """The container types for the Lean consensus specification.""" | ||
|
|
||
| from .block import Block, BlockBody, BlockHeader, SignedBlock | ||
| from .attestation import ( | ||
| AggregatedAttestations, | ||
| AggregatedSignatures, | ||
| AggregationBits, | ||
| Attestation, | ||
| AttestationData, | ||
| SignedAggregatedAttestations, | ||
| SignedAttestation, | ||
| ) | ||
| from .block import ( | ||
| Block, | ||
| BlockBody, | ||
| BlockHeader, | ||
| BlockWithAttestation, | ||
| SignedBlockWithAttestation, | ||
| ) | ||
| from .checkpoint import Checkpoint | ||
| from .config import Config | ||
| from .state import State | ||
| from .vote import SignedVote, Vote | ||
| from .validator import Validator | ||
|
|
||
| __all__ = [ | ||
| "AggregatedAttestations", | ||
| "AggregatedSignatures", | ||
| "AggregationBits", | ||
| "AttestationData", | ||
| "Attestation", | ||
| "SignedAttestation", | ||
| "SignedAggregatedAttestations", | ||
| "Block", | ||
| "BlockWithAttestation", | ||
| "BlockBody", | ||
| "BlockHeader", | ||
| "Checkpoint", | ||
| "Config", | ||
| "SignedBlock", | ||
| "SignedVote", | ||
| "SignedBlockWithAttestation", | ||
| "Validator", | ||
| "State", | ||
| "Vote", | ||
| ] |
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,20 @@ | ||
| """Attestation containers and related types for the Lean spec.""" | ||
|
|
||
| from .attestation import ( | ||
| AggregatedAttestations, | ||
| Attestation, | ||
| AttestationData, | ||
| SignedAggregatedAttestations, | ||
| SignedAttestation, | ||
| ) | ||
| from .types import AggregatedSignatures, AggregationBits | ||
|
|
||
| __all__ = [ | ||
| "AttestationData", | ||
| "Attestation", | ||
| "SignedAttestation", | ||
| "SignedAggregatedAttestations", | ||
| "AggregatedAttestations", | ||
| "AggregatedSignatures", | ||
| "AggregationBits", | ||
| ] |
73 changes: 73 additions & 0 deletions
73
src/lean_spec/subspecs/containers/attestation/attestation.py
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,73 @@ | ||
| """Attestation-related container definitions.""" | ||
|
|
||
| from lean_spec.subspecs.containers.slot import Slot | ||
| from lean_spec.types import Bytes4000, Container, Uint64 | ||
|
|
||
| from ..checkpoint import Checkpoint | ||
| from .types import AggregatedSignatures, AggregationBits | ||
|
|
||
|
|
||
| class AttestationData(Container): | ||
| """Attestation content describing the validator's observed chain view.""" | ||
|
|
||
| slot: Slot | ||
| """The slot for which the attestation is made.""" | ||
|
|
||
| head: Checkpoint | ||
| """The checkpoint representing the head block as observed by the validator.""" | ||
|
|
||
| target: Checkpoint | ||
| """The checkpoint representing the target block as observed by the validator.""" | ||
|
|
||
| source: Checkpoint | ||
| """The checkpoint representing the source block as observed by the validator.""" | ||
|
|
||
|
|
||
| class Attestation(Container): | ||
| """Validator specific attestation wrapping shared attestation data.""" | ||
|
|
||
| validator_id: Uint64 | ||
| """The index of the validator making the attestation.""" | ||
|
|
||
| data: AttestationData | ||
| """The attestation data voted on by the validator.""" | ||
|
|
||
|
|
||
| class SignedAttestation(Container): | ||
| """Validator attestation bundled with its signature.""" | ||
|
|
||
| message: Attestation | ||
tcoratger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """The attestation message signed by the validator.""" | ||
|
|
||
| signature: Bytes4000 | ||
| """Signature aggregation produced by the leanVM (SNARKs in the future).""" | ||
|
|
||
|
|
||
| class AggregatedAttestations(Container): | ||
| """Aggregated attestation consisting of participation bits and message.""" | ||
|
|
||
| aggregation_bits: AggregationBits | ||
tcoratger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """Bitfield indicating which validators participated in the aggregation.""" | ||
|
|
||
| data: AttestationData | ||
| """Combined vote data similar to the beacon chain format. | ||
|
|
||
| Multiple validator votes are aggregated here without the complexity of | ||
| committee assignments. | ||
| """ | ||
|
|
||
|
|
||
| class SignedAggregatedAttestations(Container): | ||
| """Aggregated attestation bundled with aggregated signatures.""" | ||
|
|
||
| message: AggregatedAttestations | ||
| """Aggregated vote data.""" | ||
|
|
||
| signature: AggregatedSignatures | ||
| """Aggregated vote plus its combined signature. | ||
|
|
||
| Stores a naive list of validator signatures that mirrors the attestation | ||
| order. | ||
|
|
||
| TODO: this will be replaced by a SNARK in future devnets. | ||
| """ | ||
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,19 @@ | ||
| """Attestation-related SSZ types for the Lean consensus specification.""" | ||
|
|
||
| from lean_spec.types import Bytes4000, SSZList | ||
| from lean_spec.types.bitfields import BaseBitlist | ||
|
|
||
| from ...chain.config import VALIDATOR_REGISTRY_LIMIT | ||
|
|
||
|
|
||
| class AggregationBits(BaseBitlist): | ||
| """Bitlist representing validator participation in an attestation.""" | ||
|
|
||
| LIMIT = int(VALIDATOR_REGISTRY_LIMIT) | ||
|
|
||
|
|
||
| class AggregatedSignatures(SSZList): | ||
| """Naive list of validator signatures used for aggregation placeholders.""" | ||
|
|
||
| ELEMENT_TYPE = Bytes4000 | ||
| LIMIT = int(VALIDATOR_REGISTRY_LIMIT) |
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 |
|---|---|---|
| @@ -1,12 +1,20 @@ | ||
| """Block containers and related types for the Lean Ethereum consensus specification.""" | ||
|
|
||
| from .block import Block, BlockBody, BlockHeader, SignedBlock | ||
| from .types import Attestations | ||
| from .block import ( | ||
| Block, | ||
| BlockBody, | ||
| BlockHeader, | ||
| BlockWithAttestation, | ||
| SignedBlockWithAttestation, | ||
| ) | ||
| from .types import Attestations, BlockSignatures | ||
|
|
||
| __all__ = [ | ||
| "Block", | ||
| "BlockBody", | ||
| "BlockHeader", | ||
| "SignedBlock", | ||
| "BlockWithAttestation", | ||
| "SignedBlockWithAttestation", | ||
| "Attestations", | ||
| "BlockSignatures", | ||
| ] |
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 |
|---|---|---|
|
|
@@ -4,17 +4,18 @@ | |
| from lean_spec.types import Bytes32, Uint64 | ||
| from lean_spec.types.container import Container | ||
|
|
||
| from .types import Attestations | ||
| from ..attestation import Attestation | ||
| from .types import Attestations, BlockSignatures | ||
|
|
||
|
|
||
| class BlockBody(Container): | ||
| """The body of a block, containing payload data.""" | ||
|
|
||
| attestations: Attestations | ||
g11tech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| A list of votes included in the block. | ||
| """Plain validator attestations carried in the block body. | ||
|
|
||
| Note: This will eventually be replaced by aggregated attestations. | ||
| Individual signatures live in the aggregated block signature list, so | ||
| these entries contain only vote data without per-attestation signatures. | ||
| """ | ||
|
|
||
|
|
||
|
|
@@ -56,14 +57,30 @@ class Block(Container): | |
| """The block's payload.""" | ||
|
|
||
|
|
||
| class SignedBlock(Container): | ||
| """A container for a block and the proposer's signature.""" | ||
| class BlockWithAttestation(Container): | ||
| """Bundle containing a block and the proposer's attestation.""" | ||
|
|
||
| message: Block | ||
| """The block being signed.""" | ||
| block: Block | ||
| """The proposed block message.""" | ||
|
|
||
| signature: Bytes32 | ||
| """ | ||
| The proposer's signature of the block message. | ||
| Note: Bytes32 is a placeholder; the actual signature is much larger. | ||
| proposer_attestation: Attestation | ||
| """The proposer's vote corresponding to this block.""" | ||
|
|
||
|
|
||
| class SignedBlockWithAttestation(Container): | ||
| """Envelope carrying a block, proposer vote, and aggregated signatures.""" | ||
|
|
||
| message: BlockWithAttestation | ||
| """The block plus proposer vote being signed.""" | ||
|
|
||
| signature: BlockSignatures | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| """Aggregated signature payload for the block. | ||
|
|
||
| Signatures remain in attestation order followed by the proposer signature | ||
| over entire message. For devnet 1, however the proposer signature is just | ||
| over message.proposer_attestation since leanVM is not yet performant enough | ||
| to aggregate signatures with sufficient throughput. | ||
|
|
||
| Eventually this field will be replaced by a SNARK (which represents the | ||
| aggregation of all signatures). | ||
| """ | ||
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 |
|---|---|---|
| @@ -1,13 +1,20 @@ | ||
| """Block-specific SSZ types for the Lean Ethereum consensus specification.""" | ||
|
|
||
| from lean_spec.types import SSZList | ||
| from lean_spec.types import Bytes4000, SSZList | ||
|
|
||
| from ...chain.config import VALIDATOR_REGISTRY_LIMIT | ||
| from ..vote import SignedVote | ||
| from ..attestation import Attestation | ||
|
|
||
|
|
||
| class Attestations(SSZList): | ||
| """List of signed votes (attestations) included in a block.""" | ||
| """List of validator attestations included in a block.""" | ||
|
|
||
| ELEMENT_TYPE = SignedVote | ||
| ELEMENT_TYPE = Attestation | ||
| LIMIT = int(VALIDATOR_REGISTRY_LIMIT) | ||
|
|
||
|
|
||
| class BlockSignatures(SSZList): | ||
| """Aggregated signature list included alongside the block.""" | ||
|
|
||
| ELEMENT_TYPE = Bytes4000 | ||
| LIMIT = int(VALIDATOR_REGISTRY_LIMIT) |
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
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.
Uh oh!
There was an error while loading. Please reload this page.