2
2
3
3
use anyhow:: Context ;
4
4
use clap:: Parser ;
5
+ #[ cfg( feature = "celestia_da" ) ]
6
+ use m2_rollup:: celestia_rollup:: CelestiaRollup ;
7
+ #[ cfg( feature = "mock_da" ) ]
8
+ use m2_rollup:: mock_rollup:: MockRollup ;
5
9
use m2_stf:: genesis_config:: GenesisPaths ;
6
10
#[ cfg( feature = "celestia_da" ) ]
7
11
use sov_celestia_adapter:: CelestiaConfig ;
@@ -10,10 +14,6 @@ use sov_mock_da::MockDaConfig;
10
14
use sov_modules_rollup_blueprint:: { Rollup , RollupBlueprint } ;
11
15
use sov_modules_stf_blueprint:: kernels:: basic:: BasicKernelGenesisConfig ;
12
16
use sov_modules_stf_blueprint:: kernels:: basic:: BasicKernelGenesisPaths ;
13
- #[ cfg( feature = "celestia_da" ) ]
14
- use sov_rollup_starter:: celestia_rollup:: CelestiaRollup ;
15
- #[ cfg( feature = "mock_da" ) ]
16
- use m2_rollup:: mock_rollup:: MockRollup ;
17
17
use sov_stf_runner:: RollupProverConfig ;
18
18
use sov_stf_runner:: { from_toml_path, RollupConfig } ;
19
19
use std:: str:: FromStr ;
@@ -22,142 +22,127 @@ use tracing_subscriber::prelude::*;
22
22
use tracing_subscriber:: { fmt, EnvFilter } ;
23
23
24
24
// config and genesis for mock da
25
- #[ cfg( feature = "mock_da" ) ]
26
- const DEFAULT_CONFIG_PATH : & str = "../../rollup_config.toml" ;
27
- #[ cfg( feature = "mock_da" ) ]
28
- const DEFAULT_GENESIS_PATH : & str = "../../test-data/genesis/mock/" ;
29
- #[ cfg( feature = "mock_da" ) ]
30
- const DEFAULT_KERNEL_GENESIS_PATH : & str = "../../test-data/genesis/mock/chain_state.json" ;
31
-
32
- // config and genesis for local docker celestia
33
- #[ cfg( feature = "celestia_da" ) ]
34
- const DEFAULT_CONFIG_PATH : & str = "../../celestia_rollup_config.toml" ;
35
- #[ cfg( feature = "celestia_da" ) ]
36
- const DEFAULT_GENESIS_PATH : & str = "../../test-data/genesis/celestia/" ;
37
- #[ cfg( feature = "celestia_da" ) ]
38
- const DEFAULT_KERNEL_GENESIS_PATH : & str = "../../test-data/genesis/celestia/chain_state.json" ;
25
+ // #[cfg(feature = "mock_da")]
26
+ // const DEFAULT_CONFIG_PATH: &str = "../../rollup_config.toml";
27
+ // #[cfg(feature = "mock_da")]
28
+ // const DEFAULT_GENESIS_PATH: &str = "../../test-data/genesis/mock/";
29
+ // #[cfg(feature = "mock_da")]
30
+ // const DEFAULT_KERNEL_GENESIS_PATH: &str = "../../test-data/genesis/mock/chain_state.json";
31
+ //
32
+ // // config and genesis for local docker celestia
33
+ // #[cfg(feature = "celestia_da")]
34
+ // const DEFAULT_CONFIG_PATH: &str = "../../celestia_rollup_config.toml";
35
+ // #[cfg(feature = "celestia_da")]
36
+ // const DEFAULT_GENESIS_PATH: &str = "../../test-data/genesis/celestia/";
37
+ // #[cfg(feature = "celestia_da")]
38
+ // const DEFAULT_KERNEL_GENESIS_PATH: &str = "../../test-data/genesis/celestia/chain_state.json";
39
39
40
40
#[ derive( Parser , Debug ) ]
41
41
#[ command( author, version, about, long_about = None ) ]
42
42
struct Args {
43
- /// The path to the rollup config.
44
- #[ arg( long, default_value = DEFAULT_CONFIG_PATH ) ]
45
- rollup_config_path : String ,
46
-
47
- /// The path to the genesis config.
48
- #[ arg( long, default_value = DEFAULT_GENESIS_PATH ) ]
49
- genesis_paths : String ,
50
- /// The path to the kernel genesis config.
51
- #[ arg( long, default_value = DEFAULT_KERNEL_GENESIS_PATH ) ]
52
- kernel_genesis_paths : String ,
43
+ /// The path to the rollup config.
44
+ #[ arg( long, default_value = DEFAULT_CONFIG_PATH ) ]
45
+ rollup_config_path : String ,
46
+
47
+ /// The path to the genesis config.
48
+ #[ arg( long, default_value = DEFAULT_GENESIS_PATH ) ]
49
+ genesis_paths : String ,
50
+ /// The path to the kernel genesis config.
51
+ #[ arg( long, default_value = DEFAULT_KERNEL_GENESIS_PATH ) ]
52
+ kernel_genesis_paths : String ,
53
53
}
54
54
55
55
#[ tokio:: main]
56
56
async fn main ( ) -> Result < ( ) , anyhow:: Error > {
57
- // Initializing logging
58
- tracing_subscriber:: registry ( )
59
- . with ( fmt:: layer ( ) )
60
- //.with(EnvFilter::from_default_env())
61
- . with ( EnvFilter :: from_str ( "info,hyper=info" ) . unwrap ( ) )
62
- . init ( ) ;
63
-
64
- let args = Args :: parse ( ) ;
65
- let rollup_config_path = args. rollup_config_path . as_str ( ) ;
66
-
67
- let genesis_paths = args. genesis_paths . as_str ( ) ;
68
- let kernel_genesis_paths = args. kernel_genesis_paths . as_str ( ) ;
69
-
70
- let prover_config = if option_env ! ( "CI" ) . is_some ( ) {
71
- Some ( RollupProverConfig :: Execute )
72
- } else if let Some ( prover) = option_env ! ( "SOV_PROVER_MODE" ) {
73
- match prover {
74
- "simulate" => Some ( RollupProverConfig :: Simulate ) ,
75
- "execute" => Some ( RollupProverConfig :: Execute ) ,
76
- "prove" => Some ( RollupProverConfig :: Prove ) ,
77
- _ => {
78
- tracing:: warn!(
79
- prover_mode = prover,
80
- "Unknown sov prover mode, using 'Skip' default"
81
- ) ;
82
- Some ( RollupProverConfig :: Skip )
83
- }
84
- }
85
- } else {
86
- None
87
- } ;
88
-
89
- let rollup = new_rollup (
90
- & GenesisPaths :: from_dir ( genesis_paths) ,
91
- & BasicKernelGenesisPaths {
92
- chain_state : kernel_genesis_paths. into ( ) ,
93
- } ,
94
- rollup_config_path,
95
- prover_config,
96
- )
97
- . await ?;
98
- rollup. run ( ) . await
57
+ // Initializing logging
58
+ tracing_subscriber:: registry ( )
59
+ . with ( fmt:: layer ( ) )
60
+ //.with(EnvFilter::from_default_env())
61
+ . with ( EnvFilter :: from_str ( "info,hyper=info" ) . unwrap ( ) )
62
+ . init ( ) ;
63
+
64
+ let args = Args :: parse ( ) ;
65
+ let rollup_config_path = args. rollup_config_path . as_str ( ) ;
66
+
67
+ let genesis_paths = args. genesis_paths . as_str ( ) ;
68
+ let kernel_genesis_paths = args. kernel_genesis_paths . as_str ( ) ;
69
+
70
+ let prover_config = if option_env ! ( "CI" ) . is_some ( ) {
71
+ Some ( RollupProverConfig :: Execute )
72
+ } else if let Some ( prover) = option_env ! ( "SOV_PROVER_MODE" ) {
73
+ match prover {
74
+ "simulate" => Some ( RollupProverConfig :: Simulate ) ,
75
+ "execute" => Some ( RollupProverConfig :: Execute ) ,
76
+ "prove" => Some ( RollupProverConfig :: Prove ) ,
77
+ _ => {
78
+ tracing:: warn!(
79
+ prover_mode = prover,
80
+ "Unknown sov prover mode, using 'Skip' default"
81
+ ) ;
82
+ Some ( RollupProverConfig :: Skip )
83
+ } ,
84
+ }
85
+ } else {
86
+ None
87
+ } ;
88
+
89
+ let rollup = new_rollup (
90
+ & GenesisPaths :: from_dir ( genesis_paths) ,
91
+ & BasicKernelGenesisPaths { chain_state : kernel_genesis_paths. into ( ) } ,
92
+ rollup_config_path,
93
+ prover_config,
94
+ )
95
+ . await ?;
96
+ rollup. run ( ) . await
99
97
}
100
98
101
99
#[ cfg( feature = "mock_da" ) ]
102
100
async fn new_rollup (
103
- rt_genesis_paths : & GenesisPaths ,
104
- kernel_genesis_paths : & BasicKernelGenesisPaths ,
105
- rollup_config_path : & str ,
106
- prover_config : Option < RollupProverConfig > ,
101
+ rt_genesis_paths : & GenesisPaths ,
102
+ kernel_genesis_paths : & BasicKernelGenesisPaths ,
103
+ rollup_config_path : & str ,
104
+ prover_config : Option < RollupProverConfig > ,
107
105
) -> Result < Rollup < MockRollup > , anyhow:: Error > {
108
- info ! ( "Reading rollup config from {rollup_config_path:?}" ) ;
109
-
110
- let rollup_config: RollupConfig < MockDaConfig > =
111
- from_toml_path ( rollup_config_path) . context ( "Failed to read rollup configuration" ) ?;
106
+ info ! ( "Reading rollup config from {rollup_config_path:?}" ) ;
112
107
113
- let mock_rollup = MockRollup { } ;
114
-
115
- let kernel_genesis = BasicKernelGenesisConfig {
116
- chain_state : serde_json:: from_str (
117
- & std:: fs:: read_to_string ( & kernel_genesis_paths. chain_state )
118
- . context ( "Failed to read chain state" ) ?,
119
- ) ?,
120
- } ;
121
-
122
- mock_rollup
123
- . create_new_rollup (
124
- rt_genesis_paths,
125
- kernel_genesis,
126
- rollup_config,
127
- prover_config,
128
- )
129
- . await
130
- }
131
-
132
- #[ cfg( feature = "celestia_da" ) ]
133
- async fn new_rollup (
134
- rt_genesis_paths : & GenesisPaths ,
135
- kernel_genesis_paths : & BasicKernelGenesisPaths ,
136
- rollup_config_path : & str ,
137
- prover_config : Option < RollupProverConfig > ,
138
- ) -> Result < Rollup < CelestiaRollup > , anyhow:: Error > {
139
- info ! (
140
- "Starting celestia rollup with config {}" ,
141
- rollup_config_path
142
- ) ;
108
+ let rollup_config: RollupConfig < MockDaConfig > =
109
+ from_toml_path ( rollup_config_path) . context ( "Failed to read rollup configuration" ) ?;
143
110
144
- let rollup_config: RollupConfig < CelestiaConfig > =
145
- from_toml_path ( rollup_config_path) . context ( "Failed to read rollup configuration" ) ?;
111
+ let mock_rollup = MockRollup { } ;
146
112
147
- let kernel_genesis = BasicKernelGenesisConfig {
148
- chain_state : serde_json:: from_str (
149
- & std:: fs:: read_to_string ( & kernel_genesis_paths. chain_state )
150
- . context ( "Failed to read chain state" ) ?,
151
- ) ?,
152
- } ;
113
+ let kernel_genesis = BasicKernelGenesisConfig {
114
+ chain_state : serde_json:: from_str (
115
+ & std:: fs:: read_to_string ( & kernel_genesis_paths. chain_state )
116
+ . context ( "Failed to read chain state" ) ?,
117
+ ) ?,
118
+ } ;
153
119
154
- let mock_rollup = CelestiaRollup { } ;
155
- mock_rollup
156
- . create_new_rollup (
157
- rt_genesis_paths,
158
- kernel_genesis,
159
- rollup_config,
160
- prover_config,
161
- )
162
- . await
120
+ mock_rollup
121
+ . create_new_rollup ( rt_genesis_paths, kernel_genesis, rollup_config, prover_config)
122
+ . await
163
123
}
124
+ //
125
+ // #[cfg(feature = "celestia_da")]
126
+ // async fn new_rollup(
127
+ // rt_genesis_paths: &GenesisPaths,
128
+ // kernel_genesis_paths: &BasicKernelGenesisPaths,
129
+ // rollup_config_path: &str,
130
+ // prover_config: Option<RollupProverConfig>,
131
+ // ) -> Result<Rollup<CelestiaRollup>, anyhow::Error> {
132
+ // info!("Starting celestia rollup with config {}", rollup_config_path);
133
+ //
134
+ // let rollup_config: RollupConfig<CelestiaConfig> =
135
+ // from_toml_path(rollup_config_path).context("Failed to read rollup configuration")?;
136
+ //
137
+ // let kernel_genesis = BasicKernelGenesisConfig {
138
+ // chain_state: serde_json::from_str(
139
+ // &std::fs::read_to_string(&kernel_genesis_paths.chain_state)
140
+ // .context("Failed to read chain state")?,
141
+ // )?,
142
+ // };
143
+ //
144
+ // let mock_rollup = CelestiaRollup {};
145
+ // mock_rollup
146
+ // .create_new_rollup(rt_genesis_paths, kernel_genesis, rollup_config, prover_config)
147
+ // .await
148
+ // }
0 commit comments