Remove withdrawals guard for PayloadAttributesV2

This commit is contained in:
Mark Mackey 2022-11-28 11:43:54 -06:00
parent 342489a0c3
commit e0ea26c228
5 changed files with 9 additions and 7 deletions

View File

@ -4191,6 +4191,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.await, .await,
#[cfg(feature = "withdrawals")] #[cfg(feature = "withdrawals")]
withdrawals, withdrawals,
#[cfg(not(feature = "withdrawals"))]
withdrawals: None,
}); });
debug!( debug!(

View File

@ -7,11 +7,9 @@ use reqwest::StatusCode;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strum::IntoStaticStr; use strum::IntoStaticStr;
use superstruct::superstruct; use superstruct::superstruct;
#[cfg(feature = "withdrawals")]
use types::Withdrawal;
pub use types::{ pub use types::{
Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, FixedVector, Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, FixedVector,
ForkName, Hash256, Uint256, VariableList, ForkName, Hash256, Uint256, VariableList, Withdrawal,
}; };
pub mod auth; pub mod auth;
@ -257,7 +255,6 @@ pub struct PayloadAttributes {
pub prev_randao: Hash256, pub prev_randao: Hash256,
#[superstruct(getter(copy))] #[superstruct(getter(copy))]
pub suggested_fee_recipient: Address, pub suggested_fee_recipient: Address,
#[cfg(feature = "withdrawals")]
#[superstruct(only(V2))] #[superstruct(only(V2))]
pub withdrawals: Option<Vec<Withdrawal>>, pub withdrawals: Option<Vec<Withdrawal>>,
} }

View File

@ -375,8 +375,9 @@ pub struct JsonPayloadAttributes {
pub timestamp: u64, pub timestamp: u64,
pub prev_randao: Hash256, pub prev_randao: Hash256,
pub suggested_fee_recipient: Address, pub suggested_fee_recipient: Address,
#[cfg(feature = "withdrawals")]
#[superstruct(only(V2))] #[superstruct(only(V2))]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub withdrawals: Option<Vec<JsonWithdrawal>>, pub withdrawals: Option<Vec<JsonWithdrawal>>,
} }
@ -392,7 +393,6 @@ impl From<PayloadAttributes> for JsonPayloadAttributes {
timestamp: pa.timestamp, timestamp: pa.timestamp,
prev_randao: pa.prev_randao, prev_randao: pa.prev_randao,
suggested_fee_recipient: pa.suggested_fee_recipient, suggested_fee_recipient: pa.suggested_fee_recipient,
#[cfg(feature = "withdrawals")]
withdrawals: pa withdrawals: pa
.withdrawals .withdrawals
.map(|w| w.into_iter().map(Into::into).collect()), .map(|w| w.into_iter().map(Into::into).collect()),
@ -413,7 +413,6 @@ impl From<JsonPayloadAttributes> for PayloadAttributes {
timestamp: jpa.timestamp, timestamp: jpa.timestamp,
prev_randao: jpa.prev_randao, prev_randao: jpa.prev_randao,
suggested_fee_recipient: jpa.suggested_fee_recipient, suggested_fee_recipient: jpa.suggested_fee_recipient,
#[cfg(feature = "withdrawals")]
withdrawals: jpa withdrawals: jpa
.withdrawals .withdrawals
.map(|jw| jw.into_iter().map(Into::into).collect()), .map(|jw| jw.into_iter().map(Into::into).collect()),

View File

@ -933,6 +933,8 @@ impl<T: EthSpec> ExecutionLayer<T> {
suggested_fee_recipient, suggested_fee_recipient,
#[cfg(feature = "withdrawals")] #[cfg(feature = "withdrawals")]
withdrawals: withdrawals_ref.clone(), withdrawals: withdrawals_ref.clone(),
#[cfg(not(feature = "withdrawals"))]
withdrawals: None,
}); });
let response = engine let response = engine

View File

@ -115,6 +115,8 @@ impl<T: EthSpec> MockExecutionLayer<T> {
// FIXME: think about adding withdrawals here.. // FIXME: think about adding withdrawals here..
#[cfg(feature = "withdrawals")] #[cfg(feature = "withdrawals")]
withdrawals: Some(vec![]), withdrawals: Some(vec![]),
#[cfg(not(feature = "withdrawals"))]
withdrawals: None,
}) })
} }
}, },