Skip to content

Commit 8b19cb4

Browse files
authored
Merge branch 'main' into feat/block-selection-policy
2 parents 5e2b586 + 9ef0583 commit 8b19cb4

File tree

16 files changed

+31
-30
lines changed

16 files changed

+31
-30
lines changed

.github/workflows/kurtosis_integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Setup Rust
26-
uses: actions-rs/toolchain@v1
26+
uses: dtolnay/rust-toolchain@stable
2727
with:
2828
toolchain: stable
2929
profile: minimal

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/checkout@v2
1616

1717
- name: Set up Rust
18-
uses: actions-rs/toolchain@v1
18+
uses: dtolnay/rust-toolchain@stable
1919
with:
2020
toolchain: stable
2121
override: true

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17-
- uses: actions-rs/toolchain@v1
17+
- uses: dtolnay/rust-toolchain@stable
1818
with:
1919
toolchain: stable
2020
- name: Install cargo-nextest

.github/workflows/websocket-proxy-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
sudo apt-get install -y redis
2626
2727
- name: Set up Rust
28-
uses: actions-rs/toolchain@v1
28+
uses: dtolnay/rust-toolchain@stable
2929
with:
3030
toolchain: stable
3131
override: true

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ cargo run -- [OPTIONS]
1818
- `--builder-url <URL>`: URL of the builder execution engine (required)
1919
- `--builder-jwt-token <TOKEN>`: JWT token for builder authentication (required)
2020
- `--builder-jwt-path <PATH>`: Path to the builder JWT secret file (required if `--builder-jwt-token` is not provided)
21-
- `--rpc-host <HOST>`: Host to run the server on (default: 0.0.0.0)
21+
- `--rpc-host <HOST>`: Host to run the server on (default: 127.0.0.1)
2222
- `--rpc-port <PORT>`: Port to run the server on (default: 8081)
2323
- `--tracing`: Enable tracing (default: false)
2424
- `--log-level <LEVEL>`: Log level (default: info)
2525
- `--log-format <FORMAT>`: Log format (default: text)
2626
- `--metrics`: Enable metrics (default: false)
27+
- `--metrics-host <METRICS_HOST>`: Host to run the metrics server on (default: 127.0.0.1)
2728
- `--debug-host <HOST>`: Host to run the server on (default: 127.0.0.1)
2829
- `--debug-server-port <PORT>`: Port to run the debug server on (default: 5555)
2930

scripts/ci/stress.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ run() {
5858
contender setup -p $PREFUNDED_PRIV_KEY "/tmp/scenario.toml" -r $ROLLUP_BOOST_SOCKET --optimism
5959

6060
# Run the scenario on the builder
61-
contender run -p $PREFUNDED_PRIV_KEY fill-block -r $OP_RETH_BUILDER_SOCKET --optimism
61+
contender spam --tps 50 -p $PREFUNDED_PRIV_KEY -r $OP_RETH_BUILDER_SOCKET --optimism fill-block
6262
}
6363

