@@ -51,60 +51,48 @@ impl Spec {
51
51
}
52
52
53
53
pub async fn run ( self ) -> StdResult < ( ) > {
54
+ let mut join_set = JoinSet :: new ( ) ;
54
55
let spec = Arc :: new ( self ) ;
55
56
let infrastructure_guard = spec. infrastructure . read ( ) . await ;
56
57
let infrastructure = infrastructure_guard
57
58
. as_ref ( )
58
59
. ok_or ( anyhow ! ( "No infrastructure found" ) ) ?;
60
+ let aggregators = infrastructure_guard
61
+ . as_ref ( )
62
+ . ok_or ( anyhow ! ( "No infrastructure found" ) ) ?
63
+ . aggregators ( ) ;
59
64
60
65
// Transfer some funds on the devnet to have some Cardano transactions to sign.
61
66
// This step needs to be executed early in the process so that the transactions are available
62
67
// for signing in the penultimate immutable chunk before the end of the test.
63
68
// As we get closer to the tip of the chain when signing, we'll be able to relax this constraint.
64
69
assertions:: transfer_funds ( infrastructure. devnet ( ) ) . await ?;
65
70
66
- let mut join_set = JoinSet :: new ( ) ;
67
- let spec_clone = spec. clone ( ) ;
68
- join_set. spawn ( async move { spec_clone. start_master ( ) . await } ) ;
69
- for index in 0 ..infrastructure. slave_aggregators ( ) . len ( ) {
71
+ for index in 0 ..aggregators. len ( ) {
70
72
let spec_clone = spec. clone ( ) ;
71
- join_set. spawn ( async move { spec_clone. start_slave ( index) . await } ) ;
73
+ join_set. spawn ( async move {
74
+ let infrastructure_guard = spec_clone. infrastructure . read ( ) . await ;
75
+ let infrastructure = infrastructure_guard
76
+ . as_ref ( )
77
+ . ok_or ( anyhow ! ( "No infrastructure found" ) ) ?;
78
+
79
+ spec_clone
80
+ . start_aggregator (
81
+ infrastructure. aggregator ( index) ,
82
+ infrastructure. chain_observer ( index) ,
83
+ infrastructure,
84
+ )
85
+ . await
86
+ } ) ;
72
87
}
88
+
73
89
while let Some ( res) = join_set. join_next ( ) . await {
74
90
res??;
75
91
}
76
92
77
93
Ok ( ( ) )
78
94
}
79
95
80
- pub async fn start_master ( & self ) -> StdResult < ( ) > {
81
- let infrastructure_guard = self . infrastructure . read ( ) . await ;
82
- let infrastructure = infrastructure_guard
83
- . as_ref ( )
84
- . ok_or ( anyhow ! ( "No infrastructure found" ) ) ?;
85
-
86
- self . start_aggregator (
87
- infrastructure. master_aggregator ( ) ,
88
- infrastructure. master_chain_observer ( ) ,
89
- infrastructure,
90
- )
91
- . await
92
- }
93
-
94
- pub async fn start_slave ( & self , slave_index : usize ) -> StdResult < ( ) > {
95
- let infrastructure_guard = self . infrastructure . read ( ) . await ;
96
- let infrastructure = infrastructure_guard
97
- . as_ref ( )
98
- . ok_or ( anyhow ! ( "No infrastructure found" ) ) ?;
99
-
100
- self . start_aggregator (
101
- infrastructure. slave_aggregator ( slave_index) ,
102
- infrastructure. slave_chain_observer ( slave_index) ,
103
- infrastructure,
104
- )
105
- . await
106
- }
107
-
108
96
pub async fn start_aggregator (
109
97
& self ,
110
98
aggregator : & Aggregator ,
@@ -138,7 +126,7 @@ impl Spec {
138
126
)
139
127
. await ?;
140
128
141
- if aggregator. index ( ) == 0 {
129
+ if aggregator. is_first ( ) {
142
130
// Delegate some stakes to pools
143
131
let delegation_round = 1 ;
144
132
assertions:: delegate_stakes_to_pools ( infrastructure. devnet ( ) , delegation_round) . await ?;
0 commit comments