55
55
) -> Result < Self , SM > {
56
56
let ( snapshot, epoch_number, next_input_index_in_epoch) = match state_manager
57
57
. latest_snapshot ( )
58
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?
58
+ . map_err ( MachineRunnerError :: StateManagerError ) ?
59
59
{
60
60
Some ( r) => ( r. 0 , r. 1 , r. 2 + 1 ) ,
61
61
None => ( initial_machine. to_string ( ) , 0 , 0 ) ,
@@ -95,13 +95,14 @@ where
95
95
let latest_epoch = self
96
96
. state_manager
97
97
. epoch_count ( )
98
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?;
98
+ . map_err ( MachineRunnerError :: StateManagerError ) ?;
99
99
100
100
if self . epoch_number == latest_epoch {
101
101
// all inputs processed in current epoch
102
102
// epoch may still be open, come back later
103
103
break Ok ( ( ) ) ;
104
104
} else {
105
+ // epoch has advanced, fill in the rest of machine state hashes of self.epoch_number
105
106
assert ! ( self . epoch_number < latest_epoch) ;
106
107
107
108
// Add remaining strides
@@ -135,7 +136,7 @@ where
135
136
epoch_number : self . epoch_number ,
136
137
input_index_in_epoch : self . next_input_index_in_epoch ,
137
138
} )
138
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?;
139
+ . map_err ( MachineRunnerError :: StateManagerError ) ?;
139
140
140
141
match next {
141
142
Some ( input) => {
@@ -151,7 +152,7 @@ where
151
152
let state_hashes = self
152
153
. state_manager
153
154
. machine_state_hashes ( self . epoch_number )
154
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?;
155
+ . map_err ( MachineRunnerError :: StateManagerError ) ?;
155
156
156
157
let computation_hash = build_commitment_from_hashes ( & state_hashes) ?;
157
158
@@ -169,7 +170,7 @@ where
169
170
& siblings,
170
171
self . epoch_number ,
171
172
)
172
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?;
173
+ . map_err ( MachineRunnerError :: StateManagerError ) ?;
173
174
174
175
Ok ( ( ) )
175
176
}
@@ -224,7 +225,7 @@ where
224
225
self . state_hash_index_in_epoch ,
225
226
repetitions,
226
227
)
227
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?;
228
+ . map_err ( MachineRunnerError :: StateManagerError ) ?;
228
229
self . state_hash_index_in_epoch += 1 ;
229
230
230
231
Ok ( machine_state_hash)
@@ -254,7 +255,7 @@ where
254
255
self . epoch_number ,
255
256
self . next_input_index_in_epoch ,
256
257
)
257
- . map_err ( |e| MachineRunnerError :: StateManagerError ( e ) ) ?;
258
+ . map_err ( MachineRunnerError :: StateManagerError ) ?;
258
259
self . machine . store ( & snapshot_path) ?;
259
260
}
260
261
0 commit comments