@@ -25,7 +25,10 @@ impl FromStr for Network {
2525 match s. to_lowercase ( ) . as_str ( ) {
2626 "testnet" | "sepolia" => Ok ( Network :: Testnet ) ,
2727 "mainnet" => Ok ( Network :: Mainnet ) ,
28- _ => Err ( format ! ( "Unknown network: {}. Use 'testnet' or 'mainnet'" , s) ) ,
28+ _ => Err ( format ! (
29+ "Unknown network: {}. Use 'testnet' or 'mainnet'" ,
30+ s
31+ ) ) ,
2932 }
3033 }
3134}
@@ -48,6 +51,10 @@ pub struct Config {
4851 #[ serde( default ) ]
4952 pub relayer : RelayerConfig ,
5053
54+ /// Config for EthLightClient contract initialization
55+ #[ serde( default ) ]
56+ pub init : InitConfig ,
57+
5158 /// Logging configuration
5259 #[ serde( default ) ]
5360 pub logging : LoggingConfig ,
@@ -125,6 +132,28 @@ pub struct RelayerConfig {
125132 pub fast_mode : bool ,
126133}
127134
135+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
136+ pub struct InitConfig {
137+ #[ serde( default ) ]
138+ pub network : String ,
139+
140+ /// Path to the file with init Light Client Update
141+ #[ serde( default ) ]
142+ pub init_update : String ,
143+
144+ /// Path to the file with the first (next after init) Light Client Update
145+ #[ serde( default ) ]
146+ pub first_update : String ,
147+
148+ /// Path to the file with headers
149+ #[ serde( default ) ]
150+ pub headers : String ,
151+
152+ /// Hashes threshold for Garbage Collection
153+ #[ serde( default ) ]
154+ pub hashes_gc_threshold : u64 ,
155+ }
156+
128157#[ derive( Debug , Clone , Serialize , Deserialize ) ]
129158pub struct LoggingConfig {
130159 /// Log level: trace, debug, info, warn, error
@@ -183,6 +212,18 @@ impl Default for RelayerConfig {
183212 }
184213}
185214
215+ impl Default for InitConfig {
216+ fn default ( ) -> Self {
217+ Self {
218+ network : "sepolia" . to_string ( ) ,
219+ init_update : "" . to_string ( ) ,
220+ first_update : "" . to_string ( ) ,
221+ headers : "" . to_string ( ) ,
222+ hashes_gc_threshold : 51000 ,
223+ }
224+ }
225+ }
226+
186227impl Default for LoggingConfig {
187228 fn default ( ) -> Self {
188229 Self {
@@ -359,6 +400,13 @@ impl Config {
359400 timeout_secs : defaults:: TIMEOUT_SECS ,
360401 } ,
361402 relayer : RelayerConfig :: default ( ) ,
403+ init : InitConfig {
404+ network : "mainnet" . to_string ( ) ,
405+ init_update : "" . to_string ( ) ,
406+ first_update : "" . to_string ( ) ,
407+ headers : "" . to_string ( ) ,
408+ hashes_gc_threshold : 51000 ,
409+ } ,
362410 logging : LoggingConfig :: default ( ) ,
363411 } ,
364412 }
@@ -393,6 +441,7 @@ mod tests {
393441 assert ! ( toml. contains( "[beacon]" ) ) ;
394442 assert ! ( toml. contains( "[near]" ) ) ;
395443 assert ! ( toml. contains( "[relayer]" ) ) ;
444+ assert ! ( toml. contains( "[init]" ) ) ;
396445 assert ! ( toml. contains( "[logging]" ) ) ;
397446 }
398447}
0 commit comments