Skip to content

Commit a3f44c6

Browse files
authored
Remove backwards compatibility for el_offline and is_optimstic (#6168)
* Remove Option around is_optimistic and el_offline
1 parent b4a7560 commit a3f44c6

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

beacon_node/http_api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,8 +2889,8 @@ pub fn serve<T: BeaconChainTypes>(
28892889

28902890
let syncing_data = api_types::SyncingData {
28912891
is_syncing: !network_globals.sync_state.read().is_synced(),
2892-
is_optimistic: Some(is_optimistic),
2893-
el_offline: Some(el_offline),
2892+
is_optimistic,
2893+
el_offline,
28942894
head_slot,
28952895
sync_distance,
28962896
};

beacon_node/http_api/tests/status_tests.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ async fn el_syncing_then_synced() {
5656
mock_el.el.upcheck().await;
5757

5858
let api_response = tester.client.get_node_syncing().await.unwrap().data;
59-
assert_eq!(api_response.el_offline, Some(false));
60-
assert_eq!(api_response.is_optimistic, Some(false));
59+
assert_eq!(api_response.el_offline, false);
60+
assert_eq!(api_response.is_optimistic, false);
6161
assert_eq!(api_response.is_syncing, false);
6262

6363
// EL synced
6464
mock_el.server.set_syncing_response(Ok(false));
6565
mock_el.el.upcheck().await;
6666

6767
let api_response = tester.client.get_node_syncing().await.unwrap().data;
68-
assert_eq!(api_response.el_offline, Some(false));
69-
assert_eq!(api_response.is_optimistic, Some(false));
68+
assert_eq!(api_response.el_offline, false);
69+
assert_eq!(api_response.is_optimistic, false);
7070
assert_eq!(api_response.is_syncing, false);
7171
}
7272

@@ -84,8 +84,8 @@ async fn el_offline() {
8484
mock_el.el.upcheck().await;
8585

8686
let api_response = tester.client.get_node_syncing().await.unwrap().data;
87-
assert_eq!(api_response.el_offline, Some(true));
88-
assert_eq!(api_response.is_optimistic, Some(false));
87+
assert_eq!(api_response.el_offline, true);
88+
assert_eq!(api_response.is_optimistic, false);
8989
assert_eq!(api_response.is_syncing, false);
9090
}
9191

@@ -127,8 +127,8 @@ async fn el_error_on_new_payload() {
127127

128128
// The EL should now be *offline* according to the API.
129129
let api_response = tester.client.get_node_syncing().await.unwrap().data;
130-
assert_eq!(api_response.el_offline, Some(true));
131-
assert_eq!(api_response.is_optimistic, Some(false));
130+
assert_eq!(api_response.el_offline, true);
131+
assert_eq!(api_response.is_optimistic, false);
132132
assert_eq!(api_response.is_syncing, false);
133133

134134
// Processing a block successfully should remove the status.
@@ -143,8 +143,8 @@ async fn el_error_on_new_payload() {
143143
harness.process_block_result((block, blobs)).await.unwrap();
144144

145145
let api_response = tester.client.get_node_syncing().await.unwrap().data;
146-
assert_eq!(api_response.el_offline, Some(false));
147-
assert_eq!(api_response.is_optimistic, Some(false));
146+
assert_eq!(api_response.el_offline, false);
147+
assert_eq!(api_response.is_optimistic, false);
148148
assert_eq!(api_response.is_syncing, false);
149149
}
150150

beacon_node/http_api/tests/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,9 +2159,9 @@ impl ApiTester {
21592159

21602160
let expected = SyncingData {
21612161
is_syncing: false,
2162-
is_optimistic: Some(false),
2162+
is_optimistic: false,
21632163
// these tests run without the Bellatrix fork enabled
2164-
el_offline: Some(true),
2164+
el_offline: true,
21652165
head_slot,
21662166
sync_distance,
21672167
};

common/eth2/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ pub struct VersionData {
599599
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
600600
pub struct SyncingData {
601601
pub is_syncing: bool,
602-
pub is_optimistic: Option<bool>,
603-
pub el_offline: Option<bool>,
602+
pub is_optimistic: bool,
603+
pub el_offline: bool,
604604
pub head_slot: Slot,
605605
pub sync_distance: Slot,
606606
}

validator_client/src/check_synced.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ pub async fn check_synced<T: SlotClock>(
3636
}
3737
};
3838

39-
// Default EL status to "online" for backwards-compatibility with BNs that don't include it.
40-
let el_offline = resp.data.el_offline.unwrap_or(false);
4139
let bn_is_synced = !resp.data.is_syncing || (resp.data.sync_distance.as_u64() < SYNC_TOLERANCE);
42-
let is_synced = bn_is_synced && !el_offline;
40+
let is_synced = bn_is_synced && !resp.data.el_offline;
4341

4442
if let Some(log) = log_opt {
4543
if !is_synced {
@@ -55,7 +53,7 @@ pub async fn check_synced<T: SlotClock>(
5553
"sync_distance" => resp.data.sync_distance.as_u64(),
5654
"head_slot" => resp.data.head_slot.as_u64(),
5755
"endpoint" => %beacon_node,
58-
"el_offline" => el_offline,
56+
"el_offline" => resp.data.el_offline,
5957
);
6058
}
6159

0 commit comments

Comments
 (0)