@@ -8,8 +8,8 @@ mod utils;
8
8
9
9
use std:: path:: PathBuf ;
10
10
11
- pub use clementine:: { ClementineClient , ClementineConfig } ;
12
11
pub use bitcoin:: BitcoinConfig ;
12
+ pub use clementine:: { ClementineClient , ClementineConfig } ;
13
13
pub use docker:: DockerConfig ;
14
14
pub use rollup:: { default_rollup_config, RollupConfig } ;
15
15
use serde:: Serialize ;
@@ -41,7 +41,6 @@ pub struct FullL2NodeConfig<T> {
41
41
pub type FullSequencerConfig = FullL2NodeConfig < SequencerConfig > ;
42
42
pub type FullBatchProverConfig = FullL2NodeConfig < BatchProverConfig > ;
43
43
pub type FullLightClientProverConfig = FullL2NodeConfig < LightClientProverConfig > ;
44
- pub type FullVerifierConfig = FullL2NodeConfig < ClementineConfig > ;
45
44
pub type FullFullNodeConfig = FullL2NodeConfig < ( ) > ;
46
45
47
46
pub trait NodeKindMarker {
@@ -64,10 +63,6 @@ impl NodeKindMarker for FullFullNodeConfig {
64
63
const KIND : NodeKind = NodeKind :: FullNode ;
65
64
}
66
65
67
- impl NodeKindMarker for FullVerifierConfig {
68
- const KIND : NodeKind = NodeKind :: Verifier ;
69
- }
70
-
71
66
impl < T : Clone + Serialize > Config for FullL2NodeConfig < T >
72
67
where
73
68
FullL2NodeConfig < T > : NodeKindMarker ,
@@ -105,6 +100,10 @@ where
105
100
fn rollup_config ( & self ) -> & RollupConfig {
106
101
& self . rollup
107
102
}
103
+
104
+ fn clementine_config ( & self ) -> & ClementineConfig {
105
+ unimplemented ! ( )
106
+ }
108
107
}
109
108
110
109
impl < T : Clone + Serialize > LogPathProvider for FullL2NodeConfig < T >
@@ -123,3 +122,78 @@ where
123
122
self . dir ( ) . join ( "stderr.log" )
124
123
}
125
124
}
125
+
126
+ #[ derive( Clone , Debug ) ]
127
+ pub struct ClementineNodeConfig < T > {
128
+ pub node : T ,
129
+ pub config : ClementineConfig ,
130
+ pub docker_image : Option < String > ,
131
+ pub dir : PathBuf ,
132
+ pub env : Vec < ( & ' static str , & ' static str ) > ,
133
+ }
134
+
135
+ pub type FullVerifierConfig = ClementineNodeConfig < ClementineConfig > ;
136
+
137
+ impl NodeKindMarker for FullVerifierConfig {
138
+ const KIND : NodeKind = NodeKind :: Verifier ;
139
+ }
140
+
141
+ impl < T : Clone + Serialize > Config for ClementineNodeConfig < T >
142
+ where
143
+ ClementineNodeConfig < T > : NodeKindMarker ,
144
+ {
145
+ type NodeConfig = T ;
146
+
147
+ fn dir ( & self ) -> & PathBuf {
148
+ & self . dir
149
+ }
150
+
151
+ fn rpc_bind_host ( & self ) -> & str {
152
+ & self . config . client . host
153
+ }
154
+
155
+ fn rpc_bind_port ( & self ) -> u16 {
156
+ self . config . client . port
157
+ }
158
+
159
+ fn env ( & self ) -> Vec < ( & ' static str , & ' static str ) > {
160
+ self . env . clone ( )
161
+ }
162
+
163
+ fn node_config ( & self ) -> Option < & Self :: NodeConfig > {
164
+ if std:: mem:: size_of :: < T > ( ) == 0 {
165
+ None
166
+ } else {
167
+ Some ( & self . node )
168
+ }
169
+ }
170
+
171
+ fn node_kind ( ) -> NodeKind {
172
+ <Self as NodeKindMarker >:: KIND
173
+ }
174
+
175
+ fn rollup_config ( & self ) -> & RollupConfig {
176
+ unimplemented ! ( )
177
+ }
178
+
179
+ fn clementine_config ( & self ) -> & ClementineConfig {
180
+ & self . config
181
+ }
182
+ }
183
+
184
+ impl < T : Clone + Serialize > LogPathProvider for ClementineNodeConfig < T >
185
+ where
186
+ ClementineNodeConfig < T > : Config ,
187
+ {
188
+ fn kind ( ) -> NodeKind {
189
+ Self :: node_kind ( )
190
+ }
191
+
192
+ fn log_path ( & self ) -> PathBuf {
193
+ self . dir ( ) . join ( "stdout.log" )
194
+ }
195
+
196
+ fn stderr_path ( & self ) -> PathBuf {
197
+ self . dir ( ) . join ( "stderr.log" )
198
+ }
199
+ }
0 commit comments