Skip to content

Commit 5f49111

Browse files
committed
Add test
1 parent 6a7252e commit 5f49111

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

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

+18-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,24 @@ mod tests {
125125
.await?
126126
.expect("block");
127127

128-
// blocks should only include two
129-
println!("block: {:?}", block.transactions.len());
128+
// blocks should only include two transactions (deposit + builder)
129+
assert_eq!(block.transactions.len(), 2);
130+
}
131+
132+
// check that the builder emitted logs for the reverted transactions
133+
// with the monitoring logic
134+
// TODO: this is not ideal, lets find a different way to detect this
135+
// Each time a transaction is dropped, it emits a log like this
136+
// 'Transaction event received target="monitoring" tx_hash="<tx_hash>" kind="discarded"'
137+
let builder_logs = std::fs::read_to_string(harness.builder_log_path)?;
138+
139+
for txn in pending_txn {
140+
let txn_log = format!(
141+
"Transaction event received target=\"monitoring\" tx_hash=\"{}\" kind=\"discarded\"",
142+
txn.tx_hash()
143+
);
144+
145+
assert!(builder_logs.contains(txn_log.as_str()));
130146
}
131147

132148
Ok(())

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,19 @@ impl TestHarnessBuilder {
270270

271271
framework.start("op-reth", &reth).await.unwrap();
272272

273-
let _ = framework
273+
let builder = framework
274274
.start("op-rbuilder", &op_rbuilder_config)
275275
.await
276276
.unwrap();
277277

278+
let builder_log_path = builder.log_path.clone();
279+
278280
Ok(TestHarness {
279281
_framework: framework,
280282
builder_auth_rpc_port,
281283
builder_http_port,
282284
validator_auth_rpc_port,
285+
builder_log_path,
283286
})
284287
}
285288
}
@@ -289,6 +292,7 @@ pub struct TestHarness {
289292
builder_auth_rpc_port: u16,
290293
builder_http_port: u16,
291294
validator_auth_rpc_port: u16,
295+
builder_log_path: PathBuf,
292296
}
293297

294298
impl TestHarness {

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

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl Service for OpRbuilderConfig {
118118
.arg("--disable-discovery")
119119
.arg("--color")
120120
.arg("never")
121+
.arg("--builder.log-pool-transactions")
121122
.arg("--port")
122123
.arg(self.network_port.expect("network_port not set").to_string())
123124
.arg("--ipcdisable");

0 commit comments

Comments
 (0)