Skip to content

Commit f2952d8

Browse files
committed
fix: apply reviews(remove custom rejection)
1 parent bb18578 commit f2952d8

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

beacon_node/http_api/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,15 +1139,6 @@ pub fn serve<T: BeaconChainTypes>(
11391139
.map_state_and_execution_optimistic_and_finalized(
11401140
&chain,
11411141
|state, execution_optimistic, finalized| {
1142-
if !state.fork_name_unchecked().electra_enabled() {
1143-
return Err(warp_utils::reject::pre_electra_not_supported(
1144-
format!(
1145-
"state at epoch {} is not activated for Electra",
1146-
state.current_epoch()
1147-
),
1148-
));
1149-
}
1150-
11511142
let Ok(deposits) = state.pending_deposits() else {
11521143
return Err(warp_utils::reject::custom_bad_request(
11531144
"Pending deposits not found".to_string(),
@@ -1185,15 +1176,6 @@ pub fn serve<T: BeaconChainTypes>(
11851176
.map_state_and_execution_optimistic_and_finalized(
11861177
&chain,
11871178
|state, execution_optimistic, finalized| {
1188-
if !state.fork_name_unchecked().electra_enabled() {
1189-
return Err(warp_utils::reject::pre_electra_not_supported(
1190-
format!(
1191-
"state at epoch {} is not activated for Electra",
1192-
state.current_epoch()
1193-
),
1194-
));
1195-
}
1196-
11971179
let Ok(withdrawals) = state.pending_partial_withdrawals() else {
11981180
return Err(warp_utils::reject::custom_bad_request(
11991181
"Pending withdrawals not found".to_string(),

common/warp_utils/src/reject.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,6 @@ pub fn indexed_bad_request(message: String, failures: Vec<Failure>) -> warp::rej
140140
warp::reject::custom(IndexedBadRequestErrors { message, failures })
141141
}
142142

143-
#[derive(Debug)]
144-
pub struct PreElectraNotSupported(pub String);
145-
146-
impl Reject for PreElectraNotSupported {}
147-
148-
pub fn pre_electra_not_supported(msg: String) -> warp::reject::Rejection {
149-
warp::reject::custom(PreElectraNotSupported(msg))
150-
}
151-
152143
/// This function receives a `Rejection` and tries to return a custom
153144
/// value, otherwise simply passes the rejection along.
154145
pub async fn handle_rejection(err: warp::Rejection) -> Result<impl warp::Reply, Infallible> {
@@ -211,9 +202,6 @@ pub async fn handle_rejection(err: warp::Rejection) -> Result<impl warp::Reply,
211202
} else if let Some(e) = err.find::<crate::reject::InvalidAuthorization>() {
212203
code = StatusCode::FORBIDDEN;
213204
message = format!("FORBIDDEN: Invalid auth token: {}", e.0);
214-
} else if let Some(e) = err.find::<crate::reject::PreElectraNotSupported>() {
215-
code = StatusCode::BAD_REQUEST;
216-
message = format!("BAD_REQUEST: Pre-Electra not supported: {}", e.0);
217205
} else if let Some(e) = err.find::<warp::reject::MissingHeader>() {
218206
if e.name().eq("Authorization") {
219207
code = StatusCode::UNAUTHORIZED;

0 commit comments

Comments
 (0)