@typeberry/lib 0.5.0-70ae055 → 0.5.0-7f94e30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +34 -26
- package/index.d.ts +12 -4
- package/index.js +34 -26
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -21326,12 +21326,15 @@ class Accumulate {
|
|
|
21326
21326
|
chainSpec;
|
|
21327
21327
|
blake2b;
|
|
21328
21328
|
state;
|
|
21329
|
-
|
|
21330
|
-
constructor(chainSpec, blake2b, state,
|
|
21329
|
+
options;
|
|
21330
|
+
constructor(chainSpec, blake2b, state, options) {
|
|
21331
21331
|
this.chainSpec = chainSpec;
|
|
21332
21332
|
this.blake2b = blake2b;
|
|
21333
21333
|
this.state = state;
|
|
21334
|
-
this.
|
|
21334
|
+
this.options = options;
|
|
21335
|
+
if (options.accumulateSequentially === true) {
|
|
21336
|
+
logger$5.warn `⚠️ Parallel accumulation is disabled. Running in sequential mode.`;
|
|
21337
|
+
}
|
|
21335
21338
|
}
|
|
21336
21339
|
/**
|
|
21337
21340
|
* Returns an index that determines how many WorkReports can be processed before exceeding a given gasLimit.
|
|
@@ -21383,7 +21386,7 @@ class Accumulate {
|
|
|
21383
21386
|
serviceExternalities: partialState,
|
|
21384
21387
|
fetchExternalities,
|
|
21385
21388
|
};
|
|
21386
|
-
const executor = await PvmExecutor.createAccumulateExecutor(serviceId, code, externalities, this.chainSpec, this.pvm);
|
|
21389
|
+
const executor = await PvmExecutor.createAccumulateExecutor(serviceId, code, externalities, this.chainSpec, this.options.pvm);
|
|
21387
21390
|
const invocationArgs = Encoder.encodeObject(ARGS_CODEC$1, {
|
|
21388
21391
|
slot,
|
|
21389
21392
|
serviceId,
|
|
@@ -21600,6 +21603,9 @@ class Accumulate {
|
|
|
21600
21603
|
];
|
|
21601
21604
|
return resultEntry;
|
|
21602
21605
|
});
|
|
21606
|
+
if (this.options.accumulateSequentially === true) {
|
|
21607
|
+
await promise;
|
|
21608
|
+
}
|
|
21603
21609
|
resultPromises[serviceIndex] = promise;
|
|
21604
21610
|
}
|
|
21605
21611
|
return Promise.all(resultPromises).then((results) => new Map(results));
|
|
@@ -24106,22 +24112,23 @@ class Statistics {
|
|
|
24106
24112
|
const newPreImagesSize = current[authorIndex].preImagesSize + preImagesSize;
|
|
24107
24113
|
current[authorIndex].preImagesSize = tryAsU32(newPreImagesSize);
|
|
24108
24114
|
/**
|
|
24109
|
-
*
|
|
24110
|
-
* Kappa' is not needed because we can use validator indexes directly from guarantees extrinsic.
|
|
24111
|
-
* I asked a question to ensure it is true but I didn't get any response yet:
|
|
24112
|
-
* https://github.com/w3f/jamtestvectors/pull/28#discussion_r190723700
|
|
24115
|
+
* Update guarantees
|
|
24113
24116
|
*
|
|
24114
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
24117
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/19ea0119f201?v=0.7.2
|
|
24115
24118
|
*/
|
|
24116
|
-
const
|
|
24117
|
-
for (const
|
|
24118
|
-
|
|
24119
|
-
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24123
|
-
|
|
24119
|
+
const validatorKeys = input.currentValidatorData.map((v) => v.ed25519);
|
|
24120
|
+
for (const reporter of input.reporters) {
|
|
24121
|
+
const index = validatorKeys.findIndex((x) => x.isEqualTo(reporter));
|
|
24122
|
+
if (index === -1) {
|
|
24123
|
+
/**
|
|
24124
|
+
* it should never happen because:
|
|
24125
|
+
* 1. the extrinsic is verified in reports transition
|
|
24126
|
+
* 2. we use current validators set from safrole
|
|
24127
|
+
*/
|
|
24128
|
+
continue;
|
|
24124
24129
|
}
|
|
24130
|
+
const newGuaranteesCount = current[index].guarantees + 1;
|
|
24131
|
+
current[index].guarantees = tryAsU32(newGuaranteesCount);
|
|
24125
24132
|
}
|
|
24126
24133
|
for (const { validatorIndex } of extrinsic.assurances) {
|
|
24127
24134
|
const newAssurancesCount = current[validatorIndex].assurances + 1;
|
|
@@ -24276,7 +24283,7 @@ class OnChain {
|
|
|
24276
24283
|
// chapter 13: https://graypaper.fluffylabs.dev/#/68eaa1f/18b60118b601?v=0.6.4
|
|
24277
24284
|
statistics;
|
|
24278
24285
|
isReadyForNextEpoch = Promise.resolve(false);
|
|
24279
|
-
constructor(chainSpec, state, hasher,
|
|
24286
|
+
constructor(chainSpec, state, hasher, options, headerChain) {
|
|
24280
24287
|
this.chainSpec = chainSpec;
|
|
24281
24288
|
this.state = state;
|
|
24282
24289
|
this.hasher = hasher;
|
|
@@ -24288,9 +24295,9 @@ class OnChain {
|
|
|
24288
24295
|
this.disputes = new Disputes(chainSpec, hasher.blake2b, state);
|
|
24289
24296
|
this.reports = new Reports(chainSpec, hasher.blake2b, state, headerChain);
|
|
24290
24297
|
this.assurances = new Assurances(chainSpec, state, hasher.blake2b);
|
|
24291
|
-
this.accumulate = new Accumulate(chainSpec, hasher.blake2b, state,
|
|
24298
|
+
this.accumulate = new Accumulate(chainSpec, hasher.blake2b, state, options);
|
|
24292
24299
|
this.accumulateOutput = new AccumulateOutput();
|
|
24293
|
-
this.deferredTransfers = new DeferredTransfers(chainSpec, hasher.blake2b, state, pvm);
|
|
24300
|
+
this.deferredTransfers = new DeferredTransfers(chainSpec, hasher.blake2b, state, options.pvm);
|
|
24294
24301
|
this.preimages = new Preimages(state, hasher.blake2b);
|
|
24295
24302
|
this.authorization = new Authorization(chainSpec, state);
|
|
24296
24303
|
}
|
|
@@ -24378,8 +24385,7 @@ class OnChain {
|
|
|
24378
24385
|
if (reportsResult.isError) {
|
|
24379
24386
|
return stfError(StfErrorKind.Reports, reportsResult);
|
|
24380
24387
|
}
|
|
24381
|
-
|
|
24382
|
-
const { reported: workPackages, reporters: _, stateUpdate: reportsUpdate, ...reportsRest } = reportsResult.ok;
|
|
24388
|
+
const { reported: workPackages, reporters, stateUpdate: reportsUpdate, ...reportsRest } = reportsResult.ok;
|
|
24383
24389
|
assertEmpty(reportsRest);
|
|
24384
24390
|
const { availabilityAssignment: reportsAvailAssignment, ...reportsUpdateRest } = reportsUpdate;
|
|
24385
24391
|
assertEmpty(reportsUpdateRest);
|
|
@@ -24393,7 +24399,7 @@ class OnChain {
|
|
|
24393
24399
|
}
|
|
24394
24400
|
const { preimages, ...preimagesRest } = preimagesResult.ok;
|
|
24395
24401
|
assertEmpty(preimagesRest);
|
|
24396
|
-
const timerAccumulate = measure(`import:accumulate (${PvmBackend[this.accumulate.pvm]})`);
|
|
24402
|
+
const timerAccumulate = measure(`import:accumulate (${PvmBackend[this.accumulate.options.pvm]})`);
|
|
24397
24403
|
// accumulate
|
|
24398
24404
|
const accumulateResult = await this.accumulate.transition({
|
|
24399
24405
|
slot: timeSlot,
|
|
@@ -24453,6 +24459,8 @@ class OnChain {
|
|
|
24453
24459
|
availableReports,
|
|
24454
24460
|
accumulationStatistics,
|
|
24455
24461
|
transferStatistics,
|
|
24462
|
+
reporters: reporters,
|
|
24463
|
+
currentValidatorData,
|
|
24456
24464
|
});
|
|
24457
24465
|
const { statistics, ...statisticsRest } = statisticsUpdate;
|
|
24458
24466
|
assertEmpty(statisticsRest);
|
|
@@ -25495,7 +25503,7 @@ class Importer {
|
|
|
25495
25503
|
throw new Error(`Unable to load best state from header hash: ${currentBestHeaderHash}.`);
|
|
25496
25504
|
}
|
|
25497
25505
|
this.verifier = new BlockVerifier(hasher, blocks);
|
|
25498
|
-
this.stf = new OnChain(spec, state, hasher, pvm, DbHeaderChain.new(blocks));
|
|
25506
|
+
this.stf = new OnChain(spec, state, hasher, { pvm, accumulateSequentially: false }, DbHeaderChain.new(blocks));
|
|
25499
25507
|
this.state = state;
|
|
25500
25508
|
this.currentHash = currentBestHeaderHash;
|
|
25501
25509
|
this.prepareForNextEpoch();
|
|
@@ -25641,11 +25649,11 @@ const blake2b = Blake2b.createHasher();
|
|
|
25641
25649
|
async function createImporter(config) {
|
|
25642
25650
|
const chainSpec = config.chainSpec;
|
|
25643
25651
|
const db = config.openDatabase({ readonly: false });
|
|
25644
|
-
const
|
|
25652
|
+
const pvm = config.workerParams.pvm;
|
|
25645
25653
|
const blocks = db.getBlocksDb();
|
|
25646
25654
|
const states = db.getStatesDb();
|
|
25647
25655
|
const hasher = new TransitionHasher(await keccakHasher, await blake2b);
|
|
25648
|
-
const importer = new Importer(chainSpec,
|
|
25656
|
+
const importer = new Importer(chainSpec, pvm, hasher, logger$1, blocks, states);
|
|
25649
25657
|
return {
|
|
25650
25658
|
importer,
|
|
25651
25659
|
db,
|
package/index.d.ts
CHANGED
|
@@ -9215,6 +9215,8 @@ type Input = {
|
|
|
9215
9215
|
* https://graypaper.fluffylabs.dev/#/cc517d7/18dd0018dd00?v=0.6.5
|
|
9216
9216
|
*/
|
|
9217
9217
|
transferStatistics: Map<ServiceId, CountAndGasUsed>;
|
|
9218
|
+
reporters: readonly Ed25519Key[];
|
|
9219
|
+
currentValidatorData: State["currentValidatorData"];
|
|
9218
9220
|
};
|
|
9219
9221
|
type CountAndGasUsed = {
|
|
9220
9222
|
count: U32;
|
|
@@ -9281,14 +9283,19 @@ type AccumulateResult = {
|
|
|
9281
9283
|
accumulationOutputLog: SortedArray<AccumulationOutput>;
|
|
9282
9284
|
};
|
|
9283
9285
|
|
|
9286
|
+
type AccumulateOptions = {
|
|
9287
|
+
pvm: PvmBackend;
|
|
9288
|
+
accumulateSequentially: boolean;
|
|
9289
|
+
};
|
|
9290
|
+
|
|
9284
9291
|
declare const ACCUMULATION_ERROR = "duplicate service created";
|
|
9285
9292
|
type ACCUMULATION_ERROR = typeof ACCUMULATION_ERROR;
|
|
9286
9293
|
declare class Accumulate {
|
|
9287
9294
|
readonly chainSpec: ChainSpec;
|
|
9288
9295
|
readonly blake2b: Blake2b;
|
|
9289
9296
|
readonly state: AccumulateState;
|
|
9290
|
-
readonly
|
|
9291
|
-
constructor(chainSpec: ChainSpec, blake2b: Blake2b, state: AccumulateState,
|
|
9297
|
+
readonly options: AccumulateOptions;
|
|
9298
|
+
constructor(chainSpec: ChainSpec, blake2b: Blake2b, state: AccumulateState, options: AccumulateOptions);
|
|
9292
9299
|
/**
|
|
9293
9300
|
* Returns an index that determines how many WorkReports can be processed before exceeding a given gasLimit.
|
|
9294
9301
|
*
|
|
@@ -9850,7 +9857,7 @@ declare class OnChain {
|
|
|
9850
9857
|
private readonly authorization;
|
|
9851
9858
|
private readonly statistics;
|
|
9852
9859
|
private isReadyForNextEpoch;
|
|
9853
|
-
constructor(chainSpec: ChainSpec, state: State & WithStateView, hasher: TransitionHasher,
|
|
9860
|
+
constructor(chainSpec: ChainSpec, state: State & WithStateView, hasher: TransitionHasher, options: AccumulateOptions, headerChain: HeaderChain);
|
|
9854
9861
|
/** Pre-populate things worth caching for the next epoch. */
|
|
9855
9862
|
prepareForNextEpoch(): Promise<void>;
|
|
9856
9863
|
private verifySeal;
|
|
@@ -10038,6 +10045,7 @@ type index$7_ACCUMULATION_ERROR = ACCUMULATION_ERROR;
|
|
|
10038
10045
|
type index$7_Accumulate = Accumulate;
|
|
10039
10046
|
declare const index$7_Accumulate: typeof Accumulate;
|
|
10040
10047
|
type index$7_AccumulateInput = AccumulateInput;
|
|
10048
|
+
type index$7_AccumulateOptions = AccumulateOptions;
|
|
10041
10049
|
type index$7_AccumulateResult = AccumulateResult;
|
|
10042
10050
|
type index$7_AccumulateRoot = AccumulateRoot;
|
|
10043
10051
|
type index$7_AccumulateState = AccumulateState;
|
|
@@ -10112,7 +10120,7 @@ declare const index$7_copyAndUpdateState: typeof copyAndUpdateState;
|
|
|
10112
10120
|
declare const index$7_stfError: typeof stfError;
|
|
10113
10121
|
declare namespace index$7 {
|
|
10114
10122
|
export { index$7_Accumulate as Accumulate, index$7_Assurances as Assurances, index$7_AssurancesError as AssurancesError, index$7_Authorization as Authorization, index$7_BlockVerifier as BlockVerifier, index$7_BlockVerifierError as BlockVerifierError, index$7_DbHeaderChain as DbHeaderChain, index$7_DeferredTransfers as DeferredTransfers, index$7_DeferredTransfersErrorCode as DeferredTransfersErrorCode, index$7_Disputes as Disputes, index$7_GAS_TO_INVOKE_WORK_REPORT as GAS_TO_INVOKE_WORK_REPORT, index$7_OnChain as OnChain, index$7_Preimages as Preimages, index$7_PreimagesErrorCode as PreimagesErrorCode, index$7_REPORT_TIMEOUT_GRACE_PERIOD as REPORT_TIMEOUT_GRACE_PERIOD, index$7_RecentHistory as RecentHistory, index$7_Reports as Reports, index$7_ReportsError as ReportsError, index$7_Statistics as Statistics, index$7_StfErrorKind as StfErrorKind, index$7_TransitionHasher as TransitionHasher, index$7_copyAndUpdateState as copyAndUpdateState, index$8 as externalities, index$7_stfError as stfError };
|
|
10115
|
-
export type { index$7_ACCUMULATION_ERROR as ACCUMULATION_ERROR, index$7_AccumulateInput as AccumulateInput, index$7_AccumulateResult as AccumulateResult, index$7_AccumulateRoot as AccumulateRoot, index$7_AccumulateState as AccumulateState, index$7_AccumulateStateUpdate as AccumulateStateUpdate, index$7_AssurancesInput as AssurancesInput, index$7_AssurancesState as AssurancesState, index$7_AssurancesStateUpdate as AssurancesStateUpdate, index$7_AuthorizationInput as AuthorizationInput, index$7_AuthorizationState as AuthorizationState, index$7_AuthorizationStateUpdate as AuthorizationStateUpdate, index$7_CountAndGasUsed as CountAndGasUsed, index$7_DeferredTransfersResult as DeferredTransfersResult, index$7_DeferredTransfersState as DeferredTransfersState, index$7_DisputesState as DisputesState, index$7_DisputesStateUpdate as DisputesStateUpdate, index$7_HeaderChain as HeaderChain, index$7_Input as Input, index$7_Ok as Ok, index$7_PreimagesInput as PreimagesInput, index$7_PreimagesState as PreimagesState, index$7_PreimagesStateUpdate as PreimagesStateUpdate, index$7_RecentHistoryInput as RecentHistoryInput, index$7_RecentHistoryPartialInput as RecentHistoryPartialInput, index$7_RecentHistoryState as RecentHistoryState, index$7_RecentHistoryStateUpdate as RecentHistoryStateUpdate, index$7_ReportsInput as ReportsInput, index$7_ReportsOutput as ReportsOutput, index$7_ReportsState as ReportsState, index$7_ReportsStateUpdate as ReportsStateUpdate, index$7_StatisticsState as StatisticsState, index$7_StatisticsStateUpdate as StatisticsStateUpdate, index$7_StfError as StfError };
|
|
10123
|
+
export type { index$7_ACCUMULATION_ERROR as ACCUMULATION_ERROR, index$7_AccumulateInput as AccumulateInput, index$7_AccumulateOptions as AccumulateOptions, index$7_AccumulateResult as AccumulateResult, index$7_AccumulateRoot as AccumulateRoot, index$7_AccumulateState as AccumulateState, index$7_AccumulateStateUpdate as AccumulateStateUpdate, index$7_AssurancesInput as AssurancesInput, index$7_AssurancesState as AssurancesState, index$7_AssurancesStateUpdate as AssurancesStateUpdate, index$7_AuthorizationInput as AuthorizationInput, index$7_AuthorizationState as AuthorizationState, index$7_AuthorizationStateUpdate as AuthorizationStateUpdate, index$7_CountAndGasUsed as CountAndGasUsed, index$7_DeferredTransfersResult as DeferredTransfersResult, index$7_DeferredTransfersState as DeferredTransfersState, index$7_DisputesState as DisputesState, index$7_DisputesStateUpdate as DisputesStateUpdate, index$7_HeaderChain as HeaderChain, index$7_Input as Input, index$7_Ok as Ok, index$7_PreimagesInput as PreimagesInput, index$7_PreimagesState as PreimagesState, index$7_PreimagesStateUpdate as PreimagesStateUpdate, index$7_RecentHistoryInput as RecentHistoryInput, index$7_RecentHistoryPartialInput as RecentHistoryPartialInput, index$7_RecentHistoryState as RecentHistoryState, index$7_RecentHistoryStateUpdate as RecentHistoryStateUpdate, index$7_ReportsInput as ReportsInput, index$7_ReportsOutput as ReportsOutput, index$7_ReportsState as ReportsState, index$7_ReportsStateUpdate as ReportsStateUpdate, index$7_StatisticsState as StatisticsState, index$7_StatisticsStateUpdate as StatisticsStateUpdate, index$7_StfError as StfError };
|
|
10116
10124
|
}
|
|
10117
10125
|
|
|
10118
10126
|
declare enum ImporterErrorKind {
|
package/index.js
CHANGED
|
@@ -21323,12 +21323,15 @@ class Accumulate {
|
|
|
21323
21323
|
chainSpec;
|
|
21324
21324
|
blake2b;
|
|
21325
21325
|
state;
|
|
21326
|
-
|
|
21327
|
-
constructor(chainSpec, blake2b, state,
|
|
21326
|
+
options;
|
|
21327
|
+
constructor(chainSpec, blake2b, state, options) {
|
|
21328
21328
|
this.chainSpec = chainSpec;
|
|
21329
21329
|
this.blake2b = blake2b;
|
|
21330
21330
|
this.state = state;
|
|
21331
|
-
this.
|
|
21331
|
+
this.options = options;
|
|
21332
|
+
if (options.accumulateSequentially === true) {
|
|
21333
|
+
logger$5.warn `⚠️ Parallel accumulation is disabled. Running in sequential mode.`;
|
|
21334
|
+
}
|
|
21332
21335
|
}
|
|
21333
21336
|
/**
|
|
21334
21337
|
* Returns an index that determines how many WorkReports can be processed before exceeding a given gasLimit.
|
|
@@ -21380,7 +21383,7 @@ class Accumulate {
|
|
|
21380
21383
|
serviceExternalities: partialState,
|
|
21381
21384
|
fetchExternalities,
|
|
21382
21385
|
};
|
|
21383
|
-
const executor = await PvmExecutor.createAccumulateExecutor(serviceId, code, externalities, this.chainSpec, this.pvm);
|
|
21386
|
+
const executor = await PvmExecutor.createAccumulateExecutor(serviceId, code, externalities, this.chainSpec, this.options.pvm);
|
|
21384
21387
|
const invocationArgs = Encoder.encodeObject(ARGS_CODEC$1, {
|
|
21385
21388
|
slot,
|
|
21386
21389
|
serviceId,
|
|
@@ -21597,6 +21600,9 @@ class Accumulate {
|
|
|
21597
21600
|
];
|
|
21598
21601
|
return resultEntry;
|
|
21599
21602
|
});
|
|
21603
|
+
if (this.options.accumulateSequentially === true) {
|
|
21604
|
+
await promise;
|
|
21605
|
+
}
|
|
21600
21606
|
resultPromises[serviceIndex] = promise;
|
|
21601
21607
|
}
|
|
21602
21608
|
return Promise.all(resultPromises).then((results) => new Map(results));
|
|
@@ -24103,22 +24109,23 @@ class Statistics {
|
|
|
24103
24109
|
const newPreImagesSize = current[authorIndex].preImagesSize + preImagesSize;
|
|
24104
24110
|
current[authorIndex].preImagesSize = tryAsU32(newPreImagesSize);
|
|
24105
24111
|
/**
|
|
24106
|
-
*
|
|
24107
|
-
* Kappa' is not needed because we can use validator indexes directly from guarantees extrinsic.
|
|
24108
|
-
* I asked a question to ensure it is true but I didn't get any response yet:
|
|
24109
|
-
* https://github.com/w3f/jamtestvectors/pull/28#discussion_r190723700
|
|
24112
|
+
* Update guarantees
|
|
24110
24113
|
*
|
|
24111
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
24114
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/19ea0119f201?v=0.7.2
|
|
24112
24115
|
*/
|
|
24113
|
-
const
|
|
24114
|
-
for (const
|
|
24115
|
-
|
|
24116
|
-
|
|
24117
|
-
|
|
24118
|
-
|
|
24119
|
-
|
|
24120
|
-
|
|
24116
|
+
const validatorKeys = input.currentValidatorData.map((v) => v.ed25519);
|
|
24117
|
+
for (const reporter of input.reporters) {
|
|
24118
|
+
const index = validatorKeys.findIndex((x) => x.isEqualTo(reporter));
|
|
24119
|
+
if (index === -1) {
|
|
24120
|
+
/**
|
|
24121
|
+
* it should never happen because:
|
|
24122
|
+
* 1. the extrinsic is verified in reports transition
|
|
24123
|
+
* 2. we use current validators set from safrole
|
|
24124
|
+
*/
|
|
24125
|
+
continue;
|
|
24121
24126
|
}
|
|
24127
|
+
const newGuaranteesCount = current[index].guarantees + 1;
|
|
24128
|
+
current[index].guarantees = tryAsU32(newGuaranteesCount);
|
|
24122
24129
|
}
|
|
24123
24130
|
for (const { validatorIndex } of extrinsic.assurances) {
|
|
24124
24131
|
const newAssurancesCount = current[validatorIndex].assurances + 1;
|
|
@@ -24273,7 +24280,7 @@ class OnChain {
|
|
|
24273
24280
|
// chapter 13: https://graypaper.fluffylabs.dev/#/68eaa1f/18b60118b601?v=0.6.4
|
|
24274
24281
|
statistics;
|
|
24275
24282
|
isReadyForNextEpoch = Promise.resolve(false);
|
|
24276
|
-
constructor(chainSpec, state, hasher,
|
|
24283
|
+
constructor(chainSpec, state, hasher, options, headerChain) {
|
|
24277
24284
|
this.chainSpec = chainSpec;
|
|
24278
24285
|
this.state = state;
|
|
24279
24286
|
this.hasher = hasher;
|
|
@@ -24285,9 +24292,9 @@ class OnChain {
|
|
|
24285
24292
|
this.disputes = new Disputes(chainSpec, hasher.blake2b, state);
|
|
24286
24293
|
this.reports = new Reports(chainSpec, hasher.blake2b, state, headerChain);
|
|
24287
24294
|
this.assurances = new Assurances(chainSpec, state, hasher.blake2b);
|
|
24288
|
-
this.accumulate = new Accumulate(chainSpec, hasher.blake2b, state,
|
|
24295
|
+
this.accumulate = new Accumulate(chainSpec, hasher.blake2b, state, options);
|
|
24289
24296
|
this.accumulateOutput = new AccumulateOutput();
|
|
24290
|
-
this.deferredTransfers = new DeferredTransfers(chainSpec, hasher.blake2b, state, pvm);
|
|
24297
|
+
this.deferredTransfers = new DeferredTransfers(chainSpec, hasher.blake2b, state, options.pvm);
|
|
24291
24298
|
this.preimages = new Preimages(state, hasher.blake2b);
|
|
24292
24299
|
this.authorization = new Authorization(chainSpec, state);
|
|
24293
24300
|
}
|
|
@@ -24375,8 +24382,7 @@ class OnChain {
|
|
|
24375
24382
|
if (reportsResult.isError) {
|
|
24376
24383
|
return stfError(StfErrorKind.Reports, reportsResult);
|
|
24377
24384
|
}
|
|
24378
|
-
|
|
24379
|
-
const { reported: workPackages, reporters: _, stateUpdate: reportsUpdate, ...reportsRest } = reportsResult.ok;
|
|
24385
|
+
const { reported: workPackages, reporters, stateUpdate: reportsUpdate, ...reportsRest } = reportsResult.ok;
|
|
24380
24386
|
assertEmpty(reportsRest);
|
|
24381
24387
|
const { availabilityAssignment: reportsAvailAssignment, ...reportsUpdateRest } = reportsUpdate;
|
|
24382
24388
|
assertEmpty(reportsUpdateRest);
|
|
@@ -24390,7 +24396,7 @@ class OnChain {
|
|
|
24390
24396
|
}
|
|
24391
24397
|
const { preimages, ...preimagesRest } = preimagesResult.ok;
|
|
24392
24398
|
assertEmpty(preimagesRest);
|
|
24393
|
-
const timerAccumulate = measure(`import:accumulate (${PvmBackend[this.accumulate.pvm]})`);
|
|
24399
|
+
const timerAccumulate = measure(`import:accumulate (${PvmBackend[this.accumulate.options.pvm]})`);
|
|
24394
24400
|
// accumulate
|
|
24395
24401
|
const accumulateResult = await this.accumulate.transition({
|
|
24396
24402
|
slot: timeSlot,
|
|
@@ -24450,6 +24456,8 @@ class OnChain {
|
|
|
24450
24456
|
availableReports,
|
|
24451
24457
|
accumulationStatistics,
|
|
24452
24458
|
transferStatistics,
|
|
24459
|
+
reporters: reporters,
|
|
24460
|
+
currentValidatorData,
|
|
24453
24461
|
});
|
|
24454
24462
|
const { statistics, ...statisticsRest } = statisticsUpdate;
|
|
24455
24463
|
assertEmpty(statisticsRest);
|
|
@@ -25492,7 +25500,7 @@ class Importer {
|
|
|
25492
25500
|
throw new Error(`Unable to load best state from header hash: ${currentBestHeaderHash}.`);
|
|
25493
25501
|
}
|
|
25494
25502
|
this.verifier = new BlockVerifier(hasher, blocks);
|
|
25495
|
-
this.stf = new OnChain(spec, state, hasher, pvm, DbHeaderChain.new(blocks));
|
|
25503
|
+
this.stf = new OnChain(spec, state, hasher, { pvm, accumulateSequentially: false }, DbHeaderChain.new(blocks));
|
|
25496
25504
|
this.state = state;
|
|
25497
25505
|
this.currentHash = currentBestHeaderHash;
|
|
25498
25506
|
this.prepareForNextEpoch();
|
|
@@ -25638,11 +25646,11 @@ const blake2b = Blake2b.createHasher();
|
|
|
25638
25646
|
async function createImporter(config) {
|
|
25639
25647
|
const chainSpec = config.chainSpec;
|
|
25640
25648
|
const db = config.openDatabase({ readonly: false });
|
|
25641
|
-
const
|
|
25649
|
+
const pvm = config.workerParams.pvm;
|
|
25642
25650
|
const blocks = db.getBlocksDb();
|
|
25643
25651
|
const states = db.getStatesDb();
|
|
25644
25652
|
const hasher = new TransitionHasher(await keccakHasher, await blake2b);
|
|
25645
|
-
const importer = new Importer(chainSpec,
|
|
25653
|
+
const importer = new Importer(chainSpec, pvm, hasher, logger$1, blocks, states);
|
|
25646
25654
|
return {
|
|
25647
25655
|
importer,
|
|
25648
25656
|
db,
|