mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
ContextDeserialize and Beacon API Improvements (#7372)
* #7286 * BeaconAPI is not returning a versioned response when it should for some V1 endpoints * these [strange functions with vX in the name that still accept `endpoint_version` arguments](https://github.com/sigp/lighthouse/blob/stable/beacon_node/http_api/src/produce_block.rs#L192) This refactor is a prerequisite to get the fulu EF tests running.
This commit is contained in:
@@ -1980,7 +1980,7 @@ enum InvalidBuilderPayload {
|
||||
expected: Option<u64>,
|
||||
},
|
||||
Fork {
|
||||
payload: Option<ForkName>,
|
||||
payload: ForkName,
|
||||
expected: ForkName,
|
||||
},
|
||||
Signature {
|
||||
@@ -2013,7 +2013,7 @@ impl fmt::Display for InvalidBuilderPayload {
|
||||
write!(f, "payload block number was {} not {:?}", payload, expected)
|
||||
}
|
||||
InvalidBuilderPayload::Fork { payload, expected } => {
|
||||
write!(f, "payload fork was {:?} not {}", payload, expected)
|
||||
write!(f, "payload fork was {} not {}", payload, expected)
|
||||
}
|
||||
InvalidBuilderPayload::Signature { signature, pubkey } => write!(
|
||||
f,
|
||||
@@ -2116,7 +2116,7 @@ fn verify_builder_bid<E: EthSpec>(
|
||||
payload: header.block_number(),
|
||||
expected: block_number,
|
||||
}))
|
||||
} else if bid.version != Some(current_fork) {
|
||||
} else if bid.version != current_fork {
|
||||
Err(Box::new(InvalidBuilderPayload::Fork {
|
||||
payload: bid.version,
|
||||
expected: current_fork,
|
||||
|
||||
@@ -743,7 +743,7 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
.await
|
||||
.map_err(|_| "couldn't get head".to_string())?
|
||||
.ok_or_else(|| "missing head block".to_string())?
|
||||
.data;
|
||||
.into_data();
|
||||
|
||||
let head_block_root = head_block_root.unwrap_or(head.canonical_root());
|
||||
|
||||
@@ -761,7 +761,7 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
.await
|
||||
.map_err(|_| "couldn't get finalized block".to_string())?
|
||||
.ok_or_else(|| "missing finalized block".to_string())?
|
||||
.data
|
||||
.data()
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
@@ -774,7 +774,7 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
.await
|
||||
.map_err(|_| "couldn't get justified block".to_string())?
|
||||
.ok_or_else(|| "missing justified block".to_string())?
|
||||
.data
|
||||
.data()
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
@@ -815,7 +815,7 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
.await
|
||||
.map_err(|_| "couldn't get state".to_string())?
|
||||
.ok_or_else(|| "missing state".to_string())?
|
||||
.data;
|
||||
.into_data();
|
||||
|
||||
let prev_randao = head_state
|
||||
.get_randao_mix(head_state.current_epoch())
|
||||
@@ -980,7 +980,7 @@ pub fn serve<E: EthSpec>(
|
||||
.await
|
||||
.map_err(|e| warp::reject::custom(Custom(e)))?;
|
||||
let resp: ForkVersionedResponse<_> = ForkVersionedResponse {
|
||||
version: Some(fork_name),
|
||||
version: fork_name,
|
||||
metadata: Default::default(),
|
||||
data: payload,
|
||||
};
|
||||
@@ -1040,7 +1040,7 @@ pub fn serve<E: EthSpec>(
|
||||
),
|
||||
eth2::types::Accept::Json | eth2::types::Accept::Any => {
|
||||
let resp: ForkVersionedResponse<_> = ForkVersionedResponse {
|
||||
version: Some(fork_name),
|
||||
version: fork_name,
|
||||
metadata: Default::default(),
|
||||
data: signed_bid,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user