-
Notifications
You must be signed in to change notification settings - Fork 139
chore(misc): Aligned with the Zesu's stateless input #3255
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
Filter94
wants to merge
4
commits into
main
Choose a base branch
from
guest-program-input-adjustment
base: main
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 all commits
Commits
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,119 @@ | ||
| """ | ||
| Canonical consensus-layer SSZ containers, copied verbatim from consensus-specs | ||
| @ v1.6.1 so they track upstream as forks evolve. They use `remerkleable` (the | ||
| library consensus-specs generates against), so the class bodies are identical to | ||
| upstream — only the imports and `source:` comments are local. | ||
|
|
||
| To re-sync: bump the tag, re-copy the affected `class`/alias/constant bodies from | ||
| the referenced spec files, and re-run the stateless-input SSZ decode round-trip | ||
| (`stateless_input.py::decode_stateless_input_ssz`, guarded by `_strict_decode`). | ||
|
|
||
|
Filter94 marked this conversation as resolved.
|
||
| Only canonical CL containers live here; the bespoke EIP-8025 stateless-input | ||
| envelope is in `stateless_input.py`. | ||
| """ | ||
|
|
||
| from remerkleable.basic import uint64, uint256 | ||
| from remerkleable.byte_arrays import ByteList, ByteVector, Bytes32, Bytes48, Bytes96 | ||
| from remerkleable.complex import Container, List | ||
|
|
||
| # ── Preset constants ───────────────────────────────────────────────────────── | ||
| # source: presets/mainnet/bellatrix.yaml | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/presets/mainnet/bellatrix.yaml | ||
| MAX_BYTES_PER_TRANSACTION = 2**30 # 1073741824 | ||
| MAX_TRANSACTIONS_PER_PAYLOAD = 2**20 # 1048576 | ||
| BYTES_PER_LOGS_BLOOM = 2**8 # 256 | ||
| MAX_EXTRA_DATA_BYTES = 2**5 # 32 | ||
| # source: presets/mainnet/capella.yaml | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/presets/mainnet/capella.yaml | ||
| MAX_WITHDRAWALS_PER_PAYLOAD = 2**4 # 16 | ||
| # source: presets/mainnet/electra.yaml | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/presets/mainnet/electra.yaml | ||
| MAX_DEPOSIT_REQUESTS_PER_PAYLOAD = 2**13 # 8192 | ||
| MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD = 2**4 # 16 | ||
| MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD = 2**1 # 2 | ||
|
|
||
| # ── Custom type aliases ────────────────────────────────────────────────────── | ||
| # source: specs/phase0/beacon-chain.md (Custom types table) | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/phase0/beacon-chain.md | ||
| Hash32 = Bytes32 | ||
| Gwei = uint64 | ||
| ValidatorIndex = uint64 | ||
| BLSPubkey = Bytes48 | ||
| BLSSignature = Bytes96 | ||
| # source: specs/capella/beacon-chain.md (Custom types table) | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/capella/beacon-chain.md | ||
| WithdrawalIndex = uint64 | ||
| # source: specs/bellatrix/beacon-chain.md (Custom types table) | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/bellatrix/beacon-chain.md | ||
| ExecutionAddress = ByteVector[20] # Bytes20 | ||
| Transaction = ByteList[MAX_BYTES_PER_TRANSACTION] | ||
|
|
||
| # ── Containers (verbatim) ──────────────────────────────────────────────────── | ||
| # source: specs/capella/beacon-chain.md | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/capella/beacon-chain.md | ||
|
|
||
|
|
||
| class Withdrawal(Container): | ||
| index: WithdrawalIndex | ||
| validator_index: ValidatorIndex | ||
| address: ExecutionAddress | ||
| amount: Gwei | ||
|
|
||
|
|
||
| # source: specs/deneb/beacon-chain.md (unchanged through Electra/Fulu @ v1.6.1) | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/deneb/beacon-chain.md | ||
|
|
||
|
|
||
| class ExecutionPayload(Container): | ||
| parent_hash: Hash32 | ||
| fee_recipient: ExecutionAddress | ||
| state_root: Bytes32 | ||
| receipts_root: Bytes32 | ||
| logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM] | ||
| prev_randao: Bytes32 | ||
| block_number: uint64 | ||
| gas_limit: uint64 | ||
| gas_used: uint64 | ||
| timestamp: uint64 | ||
| extra_data: ByteList[MAX_EXTRA_DATA_BYTES] | ||
| base_fee_per_gas: uint256 | ||
| block_hash: Hash32 | ||
| transactions: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD] | ||
| withdrawals: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD] | ||
| # [New in Deneb:EIP4844] | ||
| blob_gas_used: uint64 | ||
| # [New in Deneb:EIP4844] | ||
| excess_blob_gas: uint64 | ||
|
|
||
|
|
||
| # source: specs/electra/beacon-chain.md | ||
| # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/electra/beacon-chain.md | ||
|
|
||
|
|
||
| class DepositRequest(Container): | ||
| pubkey: BLSPubkey | ||
| withdrawal_credentials: Bytes32 | ||
| amount: Gwei | ||
| signature: BLSSignature | ||
| index: uint64 | ||
|
|
||
|
|
||
| class WithdrawalRequest(Container): | ||
| source_address: ExecutionAddress | ||
| validator_pubkey: BLSPubkey | ||
| amount: Gwei | ||
|
|
||
|
|
||
| class ConsolidationRequest(Container): | ||
| source_address: ExecutionAddress | ||
| source_pubkey: BLSPubkey | ||
| target_pubkey: BLSPubkey | ||
|
|
||
|
|
||
| class ExecutionRequests(Container): | ||
| # [New in Electra:EIP6110] | ||
| deposits: List[DepositRequest, MAX_DEPOSIT_REQUESTS_PER_PAYLOAD] | ||
| # [New in Electra:EIP7002:EIP7251] | ||
| withdrawals: List[WithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] | ||
| # [New in Electra:EIP7251] | ||
| consolidations: List[ConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] | ||
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.