mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 05:07:12 +00:00
Spec v1.7.0-alpha.6 and Gloas genesis (#9190)
Co-Authored-By: Josh King <josh@sigmaprime.io> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -58,6 +58,8 @@ pub struct Eth1DataReset;
|
||||
#[derive(Debug)]
|
||||
pub struct PendingBalanceDeposits;
|
||||
#[derive(Debug)]
|
||||
pub struct PendingDepositsChurn;
|
||||
#[derive(Debug)]
|
||||
pub struct PendingConsolidations;
|
||||
#[derive(Debug)]
|
||||
pub struct EffectiveBalanceUpdates;
|
||||
@@ -93,6 +95,7 @@ type_name!(RegistryUpdates, "registry_updates");
|
||||
type_name!(Slashings, "slashings");
|
||||
type_name!(Eth1DataReset, "eth1_data_reset");
|
||||
type_name!(PendingBalanceDeposits, "pending_deposits");
|
||||
type_name!(PendingDepositsChurn, "pending_deposits_churn");
|
||||
type_name!(PendingConsolidations, "pending_consolidations");
|
||||
type_name!(EffectiveBalanceUpdates, "effective_balance_updates");
|
||||
type_name!(SlashingsReset, "slashings_reset");
|
||||
@@ -191,6 +194,20 @@ impl<E: EthSpec> EpochTransition<E> for PendingBalanceDeposits {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EpochTransition<E> for PendingDepositsChurn {
|
||||
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||
process_epoch_single_pass(
|
||||
state,
|
||||
spec,
|
||||
SinglePassConfig {
|
||||
pending_deposits: true,
|
||||
..SinglePassConfig::disable_all()
|
||||
},
|
||||
)
|
||||
.map(|_| ())
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EpochTransition<E> for PendingConsolidations {
|
||||
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||
initialize_epoch_cache(state, spec)?;
|
||||
@@ -387,7 +404,9 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
|
||||
}
|
||||
|
||||
if !fork_name.gloas_enabled()
|
||||
&& (T::name() == "builder_pending_payments" || T::name() == "ptc_window")
|
||||
&& (T::name() == "builder_pending_payments"
|
||||
|| T::name() == "ptc_window"
|
||||
|| T::name() == "pending_deposits_churn")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,15 @@ pub struct WithdrawalsPayload<E: EthSpec> {
|
||||
payload: Option<ExecutionPayload<E>>,
|
||||
}
|
||||
|
||||
/// Newtype for testing voluntary exit churn (Gloas+).
|
||||
///
|
||||
/// The test case applies the same `process_voluntary_exit` operation as the regular
|
||||
/// `voluntary_exit` test, but under the `voluntary_exit_churn` handler directory.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VoluntaryExitChurn {
|
||||
exit: SignedVoluntaryExit,
|
||||
}
|
||||
|
||||
/// Newtype for testing execution payload bids.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ExecutionPayloadBidBlock<E: EthSpec> {
|
||||
@@ -265,6 +274,40 @@ impl<E: EthSpec> Operation<E> for SignedVoluntaryExit {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for VoluntaryExitChurn {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
fn handler_name() -> String {
|
||||
"voluntary_exit_churn".into()
|
||||
}
|
||||
|
||||
fn filename() -> String {
|
||||
"voluntary_exit.ssz_snappy".into()
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name.gloas_enabled()
|
||||
}
|
||||
|
||||
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file(path).map(|exit| VoluntaryExitChurn { exit })
|
||||
}
|
||||
|
||||
fn apply_to(
|
||||
&self,
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
_: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
process_exits(
|
||||
state,
|
||||
std::slice::from_ref(&self.exit),
|
||||
VerifySignatures::True,
|
||||
spec,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for BeaconBlock<E> {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user