Skip to content

Commit 17204e0

Browse files
committed
Isolate withdrawals-processing Feature
1 parent 6b72f45 commit 17204e0

File tree

19 files changed

+74
-167
lines changed

19 files changed

+74
-167
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ build-release-tarballs:
8989
# Runs the full workspace tests in **release**, without downloading any additional
9090
# test vectors.
9191
test-release:
92-
cargo test --workspace --release --exclude ef_tests --exclude beacon_chain --exclude slasher
92+
cargo test --workspace --features withdrawals-processing --release --exclude ef_tests --exclude beacon_chain --exclude slasher
9393

9494
# Runs the full workspace tests in **debug**, without downloading any additional test
9595
# vectors.
9696
test-debug:
97-
cargo test --workspace --exclude ef_tests --exclude beacon_chain
97+
cargo test --workspace --features withdrawals-processing --exclude ef_tests --exclude beacon_chain
9898

9999
# Runs cargo-fmt (linter).
100100
cargo-fmt:

beacon_node/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ withdrawals-processing = [
1717
"beacon_chain/withdrawals-processing",
1818
"store/withdrawals-processing",
1919
"execution_layer/withdrawals-processing",
20-
"http_api/withdrawals-processing",
2120
]
2221

2322
[dependencies]

beacon_node/beacon_chain/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ participation_metrics = [] # Exposes validator participation metrics to Prometh
1212
fork_from_env = [] # Initialise the harness chain spec from the FORK_NAME env variable
1313
withdrawals-processing = [
1414
"state_processing/withdrawals-processing",
15-
"store/withdrawals-processing",
1615
"execution_layer/withdrawals-processing",
17-
"operation_pool/withdrawals-processing"
1816
]
1917

2018
[dev-dependencies]

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ pub struct BeaconChain<T: BeaconChainTypes> {
362362
pub(crate) observed_attester_slashings:
363363
Mutex<ObservedOperations<AttesterSlashing<T::EthSpec>, T::EthSpec>>,
364364
/// Maintains a record of which validators we've seen BLS to execution changes for.
365-
#[cfg(feature = "withdrawals-processing")]
366365
pub(crate) observed_bls_to_execution_changes:
367366
Mutex<ObservedOperations<SignedBlsToExecutionChange, T::EthSpec>>,
368367
/// The most recently validated light client finality update received on gossip.
@@ -2232,29 +2231,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
22322231
&self,
22332232
bls_to_execution_change: SignedBlsToExecutionChange,
22342233
) -> Result<ObservationOutcome<SignedBlsToExecutionChange, T::EthSpec>, Error> {
2235-
#[cfg(feature = "withdrawals-processing")]
2236-
{
2237-
let current_fork = self.spec.fork_name_at_slot::<T::EthSpec>(self.slot()?);
2238-
if let ForkName::Base | ForkName::Altair | ForkName::Merge = current_fork {
2239-
// Disallow BLS to execution changes prior to the Capella fork.
2240-
return Err(Error::BlsToExecutionChangeBadFork(current_fork));
2241-
}
2242-
2243-
let wall_clock_state = self.wall_clock_state()?;
2244-
2245-
Ok(self
2246-
.observed_bls_to_execution_changes
2247-
.lock()
2248-
.verify_and_observe(bls_to_execution_change, &wall_clock_state, &self.spec)?)
2234+
let current_fork = self.spec.fork_name_at_slot::<T::EthSpec>(self.slot()?);
2235+
if let ForkName::Base | ForkName::Altair | ForkName::Merge = current_fork {
2236+
// Disallow BLS to execution changes prior to the Capella fork.
2237+
return Err(Error::BlsToExecutionChangeBadFork(current_fork));
22492238
}
22502239

2251-
// TODO: remove this whole block once withdrawals-processing is removed
2252-
#[cfg(not(feature = "withdrawals-processing"))]
2253-
{
2254-
#[allow(clippy::drop_non_drop)]
2255-
drop(bls_to_execution_change);
2256-
Ok(ObservationOutcome::AlreadyKnown)
2257-
}
2240+
let wall_clock_state = self.wall_clock_state()?;
2241+
2242+
Ok(self
2243+
.observed_bls_to_execution_changes
2244+
.lock()
2245+
.verify_and_observe(bls_to_execution_change, &wall_clock_state, &self.spec)?)
22582246
}
22592247

22602248
/// Import a BLS to execution change to the op pool.
@@ -2263,12 +2251,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
22632251
bls_to_execution_change: SigVerifiedOp<SignedBlsToExecutionChange, T::EthSpec>,
22642252
) {
22652253
if self.eth1_chain.is_some() {
2266-
#[cfg(feature = "withdrawals-processing")]
22672254
self.op_pool
22682255
.insert_bls_to_execution_change(bls_to_execution_change);
2269-
2270-
#[cfg(not(feature = "withdrawals-processing"))]
2271-
drop(bls_to_execution_change);
22722256
}
22732257
}
22742258

