Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .cargo/audit.toml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/security-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/audit-check@v1.2.0
- uses: taiki-e/install-action@43aecc8d72668fbcfe75c31400bc4f890f1c5853 # v2.83.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tool: cargo-audit
- run: cargo audit
26 changes: 18 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/common/src/pbs/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ pub enum PbsError {
#[error("json decode error: {err:?}, raw: {raw}")]
JsonDecode { err: serde_json::Error, raw: String },

#[error("json encode error: {0:?}")]
JsonEncode(serde_json::Error),

#[error("ssz decode error: {err:?}, fork: {fork}")]
SSZDecode { err: String, fork: ForkName },

Expand Down
10 changes: 10 additions & 0 deletions crates/pbs/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@ lazy_static! {
&["http_status_code", "endpoint"],
PBS_METRICS_REGISTRY
).unwrap();

/// Count of v2 submit_block requests that fell back to the v1 endpoint
/// because the relay returned 404 on v2. A high value indicates the relay
/// fleet has not been upgraded to support submitBlindedBlockV2.
pub static ref V2_FALLBACK_TO_V1: IntCounterVec = register_int_counter_vec_with_registry!(
"pbs_submit_block_v2_fallback_to_v1_total",
"Count of v2 submit_block requests that fell back to v1 because the relay did not support v2",
&["relay_id"],
PBS_METRICS_REGISTRY
).unwrap();
}
20 changes: 11 additions & 9 deletions crates/pbs/src/mev_boost/register_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ pub async fn register_validator<S: BuilderApiState>(
.insert(HEADER_START_TIME_UNIX_MS, HeaderValue::from_str(&utcnow_ms().to_string())?);
send_headers.insert(USER_AGENT, get_user_agent_with_version(&req_headers)?);

// prepare the body in advance, ugly dyn
let bodies: Box<dyn Iterator<Item = (usize, Bytes)>> =
// prepare the body in advance
let bodies: Vec<(usize, Bytes)> =
if let Some(batch_size) = state.config.pbs_config.validator_registration_batch_size {
Box::new(registrations.chunks(batch_size).map(|batch| {
// SAFETY: unwrap is ok because we're serializing a &[serde_json::Value]
let body = serde_json::to_vec(batch).unwrap();
(batch.len(), Bytes::from(body))
}))
registrations
.chunks(batch_size)
.map(|batch| {
let body = serde_json::to_vec(batch).map_err(PbsError::JsonEncode)?;
Ok((batch.len(), Bytes::from(body)))
})
.collect::<Result<Vec<_>, PbsError>>()?
} else {
let body = serde_json::to_vec(&registrations).unwrap();
Box::new(std::iter::once((registrations.len(), Bytes::from(body))))
let body = serde_json::to_vec(&registrations).map_err(PbsError::JsonEncode)?;
vec![(registrations.len(), Bytes::from(body))]
};
send_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));

Expand Down
Loading
Loading