@@ -172,7 +172,7 @@ public final class Runtime {
172172 try updateDisputes ( block: block, state: & newState)
173173
174174 // depends on Safrole and Disputes
175- let availableReports = try updateReports ( block: block, state: & newState)
175+ let availableReports = try await updateAssurances ( block: block, state: & newState)
176176
177177 // accumulate
178178 let ( accumulateRoot, accumulateStats, transfersStats) = try await newState. update (
@@ -183,6 +183,14 @@ public final class Runtime {
183183 entropy: newState. entropyPool. t0
184184 )
185185
186+ newState. recentHistory. updatePartial ( parentStateRoot: block. header. priorStateRoot)
187+
188+ try await updateGuarantees ( block: block, state: & newState)
189+
190+ // after reports as it need old recent history
191+ try updateRecentHistory ( block: block, state: & newState, accumulateRoot: accumulateRoot)
192+
193+ // update authorization pool and queue
186194 do {
187195 let authorizationResult = try newState. update (
188196 config: config,
@@ -206,9 +214,6 @@ public final class Runtime {
206214 transfersStats: transfersStats
207215 )
208216
209- // after reports as it need old recent history
210- try updateRecentHistory ( block: block, state: & newState, accumulateRoot: accumulateRoot)
211-
212217 try await newState. save ( )
213218 } catch let error as Error {
214219 throw error
@@ -230,7 +235,6 @@ public final class Runtime {
230235 ) } )
231236 newState. recentHistory. update (
232237 headerHash: block. hash,
233- parentStateRoot: block. header. priorStateRoot,
234238 accumulateRoot: accumulateRoot,
235239 lookup: lookup
236240 )
@@ -265,7 +269,7 @@ public final class Runtime {
265269 }
266270
267271 // returns available reports
268- public func updateReports ( block: BlockRef , state newState: inout State ) throws -> [ WorkReport ] {
272+ public func updateAssurances ( block: BlockRef , state newState: inout State ) async throws -> [ WorkReport ] {
269273 let (
270274 newReports: newReports, availableReports: availableReports
271275 ) = try newState. update (
@@ -276,13 +280,14 @@ public final class Runtime {
276280 )
277281
278282 newState. reports = newReports
279- let result = try newState. update (
283+ return availableReports
284+ }
285+
286+ public func updateGuarantees( block: BlockRef , state newState: inout State ) async throws {
287+ let result = try await newState. update (
280288 config: config, timeslot: newState. timeslot, extrinsic: block. extrinsic. reports
281289 )
282-
283290 newState. reports = result. newReports
284-
285- return availableReports
286291 }
287292
288293 public func updatePreimages( block: BlockRef , state newState: inout State ) async throws {
0 commit comments