@@ -52,7 +52,9 @@ use reth_optimism_rpc::{
5252 witness:: { DebugExecutionWitnessApiServer , OpDebugPostExecApiServer , OpDebugWitnessApi } ,
5353} ;
5454use reth_optimism_storage:: OpStorage ;
55- use reth_optimism_txpool:: { OpPool , OpPooledTx , interop_filter:: InteropFilterClient } ;
55+ use reth_optimism_txpool:: {
56+ OpPool , OpPooledTx , interop:: InteropFailsafe , interop_filter:: InteropFilterClient ,
57+ } ;
5658use reth_primitives_traits:: header:: HeaderMut ;
5759use reth_provider:: { CanonStateSubscriptions , providers:: ProviderFactoryBuilder } ;
5860use reth_rpc_api:: {
@@ -207,6 +209,9 @@ pub struct OpNode {
207209 /// Local operator opt-in for SDM `PostExec` production. Shared (via Arc clones) between the
208210 /// payload builder and the `admin_setSdmPostExecOptIn` RPC handler.
209211 pub sdm_post_exec_opt_in : SdmPostExecOptIn ,
212+ /// Interop failsafe gate, shared between the txpool's interop filter client (writer) and the
213+ /// payload builder (reader, to exclude interop txs while it is active).
214+ pub interop_failsafe : InteropFailsafe ,
210215}
211216
212217/// A [`ComponentsBuilder`] with its generic arguments set to a stack of Optimism specific builders.
@@ -227,6 +232,7 @@ impl OpNode {
227232 da_config : OpDAConfig :: default ( ) ,
228233 gas_limit_config : OpGasLimitConfig :: default ( ) ,
229234 sdm_post_exec_opt_in : SdmPostExecOptIn :: default ( ) ,
235+ interop_failsafe : InteropFailsafe :: default ( ) ,
230236 }
231237 }
232238
@@ -259,13 +265,15 @@ impl OpNode {
259265 self . args . interop_http . clone ( ) ,
260266 self . args . interop_min_responses ,
261267 self . args . interop_safety_level ,
262- ) ,
268+ )
269+ . with_interop_failsafe ( self . interop_failsafe . clone ( ) ) ,
263270 )
264271 . payload ( BasicPayloadServiceBuilder :: new (
265272 OpPayloadBuilder :: new ( compute_pending_block)
266273 . with_da_config ( self . da_config . clone ( ) )
267274 . with_gas_limit_config ( self . gas_limit_config . clone ( ) )
268275 . with_sdm_post_exec_opt_in ( self . sdm_post_exec_opt_in . clone ( ) )
276+ . with_interop_failsafe ( self . interop_failsafe . clone ( ) )
269277 . with_max_uncompressed_block_size ( self . args . max_uncompressed_block_size ) ,
270278 ) )
271279 . network ( OpNetworkBuilder :: new ( disable_txpool_gossip, !discovery_v4) )
@@ -1083,6 +1091,8 @@ pub struct OpPoolBuilder<T = crate::txpool::OpPooledTransaction> {
10831091 pub interop_min_responses : Option < usize > ,
10841092 /// Safety level for interop filter validation.
10851093 pub interop_safety_level : SafetyLevel ,
1094+ /// Shared interop failsafe gate, passed to the interop filter client this builder constructs.
1095+ pub interop_failsafe : InteropFailsafe ,
10861096 /// Marker for the pooled transaction type.
10871097 _pd : core:: marker:: PhantomData < T > ,
10881098}
@@ -1095,6 +1105,7 @@ impl<T> Default for OpPoolBuilder<T> {
10951105 interop_endpoints : Vec :: new ( ) ,
10961106 interop_min_responses : None ,
10971107 interop_safety_level : SafetyLevel :: CrossUnsafe ,
1108+ interop_failsafe : InteropFailsafe :: default ( ) ,
10981109 _pd : Default :: default ( ) ,
10991110 }
11001111 }
@@ -1108,6 +1119,7 @@ impl<T> Clone for OpPoolBuilder<T> {
11081119 interop_endpoints : self . interop_endpoints . clone ( ) ,
11091120 interop_min_responses : self . interop_min_responses ,
11101121 interop_safety_level : self . interop_safety_level ,
1122+ interop_failsafe : self . interop_failsafe . clone ( ) ,
11111123 _pd : core:: marker:: PhantomData ,
11121124 }
11131125 }
@@ -1143,6 +1155,12 @@ impl<T> OpPoolBuilder<T> {
11431155 self . interop_safety_level = interop_safety_level;
11441156 self
11451157 }
1158+
1159+ /// Shares the interop failsafe gate, written by the interop filter client this builder builds.
1160+ pub fn with_interop_failsafe ( mut self , interop_failsafe : InteropFailsafe ) -> Self {
1161+ self . interop_failsafe = interop_failsafe;
1162+ self
1163+ }
11461164}
11471165
11481166impl < Node , T , Evm > PoolBuilder < Node , Evm > for OpPoolBuilder < T >
@@ -1180,7 +1198,8 @@ where
11801198 self . interop_endpoints . clone ( ) ,
11811199 ctx. chain_spec ( ) . chain_id ( ) ,
11821200 )
1183- . minimum_safety ( self . interop_safety_level ) ;
1201+ . minimum_safety ( self . interop_safety_level )
1202+ . failsafe ( self . interop_failsafe . clone ( ) ) ;
11841203 if let Some ( min) = self . interop_min_responses {
11851204 builder = builder. min_responses ( min) ;
11861205 }
@@ -1302,6 +1321,8 @@ pub struct OpPayloadBuilder<Txs = ()> {
13021321 pub gas_limit_config : OpGasLimitConfig ,
13031322 /// Operator opt-in flag for SDM `PostExec` production. Shared with the admin RPC.
13041323 pub sdm_post_exec_opt_in : SdmPostExecOptIn ,
1324+ /// Interop failsafe gate, read by the builder to exclude interop txs while it is active.
1325+ pub interop_failsafe : InteropFailsafe ,
13051326 /// Maximum cumulative uncompressed (EIP-2718 encoded) block size in bytes.
13061327 ///
13071328 /// `None` disables the limit. See
@@ -1319,6 +1340,7 @@ impl OpPayloadBuilder {
13191340 da_config : OpDAConfig :: default ( ) ,
13201341 gas_limit_config : OpGasLimitConfig :: default ( ) ,
13211342 sdm_post_exec_opt_in : SdmPostExecOptIn :: default ( ) ,
1343+ interop_failsafe : InteropFailsafe :: default ( ) ,
13221344 max_uncompressed_block_size : None ,
13231345 }
13241346 }
@@ -1350,6 +1372,13 @@ impl OpPayloadBuilder {
13501372 self . sdm_post_exec_opt_in = sdm_post_exec_opt_in;
13511373 self
13521374 }
1375+
1376+ /// Provide the shared interop failsafe gate read by the builder.
1377+ #[ must_use]
1378+ pub fn with_interop_failsafe ( mut self , interop_failsafe : InteropFailsafe ) -> Self {
1379+ self . interop_failsafe = interop_failsafe;
1380+ self
1381+ }
13531382}
13541383
13551384impl < Txs > OpPayloadBuilder < Txs > {
@@ -1361,6 +1390,7 @@ impl<Txs> OpPayloadBuilder<Txs> {
13611390 da_config,
13621391 gas_limit_config,
13631392 sdm_post_exec_opt_in,
1393+ interop_failsafe,
13641394 max_uncompressed_block_size,
13651395 ..
13661396 } = self ;
@@ -1370,6 +1400,7 @@ impl<Txs> OpPayloadBuilder<Txs> {
13701400 da_config,
13711401 gas_limit_config,
13721402 sdm_post_exec_opt_in,
1403+ interop_failsafe,
13731404 max_uncompressed_block_size,
13741405 }
13751406 }
@@ -1421,6 +1452,7 @@ where
14211452 da_config : self . da_config . clone ( ) ,
14221453 gas_limit_config : self . gas_limit_config . clone ( ) ,
14231454 sdm_post_exec_opt_in : self . sdm_post_exec_opt_in . clone ( ) ,
1455+ interop_failsafe : self . interop_failsafe . clone ( ) ,
14241456 max_uncompressed_block_size : self . max_uncompressed_block_size ,
14251457 } ,
14261458 )
0 commit comments