Skip to content

Commit 0e2e23e

Browse files
committed
Remove the unused ExecutionOptimisticForkVersionedResponse type (#4160)
## Issue Addressed #4146 ## Proposed Changes Removes the `ExecutionOptimisticForkVersionedResponse` type and the associated Beacon API endpoint which is now deprecated. Also removes the test associated with the endpoint.
1 parent 3b117f4 commit 0e2e23e

File tree

4 files changed

+1
-72
lines changed

4 files changed

+1
-72
lines changed

beacon_node/http_api/tests/tests.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,21 +1875,6 @@ impl ApiTester {
18751875
.unwrap();
18761876
assert_eq!(result_ssz, expected, "{:?}", state_id);
18771877

1878-
// Check legacy v1 API.
1879-
let result_v1 = self
1880-
.client
1881-
.get_debug_beacon_states_v1(state_id.0)
1882-
.await
1883-
.unwrap();
1884-
1885-
if let (Some(json), Some(expected)) = (&result_v1, &expected) {
1886-
assert_eq!(json.version, None);
1887-
assert_eq!(json.data, *expected, "{:?}", state_id);
1888-
} else {
1889-
assert_eq!(result_v1, None);
1890-
assert_eq!(expected, None);
1891-
}
1892-
18931878
// Check that version headers are provided.
18941879
let url = self
18951880
.client

common/eth2/src/lib.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,23 +1280,6 @@ impl BeaconNodeHttpClient {
12801280
self.get_opt(path).await
12811281
}
12821282

1283-
/// `GET v1/debug/beacon/states/{state_id}` (LEGACY)
1284-
pub async fn get_debug_beacon_states_v1<T: EthSpec>(
1285-
&self,
1286-
state_id: StateId,
1287-
) -> Result<Option<ExecutionOptimisticForkVersionedResponse<BeaconState<T>>>, Error> {
1288-
let mut path = self.eth_path(V1)?;
1289-
1290-
path.path_segments_mut()
1291-
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
1292-
.push("debug")
1293-
.push("beacon")
1294-
.push("states")
1295-
.push(&state_id.to_string());
1296-
1297-
self.get_opt(path).await
1298-
}
1299-
13001283
/// `GET debug/beacon/states/{state_id}`
13011284
/// `-H "accept: application/octet-stream"`
13021285
pub async fn get_debug_beacon_states_ssz<T: EthSpec>(

consensus/types/src/fork_versioned_response.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,6 @@ where
4545
}
4646
}
4747

48-
#[derive(Debug, PartialEq, Clone, Serialize)]
49-
pub struct ExecutionOptimisticForkVersionedResponse<T> {
50-
#[serde(skip_serializing_if = "Option::is_none")]
51-
pub version: Option<ForkName>,
52-
pub execution_optimistic: Option<bool>,
53-
pub data: T,
54-
}
55-
56-
impl<'de, F> serde::Deserialize<'de> for ExecutionOptimisticForkVersionedResponse<F>
57-
where
58-
F: ForkVersionDeserialize,
59-
{
60-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
61-
where
62-
D: Deserializer<'de>,
63-
{
64-
#[derive(Deserialize)]
65-
struct Helper {
66-
version: Option<ForkName>,
67-
execution_optimistic: Option<bool>,
68-
data: serde_json::Value,
69-
}
70-
71-
let helper = Helper::deserialize(deserializer)?;
72-
let data = match helper.version {
73-
Some(fork_name) => F::deserialize_by_fork::<'de, D>(helper.data, fork_name)?,
74-
None => serde_json::from_value(helper.data).map_err(serde::de::Error::custom)?,
75-
};
76-
77-
Ok(ExecutionOptimisticForkVersionedResponse {
78-
version: helper.version,
79-
execution_optimistic: helper.execution_optimistic,
80-
data,
81-
})
82-
}
83-
}
84-
8548
pub trait ForkVersionDeserialize: Sized + DeserializeOwned {
8649
fn deserialize_by_fork<'de, D: Deserializer<'de>>(
8750
value: Value,

consensus/types/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ pub use crate::fork::Fork;
143143
pub use crate::fork_context::ForkContext;
144144
pub use crate::fork_data::ForkData;
145145
pub use crate::fork_name::{ForkName, InconsistentFork};
146-
pub use crate::fork_versioned_response::{
147-
ExecutionOptimisticForkVersionedResponse, ForkVersionDeserialize, ForkVersionedResponse,
148-
};
146+
pub use crate::fork_versioned_response::{ForkVersionDeserialize, ForkVersionedResponse};
149147
pub use crate::graffiti::{Graffiti, GRAFFITI_BYTES_LEN};
150148
pub use crate::historical_batch::HistoricalBatch;
151149
pub use crate::indexed_attestation::IndexedAttestation;

0 commit comments

Comments
 (0)