@@ -212,8 +212,8 @@ extension Accumulation {
212212 var newAuthorizationQueue = authorizationQueue
213213 var overallAccountChanges = AccountChanges ( )
214214 var tempPrivilegedServices : PrivilegedServices ?
215- var newDelegator = privilegedServices . delegator
216- var newAssigners = privilegedServices . assigners
215+ var newDelegator : ServiceIndex ?
216+ var newAssigners : ConfigFixedSizeArray < ServiceIndex , ProtocolConfig . TotalNumberOfCores > ?
217217
218218 for report in workReports {
219219 for digest in report. digests {
@@ -260,20 +260,19 @@ extension Accumulation {
260260
261261 servicePreimageSet. formUnion ( singleOutput. provide)
262262
263- switch service {
264263 // m'
265- case privilegedServices. manager:
264+ if service == privilegedServices. manager {
266265 tempPrivilegedServices = PrivilegedServices (
267266 manager: singleOutput. state. manager,
268267 assigners: singleOutput. state. assigners,
269268 delegator: singleOutput. state. delegator,
270269 alwaysAcc: singleOutput. state. alwaysAcc
271270 )
271+ }
272+
272273 // i'
273- case privilegedServices. delegator:
274+ if service == privilegedServices. delegator {
274275 newValidatorQueue = singleOutput. state. validatorQueue
275- default :
276- break
277276 }
278277
279278 // v'
@@ -288,7 +287,10 @@ extension Accumulation {
288287
289288 // a'
290289 if let index = tempPrivilegedServices? . assigners. firstIndex ( of: service) {
291- newAssigners [ index] = singleOutput. state. assigners [ index]
290+ if newAssigners == nil {
291+ newAssigners = tempPrivilegedServices? . assigners
292+ }
293+ newAssigners![ index] = singleOutput. state. assigners [ index]
292294 }
293295
294296 accountsRef = singleOutput. state. accounts
@@ -308,8 +310,8 @@ extension Accumulation {
308310 validatorQueue: newValidatorQueue ?? validatorQueue,
309311 authorizationQueue: newAuthorizationQueue,
310312 manager: tempPrivilegedServices? . manager ?? privilegedServices. manager,
311- assigners: newAssigners,
312- delegator: newDelegator,
313+ assigners: newAssigners ?? tempPrivilegedServices ? . assigners ?? privilegedServices . assigners ,
314+ delegator: newDelegator ?? tempPrivilegedServices ? . delegator ?? privilegedServices . delegator ,
313315 alwaysAcc: tempPrivilegedServices? . alwaysAcc ?? privilegedServices. alwaysAcc,
314316 entropy: state. entropy
315317 ) ,
@@ -533,15 +535,6 @@ extension Accumulation {
533535 timeslot: timeslot
534536 )
535537
536- authorizationQueue = accumulateOutput. state. authorizationQueue
537- validatorQueue = accumulateOutput. state. validatorQueue
538- privilegedServices = PrivilegedServices (
539- manager: accumulateOutput. state. manager,
540- assigners: accumulateOutput. state. assigners,
541- delegator: accumulateOutput. state. delegator,
542- alwaysAcc: accumulateOutput. state. alwaysAcc
543- )
544-
545538 // transfers execution + transfers statistics
546539 var transferGroups = [ ServiceIndex: [ DeferredTransfers] ] ( )
547540 var transfersStats = TransfersStats ( )
@@ -552,7 +545,7 @@ extension Accumulation {
552545 let gasUsed = try await onTransfer (
553546 config: config,
554547 serviceIndex: service,
555- serviceAccounts: accountsMutRef ,
548+ serviceAccounts: accumulateOutput . state . accounts ,
556549 timeslot: timeslot,
557550 entropy: entropy,
558551 transfers: transfers
@@ -564,6 +557,16 @@ extension Accumulation {
564557
565558 self = accumulateOutput. state. accounts. value as! Self
566559
560+ // update non-accounts state after accounts updated
561+ authorizationQueue = accumulateOutput. state. authorizationQueue
562+ validatorQueue = accumulateOutput. state. validatorQueue
563+ privilegedServices = PrivilegedServices (
564+ manager: accumulateOutput. state. manager,
565+ assigners: accumulateOutput. state. assigners,
566+ delegator: accumulateOutput. state. delegator,
567+ alwaysAcc: accumulateOutput. state. alwaysAcc
568+ )
569+
567570 // update accumulation history
568571 let accumulated = accumulatableReports [ 0 ..< accumulateOutput. numAccumulated]
569572 let newHistoryItem = Set ( accumulated. map ( \. packageSpecification. workPackageHash) )
0 commit comments