diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 51aed941f..dc0b6e717 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -4191,6 +4191,8 @@ impl BeaconChain { .await, #[cfg(feature = "withdrawals")] withdrawals, + #[cfg(not(feature = "withdrawals"))] + withdrawals: None, }); debug!( diff --git a/beacon_node/execution_layer/src/engine_api.rs b/beacon_node/execution_layer/src/engine_api.rs index b1a3cfa41..65d3b656b 100644 --- a/beacon_node/execution_layer/src/engine_api.rs +++ b/beacon_node/execution_layer/src/engine_api.rs @@ -7,11 +7,9 @@ use reqwest::StatusCode; use serde::{Deserialize, Serialize}; use strum::IntoStaticStr; use superstruct::superstruct; -#[cfg(feature = "withdrawals")] -use types::Withdrawal; pub use types::{ Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, FixedVector, - ForkName, Hash256, Uint256, VariableList, + ForkName, Hash256, Uint256, VariableList, Withdrawal, }; pub mod auth; @@ -257,7 +255,6 @@ pub struct PayloadAttributes { pub prev_randao: Hash256, #[superstruct(getter(copy))] pub suggested_fee_recipient: Address, - #[cfg(feature = "withdrawals")] #[superstruct(only(V2))] pub withdrawals: Option>, } diff --git a/beacon_node/execution_layer/src/engine_api/json_structures.rs b/beacon_node/execution_layer/src/engine_api/json_structures.rs index 0e53a3b06..1b125cde4 100644 --- a/beacon_node/execution_layer/src/engine_api/json_structures.rs +++ b/beacon_node/execution_layer/src/engine_api/json_structures.rs @@ -375,8 +375,9 @@ pub struct JsonPayloadAttributes { pub timestamp: u64, pub prev_randao: Hash256, pub suggested_fee_recipient: Address, - #[cfg(feature = "withdrawals")] #[superstruct(only(V2))] + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] pub withdrawals: Option>, } @@ -392,7 +393,6 @@ impl From for JsonPayloadAttributes { timestamp: pa.timestamp, prev_randao: pa.prev_randao, suggested_fee_recipient: pa.suggested_fee_recipient, - #[cfg(feature = "withdrawals")] withdrawals: pa .withdrawals .map(|w| w.into_iter().map(Into::into).collect()), @@ -413,7 +413,6 @@ impl From for PayloadAttributes { timestamp: jpa.timestamp, prev_randao: jpa.prev_randao, suggested_fee_recipient: jpa.suggested_fee_recipient, - #[cfg(feature = "withdrawals")] withdrawals: jpa .withdrawals .map(|jw| jw.into_iter().map(Into::into).collect()), diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index c90ed291d..96c1e0906 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -933,6 +933,8 @@ impl ExecutionLayer { suggested_fee_recipient, #[cfg(feature = "withdrawals")] withdrawals: withdrawals_ref.clone(), + #[cfg(not(feature = "withdrawals"))] + withdrawals: None, }); let response = engine diff --git a/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs b/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs index cadeec1b3..6a9070ca4 100644 --- a/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs +++ b/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs @@ -115,6 +115,8 @@ impl MockExecutionLayer { // FIXME: think about adding withdrawals here.. #[cfg(feature = "withdrawals")] withdrawals: Some(vec![]), + #[cfg(not(feature = "withdrawals"))] + withdrawals: None, }) } },