mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Implement Gloas withdrawals and refactor (#8692)
Co-Authored-By: Michael Sproul <michael@sigmaprime.io> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
This commit is contained in:
@@ -23,13 +23,13 @@ use tree_hash_derive::TreeHash;
|
||||
use typenum::Unsigned;
|
||||
|
||||
use crate::{
|
||||
Builder, BuilderIndex, BuilderPendingPayment, BuilderPendingWithdrawal, ExecutionBlockHash,
|
||||
ExecutionPayloadBid, Withdrawal,
|
||||
ExecutionBlockHash, ExecutionPayloadBid, Withdrawal,
|
||||
attestation::{
|
||||
AttestationData, AttestationDuty, BeaconCommittee, Checkpoint, CommitteeIndex, PTC,
|
||||
ParticipationFlags, PendingAttestation,
|
||||
},
|
||||
block::{BeaconBlock, BeaconBlockHeader, SignedBeaconBlockHash},
|
||||
builder::{Builder, BuilderIndex, BuilderPendingPayment, BuilderPendingWithdrawal},
|
||||
consolidation::PendingConsolidation,
|
||||
core::{ChainSpec, Domain, Epoch, EthSpec, Hash256, RelativeEpoch, RelativeEpochError, Slot},
|
||||
deposit::PendingDeposit,
|
||||
@@ -68,6 +68,7 @@ pub enum BeaconStateError {
|
||||
EpochOutOfBounds,
|
||||
SlotOutOfBounds,
|
||||
UnknownValidator(usize),
|
||||
UnknownBuilder(BuilderIndex),
|
||||
UnableToDetermineProducer,
|
||||
InvalidBitfield,
|
||||
EmptyCommittee,
|
||||
|
||||
29
consensus/types/src/withdrawal/expected_withdrawals.rs
Normal file
29
consensus/types/src/withdrawal/expected_withdrawals.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use crate::{EthSpec, Withdrawals};
|
||||
use superstruct::superstruct;
|
||||
|
||||
#[superstruct(
|
||||
variants(Capella, Electra, Gloas),
|
||||
variant_attributes(derive(Debug, PartialEq, Clone))
|
||||
)]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct ExpectedWithdrawals<E: EthSpec> {
|
||||
pub withdrawals: Withdrawals<E>,
|
||||
#[superstruct(only(Gloas), partial_getter(copy))]
|
||||
pub processed_builder_withdrawals_count: u64,
|
||||
#[superstruct(only(Electra, Gloas), partial_getter(copy))]
|
||||
pub processed_partial_withdrawals_count: u64,
|
||||
#[superstruct(only(Gloas), partial_getter(copy))]
|
||||
pub processed_builders_sweep_count: u64,
|
||||
#[superstruct(getter(copy))]
|
||||
pub processed_sweep_withdrawals_count: u64,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<ExpectedWithdrawals<E>> for Withdrawals<E> {
|
||||
fn from(expected_withdrawals: ExpectedWithdrawals<E>) -> Withdrawals<E> {
|
||||
match expected_withdrawals {
|
||||
ExpectedWithdrawals::Capella(ew) => ew.withdrawals,
|
||||
ExpectedWithdrawals::Electra(ew) => ew.withdrawals,
|
||||
ExpectedWithdrawals::Gloas(ew) => ew.withdrawals,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
mod expected_withdrawals;
|
||||
mod pending_partial_withdrawal;
|
||||
mod withdrawal;
|
||||
mod withdrawal_credentials;
|
||||
mod withdrawal_request;
|
||||
|
||||
pub use expected_withdrawals::{
|
||||
ExpectedWithdrawals, ExpectedWithdrawalsCapella, ExpectedWithdrawalsElectra,
|
||||
ExpectedWithdrawalsGloas,
|
||||
};
|
||||
pub use pending_partial_withdrawal::PendingPartialWithdrawal;
|
||||
pub use withdrawal::{Withdrawal, Withdrawals};
|
||||
pub use withdrawal_credentials::WithdrawalCredentials;
|
||||
|
||||
Reference in New Issue
Block a user