beacon_node/beacon_chain/src/builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ where
798798
observed_voluntary_exits: <_>::default(),
799799
observed_proposer_slashings: <_>::default(),
800800
observed_attester_slashings: <_>::default(),
801-
#[cfg(feature = "withdrawals-processing")]
802801
observed_bls_to_execution_changes: <_>::default(),
803802
latest_seen_finality_update: <_>::default(),
804803
latest_seen_optimistic_update: <_>::default(),

beacon_node/beacon_chain/src/observed_operations.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ use std::collections::HashSet;
66
use std::marker::PhantomData;
77
use types::{
88
AttesterSlashing, BeaconState, ChainSpec, EthSpec, ForkName, ProposerSlashing,
9-
SignedVoluntaryExit, Slot,
9+
SignedBlsToExecutionChange, SignedVoluntaryExit, Slot,
1010
};
1111

12-
#[cfg(feature = "withdrawals-processing")]
13-
use types::SignedBlsToExecutionChange;
14-
1512
/// Number of validator indices to store on the stack in `observed_validators`.
1613
pub const SMALL_VEC_SIZE: usize = 8;
1714

@@ -83,7 +80,6 @@ impl<E: EthSpec> ObservableOperation<E> for AttesterSlashing<E> {
8380
}
8481
}
8582

86-
#[cfg(feature = "withdrawals-processing")]
8783
impl<E: EthSpec> ObservableOperation<E> for SignedBlsToExecutionChange {
8884
fn observed_validators(&self) -> SmallVec<[u64; SMALL_VEC_SIZE]> {
8985
smallvec![self.message.validator_index]

beacon_node/execution_layer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[features]
8-
withdrawals-processing = ["state_processing/withdrawals-processing", "eth2/withdrawals-processing"]
8+
withdrawals-processing = ["state_processing/withdrawals-processing"]
99

1010
[dependencies]
1111
types = { path = "../../consensus/types"}

beacon_node/http_api/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
55
edition = "2021"
66
autotests = false # using a single test binary compiles faster
77

8-
[features]
9-
withdrawals-processing = []
10-
118
[dependencies]
129
warp = { version = "0.3.2", features = ["tls"] }
1310
serde = { version = "1.0.116", features = ["derive"] }

beacon_node/http_api/src/lib.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,16 +1687,12 @@ pub fn serve<T: BeaconChainTypes>(
16871687

16881688
match chain.verify_bls_to_execution_change_for_gossip(address_change) {
16891689
Ok(ObservationOutcome::New(verified_address_change)) => {
1690-
#[cfg(feature = "withdrawals-processing")]
1691-
{
1692-
publish_pubsub_message(
1693-
&network_tx,
1694-
PubsubMessage::BlsToExecutionChange(Box::new(
1695-
verified_address_change.as_inner().clone(),
1696-
)),
1697-
)?;
1698-
}
1699-
1690+
publish_pubsub_message(
1691+
&network_tx,
1692+
PubsubMessage::BlsToExecutionChange(Box::new(
1693+
verified_address_change.as_inner().clone(),
1694+
)),
1695+
)?;
17001696
chain.import_bls_to_execution_change(verified_address_change);
17011697
}
17021698
Ok(ObservationOutcome::AlreadyKnown) => {

beacon_node/operation_pool/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ version = "0.2.0"
44
authors = ["Michael Sproul <michael@sigmaprime.io>"]
55
edition = "2021"
66

7-
[features]
8-
withdrawals-processing = []
9-
107
[dependencies]
118
derivative = "2.1.1"
129
itertools = "0.10.0"

0 commit comments

Comments
 (0)