Construct a new `TestRollupNode` from pre-built components. The `pipeline`, `engine`, and `p2p` are the three actors that the node orchestrates. `safe_head` is the L2 genesis head from which derivation starts. `rollup_config` is used for Engine API version selection. Call [`initialize`] before the first [`step`] or [`run_until_idle`]. [`initialize`]: TestRollupNode::initialize [`step`]: TestRol
(
pipeline: P,
engine: ActionEngineClient,
p2p: TestGossipTransport,
safe_head: L2BlockInfo,
rollup_config: Arc<RollupConfig>,
l2_provider: ActionL2Chai
| 182 | /// [`step`]: TestRollupNode::step |
| 183 | /// [`run_until_idle`]: TestRollupNode::run_until_idle |
| 184 | pub fn new( |
| 185 | pipeline: P, |
| 186 | engine: ActionEngineClient, |
| 187 | p2p: TestGossipTransport, |
| 188 | safe_head: L2BlockInfo, |
| 189 | rollup_config: Arc<RollupConfig>, |
| 190 | l2_provider: ActionL2ChainProvider, |
| 191 | ) -> Self { |
| 192 | let safedb_dir = |
| 193 | tempfile::TempDir::new().expect("TestRollupNode: failed to create safedb temp dir"); |
| 194 | let safe_db = Arc::new( |
| 195 | SafeDB::open(safedb_dir.path().join("safedb")) |
| 196 | .expect("TestRollupNode: failed to open safedb"), |
| 197 | ); |
| 198 | Self { |
| 199 | pipeline, |
| 200 | engine, |
| 201 | p2p, |
| 202 | safe_head, |
| 203 | unsafe_head: safe_head, |
| 204 | finalized_head: safe_head, |
| 205 | finalized_l1_number: 0, |
| 206 | safe_l1_number: 0, |
| 207 | safe_head_history: Vec::new(), |
| 208 | derived_tx_counts: Vec::new(), |
| 209 | derived_user_tx_counts: Vec::new(), |
| 210 | derived_l1_info_txs: Vec::new(), |
| 211 | rollup_config, |
| 212 | safe_db, |
| 213 | l2_provider, |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /// Initialize the pipeline by sending the genesis activation signal. |
| 218 | /// |