mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-18 22:49:34 +00:00
Implement Electra devnet-1 changes (#5937)
* Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into p2p-electra * Merge branch 'p2p-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * fix genesis from eth1 for electra * Fix Electra Fork Choice Tests (#5764) * add new operation tests * Fix Electra Fork Choice Tests (#5764) * Fix Electra Fork Choice Tests (#5764) * Fix Electra Fork Choice Tests (#5764) * add epoch processing new tests * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into p2p-electra * Merge branch 'ef-tests-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * Merge branch 'p2p-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * fix ef test compilation * disable and enable ef test for epoch processing appropriately * add consolidations to merkle calc for inclusion proof * fix should_override_fc tests * Merge branch 'ef-tests-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * get ssz tests compiling * ssz merkle validity for only deneb * im dumb af * Merge remote-tracking branch 'upstream/ef-tests-electra' into ef-tests-electra * enable tests * Fix Consolidation Sigs & Withdrawals * Merge pull request #5766 from ethDreamer/two_fixes Fix Consolidation Sigs & Withdrawals * Merge branches 'block-processing-electra' and 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into p2p-electra * Merge branch 'p2p-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * comment out consolidation operation ef tests until they are added * add signed consolidation ssz tests * add as_iter to all List and Vector fields in the beacon state * remove dbg * Send unagg attestation based on fork * Merge branch 'beacon-api-electra' into p2p-electra * Merge branch 'p2p-electra' into ef-tests-electra * Fix Epoch Processing Consolidations * Fix Final Spec Tests! * Fix ser/de * Merge branch 'electra-engine-api' into beacon-api-electra * Merge branch 'beacon-api-electra' into p2p-electra * Merge branch 'p2p-electra' into ef-tests-electra * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * update electra readiness with new endpoints * don't block mev boost till genesis finalization * Publish all aggregates * just one more check bro plz.. * Fix Bug In Block Processing with 0x02 Credentials * fix slashing handling * Fix Bug In Block Processing with 0x02 Credentials * Merge remote-tracking branch 'upstream/unstable' * Send unagg attestation based on fork * Publish all aggregates * just one more check bro plz.. * Merge pull request #5832 from ethDreamer/electra_attestation_changes_merge_unstable Merge `unstable` into `electra_attestation_changes` * Merge pull request #5835 from realbigsean/fix-validator-logic Fix validator logic * Merge pull request #5816 from realbigsean/electra-attestation-slashing-handling Electra slashing handling * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into p2p-electra * Merge branch 'p2p-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * Rename deploy block electra (#5853) * Rename deploy_block.txt to deposit_contract_block.txt * fmt * Change for prater too * fix: serde rename camle case for execution payload body (#5846) * Merge branch 'electra-engine-api' into beacon-api-electra * Merge branch 'beacon-api-electra' into p2p-electra * Merge branch 'p2p-electra' into ef-tests-electra * Electra attestation changes rm decode impl (#5856) * Remove Crappy Decode impl for Attestation * Remove Inefficient Attestation Decode impl * Implement Schema Upgrade / Downgrade * Update beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs Co-authored-by: Michael Sproul <micsproul@gmail.com> --------- Co-authored-by: Michael Sproul <micsproul@gmail.com> * Fix failing attestation tests and misc electra attestation cleanup (#5810) * - get attestation related beacon chain tests to pass - observed attestations are now keyed off of data + committee index - rename op pool attestationref to compactattestationref - remove unwraps in agg pool and use options instead - cherry pick some changes from ef-tests-electra * cargo fmt * fix failing test * Revert dockerfile changes * make committee_index return option * function args shouldnt be a ref to attestation ref * fmt * fix dup imports --------- Co-authored-by: realbigsean <seananderson33@GMAIL.com> * fix some todos (#5817) * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * add consolidations to merkle calc for inclusion proof * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into p2p-electra * Merge branch 'p2p-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * Remove Duplicate KZG Commitment Merkle Proof Code (#5874) * Remove Duplicate KZG Commitment Merkle Proof Code * s/tree_lists/fields/ * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * fix compile * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * Fix slasher tests (#5906) * Fix electra tests * Add electra attestations to double vote tests * Update superstruct to 0.8 * Merge remote-tracking branch 'origin/unstable' into electra_attestation_changes * Small cleanup in slasher tests * Clean up Electra observed aggregates (#5929) * Use consistent key in observed_attestations * Remove unwraps from observed aggregates * move committee bits to the last index in attestation (#5924) * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * De-dup attestation constructor logic * Remove unwraps in Attestation construction * Dedup match_attestation_data * Remove outdated TODO * Use ForkName Ord in fork-choice tests * Use ForkName Ord in BeaconBlockBody * Make to_electra not fallible * Remove TestRandom impl for IndexedAttestation * Remove IndexedAttestation faulty Decode impl * Drop TestRandom impl * Add PendingAttestationInElectra * Indexed att on disk (#35) * indexed att on disk * fix lints * Update slasher/src/migrate.rs Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> --------- Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> * add electra fork enabled fn to ForkName impl (#36) * add electra fork enabled fn to ForkName impl * remove inadvertent file * Update common/eth2/src/types.rs Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> * Dedup attestation constructor logic in attester cache * Use if let Ok for committee_bits * Dedup Attestation constructor code * Diff reduction in tests * Fix beacon_chain tests * Diff reduction * Use Ord for ForkName in pubsub * Resolve into_attestation_and_indices todo * Remove stale TODO * Fix beacon_chain tests * Test spec invariant * Use electra_enabled in pubsub * Remove get_indexed_attestation_from_signed_aggregate * Use ok_or instead of if let else * committees are sorted * remove dup method `get_indexed_attestation_from_committees` * Merge pull request #5940 from dapplion/electra_attestation_changes_lionreview Electra attestations #5712 review * update default persisted op pool deserialization * ensure aggregate and proof uses serde untagged on ref * Fork aware ssz static attestation tests * Electra attestation changes from Lions review (#5971) * dedup/cleanup and remove unneeded hashset use * remove irrelevant TODOs * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * Merge branch 'ef-tests-electra' of https://github.com/sigp/lighthouse into electra-devnet-1 * Fix Compilation Break * Merge pull request #5973 from ethDreamer/beacon-api-electra Fix Compilation Break * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * Merge branch 'ef-tests-electra' of https://github.com/sigp/lighthouse into electra-devnet-1 * Rename Constants, Structures, and Fields * Second Round * Third Round * Round Four * Electra attestation changes sean review (#5972) * instantiate empty bitlist in unreachable code * clean up error conversion * fork enabled bool cleanup * remove a couple todos * return bools instead of options in `aggregate` and use the result * delete commented out code * use map macros in simple transformations * remove signers_disjoint_from * get ef tests compiling * get ef tests compiling * update intentionally excluded files * Avoid changing slasher schema for Electra * Delete slasher schema v4 * Fix clippy * Fix compilation of beacon_chain tests * Update database.rs * Update per_block_processing.rs * Add electra lightclient types * Update slasher/src/database.rs * fix imports * Merge pull request #5980 from dapplion/electra-lightclient Add electra lightclient types * Merge pull request #5975 from michaelsproul/electra-slasher-no-migration Avoid changing slasher schema for Electra * Update beacon_node/beacon_chain/src/attestation_verification.rs * Update beacon_node/beacon_chain/src/attestation_verification.rs * Merge pull request #5974 from ethDreamer/electra-devnet-1 Electra: `devnet-1` Rename and Move Stuff * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * Merge branch 'electra_attestation_changes' of https://github.com/realbigsean/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * clean up enabled and disabled fork logic in ef tests * Merge branch 'ef-tests-electra' of https://github.com/sigp/lighthouse into electra-devnet-1 * Electra devnet 1 process operations (#5994) * Implement `process_consolidation_requests()` * Finish Changes to `process_operations()` * Fix Lint * Fix test * use electra_enabled() * add light client ssz tests * Update `engine-api` for `devnet-1` * disable failing light client ssz tests * correctly exclude light client struct from accessed files * Fix Failing Tests * Fix Calculations Relying on MAX_EB (#5983) * Fix Calculations Relying on MAX_EB * Use spec fn for max_effective_balance * The great renaming receipt -> request * Address some more review comments * Electra: Get `devnet-1` ef-tests Working * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra-engine-api * Update beacon_node/beacon_chain/src/electra_readiness.rs * Update consensus/types/src/chain_spec.rs * Update pending balance deposit processing (#6005) * Update pending balance deposit processing * Update single_pass.rs --------- Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Merge pull request #6001 from ethDreamer/electra-devnet-1-engine-api Update `engine-api` for `devnet-1` * Merge pull request #6019 from ethDreamer/electra-devnet-1-ef-tests Electra: Get `devnet-1` ef-tests Working * Fix Bug in `engine_api` by Renaming Field * Merge pull request #6047 from ethDreamer/electra-devnet-1-engine-api-fix Fix Bug in `engine_api` by Renaming Field * one more stupid rename * update GET requests * update POST requests * add client updates and test updates * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * compile after merge * unwrap -> unwrap_err * self review * fix tests * convert op pool messages to electra in electra * remove methods to post without content header * Add BeaconBlocksByRange v3 * Revert "Add BeaconBlocksByRange v3" This reverts commite3ce7fc5ea. * filter instead of convert * Add range sync metrics to track efficiency (#6095) * Add more range sync metrics to track efficiency * Add ignored blocks metrics * Enable the outbound rate limiter by default, and update blobs method quotas (#6093) * Enable the outbound rate limiter by default, and update blobs method quotas. * Lint and book updates. * Beacon api + validator electra (#5744) * Attestation superstruct changes for EIP 7549 (#5644) * update * experiment * superstruct changes * revert * superstruct changes * fix tests * indexed attestation * indexed attestation superstruct * updated TODOs * `superstruct` the `AttesterSlashing` (#5636) * `superstruct` Attester Fork Variants * Push a little further * Deal with Encode / Decode of AttesterSlashing * not so sure about this.. * Stop Encode/Decode Bounds from Propagating Out * Tons of Changes.. * More Conversions to AttestationRef * Add AsReference trait (#15) * Add AsReference trait * Fix some snafus * Got it Compiling! :D * Got Tests Building * Get beacon chain tests compiling --------- Co-authored-by: Michael Sproul <micsproul@gmail.com> * Merge remote-tracking branch 'upstream/unstable' into electra_attestation_changes * Make EF Tests Fork-Agnostic (#5713) * Finish EF Test Fork Agnostic (#5714) * Superstruct `AggregateAndProof` (#5715) * Upgrade `superstruct` to `0.8.0` * superstruct `AggregateAndProof` * Merge remote-tracking branch 'sigp/unstable' into electra_attestation_changes * cargo fmt * Merge pull request #5726 from realbigsean/electra_attestation_changes Merge unstable into Electra attestation changes * process withdrawals updates * cleanup withdrawals processing * update `process_operations` deposit length check * add apply_deposit changes * add execution layer withdrawal request processing * process deposit receipts * add consolidation processing * update process operations function * exit updates * clean up * update slash_validator * EIP7549 `get_attestation_indices` (#5657) * get attesting indices electra impl * fmt * get tests to pass * fmt * fix some beacon chain tests * fmt * fix slasher test * fmt got me again * fix more tests * fix tests * Some small changes (#5739) * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * cargo fmt (#5740) * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * fix attestation verification * Add new engine api methods * Fix the versioning of v4 requests * Handle new engine api methods in mock EL * Note todo * Fix todos * Add support for electra fields in getPayloadBodies * Add comments for potential versioning confusion * udpates for aggregate attestation endpoint * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Sketch op pool changes * fix get attesting indices (#5742) * fix get attesting indices * better errors * fix compile * only get committee index once * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Ef test fixes (#5753) * attestation related ef test fixes * delete commented out stuff * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Fix Aggregation Pool for Electra (#5754) * Fix Aggregation Pool for Electra * Remove Outdated Interface * fix ssz (#5755) * Get `electra_op_pool` up to date (#5756) * fix get attesting indices (#5742) * fix get attesting indices * better errors * fix compile * only get committee index once * Ef test fixes (#5753) * attestation related ef test fixes * delete commented out stuff * Fix Aggregation Pool for Electra (#5754) * Fix Aggregation Pool for Electra * Remove Outdated Interface * fix ssz (#5755) --------- Co-authored-by: realbigsean <sean@sigmaprime.io> * Revert "Get `electra_op_pool` up to date (#5756)" (#5757) This reverts commitab9e58aa3d. * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into electra_op_pool * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Compute on chain aggregate impl (#5752) * add compute_on_chain_agg impl to op pool changes * fmt * get op pool tests to pass * update beacon api aggregate attestationendpoint * update the naive agg pool interface (#5760) * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * updates after merge * Fix bugs in cross-committee aggregation * Add comment to max cover optimisation * Fix assert * Electra epoch processing * add deposit limit for old deposit queue * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge pull request #5749 from sigp/electra_op_pool Optimise Electra op pool aggregation * don't fail on empty consolidations * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * update committee offset * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * update committee offset * update committee offset * update committee offset * only increment the state deposit index on old deposit flow * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * use correct max eb in epoch cache initialization * drop initiate validator ordering optimization * fix initiate exit for single pass * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * accept new payload v4 in mock el * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Fix Electra Fork Choice Tests (#5764) * Fix Electra Fork Choice Tests (#5764) * Fix Electra Fork Choice Tests (#5764) * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Fix Consolidation Sigs & Withdrawals * Merge pull request #5766 from ethDreamer/two_fixes Fix Consolidation Sigs & Withdrawals * Merge branches 'block-processing-electra' and 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Send unagg attestation based on fork * Fix ser/de * Merge branch 'electra-engine-api' into beacon-api-electra * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * Subscribe to the correct subnets for electra attestations (#5782) * subscribe to the correct att subnets for electra * subscribe to the correct att subnets for electra * cargo fmt * update electra readiness with new endpoints * fix slashing handling * Fix Bug In Block Processing with 0x02 Credentials * Merge remote-tracking branch 'upstream/unstable' * Send unagg attestation based on fork * Publish all aggregates * just one more check bro plz.. * Merge pull request #5832 from ethDreamer/electra_attestation_changes_merge_unstable Merge `unstable` into `electra_attestation_changes` * Merge pull request #5835 from realbigsean/fix-validator-logic Fix validator logic * Merge pull request #5816 from realbigsean/electra-attestation-slashing-handling Electra slashing handling * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * fix: serde rename camle case for execution payload body (#5846) * Merge branch 'electra-engine-api' into beacon-api-electra * Electra attestation changes rm decode impl (#5856) * Remove Crappy Decode impl for Attestation * Remove Inefficient Attestation Decode impl * Implement Schema Upgrade / Downgrade * Update beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs Co-authored-by: Michael Sproul <micsproul@gmail.com> --------- Co-authored-by: Michael Sproul <micsproul@gmail.com> * Fix failing attestation tests and misc electra attestation cleanup (#5810) * - get attestation related beacon chain tests to pass - observed attestations are now keyed off of data + committee index - rename op pool attestationref to compactattestationref - remove unwraps in agg pool and use options instead - cherry pick some changes from ef-tests-electra * cargo fmt * fix failing test * Revert dockerfile changes * make committee_index return option * function args shouldnt be a ref to attestation ref * fmt * fix dup imports --------- Co-authored-by: realbigsean <seananderson33@GMAIL.com> * fix some todos (#5817) * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * add consolidations to merkle calc for inclusion proof * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Remove Duplicate KZG Commitment Merkle Proof Code (#5874) * Remove Duplicate KZG Commitment Merkle Proof Code * s/tree_lists/fields/ * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * fix compile * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Fix slasher tests (#5906) * Fix electra tests * Add electra attestations to double vote tests * Update superstruct to 0.8 * Merge remote-tracking branch 'origin/unstable' into electra_attestation_changes * Small cleanup in slasher tests * Clean up Electra observed aggregates (#5929) * Use consistent key in observed_attestations * Remove unwraps from observed aggregates * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * De-dup attestation constructor logic * Remove unwraps in Attestation construction * Dedup match_attestation_data * Remove outdated TODO * Use ForkName Ord in fork-choice tests * Use ForkName Ord in BeaconBlockBody * Make to_electra not fallible * Remove TestRandom impl for IndexedAttestation * Remove IndexedAttestation faulty Decode impl * Drop TestRandom impl * Add PendingAttestationInElectra * Indexed att on disk (#35) * indexed att on disk * fix lints * Update slasher/src/migrate.rs Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> --------- Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> * add electra fork enabled fn to ForkName impl (#36) * add electra fork enabled fn to ForkName impl * remove inadvertent file * Update common/eth2/src/types.rs Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> * Dedup attestation constructor logic in attester cache * Use if let Ok for committee_bits * Dedup Attestation constructor code * Diff reduction in tests * Fix beacon_chain tests * Diff reduction * Use Ord for ForkName in pubsub * Resolve into_attestation_and_indices todo * Remove stale TODO * Fix beacon_chain tests * Test spec invariant * Use electra_enabled in pubsub * Remove get_indexed_attestation_from_signed_aggregate * Use ok_or instead of if let else * committees are sorted * remove dup method `get_indexed_attestation_from_committees` * Merge pull request #5940 from dapplion/electra_attestation_changes_lionreview Electra attestations #5712 review * update default persisted op pool deserialization * ensure aggregate and proof uses serde untagged on ref * Fork aware ssz static attestation tests * Electra attestation changes from Lions review (#5971) * dedup/cleanup and remove unneeded hashset use * remove irrelevant TODOs * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * Fix Compilation Break * Merge pull request #5973 from ethDreamer/beacon-api-electra Fix Compilation Break * Electra attestation changes sean review (#5972) * instantiate empty bitlist in unreachable code * clean up error conversion * fork enabled bool cleanup * remove a couple todos * return bools instead of options in `aggregate` and use the result * delete commented out code * use map macros in simple transformations * remove signers_disjoint_from * get ef tests compiling * get ef tests compiling * update intentionally excluded files * Avoid changing slasher schema for Electra * Delete slasher schema v4 * Fix clippy * Fix compilation of beacon_chain tests * Update database.rs * Update per_block_processing.rs * Add electra lightclient types * Update slasher/src/database.rs * fix imports * Merge pull request #5980 from dapplion/electra-lightclient Add electra lightclient types * Merge pull request #5975 from michaelsproul/electra-slasher-no-migration Avoid changing slasher schema for Electra * Update beacon_node/beacon_chain/src/attestation_verification.rs * Update beacon_node/beacon_chain/src/attestation_verification.rs * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes * Merge branch 'electra_attestation_changes' of https://github.com/realbigsean/lighthouse into block-processing-electra * Merge branch 'block-processing-electra' of https://github.com/sigp/lighthouse into electra-epoch-proc * Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * The great renaming receipt -> request * Address some more review comments * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra-engine-api * Update beacon_node/beacon_chain/src/electra_readiness.rs * Update consensus/types/src/chain_spec.rs * update GET requests * update POST requests * add client updates and test updates * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra-engine-api * Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra * compile after merge * unwrap -> unwrap_err * self review * fix tests * convert op pool messages to electra in electra * remove methods to post without content header * filter instead of convert * Merge branch 'unstable' of https://github.com/sigp/lighthouse into beacon-api-electra * Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra * fix ef test compile * use `enabled` fork methods * get tests passing * last updates * Fix bug on engine api with consolidations (#6101) * Fix small bug in engine_api * Merge pull request #6116 from ethDreamer/electra-devnet-1 Fix payload_bodies bug in engine_api * Merge branch 'unstable' of https://github.com/sigp/lighthouse into ef-tests-electra * add deposit request file * Merge branch 'unstable' of https://github.com/sigp/lighthouse into ef-tests-electra * Merge branch 'ef-tests-electra' of https://github.com/sigp/lighthouse into electra-devnet-1 * clean up after merge * Fix Broken Test on `devnet-1` * another small bug * Merge pull request #6132 from ethDreamer/devnet-1-fix-test Fix Broken Test on `devnet-1` * Fix Deserialization Bug in `engine-api` * Merge pull request #6235 from ethDreamer/fix_deserialization Fix Deserialization Bug in `engine-api` * Merge branch 'unstable' into electra-devnet-1 * remove import * Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra-devnet-1 * Remove false negative checks on `shuffling_is_compatible` * Fix flaky validator monitor test
This commit is contained in:
@@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
|
||||
# `uint64(2**3)` (= 8)
|
||||
MAX_ATTESTATIONS_ELECTRA: 8
|
||||
# `uint64(2**0)` (= 1)
|
||||
MAX_CONSOLIDATIONS: 1
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
|
||||
|
||||
# Execution
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
|
||||
# `uint64(2**3)` (= 8)
|
||||
MAX_ATTESTATIONS_ELECTRA: 8
|
||||
# `uint64(2**0)` (= 1)
|
||||
MAX_CONSOLIDATIONS: 1
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
|
||||
|
||||
# Execution
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
|
||||
# `uint64(2**3)` (= 8)
|
||||
MAX_ATTESTATIONS_ELECTRA: 8
|
||||
# `uint64(2**0)` (= 1)
|
||||
MAX_CONSOLIDATIONS: 1
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
|
||||
|
||||
# Execution
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -77,9 +77,9 @@ pub struct Attestation<E: EthSpec> {
|
||||
#[superstruct(only(Electra), partial_getter(rename = "aggregation_bits_electra"))]
|
||||
pub aggregation_bits: BitList<E::MaxValidatorsPerSlot>,
|
||||
pub data: AttestationData,
|
||||
pub signature: AggregateSignature,
|
||||
#[superstruct(only(Electra))]
|
||||
pub committee_bits: BitVector<E::MaxCommitteesPerSlot>,
|
||||
pub signature: AggregateSignature,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Hash for Attestation<E> {
|
||||
|
||||
@@ -670,7 +670,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockElectra<E, Payload>
|
||||
graffiti: Graffiti::default(),
|
||||
execution_payload: Payload::Electra::default(),
|
||||
blob_kzg_commitments: VariableList::empty(),
|
||||
consolidations: VariableList::empty(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -701,7 +700,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockElec
|
||||
execution_payload: Payload::Electra::default(),
|
||||
bls_to_execution_changes: VariableList::empty(),
|
||||
blob_kzg_commitments: VariableList::empty(),
|
||||
consolidations: VariableList::empty(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +114,6 @@ pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPay
|
||||
VariableList<SignedBlsToExecutionChange, E::MaxBlsToExecutionChanges>,
|
||||
#[superstruct(only(Deneb, Electra))]
|
||||
pub blob_kzg_commitments: KzgCommitments<E>,
|
||||
#[superstruct(only(Electra))]
|
||||
pub consolidations: VariableList<SignedConsolidation, E::MaxConsolidations>,
|
||||
#[superstruct(only(Base, Altair))]
|
||||
#[metastruct(exclude_from(fields))]
|
||||
#[ssz(skip_serializing, skip_deserializing)]
|
||||
@@ -664,7 +662,6 @@ impl<E: EthSpec> From<BeaconBlockBodyElectra<E, FullPayload<E>>>
|
||||
execution_payload: FullPayloadElectra { execution_payload },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
consolidations,
|
||||
} = body;
|
||||
|
||||
(
|
||||
@@ -683,7 +680,6 @@ impl<E: EthSpec> From<BeaconBlockBodyElectra<E, FullPayload<E>>>
|
||||
},
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments: blob_kzg_commitments.clone(),
|
||||
consolidations,
|
||||
},
|
||||
Some(execution_payload),
|
||||
)
|
||||
@@ -822,7 +818,6 @@ impl<E: EthSpec> BeaconBlockBodyElectra<E, FullPayload<E>> {
|
||||
execution_payload: FullPayloadElectra { execution_payload },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
consolidations,
|
||||
} = self;
|
||||
|
||||
BeaconBlockBodyElectra {
|
||||
@@ -840,7 +835,6 @@ impl<E: EthSpec> BeaconBlockBodyElectra<E, FullPayload<E>> {
|
||||
},
|
||||
bls_to_execution_changes: bls_to_execution_changes.clone(),
|
||||
blob_kzg_commitments: blob_kzg_commitments.clone(),
|
||||
consolidations: consolidations.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,11 +486,7 @@ where
|
||||
// Electra
|
||||
#[superstruct(only(Electra), partial_getter(copy))]
|
||||
#[metastruct(exclude_from(tree_lists))]
|
||||
#[serde(
|
||||
with = "serde_utils::quoted_u64",
|
||||
//TODO(electra) remove alias when ef tests are updated
|
||||
alias = "deposit_receipts_start_index"
|
||||
)]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub deposit_requests_start_index: u64,
|
||||
#[superstruct(only(Electra), partial_getter(copy))]
|
||||
#[metastruct(exclude_from(tree_lists))]
|
||||
@@ -897,6 +893,8 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
return Err(Error::InsufficientValidators);
|
||||
}
|
||||
|
||||
let max_effective_balance = spec.max_effective_balance_for_fork(self.fork_name_unchecked());
|
||||
|
||||
let mut i = 0;
|
||||
loop {
|
||||
let shuffled_index = compute_shuffled_index(
|
||||
@@ -912,9 +910,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
let random_byte = Self::shuffling_random_byte(i, seed)?;
|
||||
let effective_balance = self.get_effective_balance(candidate_index)?;
|
||||
if effective_balance.safe_mul(MAX_RANDOM_BYTE)?
|
||||
>= spec
|
||||
.max_effective_balance
|
||||
.safe_mul(u64::from(random_byte))?
|
||||
>= max_effective_balance.safe_mul(u64::from(random_byte))?
|
||||
{
|
||||
return Ok(candidate_index);
|
||||
}
|
||||
@@ -1095,6 +1091,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
let active_validator_count = active_validator_indices.len();
|
||||
|
||||
let seed = self.get_seed(epoch, Domain::SyncCommittee, spec)?;
|
||||
let max_effective_balance = spec.max_effective_balance_for_fork(self.fork_name_unchecked());
|
||||
|
||||
let mut i = 0;
|
||||
let mut sync_committee_indices = Vec::with_capacity(E::SyncCommitteeSize::to_usize());
|
||||
@@ -1112,9 +1109,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
let random_byte = Self::shuffling_random_byte(i, seed.as_bytes())?;
|
||||
let effective_balance = self.get_validator(candidate_index)?.effective_balance;
|
||||
if effective_balance.safe_mul(MAX_RANDOM_BYTE)?
|
||||
>= spec
|
||||
.max_effective_balance
|
||||
.safe_mul(u64::from(random_byte))?
|
||||
>= max_effective_balance.safe_mul(u64::from(random_byte))?
|
||||
{
|
||||
sync_committee_indices.push(candidate_index);
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
use crate::Epoch;
|
||||
use crate::{test_utils::TestRandom, SignedRoot};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use test_random_derive::TestRandom;
|
||||
use tree_hash_derive::TreeHash;
|
||||
|
||||
#[derive(
|
||||
arbitrary::Arbitrary,
|
||||
Debug,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
Clone,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Encode,
|
||||
Decode,
|
||||
TreeHash,
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct Consolidation {
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub source_index: u64,
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub target_index: u64,
|
||||
pub epoch: Epoch,
|
||||
}
|
||||
|
||||
impl SignedRoot for Consolidation {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
ssz_and_tree_hash_tests!(Consolidation);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::test_utils::TestRandom;
|
||||
use crate::{Consolidation, Signature};
|
||||
use crate::{test_utils::TestRandom, Address, PublicKeyBytes, SignedRoot};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use test_random_derive::TestRandom;
|
||||
@@ -19,14 +18,17 @@ use tree_hash_derive::TreeHash;
|
||||
TreeHash,
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct SignedConsolidation {
|
||||
pub message: Consolidation,
|
||||
pub signature: Signature,
|
||||
pub struct ConsolidationRequest {
|
||||
pub source_address: Address,
|
||||
pub source_pubkey: PublicKeyBytes,
|
||||
pub target_pubkey: PublicKeyBytes,
|
||||
}
|
||||
|
||||
impl SignedRoot for ConsolidationRequest {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
ssz_and_tree_hash_tests!(SignedConsolidation);
|
||||
ssz_and_tree_hash_tests!(ConsolidationRequest);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ pub trait EthSpec:
|
||||
type PendingBalanceDepositsLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type PendingPartialWithdrawalsLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type PendingConsolidationsLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxConsolidations: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxConsolidationRequestsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxDepositRequestsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxAttesterSlashingsElectra: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxAttestationsElectra: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
@@ -346,9 +346,9 @@ pub trait EthSpec:
|
||||
Self::PendingConsolidationsLimit::to_usize()
|
||||
}
|
||||
|
||||
/// Returns the `MAX_CONSOLIDATIONS` constant for this specification.
|
||||
fn max_consolidations() -> usize {
|
||||
Self::MaxConsolidations::to_usize()
|
||||
/// Returns the `MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD` constant for this specification.
|
||||
fn max_consolidation_requests_per_payload() -> usize {
|
||||
Self::MaxConsolidationRequestsPerPayload::to_usize()
|
||||
}
|
||||
|
||||
/// Returns the `MAX_DEPOSIT_REQUESTS_PER_PAYLOAD` constant for this specification.
|
||||
@@ -433,7 +433,7 @@ impl EthSpec for MainnetEthSpec {
|
||||
type PendingBalanceDepositsLimit = U134217728;
|
||||
type PendingPartialWithdrawalsLimit = U134217728;
|
||||
type PendingConsolidationsLimit = U262144;
|
||||
type MaxConsolidations = U1;
|
||||
type MaxConsolidationRequestsPerPayload = U1;
|
||||
type MaxDepositRequestsPerPayload = U8192;
|
||||
type MaxAttesterSlashingsElectra = U1;
|
||||
type MaxAttestationsElectra = U8;
|
||||
@@ -501,7 +501,7 @@ impl EthSpec for MinimalEthSpec {
|
||||
MaxBlobsPerBlock,
|
||||
BytesPerFieldElement,
|
||||
PendingBalanceDepositsLimit,
|
||||
MaxConsolidations,
|
||||
MaxConsolidationRequestsPerPayload,
|
||||
MaxAttesterSlashingsElectra,
|
||||
MaxAttestationsElectra
|
||||
});
|
||||
@@ -560,7 +560,7 @@ impl EthSpec for GnosisEthSpec {
|
||||
type PendingBalanceDepositsLimit = U134217728;
|
||||
type PendingPartialWithdrawalsLimit = U134217728;
|
||||
type PendingConsolidationsLimit = U262144;
|
||||
type MaxConsolidations = U1;
|
||||
type MaxConsolidationRequestsPerPayload = U1;
|
||||
type MaxDepositRequestsPerPayload = U8192;
|
||||
type MaxAttesterSlashingsElectra = U1;
|
||||
type MaxAttestationsElectra = U8;
|
||||
|
||||
@@ -16,7 +16,9 @@ pub type Withdrawals<E> = VariableList<Withdrawal, <E as EthSpec>::MaxWithdrawal
|
||||
pub type DepositRequests<E> =
|
||||
VariableList<DepositRequest, <E as EthSpec>::MaxDepositRequestsPerPayload>;
|
||||
pub type WithdrawalRequests<E> =
|
||||
VariableList<ExecutionLayerWithdrawalRequest, <E as EthSpec>::MaxWithdrawalRequestsPerPayload>;
|
||||
VariableList<WithdrawalRequest, <E as EthSpec>::MaxWithdrawalRequestsPerPayload>;
|
||||
pub type ConsolidationRequests<E> =
|
||||
VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>;
|
||||
|
||||
#[superstruct(
|
||||
variants(Bellatrix, Capella, Deneb, Electra),
|
||||
@@ -94,12 +96,12 @@ pub struct ExecutionPayload<E: EthSpec> {
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub excess_blob_gas: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
//TODO(electra) remove alias once EF tests are updates with correct name
|
||||
#[serde(alias = "deposit_receipts")]
|
||||
pub deposit_requests: VariableList<DepositRequest, E::MaxDepositRequestsPerPayload>,
|
||||
#[superstruct(only(Electra))]
|
||||
pub withdrawal_requests:
|
||||
VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>,
|
||||
pub withdrawal_requests: VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>,
|
||||
#[superstruct(only(Electra))]
|
||||
pub consolidation_requests:
|
||||
VariableList<ConsolidationRequest, E::MaxConsolidationRequestsPerPayload>,
|
||||
}
|
||||
|
||||
impl<'a, E: EthSpec> ExecutionPayloadRef<'a, E> {
|
||||
|
||||
@@ -86,11 +86,11 @@ pub struct ExecutionPayloadHeader<E: EthSpec> {
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub excess_blob_gas: u64,
|
||||
#[superstruct(only(Electra), partial_getter(copy))]
|
||||
//TODO(electra) remove alias once EF tests are updates with correct name
|
||||
#[serde(alias = "deposit_receipts_root")]
|
||||
pub deposit_requests_root: Hash256,
|
||||
#[superstruct(only(Electra), partial_getter(copy))]
|
||||
pub withdrawal_requests_root: Hash256,
|
||||
#[superstruct(only(Electra), partial_getter(copy))]
|
||||
pub consolidation_requests_root: Hash256,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> ExecutionPayloadHeader<E> {
|
||||
@@ -127,6 +127,15 @@ impl<E: EthSpec> ExecutionPayloadHeader<E> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fork_name_unchecked(&self) -> ForkName {
|
||||
match self {
|
||||
ExecutionPayloadHeader::Bellatrix(_) => ForkName::Bellatrix,
|
||||
ExecutionPayloadHeader::Capella(_) => ForkName::Capella,
|
||||
ExecutionPayloadHeader::Deneb(_) => ForkName::Deneb,
|
||||
ExecutionPayloadHeader::Electra(_) => ForkName::Electra,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, E: EthSpec> ExecutionPayloadHeaderRef<'a, E> {
|
||||
@@ -206,6 +215,7 @@ impl<E: EthSpec> ExecutionPayloadHeaderDeneb<E> {
|
||||
excess_blob_gas: self.excess_blob_gas,
|
||||
deposit_requests_root: Hash256::zero(),
|
||||
withdrawal_requests_root: Hash256::zero(),
|
||||
consolidation_requests_root: Hash256::zero(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,6 +309,7 @@ impl<'a, E: EthSpec> From<&'a ExecutionPayloadElectra<E>> for ExecutionPayloadHe
|
||||
excess_blob_gas: payload.excess_blob_gas,
|
||||
deposit_requests_root: payload.deposit_requests.tree_hash_root(),
|
||||
withdrawal_requests_root: payload.withdrawal_requests.tree_hash_root(),
|
||||
consolidation_requests_root: payload.consolidation_requests.tree_hash_root(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ pub mod bls_to_execution_change;
|
||||
pub mod builder_bid;
|
||||
pub mod chain_spec;
|
||||
pub mod checkpoint;
|
||||
pub mod consolidation;
|
||||
pub mod consolidation_request;
|
||||
pub mod consts;
|
||||
pub mod contribution_and_proof;
|
||||
pub mod deposit;
|
||||
@@ -39,7 +39,6 @@ pub mod enr_fork_id;
|
||||
pub mod eth1_data;
|
||||
pub mod eth_spec;
|
||||
pub mod execution_block_hash;
|
||||
pub mod execution_layer_withdrawal_request;
|
||||
pub mod execution_payload;
|
||||
pub mod execution_payload_header;
|
||||
pub mod fork;
|
||||
@@ -67,7 +66,6 @@ pub mod signed_aggregate_and_proof;
|
||||
pub mod signed_beacon_block;
|
||||
pub mod signed_beacon_block_header;
|
||||
pub mod signed_bls_to_execution_change;
|
||||
pub mod signed_consolidation;
|
||||
pub mod signed_contribution_and_proof;
|
||||
pub mod signed_voluntary_exit;
|
||||
pub mod signing_data;
|
||||
@@ -77,6 +75,7 @@ pub mod validator;
|
||||
pub mod validator_subscription;
|
||||
pub mod voluntary_exit;
|
||||
pub mod withdrawal_credentials;
|
||||
pub mod withdrawal_request;
|
||||
#[macro_use]
|
||||
pub mod slot_epoch_macros;
|
||||
pub mod activation_queue;
|
||||
@@ -146,7 +145,7 @@ pub use crate::checkpoint::Checkpoint;
|
||||
pub use crate::config_and_preset::{
|
||||
ConfigAndPreset, ConfigAndPresetCapella, ConfigAndPresetDeneb, ConfigAndPresetElectra,
|
||||
};
|
||||
pub use crate::consolidation::Consolidation;
|
||||
pub use crate::consolidation_request::ConsolidationRequest;
|
||||
pub use crate::contribution_and_proof::ContributionAndProof;
|
||||
pub use crate::data_column_sidecar::{
|
||||
ColumnIndex, DataColumnIdentifier, DataColumnSidecar, DataColumnSidecarList,
|
||||
@@ -163,7 +162,6 @@ pub use crate::eth1_data::Eth1Data;
|
||||
pub use crate::eth_spec::EthSpecId;
|
||||
pub use crate::execution_block_hash::ExecutionBlockHash;
|
||||
pub use crate::execution_block_header::{EncodableExecutionBlockHeader, ExecutionBlockHeader};
|
||||
pub use crate::execution_layer_withdrawal_request::ExecutionLayerWithdrawalRequest;
|
||||
pub use crate::execution_payload::{
|
||||
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb,
|
||||
ExecutionPayloadElectra, ExecutionPayloadRef, Transaction, Transactions, Withdrawals,
|
||||
@@ -235,7 +233,6 @@ pub use crate::signed_beacon_block::{
|
||||
};
|
||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
||||
pub use crate::signed_consolidation::SignedConsolidation;
|
||||
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
||||
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
|
||||
pub use crate::signing_data::{SignedRoot, SigningData};
|
||||
@@ -256,6 +253,7 @@ pub use crate::validator_subscription::ValidatorSubscription;
|
||||
pub use crate::voluntary_exit::VoluntaryExit;
|
||||
pub use crate::withdrawal::Withdrawal;
|
||||
pub use crate::withdrawal_credentials::WithdrawalCredentials;
|
||||
pub use crate::withdrawal_request::WithdrawalRequest;
|
||||
|
||||
pub type CommitteeIndex = u64;
|
||||
pub type Hash256 = H256;
|
||||
|
||||
@@ -41,13 +41,16 @@ pub trait ExecPayload<E: EthSpec>: Debug + Clone + PartialEq + Hash + TreeHash +
|
||||
fn blob_gas_used(&self) -> Result<u64, Error>;
|
||||
fn withdrawal_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
>;
|
||||
) -> Result<Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>, Error>;
|
||||
fn deposit_requests(
|
||||
&self,
|
||||
) -> Result<Option<VariableList<DepositRequest, E::MaxDepositRequestsPerPayload>>, Error>;
|
||||
fn consolidation_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ConsolidationRequest, E::MaxConsolidationRequestsPerPayload>>,
|
||||
Error,
|
||||
>;
|
||||
|
||||
/// Is this a default payload with 0x0 roots for transactions and withdrawals?
|
||||
fn is_default_with_zero_roots(&self) -> bool;
|
||||
@@ -289,10 +292,8 @@ impl<E: EthSpec> ExecPayload<E> for FullPayload<E> {
|
||||
|
||||
fn withdrawal_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
> {
|
||||
) -> Result<Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>, Error>
|
||||
{
|
||||
match self {
|
||||
FullPayload::Bellatrix(_) | FullPayload::Capella(_) | FullPayload::Deneb(_) => {
|
||||
Err(Error::IncorrectStateVariant)
|
||||
@@ -316,6 +317,24 @@ impl<E: EthSpec> ExecPayload<E> for FullPayload<E> {
|
||||
}
|
||||
}
|
||||
|
||||
fn consolidation_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<
|
||||
VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>,
|
||||
>,
|
||||
Error,
|
||||
> {
|
||||
match self {
|
||||
FullPayload::Bellatrix(_) | FullPayload::Capella(_) | FullPayload::Deneb(_) => {
|
||||
Err(Error::IncorrectStateVariant)
|
||||
}
|
||||
FullPayload::Electra(inner) => {
|
||||
Ok(Some(inner.execution_payload.consolidation_requests.clone()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn is_default_with_zero_roots<'a>(&'a self) -> bool {
|
||||
map_full_payload_ref!(&'a _, self.to_ref(), move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -450,10 +469,8 @@ impl<'b, E: EthSpec> ExecPayload<E> for FullPayloadRef<'b, E> {
|
||||
|
||||
fn withdrawal_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
> {
|
||||
) -> Result<Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>, Error>
|
||||
{
|
||||
match self {
|
||||
FullPayloadRef::Bellatrix(_)
|
||||
| FullPayloadRef::Capella(_)
|
||||
@@ -477,6 +494,24 @@ impl<'b, E: EthSpec> ExecPayload<E> for FullPayloadRef<'b, E> {
|
||||
}
|
||||
}
|
||||
|
||||
fn consolidation_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<
|
||||
VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>,
|
||||
>,
|
||||
Error,
|
||||
> {
|
||||
match self {
|
||||
FullPayloadRef::Bellatrix(_)
|
||||
| FullPayloadRef::Capella(_)
|
||||
| FullPayloadRef::Deneb(_) => Err(Error::IncorrectStateVariant),
|
||||
FullPayloadRef::Electra(inner) => {
|
||||
Ok(Some(inner.execution_payload.consolidation_requests.clone()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn is_default_with_zero_roots<'a>(&'a self) -> bool {
|
||||
map_full_payload_ref!(&'a _, self, move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -659,10 +694,8 @@ impl<E: EthSpec> ExecPayload<E> for BlindedPayload<E> {
|
||||
|
||||
fn withdrawal_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
> {
|
||||
) -> Result<Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>, Error>
|
||||
{
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
@@ -672,6 +705,17 @@ impl<E: EthSpec> ExecPayload<E> for BlindedPayload<E> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn consolidation_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<
|
||||
VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>,
|
||||
>,
|
||||
Error,
|
||||
> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn is_default_with_zero_roots(&self) -> bool {
|
||||
self.to_ref().is_default_with_zero_roots()
|
||||
}
|
||||
@@ -775,10 +819,8 @@ impl<'b, E: EthSpec> ExecPayload<E> for BlindedPayloadRef<'b, E> {
|
||||
|
||||
fn withdrawal_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
> {
|
||||
) -> Result<Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>, Error>
|
||||
{
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
@@ -788,6 +830,17 @@ impl<'b, E: EthSpec> ExecPayload<E> for BlindedPayloadRef<'b, E> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn consolidation_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<
|
||||
VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>,
|
||||
>,
|
||||
Error,
|
||||
> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn is_default_with_zero_roots<'a>(&'a self) -> bool {
|
||||
map_blinded_payload_ref!(&'b _, self, move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -816,7 +869,8 @@ macro_rules! impl_exec_payload_common {
|
||||
$g:block,
|
||||
$h:block,
|
||||
$i:block,
|
||||
$j:block) => {
|
||||
$j:block,
|
||||
$k:block) => {
|
||||
impl<E: EthSpec> ExecPayload<E> for $wrapper_type<E> {
|
||||
fn block_type() -> BlockType {
|
||||
BlockType::$block_type_variant
|
||||
@@ -883,7 +937,7 @@ macro_rules! impl_exec_payload_common {
|
||||
fn withdrawal_requests(
|
||||
&self,
|
||||
) -> Result<
|
||||
Option<VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
> {
|
||||
let i = $i;
|
||||
@@ -896,6 +950,13 @@ macro_rules! impl_exec_payload_common {
|
||||
let j = $j;
|
||||
j(self)
|
||||
}
|
||||
|
||||
fn consolidation_requests(
|
||||
&self,
|
||||
) -> Result<Option<VariableList<ConsolidationRequest, <E as EthSpec>::MaxConsolidationRequestsPerPayload>>, Error> {
|
||||
let k = $k;
|
||||
k(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<$wrapped_type<E>> for $wrapper_type<E> {
|
||||
@@ -943,6 +1004,7 @@ macro_rules! impl_exec_payload_for_fork {
|
||||
c
|
||||
},
|
||||
{ |_| { Ok(None) } },
|
||||
{ |_| { Ok(None) } },
|
||||
{ |_| { Ok(None) } }
|
||||
);
|
||||
|
||||
@@ -1035,12 +1097,7 @@ macro_rules! impl_exec_payload_for_fork {
|
||||
let c: for<'a> fn(
|
||||
&'a $wrapper_type_full<E>,
|
||||
) -> Result<
|
||||
Option<
|
||||
VariableList<
|
||||
ExecutionLayerWithdrawalRequest,
|
||||
E::MaxWithdrawalRequestsPerPayload,
|
||||
>,
|
||||
>,
|
||||
Option<VariableList<WithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
Error,
|
||||
> = |payload: &$wrapper_type_full<E>| {
|
||||
let wrapper_ref_type = FullPayloadRef::$fork_variant(&payload);
|
||||
@@ -1059,6 +1116,23 @@ macro_rules! impl_exec_payload_for_fork {
|
||||
wrapper_ref_type.deposit_requests()
|
||||
};
|
||||
c
|
||||
},
|
||||
{
|
||||
let c: for<'a> fn(
|
||||
&'a $wrapper_type_full<E>,
|
||||
) -> Result<
|
||||
Option<
|
||||
VariableList<
|
||||
ConsolidationRequest,
|
||||
<E as EthSpec>::MaxConsolidationRequestsPerPayload,
|
||||
>,
|
||||
>,
|
||||
Error,
|
||||
> = |payload: &$wrapper_type_full<E>| {
|
||||
let wrapper_ref_type = FullPayloadRef::$fork_variant(&payload);
|
||||
wrapper_ref_type.consolidation_requests()
|
||||
};
|
||||
c
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ pub struct ElectraPreset {
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub pending_consolidations_limit: u64,
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_consolidations: u64,
|
||||
pub max_consolidation_requests_per_payload: u64,
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_deposit_requests_per_payload: u64,
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
@@ -269,7 +269,8 @@ impl ElectraPreset {
|
||||
pending_balance_deposits_limit: E::pending_balance_deposits_limit() as u64,
|
||||
pending_partial_withdrawals_limit: E::pending_partial_withdrawals_limit() as u64,
|
||||
pending_consolidations_limit: E::pending_consolidations_limit() as u64,
|
||||
max_consolidations: E::max_consolidations() as u64,
|
||||
max_consolidation_requests_per_payload: E::max_consolidation_requests_per_payload()
|
||||
as u64,
|
||||
max_deposit_requests_per_payload: E::max_deposit_requests_per_payload() as u64,
|
||||
max_attester_slashings_electra: E::max_attester_slashings_electra() as u64,
|
||||
max_attestations_electra: E::max_attestations_electra() as u64,
|
||||
|
||||
@@ -498,7 +498,6 @@ impl<E: EthSpec> SignedBeaconBlockElectra<E, BlindedPayload<E>> {
|
||||
execution_payload: BlindedPayloadElectra { .. },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
consolidations,
|
||||
},
|
||||
},
|
||||
signature,
|
||||
@@ -522,7 +521,6 @@ impl<E: EthSpec> SignedBeaconBlockElectra<E, BlindedPayload<E>> {
|
||||
execution_payload: FullPayloadElectra { execution_payload },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
consolidations,
|
||||
},
|
||||
},
|
||||
signature,
|
||||
|
||||
@@ -219,6 +219,7 @@ impl Validator {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO(electra): refactor these functions and make it simpler.. this is a mess
|
||||
/// Returns `true` if the validator is partially withdrawable.
|
||||
fn is_partially_withdrawable_validator_capella(&self, balance: u64, spec: &ChainSpec) -> bool {
|
||||
self.has_eth1_withdrawal_credential(spec)
|
||||
|
||||
@@ -19,7 +19,7 @@ use tree_hash_derive::TreeHash;
|
||||
TreeHash,
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct ExecutionLayerWithdrawalRequest {
|
||||
pub struct WithdrawalRequest {
|
||||
pub source_address: Address,
|
||||
pub validator_pubkey: PublicKeyBytes,
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
@@ -30,5 +30,5 @@ pub struct ExecutionLayerWithdrawalRequest {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
ssz_and_tree_hash_tests!(ExecutionLayerWithdrawalRequest);
|
||||
ssz_and_tree_hash_tests!(WithdrawalRequest);
|
||||
}
|
||||
Reference in New Issue
Block a user