Skip to content

Commit bea2080

Browse files
committed
Merge branch 'main' into mb/remove_accounts
2 parents c0705b9 + 0ca3a4e commit bea2080

File tree

10 files changed

+48
-26
lines changed

10 files changed

+48
-26
lines changed

Cargo.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resolver = "2"
55
[workspace.package]
66
edition = "2021"
77
rust-version = "1.83"
8-
version = "0.7.0-rc.2"
8+
version = "0.8.0-rc.1"
99

1010
[workspace.dependencies]
1111
aes = "0.8"

TERMS-OF-USE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TERMS OF USE
33

44
PLEASE READ THE FOLLOWING TERMS AND CONDITIONS (THE “TERMS”) WHICH CONSTITUTE THE AGREEMENT BETWEEN YOU OR ANY ENTITY ON WHOSE BEHALF YOU ACCESS OR USE THE FEATURES DESCRIBED HEREIN (“USER” OR “YOU”), AND COMMIT-BOOST, INC. (“COMMIT-BOOST”). THIS AGREEMENT REPRESENTS THE ENTIRE AGREEMENT CONCERNING THE FEATURES BETWEEN THE PARTIES AND IT SUPERSEDES ANY PRIOR PROPOSAL, REPRESENTATION, OR UNDERSTANDING BETWEEN THE PARTIES. COMMIT-BOOST AND USER ARE HEREINAFTER JOINTLY DEFINED AS THE “PARTIES” OR INDIVIDUALLY A “PARTY”.
55

6-
These Terms of Use (as amended or supplemented from time to time, these "Terms") explain the terms and conditions by which you may access and/or use Commit-Boost, Inc.’s website, https://github.com/Commit-Boost, tools, software, documentation, and other online properties (collectively, “Features”) provided by the Commit-Boost, Inc. (“Commit-Boost,” “we,” “us,” or “our”) repository.
6+
These Terms of Use (as amended or supplemented from time to time, these "Terms") explain the terms and conditions by which you may access and/or use Commit-Boost, Inc.’s website, https://github.com/Commit-Boost, tools, software, documentation, projects, and other online properties (collectively, “Features”) provided by the Commit-Boost, Inc. (“Commit-Boost,” “we,” “us,” or “our”) repository.
77

88
All access and use of the Features is subject to these Terms. By accessing or otherwise using the Features, you acknowledge that you have read, understood, and agree to be bound by these Terms. If you do not accept the terms and conditions of these Terms, you will not access, browse, or otherwise use the Features.
99

crates/common/src/config/mux.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ sol! {
217217
"src/abi/LidoNORegistry.json"
218218
}
219219

