diff --git a/examples/demo-rollup/src/main.rs b/examples/demo-rollup/src/main.rs index 9f6f962c8..1de442427 100644 --- a/examples/demo-rollup/src/main.rs +++ b/examples/demo-rollup/src/main.rs @@ -43,6 +43,11 @@ struct Args { /// The path to the sequencer config. If set, runs the node in sequencer mode, otherwise in full node mode. #[arg(long)] sequencer_config_path: Option, + + /// If set, runs the node in prover mode, else in full node mode. + /// Can't be set if sequencer_config_path is set. + #[arg(long, conflicts_with = "sequencer_config_path")] + prover: bool, } #[derive(clap::ValueEnum, Clone, Debug)] @@ -65,6 +70,7 @@ async fn main() -> Result<(), anyhow::Error> { .unwrap() }); + let is_prover = args.prover; match args.da_layer { SupportedDaLayer::Mock => { let kernel_genesis_paths = &BasicKernelGenesisPaths { @@ -84,6 +90,7 @@ async fn main() -> Result<(), anyhow::Error> { rollup_config_path, RollupProverConfig::Execute, sequencer_config, + is_prover, ) .await?; } @@ -105,6 +112,7 @@ async fn main() -> Result<(), anyhow::Error> { rollup_config_path, RollupProverConfig::Execute, sequencer_config, + is_prover, ) .await?; } @@ -126,6 +134,7 @@ async fn main() -> Result<(), anyhow::Error> { rollup_config_path, RollupProverConfig::Execute, sequencer_config, + is_prover, ) .await?; } @@ -150,6 +159,7 @@ async fn start_rollup( // ::DaSpec, // >>::GenesisPaths, sequencer_config: Option, + is_prover: bool, ) -> Result<(), anyhow::Error> where DaC: serde::de::DeserializeOwned + DebugTrait + Clone, @@ -184,6 +194,7 @@ where kernel_genesis, rollup_config, prover_config, + is_prover, ) .await .unwrap(); diff --git a/examples/demo-rollup/tests/test_helpers.rs b/examples/demo-rollup/tests/test_helpers.rs index 34c61a24a..ab4fc27dc 100644 --- a/examples/demo-rollup/tests/test_helpers.rs +++ b/examples/demo-rollup/tests/test_helpers.rs @@ -23,6 +23,8 @@ use tracing::warn; pub enum NodeMode { FullNode(SocketAddr), SequencerNode, + #[allow(dead_code)] + Prover(SocketAddr), } pub async fn start_rollup( @@ -64,9 +66,11 @@ pub async fn start_rollup( aggregated_proof_block_jump: 1, }, sequencer_client: match node_mode { - NodeMode::FullNode(socket_addr) => Some(SequencerClientRpcConfig { - url: format!("http://localhost:{}", socket_addr.port()), - }), + NodeMode::FullNode(socket_addr) | NodeMode::Prover(socket_addr) => { + Some(SequencerClientRpcConfig { + url: format!("http://localhost:{}", socket_addr.port()), + }) + } NodeMode::SequencerNode => None, }, }; @@ -93,6 +97,23 @@ pub async fn start_rollup( kernel_genesis, rollup_config.clone(), rollup_prover_config, + false, + ) + .await + .unwrap(); + rollup + .run_and_report_rpc_port(Some(rpc_reporting_channel)) + .await + .unwrap(); + } + NodeMode::Prover(_) => { + let rollup = mock_demo_rollup + .create_new_rollup( + &rt_genesis_paths, + kernel_genesis, + rollup_config.clone(), + rollup_prover_config, + true, ) .await .unwrap(); diff --git a/full-node/sov-stf-runner/src/runner.rs b/full-node/sov-stf-runner/src/runner.rs index 6d64f2f53..46a3823ec 100644 --- a/full-node/sov-stf-runner/src/runner.rs +++ b/full-node/sov-stf-runner/src/runner.rs @@ -56,7 +56,7 @@ where state_root: StateRoot, listen_address: SocketAddr, #[allow(dead_code)] - prover_service: Ps, + prover_service: Option, sequencer_client: Option, sequencer_pub_key: Vec, phantom: std::marker::PhantomData, @@ -119,7 +119,7 @@ where stf: Stf, mut storage_manager: Sm, init_variant: InitVariant, - prover_service: Ps, + prover_service: Option, sequencer_client: Option, sequencer_pub_key: Vec, ) -> Result { diff --git a/full-node/sov-stf-runner/tests/runner_initialization_tests.rs b/full-node/sov-stf-runner/tests/runner_initialization_tests.rs index bef37c5a4..6036d7024 100644 --- a/full-node/sov-stf-runner/tests/runner_initialization_tests.rs +++ b/full-node/sov-stf-runner/tests/runner_initialization_tests.rs @@ -119,7 +119,7 @@ fn initialize_runner( stf, storage_manager, init_variant, - prover_service, + Some(prover_service), None, vec![0u8; 32], ) diff --git a/full-node/sov-stf-runner/tests/runner_reorg_tests.rs b/full-node/sov-stf-runner/tests/runner_reorg_tests.rs index 445313f90..9aac7bf1b 100644 --- a/full-node/sov-stf-runner/tests/runner_reorg_tests.rs +++ b/full-node/sov-stf-runner/tests/runner_reorg_tests.rs @@ -173,7 +173,7 @@ async fn runner_execution( stf, storage_manager, init_variant, - prover_service, + Some(prover_service), None, vec![0u8; 32], ) diff --git a/module-system/sov-modules-rollup-blueprint/src/lib.rs b/module-system/sov-modules-rollup-blueprint/src/lib.rs index 5d880b3b3..424622720 100644 --- a/module-system/sov-modules-rollup-blueprint/src/lib.rs +++ b/module-system/sov-modules-rollup-blueprint/src/lib.rs @@ -221,6 +221,7 @@ pub trait RollupBlueprint: Sized + Send + Sync { kernel_genesis_config: >::GenesisConfig, rollup_config: RollupConfig, prover_config: RollupProverConfig, + is_prover: bool, ) -> Result, anyhow::Error> where ::Storage: NativeStorage, @@ -231,9 +232,14 @@ pub trait RollupBlueprint: Sized + Send + Sync { // Maybe whole "prev_root" can be initialized inside runner // Getting block here, so prover_service doesn't have to be `Send` let last_finalized_block_header = da_service.get_last_finalized_block_header().await?; - let prover_service = self - .create_prover_service(prover_config, &rollup_config, &da_service) - .await; + + let prover_service = match is_prover { + true => Some( + self.create_prover_service(prover_config, &rollup_config, &da_service) + .await, + ), + false => None, + }; let ledger_db = self.create_ledger_db(&rollup_config); let genesis_config = self.create_genesis_config(