6464
clean() {

src/cli.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct Args {
3737
pub max_unsafe_interval: u64,
3838

3939
/// Host to run the server on
40-
#[arg(long, env, default_value = "0.0.0.0")]
40+
#[arg(long, env, default_value = "127.0.0.1")]
4141
pub rpc_host: String,
4242

4343
/// Port to run the server on
@@ -53,7 +53,7 @@ pub struct Args {
5353
pub metrics: bool,
5454

5555
/// Host to run the metrics server on
56-
#[arg(long, env, default_value = "0.0.0.0")]
56+
#[arg(long, env, default_value = "127.0.0.1")]
5757
pub metrics_host: String,
5858

5959
/// Port to run the metrics server on
@@ -94,9 +94,7 @@ pub struct Args {
9494

9595
impl Args {
9696
pub async fn run(self) -> eyre::Result<()> {
97-
rustls::crypto::ring::default_provider()
98-
.install_default()
99-
.expect("Failed to install TLS ring CryptoProvider");
97+
let _ = rustls::crypto::ring::default_provider().install_default();
10098

10199
let debug_addr = format!("{}:{}", self.debug_host, self.debug_server_port);
102100

@@ -107,7 +105,7 @@ impl Args {
107105
Commands::Debug { command } => match command {
108106
DebugCommands::SetExecutionMode { execution_mode } => {
109107
let client = DebugClient::new(debug_addr.as_str())?;
110-
let result = client.set_execution_mode(execution_mode).await.unwrap();
108+
let result = client.set_execution_mode(execution_mode).await?;
111109
println!("Response: {:?}", result.execution_mode);
112110

113111
Ok(())

src/client/auth.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ pub fn secret_to_bearer_header(secret: &JwtSecret) -> HeaderValue {
7777
.encode(&Claims {
7878
iat: SystemTime::now()
7979
.duration_since(UNIX_EPOCH)
80-
.unwrap()
80+
.expect("Failed to get epoch time")
8181
.as_secs(),
8282
exp: None,
8383
})
84-
.unwrap()
84+
.expect("Failed to encode JWT claims")
8585
)
8686
.parse()
87-
.unwrap()
87+
.expect("Failed to parse JWT Header")
8888
}

src/client/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ pub mod tests {
392392

393393
use super::*;
394394

395-
const AUTH_ADDR: &str = "0.0.0.0";
395+
const AUTH_ADDR: &str = "127.0.0.1";
396396
const SECRET: &str = "f79ae8046bc11c9927afe911db7143c51a806c4a537cc08e0d37140b0192f430";
397397

398398
pub fn get_available_port() -> u16 {

src/health.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ mod tests {
101101
+ 'static,
102102
{
103103
{
104-
let listener = TcpListener::bind("0.0.0.0:0").await?;
104+
let listener = TcpListener::bind("127.0.0.1:0").await?;
105105
let addr = listener.local_addr()?;
106106

107107
let handle = tokio::spawn(async move {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ mod payload;
3232
pub use payload::*;
3333

3434
mod selection;
35-
pub use selection::*;
35+
pub use selection::*;

src/metrics.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ async fn init_metrics_server(addr: SocketAddr, handle: PrometheusHandle) -> eyre
4646
"/metrics" => Response::builder()
4747
.header("content-type", "text/plain")
4848
.body(HttpBody::from(handle.render()))
49-
.unwrap(),
49+
.expect("Failed to create metrics response"),
5050
_ => Response::builder()
5151
.status(StatusCode::NOT_FOUND)
5252
.body(HttpBody::empty())
53-
.unwrap(),
53+
.expect("Failed to create not found response"),
5454
};
55+
5556
async { Ok::<_, hyper::Error>(response) }
5657
});
5758

src/payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl OpExecutionPayloadEnvelope {
2222
OpExecutionPayloadEnvelope::V4(_) => PayloadVersion::V4,
2323
}
2424
}
25-
25+
2626
pub fn gas_used(&self) -> u64 {
2727
match self {
2828
OpExecutionPayloadEnvelope::V3(payload) => {

src/probe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ fn ok() -> HttpResponse<HttpBody> {
127127
HttpResponse::builder()
128128
.status(200)
129129
.body(HttpBody::from("OK"))
130-
.unwrap()
130+
.expect("Failed to create OK reponse")
131131
}
132132

133133
fn partial_content() -> HttpResponse<HttpBody> {
134134
HttpResponse::builder()
135135
.status(206)
136136
.body(HttpBody::from("Partial Content"))
137-
.unwrap()
137+
.expect("Failed to create partial content response")
138138
}
139139

140140
fn service_unavailable() -> HttpResponse<HttpBody> {
141141
HttpResponse::builder()
142142
.status(503)
143143
.body(HttpBody::from("Service Unavailable"))
144-
.unwrap()
144+
.expect("Failed to create service unavailable response")
145145
}

src/proxy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ mod tests {
206206
// None,
207207
));
208208

209-
let temp_listener = TcpListener::bind("0.0.0.0:0").await?;
209+
let temp_listener = TcpListener::bind("127.0.0.1:0").await?;
210210
let server_addr = temp_listener.local_addr()?;
211211
drop(temp_listener);
212212

@@ -247,7 +247,7 @@ mod tests {
247247

248248
impl MockHttpServer {
249249
async fn serve() -> eyre::Result<Self> {
250-
let listener = TcpListener::bind("0.0.0.0:0").await?;
250+
let listener = TcpListener::bind("127.0.0.1:0").await?;
251251
let addr = listener.local_addr()?;
252252
let requests = Arc::new(Mutex::new(vec![]));
253253

tests/common/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use alloy_rpc_types_engine::{
88
};
99
use alloy_rpc_types_eth::BlockNumberOrTag;
1010
use bytes::BytesMut;
11+
use eyre::{Context, ContextCompat};
1112
use futures::FutureExt;
1213
use futures::future::BoxFuture;
1314
use jsonrpsee::http_client::{HttpClient, transport::HttpBackend};
@@ -82,7 +83,7 @@ impl EngineApi {
8283
let client = jsonrpsee::http_client::HttpClientBuilder::default()
8384
.set_http_middleware(middleware)
8485
.build(url)
85-
.expect("Failed to create http client");
86+
.context("Failed to create http client")?;
8687

8788
Ok(Self {
8889
engine_api_client: client,
@@ -411,7 +412,7 @@ impl SimpleBlockGenerator {
411412

412413
/// Initialize the block generator by fetching the latest block
413414
pub async fn init(&mut self) -> eyre::Result<()> {
414-
let latest_block = self.engine_api.latest().await?.expect("block not found");
415+
let latest_block = self.engine_api.latest().await?.context("block not found")?;
415416
self.latest_hash = latest_block.header.hash;
416417
self.timestamp = latest_block.header.timestamp;
417418
Ok(())
@@ -470,7 +471,7 @@ impl SimpleBlockGenerator {
470471
)
471472
.await?;
472473

473-
let payload_id = result.payload_id.expect("missing payload id");
474+
let payload_id = result.payload_id.context("missing payload id")?;
474475

475476
if !empty_blocks {
476477
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
@@ -505,7 +506,7 @@ impl SimpleBlockGenerator {
505506
.validator
506507
.get_block_creator(new_block_hash)
507508
.await?
508-
.expect("block creator not found");
509+
.context("block creator not found")?;
509510

510511
Ok((new_block_hash, block_creator))
511512
}

0 commit comments

Comments
 (0)