@@ -34,6 +34,7 @@ use rollup_node_chain_orchestrator::{ChainOrchestratorEvent, ChainOrchestratorHa
3434use rollup_node_sequencer:: L1MessageInclusionMode ;
3535use scroll_alloy_consensus:: ScrollPooledTransaction ;
3636use scroll_alloy_rpc_types:: Transaction ;
37+ use scroll_engine:: { Engine , ForkchoiceState } ;
3738use std:: {
3839 fmt:: { Debug , Formatter } ,
3940 ops:: { Deref , DerefMut } ,
@@ -95,14 +96,10 @@ pub type ScrollNetworkHandle =
9596pub type TestBlockChainProvider =
9697 BlockchainProvider < NodeTypesWithDBAdapter < ScrollRollupNode , TmpDB > > ;
9798
98- <<<<<<< HEAD
9999/// The test node type for Scroll nodes.
100100pub type ScrollTestNode = NodeHelperType < ScrollRollupNode , TestBlockChainProvider > ;
101101
102- /// The node type (sequencer or follower).
103- =======
104102/// The node type (sequencer, follower, or remote source).
105- >>>>>>> main
106103#[ derive( Debug ) ]
107104pub enum NodeType {
108105 /// A sequencer node.
@@ -158,6 +155,8 @@ impl Deref for ScrollNodeTestComponents {
158155pub struct NodeHandle {
159156 /// The underlying node context.
160157 pub node : ScrollNodeTestComponents ,
158+ /// Engine instance for this node.
159+ pub engine : Engine < Arc < dyn ScrollEngineApi + Send + Sync + ' static > > ,
161160 /// Chain orchestrator listener.
162161 pub chain_orchestrator_rx : EventStream < ChainOrchestratorEvent > ,
163162 /// Chain orchestrator handle.
@@ -167,15 +166,6 @@ pub struct NodeHandle {
167166}
168167
169168impl NodeHandle {
170- /// Create a new node handle.
171- pub async fn new( node: ScrollNodeTestComponents , typ : NodeType ) -> eyre:: Result < Self > {
172- let rollup_manager_handle = node. inner. add_ons_handle. rollup_manager_handle. clone( ) ;
173- let chain_orchestrator_rx =
174- node. inner. add_ons_handle. rollup_manager_handle. get_event_listener( ) . await ?;
175-
176- Ok ( Self { node, chain_orchestrator_rx, rollup_manager_handle, typ } )
177- }
178-
179169 /// Returns true if this is a handle to the sequencer.
180170 pub const fn is_sequencer ( & self ) -> bool {
181171 matches ! ( self . typ, NodeType :: Sequencer )
@@ -236,7 +226,7 @@ impl TestFixture {
236226 pub fn remote_source ( & mut self ) -> & mut NodeHandle {
237227 self . nodes
238228 . iter_mut ( )
239- . find ( |n| matches ! ( n . typ, NodeType :: RemoteSource ) )
229+ . find_map ( |n| n . as_mut ( ) . filter ( |node| matches ! ( node . typ, NodeType :: RemoteSource ) ) )
240230 . expect ( "remote source node not found" )
241231 }
242232
@@ -654,7 +644,6 @@ impl TestFixtureBuilder {
654644 pub async fn build ( mut self ) -> eyre:: Result < TestFixture > {
655645 let chain_spec = self . chain_spec . unwrap_or_else ( || SCROLL_DEV . clone ( ) ) ;
656646
657- <<<<<<< HEAD
658647 // Start Anvil if requested
659648 let anvil = if self . anvil_config . enabled {
660649 let handle = Self :: spawn_anvil (
@@ -682,25 +671,17 @@ impl TestFixtureBuilder {
682671 None
683672 } ;
684673
685- let ( node_components , dbs, wallet) = setup_engine(
674+ let ( mut nodes , mut dbs, task , wallet) = setup_engine (
686675 self . config . clone ( ) ,
687- =======
688- let ( mut nodes, mut tasks, wallet) = setup_engine(
689- config. clone( ) ,
690- >>>>>>> main
691676 self . num_nodes ,
692677 chain_spec. clone ( ) ,
693678 self . is_dev ,
694679 self . no_local_transactions_propagation ,
695680 None ,
681+ None ,
696682 )
697683 . await ?;
698684
699- <<<<<<< HEAD
700- let mut nodes = Vec :: with_capacity( node_components. len( ) ) ;
701- for ( index, node) in node_components. into_iter( ) . enumerate( ) {
702- let handle = NodeHandle : : new(
703- =======
704685 // Launch remote source node if requested
705686 if self . has_remote_source_node {
706687 // Get sequencer's RPC URL
@@ -716,16 +697,17 @@ impl TestFixtureBuilder {
716697 // Use a fast poll interval for tests
717698 remote_config. remote_block_source_args . poll_interval_ms = 100 ;
718699
719- let ( mut remote_nodes, new_tasks , _) = setup_engine(
700+ let ( mut remote_nodes, _ , new_task , _) = setup_engine (
720701 remote_config,
721702 1 ,
722703 chain_spec. clone ( ) ,
723704 self . is_dev ,
724705 self . no_local_transactions_propagation ,
706+ None ,
725707 Some ( tasks) ,
726708 )
727709 . await ?;
728- tasks = new_tasks ;
710+ let tasks = new_task ;
729711
730712 nodes. push ( remote_nodes. pop ( ) . unwrap ( ) ) ;
731713 }
@@ -751,17 +733,18 @@ impl TestFixtureBuilder {
751733 node. inner . add_ons_handle . rollup_manager_handle . get_event_listener ( ) . await ?;
752734
753735 node_handles. push ( NodeHandle {
754- >>>>>>> main
755736 node,
756- if self . config. sequencer_args. sequencer_enabled && index == 0 {
737+ engine,
738+ chain_orchestrator_rx,
739+ rollup_manager_handle,
740+ typ : if config. sequencer_args . sequencer_enabled && index == 0 {
757741 NodeType :: Sequencer
758742 } else if config. remote_block_source_args . enabled && index == node_handles. len ( ) {
759743 NodeType :: RemoteSource
760744 } else {
761745 NodeType :: Follower
762746 } ,
763- )
764- . await ?;
747+ } ) ;
765748
766749 nodes. push ( Some ( handle) ) ;
767750 }
@@ -771,12 +754,8 @@ impl TestFixtureBuilder {
771754 dbs,
772755 wallet : Arc :: new ( Mutex :: new ( wallet) ) ,
773756 chain_spec,
774- <<<<<<< HEAD
775757 anvil,
776758 config : self . config ,
777- =======
778- _tasks: tasks,
779- >>>>>>> main
780759 } )
781760 }
782761
0 commit comments