@@ -11,7 +11,7 @@ pub mod faucet;
11
11
pub mod rest_api;
12
12
use std:: path:: PathBuf ;
13
13
14
- use faucet:: { Faucet , ParseFaucet } ;
14
+ use faucet:: { Faucet as FaucetApi , ParseFaucet } ;
15
15
use movement_signer_loader:: identifiers:: SignerIdentifier ;
16
16
use mtma_types:: movement:: movement_config:: Config as MovementConfig ;
17
17
use rest_api:: { ParseRestApi , RestApi } ;
@@ -26,90 +26,72 @@ vendor_workspace!(MovementWorkspace, "movement");
26
26
/// The different overlays that can be applied to the movement runner. s
27
27
#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Serialize , Deserialize ) ]
28
28
pub enum Overlay {
29
- /// The celestia overlay is used to run the movement runner on a select Celestia network.
30
- Celestia ( Celestia ) ,
31
- /// The eth overlay is used to run the movement runner on a select Ethereum network.
32
- Eth ( Eth ) ,
33
- /// The test migration overlay is used to run and check the migration to the L1 pre-merge chain.
34
- ///
35
- /// TODO: in this repo, we may want to remove this from the runner and place it actual embeeded code under the -core lib for https://github.com/movementlabsxyz/movement-migration/issues/61
36
- TestMigrateBiarritzRc1ToPreL1Merge ,
29
+ /// The local overlay takes care of setting up the DA sequencer and the full nodd
30
+ Local ( Local ) ,
31
+ /// The faucet overlay adds the faucet to whatever orchestration
32
+ Faucet ( Faucet ) ,
33
+ /// The fullnode overlay is best used for connecting to an existing network
34
+ Fullnode ( Fullnode ) ,
37
35
}
38
36
39
37
impl Overlay {
40
38
/// Returns the overlay as a string as would be used in a nix command.
41
39
pub fn overlay_arg ( & self ) -> & str {
42
40
match self {
43
- Self :: Celestia ( celestia ) => celestia . overlay_arg ( ) ,
44
- Self :: Eth ( eth ) => eth . overlay_arg ( ) ,
45
- Self :: TestMigrateBiarritzRc1ToPreL1Merge => "test-migrate-biarritz-rc1-to-pre-l1-merge" ,
41
+ Self :: Local ( local ) => local . overlay_arg ( ) ,
42
+ Self :: Faucet ( faucet ) => faucet . overlay_arg ( ) ,
43
+ Self :: Fullnode ( fullnode ) => fullnode . overlay_arg ( ) ,
46
44
}
47
45
}
48
46
}
49
47
50
- /// Errors thrown when parsing an [Eth ] network.
48
+ /// Errors thrown when parsing an [Overlay ] network.
51
49
#[ derive( Debug , thiserror:: Error ) ]
52
- pub enum EthError {
53
- #[ error( "invalid ethereum network: {0}" ) ]
54
- InvalidNetwork ( #[ source] Box < dyn std:: error:: Error + Send + Sync > ) ,
55
- }
56
-
57
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Serialize , Deserialize ) ]
58
- pub enum Eth {
59
- /// The local network.
60
- Local ,
50
+ pub enum OverlayError {
51
+ #[ error( "invalid overlay selection: {0}" ) ]
52
+ InvalidOverlaySelection ( #[ source] Box < dyn std:: error:: Error + Send + Sync > ) ,
61
53
}
62
54
63
- impl FromStr for Eth {
64
- type Err = EthError ;
55
+ impl FromStr for Overlay {
56
+ type Err = OverlayError ;
65
57
66
58
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
67
59
Ok ( match s {
68
- "local" => Self :: Local ,
69
- network => return Err ( EthError :: InvalidNetwork ( network. into ( ) ) ) ,
60
+ "local" => Self :: Local ( Local ) ,
61
+ "faucet" => Self :: Faucet ( Faucet ) ,
62
+ "fullnode" => Self :: Fullnode ( Fullnode ) ,
63
+ overlay => return Err ( OverlayError :: InvalidOverlaySelection ( overlay. into ( ) ) ) ,
70
64
} )
71
65
}
72
66
}
73
67
74
- impl Eth {
68
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Serialize , Deserialize ) ]
69
+ pub struct Local ;
70
+
71
+ impl Local {
75
72
/// Returns the overlay as a string as would be used in a nix command.
76
73
pub fn overlay_arg ( & self ) -> & str {
77
- match self {
78
- Self :: Local => "local" ,
79
- }
74
+ "local"
80
75
}
81
76
}
82
77
83
78
#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Serialize , Deserialize ) ]
84
- pub enum Celestia {
85
- /// The local network.
86
- Local ,
87
- }
88
-
89
- /// Errors thrown when parsing a [Celestia] network.
90
- #[ derive( Debug , thiserror:: Error ) ]
91
- pub enum CelestiaError {
92
- #[ error( "invalid celestia network: {0}" ) ]
93
- InvalidNetwork ( #[ source] Box < dyn std:: error:: Error + Send + Sync > ) ,
94
- }
79
+ pub struct Faucet ;
95
80
96
- impl FromStr for Celestia {
97
- type Err = CelestiaError ;
98
-
99
- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
100
- Ok ( match s {
101
- "local" => Self :: Local ,
102
- network => return Err ( CelestiaError :: InvalidNetwork ( network. into ( ) ) ) ,
103
- } )
81
+ impl Faucet {
82
+ /// Returns the overlay as a string as would be used in a nix command.
83
+ pub fn overlay_arg ( & self ) -> & str {
84
+ "faucet"
104
85
}
105
86
}
106
87
107
- impl Celestia {
88
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Serialize , Deserialize ) ]
89
+ pub struct Fullnode ;
90
+
91
+ impl Fullnode {
108
92
/// Returns the overlay as a string as would be used in a nix command.
109
93
pub fn overlay_arg ( & self ) -> & str {
110
- match self {
111
- Self :: Local => "local" ,
112
- }
94
+ "fullnode"
113
95
}
114
96
}
115
97
@@ -141,6 +123,10 @@ impl Overlays {
141
123
pub fn to_overlay_args ( & self ) -> String {
142
124
self . 0 . iter ( ) . map ( |o| o. overlay_arg ( ) ) . collect :: < Vec < _ > > ( ) . join ( "." )
143
125
}
126
+
127
+ pub fn as_vec ( & self ) -> Vec < Overlay > {
128
+ self . 0 . iter ( ) . cloned ( ) . collect ( )
129
+ }
144
130
}
145
131
146
132
impl From < BTreeSet < Overlay > > for Overlays {
@@ -152,8 +138,8 @@ impl From<BTreeSet<Overlay>> for Overlays {
152
138
impl Default for Overlays {
153
139
fn default ( ) -> Self {
154
140
Self :: new ( BTreeSet :: new ( ) )
155
- . with ( Overlay :: Eth ( Eth :: Local ) )
156
- . with ( Overlay :: Celestia ( Celestia :: Local ) )
141
+ . with ( Overlay :: Local ( Local ) )
142
+ . with ( Overlay :: Faucet ( Faucet ) )
157
143
}
158
144
}
159
145
@@ -199,7 +185,7 @@ pub struct Movement {
199
185
/// Whether to ping the faucet to ensure it is responding to pings.
200
186
ping_faucet : bool ,
201
187
/// The faucet state.
202
- faucet : State < Faucet > ,
188
+ faucet : State < FaucetApi > ,
203
189
}
204
190
205
191
/// Errors thrown when running [Movement].
@@ -376,8 +362,8 @@ impl Movement {
376
362
& self . rest_api
377
363
}
378
364
379
- /// Borrows the [Faucet ] state.
380
- pub fn faucet ( & self ) -> & State < Faucet > {
365
+ /// Borrows the [FaucetApi ] state.
366
+ pub fn faucet ( & self ) -> & State < FaucetApi > {
381
367
& self . faucet
382
368
}
383
369
0 commit comments