220+
// Fetching Lido Curated Module
220221
fn lido_registry_address(chain: Chain) -> eyre::Result<Address> {
221222
match chain {
222223
Chain::Mainnet => Ok(address!("55032650b14df07b85bF18A3a3eC8E0Af2e028d5")),
223224
Chain::Holesky => Ok(address!("595F64Ddc3856a3b5Ff4f4CC1d1fb4B46cFd2bAC")),
225+
Chain::Hoodi => Ok(address!("5cDbE1590c083b5A2A64427fAA63A7cfDB91FbB5")),
224226
Chain::Sepolia => Ok(address!("33d6E15047E8644F8DDf5CD05d202dfE587DA6E3")),
225227
_ => bail!("Lido registry not supported for chain: {chain:?}"),
226228
}
@@ -290,6 +292,7 @@ async fn fetch_ssv_pubkeys(
290292
let chain_name = match chain {
291293
Chain::Mainnet => "mainnet",
292294
Chain::Holesky => "holesky",
295+
Chain::Hoodi => "hoodi",
293296
_ => bail!("SSV network is not supported for chain: {chain:?}"),
294297
};
295298

crates/pbs/src/constants.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ pub const TIMEOUT_ERROR_CODE_STR: &str = "555";
1010

1111
/// 20 MiB to cover edge cases for heavy blocks and also add a bit of slack for
1212
/// any Ethereum upgrades in the near future
13-
pub const MAX_SIZE_SUBMIT_BLOCK: usize = 20 * 1024 * 1024;
13+
pub const MAX_SIZE_SUBMIT_BLOCK_RESPONSE: usize = 20 * 1024 * 1024;
14+
15+
/// 20 MiB, enough to process ~45000 registrations in one request
16+
pub const MAX_SIZE_REGISTER_VALIDATOR_REQUEST: usize = 20 * 1024 * 1024;
1417

1518
/// 10 KiB, headers are around 700 bytes + buffer for encoding
16-
pub const MAX_SIZE_GET_HEADER: usize = 10 * 1024;
19+
pub const MAX_SIZE_GET_HEADER_RESPONSE: usize = 10 * 1024;
1720

1821
pub const MAX_SIZE_DEFAULT: usize = 1024;

crates/pbs/src/mev_boost/get_header.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ use url::Url;
3131

3232
use crate::{
3333
constants::{
34-
GET_HEADER_ENDPOINT_TAG, MAX_SIZE_GET_HEADER, TIMEOUT_ERROR_CODE, TIMEOUT_ERROR_CODE_STR,
34+
GET_HEADER_ENDPOINT_TAG, MAX_SIZE_GET_HEADER_RESPONSE, TIMEOUT_ERROR_CODE,
35+
TIMEOUT_ERROR_CODE_STR,
3536
},
3637
metrics::{RELAY_HEADER_VALUE, RELAY_LAST_SLOT, RELAY_LATENCY, RELAY_STATUS_CODE},
3738
state::{BuilderApiState, PbsState},
@@ -323,7 +324,7 @@ async fn send_one_get_header(
323324
let code = res.status();
324325
RELAY_STATUS_CODE.with_label_values(&[code.as_str(), GET_HEADER_ENDPOINT_TAG, &relay.id]).inc();
325326

326-
let response_bytes = read_chunked_body_with_max(res, MAX_SIZE_GET_HEADER).await?;
327+
let response_bytes = read_chunked_body_with_max(res, MAX_SIZE_GET_HEADER_RESPONSE).await?;
327328
if !code.is_success() {
328329
return Err(PbsError::RelayResponse {
329330
error_msg: String::from_utf8_lossy(&response_bytes).into_owned(),

crates/pbs/src/mev_boost/submit_block.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ use tracing::{debug, warn};
1616
use url::Url;
1717

1818
use crate::{
19-
constants::{MAX_SIZE_SUBMIT_BLOCK, SUBMIT_BLINDED_BLOCK_ENDPOINT_TAG, TIMEOUT_ERROR_CODE_STR},
19+
constants::{
20+
MAX_SIZE_SUBMIT_BLOCK_RESPONSE, SUBMIT_BLINDED_BLOCK_ENDPOINT_TAG, TIMEOUT_ERROR_CODE_STR,
21+
},
2022
metrics::{RELAY_LATENCY, RELAY_STATUS_CODE},
2123
state::{BuilderApiState, PbsState},
2224
utils::read_chunked_body_with_max,
@@ -139,7 +141,7 @@ async fn send_submit_block(
139141
.with_label_values(&[code.as_str(), SUBMIT_BLINDED_BLOCK_ENDPOINT_TAG, &relay.id])
140142
.inc();
141143

142-
let response_bytes = read_chunked_body_with_max(res, MAX_SIZE_SUBMIT_BLOCK).await?;
144+
let response_bytes = read_chunked_body_with_max(res, MAX_SIZE_SUBMIT_BLOCK_RESPONSE).await?;
143145
if !code.is_success() {
144146
let err = PbsError::RelayResponse {
145147
error_msg: String::from_utf8_lossy(&response_bytes).into_owned(),

crates/pbs/src/routes/router.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use axum::{
2-
extract::{MatchedPath, Request},
2+
extract::{DefaultBodyLimit, MatchedPath, Request},
33
middleware::{self, Next},
44
response::Response,
55
routing::{get, post},
@@ -20,16 +20,27 @@ use super::{
2020
use crate::{
2121
api::BuilderApi,
2222
state::{BuilderApiState, PbsStateGuard},
23+
MAX_SIZE_REGISTER_VALIDATOR_REQUEST, MAX_SIZE_SUBMIT_BLOCK_RESPONSE,
2324
};
2425

2526
pub fn create_app_router<S: BuilderApiState, A: BuilderApi<S>>(state: PbsStateGuard<S>) -> Router {
27+
// DefaultBodyLimit is 2Mib by default, so we only increase it for a few routes
28+
// thay may need more
29+
2630
let builder_routes = Router::new()
2731
.route(GET_HEADER_PATH, get(handle_get_header::<S, A>))
2832
.route(GET_STATUS_PATH, get(handle_get_status::<S, A>))
29-
.route(REGISTER_VALIDATOR_PATH, post(handle_register_validator::<S, A>))
30-
.route(SUBMIT_BLOCK_PATH, post(handle_submit_block::<S, A>));
33+
.route(
34+
REGISTER_VALIDATOR_PATH,
35+
post(handle_register_validator::<S, A>)
36+
.route_layer(DefaultBodyLimit::max(MAX_SIZE_REGISTER_VALIDATOR_REQUEST)),
37+
)
38+
.route(
39+
SUBMIT_BLOCK_PATH,
40+
post(handle_submit_block::<S, A>)
41+
.route_layer(DefaultBodyLimit::max(MAX_SIZE_SUBMIT_BLOCK_RESPONSE)),
42+
); // header is smaller than the response but err on the safe side
3143
let reload_router = Router::new().route(RELOAD_PATH, post(handle_reload::<S, A>));
32-
3344
let builder_api = Router::new().nest(BUILDER_API_PATH, builder_routes).merge(reload_router);
3445

3546
let app = if let Some(extra_routes) = A::extra_routes() {
@@ -58,7 +69,7 @@ pub async fn tracing_middleware(req: Request, next: Next) -> Response {
5869
trace!(
5970
http.method = %req.method(),
6071
http.user_agent = req.headers().typed_get::<UserAgent>().map(|ua| ua.to_string()).unwrap_or_default(),
61-
http.content_type = req.headers().typed_get::<ContentType>().map(|ua| ua.to_string()).unwrap_or_default(),
72+
http.content_type = req.headers().typed_get::<ContentType>().map(|ua| ua.to_string()).unwrap_or_default(),
6273
"start request");
6374

6475
let response = next.run(req).await;

docs/docs/intro.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ Commit-Boost runs as a single sidecar composed of multiple modules:
2424
<br/>
2525

2626
Commit-Boost is being developed in Rust from scratch, and has been designed with safety and modularity at its core, with the goal of not limiting the market downstream including stakeholders, flows, proposer commitments, enforcement mechanisms, etc.
27+
28+
Please see Commit-Boost, Inc's [terms of service](https://github.com/Commit-Boost/commit-boost-client/blob/main/TERMS-OF-USE.md).

tests/src/mock_relay.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use cb_common::{
2525
types::Chain,
2626
utils::{blst_pubkey_to_alloy, timestamp_of_slot_start_sec},
2727
};
28-
use cb_pbs::MAX_SIZE_SUBMIT_BLOCK;
28+
use cb_pbs::MAX_SIZE_SUBMIT_BLOCK_RESPONSE;
2929
use tokio::net::TcpListener;
3030
use tracing::debug;
3131
use tree_hash::TreeHash;
@@ -136,7 +136,7 @@ async fn handle_register_validator(
136136
async fn handle_submit_block(State(state): State<Arc<MockRelayState>>) -> Response {
137137
state.received_submit_block.fetch_add(1, Ordering::Relaxed);
138138
if state.large_body() {
139-
(StatusCode::OK, Json(vec![1u8; 1 + MAX_SIZE_SUBMIT_BLOCK])).into_response()
139+
(StatusCode::OK, Json(vec![1u8; 1 + MAX_SIZE_SUBMIT_BLOCK_RESPONSE])).into_response()
140140
} else {
141141
let response = SubmitBlindedBlockResponse::default();
142142
(StatusCode::OK, Json(response)).into_response()

0 commit comments

Comments
 (0)