Skip to content

Commit aa98a26

Browse files
author
Solar Mithril
committed
Fix merge conflict
1 parent 445849c commit aa98a26

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/op-rbuilder/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ shellexpand = "3.1"
9797
serde_yaml = { version = "0.9" }
9898

9999

100-
# `flashblocks` branch
101-
rollup-boost = { git = "https://github.com/flashbots/rollup-boost", rev = "6f994a2092967108e7dda0ade57625ba10940310" }
100+
# `msozin/flashblocks-v1.4.1` branch based on `flashblocks-rebase`
101+
rollup-boost = { git = "https://github.com/flashbots/rollup-boost", rev = "b9e6353d08672bd19e754a9525de47e04b34c84c" }
102102

103103
[target.'cfg(unix)'.dependencies]
104104
tikv-jemallocator = { version = "0.6", optional = true }

crates/op-rbuilder/src/bin/tester/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async fn main() -> eyre::Result<()> {
6666
.await
6767
}
6868
Commands::Deposit { address, amount } => {
69-
let engine_api = EngineApi::default();
69+
let engine_api = EngineApi::builder().build().unwrap();
7070
let mut generator = BlockGenerator::new(engine_api, None, false, 1, None);
7171

7272
generator.init().await?;

crates/op-rbuilder/src/integration/integration_test.rs

Whitespace-only changes.

crates/op-rbuilder/src/integration/mod.rs

Whitespace-only changes.

crates/op-rbuilder/src/tests/framework/apis.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ use alloy_eips::BlockNumberOrTag;
33
use alloy_primitives::B256;
44
use alloy_rpc_types_engine::{ExecutionPayloadV3, ForkchoiceUpdated, PayloadStatus};
55
use jsonrpsee::{
6-
core::RpcResult,
7-
http_client::{transport::HttpBackend, HttpClient},
6+
core::{client::SubscriptionClientT, RpcResult},
87
proc_macros::rpc,
98
};
109
use reth::rpc::{api::EngineApiClient, types::engine::ForkchoiceState};
1110
use reth_node_api::{EngineTypes, PayloadTypes};
1211
use reth_optimism_node::OpEngineTypes;
1312
use reth_payload_builder::PayloadId;
14-
use reth_rpc_layer::{AuthClientLayer, AuthClientService, JwtSecret};
13+
use reth_rpc_layer::{AuthClientLayer, JwtSecret};
1514
use serde_json::Value;
1615
use std::str::FromStr;
1716

1817
/// Helper for engine api operations
1918
pub struct EngineApi {
20-
pub engine_api_client: HttpClient<AuthClientService<HttpBackend>>,
19+
url: url::Url,
20+
jwt_secret: JwtSecret,
2121
}
2222

2323
/// Builder for EngineApi configuration
@@ -46,15 +46,9 @@ impl EngineApiBuilder {
4646
}
4747

4848
pub fn build(self) -> Result<EngineApi, Box<dyn std::error::Error>> {
49-
let secret_layer = AuthClientLayer::new(JwtSecret::from_str(&self.jwt_secret)?);
50-
let middleware = tower::ServiceBuilder::default().layer(secret_layer);
51-
let client = jsonrpsee::http_client::HttpClientBuilder::default()
52-
.set_http_middleware(middleware)
53-
.build(&self.url)
54-
.expect("Failed to create http client");
55-
5649
Ok(EngineApi {
57-
engine_api_client: client,
50+
url: self.url.parse()?,
51+
jwt_secret: JwtSecret::from_str(&self.jwt_secret)?,
5852
})
5953
}
6054
}
@@ -74,6 +68,16 @@ impl EngineApi {
7468
.build()
7569
}
7670

71+
pub fn http_client(&self) -> impl SubscriptionClientT + Clone + Send + Sync + Unpin + 'static {
72+
// Create a middleware that adds a new JWT token to every request.
73+
let secret_layer = AuthClientLayer::new(self.jwt_secret);
74+
let middleware = tower::ServiceBuilder::default().layer(secret_layer);
75+
jsonrpsee::http_client::HttpClientBuilder::default()
76+
.set_http_middleware(middleware)
77+
.build(&self.url)
78+
.expect("Failed to create http client")
79+
}
80+
7781
pub async fn get_payload_v3(
7882
&self,
7983
payload_id: PayloadId,
@@ -85,7 +89,7 @@ impl EngineApi {
8589
);
8690

8791
Ok(
88-
EngineApiClient::<OpEngineTypes>::get_payload_v3(&self.engine_api_client, payload_id)
92+
EngineApiClient::<OpEngineTypes>::get_payload_v3(&self.http_client(), payload_id)
8993
.await?,
9094
)
9195
}
@@ -99,7 +103,7 @@ impl EngineApi {
99103
println!("Submitting new payload at {}...", chrono::Utc::now());
100104

101105
Ok(EngineApiClient::<OpEngineTypes>::new_payload_v3(
102-
&self.engine_api_client,
106+
&self.http_client(),
103107
payload,
104108
versioned_hashes,
105109
parent_beacon_block_root,
@@ -116,7 +120,7 @@ impl EngineApi {
116120
println!("Updating forkchoice at {}...", chrono::Utc::now());
117121

118122
Ok(EngineApiClient::<OpEngineTypes>::fork_choice_updated_v3(
119-
&self.engine_api_client,
123+
&self.http_client(),
120124
ForkchoiceState {
121125
head_block_hash: new_head,
122126
safe_block_hash: current_head,
@@ -137,10 +141,7 @@ impl EngineApi {
137141
number: BlockNumberOrTag,
138142
include_txs: bool,
139143
) -> eyre::Result<Option<alloy_rpc_types_eth::Block>> {
140-
Ok(
141-
BlockApiClient::get_block_by_number(&self.engine_api_client, number, include_txs)
142-
.await?,
143-
)
144+
Ok(BlockApiClient::get_block_by_number(&self.http_client(), number, include_txs).await?)
144145
}
145146
}
146147

crates/op-rbuilder/src/tests/framework/harness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl TestHarness {
149149
pub fn provider(&self) -> eyre::Result<RootProvider<Optimism>> {
150150
let url = format!("http://localhost:{}", self.builder_http_port);
151151
let provider =
152-
ProviderBuilder::<Identity, Identity, Optimism>::default().on_http(url.parse()?);
152+
ProviderBuilder::<Identity, Identity, Optimism>::default().connect_http(url.parse()?);
153153

154154
Ok(provider)
155155
}

0 commit comments

Comments
 (0)