Skip to content

Commit 382356c

Browse files
committed
address review comments
1 parent 75b1a99 commit 382356c

5 files changed

Lines changed: 9 additions & 23 deletions

File tree

‎crates/common/src/wire.rs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub enum AcceptedEncodingsError {
4242
#[error("invalid header string: {0}")]
4343
InvalidString(#[from] ToStrError),
4444

45-
#[error("invalid accept header: {error_msg}")]
46-
InvalidEncoding { error_msg: String },
45+
#[error("invalid accept header")]
46+
InvalidAccept,
4747

4848
#[error("unsupported accept type")]
4949
UnsupportedAcceptType,
@@ -220,11 +220,9 @@ pub fn get_accept_types(
220220
let mut saw_any = false;
221221
let mut had_supported = false;
222222
for header in req_headers.get_all(ACCEPT).iter() {
223-
let accept_str = header.to_str().map_err(AcceptedEncodingsError::InvalidString)?;
223+
let accept_str = header.to_str()?;
224224
let accept =
225-
Accept::from_str(accept_str).map_err(|e| AcceptedEncodingsError::InvalidEncoding {
226-
error_msg: (format!("invalid accept header: {e}")).to_string(),
227-
})?;
225+
Accept::from_str(accept_str).map_err(|_| AcceptedEncodingsError::InvalidAccept)?;
228226

229227
for mt in accept.media_types() {
230228
saw_any = true;

‎crates/pbs/src/mev_boost/get_header.rs‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ use crate::{
5050
/// Sent from get_header to each send_timed_get_header call.
5151
#[derive(Clone)]
5252
struct RequestInfo {
53-
/// The blockchain parameters of the get_header request (what slot it's for,
54-
/// which pubkey is requesting it, etc)
5553
params: GetHeaderParams,
5654

5755
/// Common baseline of headers to send with each request
@@ -834,9 +832,6 @@ mod tests {
834832
.expect("failed to extract bid value from SSZ");
835833

836834
// Compare to the original value
837-
println!("Testing fork: {}", fork_name);
838-
println!("Original value: {}", decoded.value());
839-
println!("Extracted value: {}", bid_value);
840835
assert_eq!(*decoded.value(), bid_value);
841836
}
842837
}

‎crates/pbs/src/service.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl PbsService {
6969
watcher = RecommendedWatcher::new(
7070
move |result: Result<Event, Error>| {
7171
match result {
72-
Err(e) => {
73-
warn!(%e, "error watching PBS config file for changes");
72+
Err(err) => {
73+
warn!(%err, "error watching PBS config file for changes");
7474
return;
7575
}
7676
Ok(event) => {

‎tests/src/mock_relay.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,9 @@ async fn handle_submit_block_v1(
351351
vec![1u8; 1 + MAX_SIZE_SUBMIT_BLOCK_RESPONSE]
352352
} else {
353353
let mut execution_payload = ExecutionPayloadElectra::test_random();
354-
let submit_block = deserialize_body(&headers, body_bytes).map_err(|e| {
355-
error!(%e, "failed to deserialize signed blinded block");
356-
(StatusCode::BAD_REQUEST, format!("failed to deserialize body: {e}"))
354+
let submit_block = deserialize_body(&headers, body_bytes).map_err(|err| {
355+
error!(%err, "failed to deserialize signed blinded block");
356+
(StatusCode::BAD_REQUEST, format!("failed to deserialize body: {err}"))
357357
});
358358
if let Err(e) = submit_block {
359359
return e.into_response();

‎tests/src/utils.rs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ pub fn get_local_address(port: u16) -> String {
2828
}
2929

3030
/// Bind to port 0 and let the OS assign an unused ephemeral port.
31-
///
32-
/// The returned listener keeps the port reserved. Pass it to
33-
/// [`start_mock_relay_service_with_listener`] so the socket is never released
34-
/// between allocation and use (zero TOCTOU race). For servers that bind
35-
/// internally (e.g. `PbsService::run`), read the port with
36-
/// `listener.local_addr().unwrap().port()`, then `drop` the listener
37-
/// immediately before starting the server.
3831
pub async fn get_free_listener() -> tokio::net::TcpListener {
3932
tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap()
4033
}

0 commit comments

Comments
 (0)