Removed withdrawals feature flag

This commit is contained in:
Mark Mackey
2022-12-19 15:10:50 -06:00
parent ab11f8c71f
commit b75ca74222
35 changed files with 29 additions and 188 deletions

View File

@@ -19,7 +19,7 @@ pub use process_operations::process_operations;
pub use verify_attestation::{
verify_attestation_for_block_inclusion, verify_attestation_for_state,
};
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
#[cfg(feature = "withdrawals-processing")]
pub use verify_bls_to_execution_change::verify_bls_to_execution_change;
pub use verify_deposit::{
get_existing_validator_index, verify_deposit_merkle_proof, verify_deposit_signature,
@@ -36,7 +36,7 @@ pub mod signature_sets;
pub mod tests;
mod verify_attestation;
mod verify_attester_slashing;
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
#[cfg(feature = "withdrawals-processing")]
mod verify_bls_to_execution_change;
mod verify_deposit;
mod verify_exit;
@@ -165,7 +165,7 @@ pub fn per_block_processing<T: EthSpec, Payload: AbstractExecPayload<T>>(
// previous block.
if is_execution_enabled(state, block.body()) {
let payload = block.body().execution_payload()?;
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
#[cfg(feature = "withdrawals-processing")]
process_withdrawals::<T, Payload>(state, payload, spec)?;
process_execution_payload::<T, Payload>(state, payload, spec)?;
}
@@ -469,7 +469,6 @@ pub fn compute_timestamp_at_slot<T: EthSpec>(
/// Compute the next batch of withdrawals which should be included in a block.
///
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#new-get_expected_withdrawals
#[cfg(feature = "withdrawals")]
pub fn get_expected_withdrawals<T: EthSpec>(
state: &BeaconState<T>,
spec: &ChainSpec,
@@ -525,7 +524,7 @@ pub fn get_expected_withdrawals<T: EthSpec>(
}
/// Apply withdrawals to the state.
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
#[cfg(feature = "withdrawals-processing")]
pub fn process_withdrawals<'payload, T: EthSpec, Payload: AbstractExecPayload<T>>(
state: &mut BeaconState<T>,
payload: Payload::Ref<'payload>,

View File

@@ -170,7 +170,6 @@ where
// Deposits are not included because they can legally have invalid signatures.
self.include_exits(block)?;
self.include_sync_aggregate(block)?;
#[cfg(feature = "withdrawals")]
self.include_bls_to_execution_changes(block)?;
Ok(())
@@ -345,7 +344,6 @@ where
}
/// Include the signature of the block's BLS to execution changes for verification.
#[cfg(feature = "withdrawals")]
pub fn include_bls_to_execution_changes<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,

View File

@@ -34,7 +34,7 @@ pub fn process_operations<'a, T: EthSpec, Payload: AbstractExecPayload<T>>(
process_deposits(state, block_body.deposits(), spec)?;
process_exits(state, block_body.voluntary_exits(), verify_signatures, spec)?;
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
#[cfg(feature = "withdrawals-processing")]
if let Ok(bls_to_execution_changes) = block_body.bls_to_execution_changes() {
process_bls_to_execution_changes(state, bls_to_execution_changes, verify_signatures, spec)?;
}
@@ -295,7 +295,7 @@ pub fn process_exits<T: EthSpec>(
///
/// Returns `Ok(())` if the validation and state updates completed successfully. Otherwise returns
/// an `Err` describing the invalid object or cause of failure.
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
#[cfg(feature = "withdrawals-processing")]
pub fn process_bls_to_execution_changes<T: EthSpec>(
state: &mut BeaconState<T>,
bls_to_execution_changes: &[SignedBlsToExecutionChange],

View File

@@ -56,9 +56,7 @@ pub fn upgrade_to_capella<E: EthSpec>(
// Execution
latest_execution_payload_header: pre.latest_execution_payload_header.upgrade_to_capella(),
// Withdrawals
#[cfg(feature = "withdrawals")]
next_withdrawal_index: 0,
#[cfg(feature = "withdrawals")]
next_withdrawal_validator_index: 0,
// Caches
total_active_balance: pre.total_active_balance,

View File

@@ -10,12 +10,8 @@ pub fn upgrade_to_eip4844<E: EthSpec>(
let pre = pre_state.as_capella_mut()?;
// FIXME(sean) This is a hack to let us participate in testnets where capella doesn't exist.
// if we are disabling withdrawals, assume we should fork off of bellatrix.
let previous_fork_version = if cfg!(feature = "withdrawals") {
pre.fork.current_version
} else {
spec.bellatrix_fork_version
};
// let previous_fork_version = spec.bellatrix_fork_version;
let previous_fork_version = pre.fork.current_version;
// Where possible, use something like `mem::take` to move fields from behind the &mut
// reference. For other fields that don't have a good default value, use `clone`.
@@ -64,9 +60,7 @@ pub fn upgrade_to_eip4844<E: EthSpec>(
// Execution
latest_execution_payload_header: pre.latest_execution_payload_header.upgrade_to_eip4844(),
// Withdrawals
#[cfg(feature = "withdrawals")]
next_withdrawal_index: pre.next_withdrawal_index,
#[cfg(feature = "withdrawals")]
next_withdrawal_validator_index: pre.next_withdrawal_validator_index,
// Caches
total_active_balance: pre.total_active_balance,