-
Notifications
You must be signed in to change notification settings - Fork 296
Create execution payload gossip validation #7623
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
Open
ahshum
wants to merge
52
commits into
unstable
Choose a base branch
from
sam/g
base: unstable
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 49 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
2b61c86
feat: disable execution payload validation for beacon block on gloas
ahshum d49413a
chore: include gloas spec for beacon_block
ahshum 411deae
feat: full block pool
ahshum 48075c3
fix: case
ahshum 46ad77e
feat: check block by root
ahshum 8bdb4f8
feat: add validation for execution payload
ahshum 1286ae7
feat: init full block pool
ahshum 4c02aa0
feat: create execution payload gossip processor
ahshum 4a81e7b
refactor: move toBlockId under gloas
ahshum 6463ef4
test: add full block pool
ahshum f9295bd
fix: simplify checks
ahshum 85cd2b6
chore: copyright year
ahshum dafc65a
fix: validation
ahshum 16a1c56
test: update case name
ahshum a4e16b6
feat: log bid for fallback investigation
ahshum a2af12a
fix: specify beacon block type
ahshum d3f1aa2
chore: todo
ahshum 8fce3e3
refactor: remove processing status
ahshum 7950b9b
chore: free unused var
ahshum 9abc8db
chore: import ordering
ahshum 8b78858
Merge branch 'unstable' into sam/g
ahshum 2f4d295
Merge branch 'unstable' into sam/g
ahshum 4922fb1
fix: beacon time from cfg
ahshum 59fab8f
refactor: check seen block from existing data
ahshum 832e990
Merge branch 'unstable' into sam/g
ahshum 7f13385
fix: beacon time from time params
ahshum b96fda8
fix: time params
ahshum b0fa3a5
Merge branch 'unstable' into sam/g
ahshum 3dbd874
fix: time params
ahshum 07bf838
fix: use table
ahshum a40ff27
refactor: remove unused function
ahshum 1c440d7
refactor: rename processor
ahshum c0da29d
refactor: remove unused block execution enabled impl
ahshum b6058b6
revert: gloas beacon_block validation
ahshum cf8fb6e
revert: undo full block pool
ahshum 5d5b8c5
refactor: execution payload gossip validation
ahshum df1600e
revert: extract changes
ahshum 9622532
feat: add envelope quarantine
ahshum 44b938a
revert: envelope block id
ahshum b45bdd0
feat: add envelope table
ahshum b3003a9
feat: update gossip handler
ahshum d2a3713
Merge branch 'unstable'
ahshum 168bd04
test: envelope quarantine
ahshum 6383065
fix: func to use
ahshum 21b5697
merge unstable
ahshum 53413a7
fix: verify sig
ahshum 03cd38f
fix: add missing by root
ahshum f9e4a6b
merge unstable
ahshum f60dfa3
chore: cleanup
ahshum a86e3c6
fix: style and comment
ahshum 58b37fd
merge unstable
ahshum 0c2ee81
fix: func call
ahshum 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
76 changes: 76 additions & 0 deletions
76
beacon_chain/consensus_object_pools/envelope_quarantine.nim
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,76 @@ | ||
| # beacon_chain | ||
| # Copyright (c) 2025 Status Research & Development GmbH | ||
| # Licensed and distributed under either of | ||
| # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). | ||
| # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). | ||
| # at your option. This file may not be copied, modified, or distributed except according to those terms. | ||
|
|
||
| {.push raises: [], gcsafe.} | ||
|
|
||
| import std/tables | ||
| import ../spec/[digest, forks] | ||
|
|
||
| type | ||
| EnvelopeQuarantine* = object | ||
| orphans*: Table[Eth2Digest, Table[uint64, SignedExecutionPayloadEnvelope]] | ||
| ## Envelopes that we have received but did not have a block yet. In the | ||
| ## ideal scenario, block should arrive before envelope but that is not | ||
| ## guaranteed. | ||
|
|
||
| missing*: HashSet[Eth2Digest] | ||
| ## List of block roots that we would like to have the envelopes but we | ||
| ## have not got yet. Missing envelopes should usually be found when we | ||
| ## received a block, blob or data column. | ||
|
|
||
| func init*(T: typedesc[EnvelopeQuarantine]): T = | ||
| T() | ||
|
|
||
| template root(v: SignedExecutionPayloadEnvelope): Eth2Digest = | ||
| v.message.beacon_block_root | ||
|
|
||
| func addMissing*( | ||
| self: var EnvelopeQuarantine, | ||
| root: Eth2Digest) = | ||
| self.missing.incl(root) | ||
|
|
||
| func addOrphan*( | ||
| self: var EnvelopeQuarantine, | ||
| envelope: SignedExecutionPayloadEnvelope) = | ||
| discard self.orphans | ||
| .mgetOrPut(envelope.root) | ||
| .hasKeyOrPut(envelope.message.builder_index, envelope) | ||
|
|
||
| func popOrphan*( | ||
| self: var EnvelopeQuarantine, | ||
| blck: gloas.SignedBeaconBlock, | ||
| ): Opt[SignedExecutionPayloadEnvelope] = | ||
| if blck.root notin self.orphans: | ||
| return Opt.none(SignedExecutionPayloadEnvelope) | ||
|
|
||
| template builderIdx: untyped = | ||
| blck.message.body.signed_execution_payload_bid.message.builder_index | ||
| try: | ||
| var envelope: SignedExecutionPayloadEnvelope | ||
| if self.orphans[blck.root].pop(builderIdx, envelope): | ||
| Opt.some(envelope) | ||
| else: | ||
| Opt.none(SignedExecutionPayloadEnvelope) | ||
| except KeyError: | ||
| Opt.none(SignedExecutionPayloadEnvelope) | ||
| finally: | ||
| # After poping an envelope by block, the rest will no longer be valid due to | ||
| # the mismatch builder index. | ||
| self.orphans.del(blck.root) | ||
|
|
||
| func cleanupOrphans*(self: var EnvelopeQuarantine, finalizedSlot: Slot) = | ||
| var toDel: seq[Eth2Digest] | ||
|
|
||
| for k, v in self.orphans: | ||
| for _, e in v: | ||
| if finalizedSlot >= e.message.slot: | ||
| toDel.add(k) | ||
| # check only the first envelope as slot should be the same by block root. | ||
| break | ||
|
|
||
| for k in toDel: | ||
| self.orphans.del(k) | ||
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.