@typeberry/lib 0.5.0-d7595f1 → 0.5.1-f5e8f92

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.
Files changed (4) hide show
  1. package/index.cjs +191 -176
  2. package/index.d.ts +42 -21
  3. package/index.js +191 -176
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3603,7 +3603,7 @@ declare namespace workReport {
3603
3603
  * Since GP defines that value explicitly as "two or three",
3604
3604
  * we do that as well.
3605
3605
  *
3606
- * https://graypaper.fluffylabs.dev/#/579bd12/14b90214bb02
3606
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/152b01152d01?v=0.7.2
3607
3607
  */
3608
3608
  type REQUIRED_CREDENTIALS = 2 | 3;
3609
3609
  declare const REQUIRED_CREDENTIALS_RANGE: number[];
@@ -3623,7 +3623,7 @@ declare class Credential extends WithDebug {
3623
3623
  /**
3624
3624
  * Tuple of work-report, a credential and it's corresponding timeslot.
3625
3625
  *
3626
- * https://graypaper.fluffylabs.dev/#/579bd12/147102149102
3626
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/15df00150301?v=0.7.2
3627
3627
  */
3628
3628
  declare class ReportGuarantee extends WithDebug {
3629
3629
  /** The work-report being guaranteed. */
@@ -3635,7 +3635,7 @@ declare class ReportGuarantee extends WithDebug {
3635
3635
  * validator index and a signature.
3636
3636
  * Credentials must be ordered by their validator index.
3637
3637
  *
3638
- * https://graypaper.fluffylabs.dev/#/579bd12/14b90214bb02
3638
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/152b01152d01?v=0.7.2
3639
3639
  */
3640
3640
  readonly credentials: KnownSizeArray<Credential, `${REQUIRED_CREDENTIALS}`>;
3641
3641
  static Codec: Descriptor<ReportGuarantee, ViewOf<ReportGuarantee, {
@@ -3694,7 +3694,7 @@ declare const GuaranteesExtrinsicBounds = "[0..CoresCount)";
3694
3694
  * Each core index (within work-report) must be unique and guarantees
3695
3695
  * must be in ascending order of this.
3696
3696
  *
3697
- * https://graypaper.fluffylabs.dev/#/579bd12/146402146702
3697
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/15d10015d400?v=0.7.2
3698
3698
  */
3699
3699
  type GuaranteesExtrinsic = KnownSizeArray<ReportGuarantee, typeof GuaranteesExtrinsicBounds>;
3700
3700
  declare const guaranteesExtrinsicCodec: Descriptor<readonly ReportGuarantee[] & WithOpaque<"[0..CoresCount)">, SequenceView<ReportGuarantee, ViewOf<ReportGuarantee, {
@@ -7270,12 +7270,12 @@ declare class DirectWorkerConfig<TParams = void, TBlocks = BlocksDb, TStates = S
7270
7270
  readonly workerParams: TParams;
7271
7271
  private readonly blocksDb;
7272
7272
  private readonly statesDb;
7273
- static new<T, B, S>({ nodeName, chainSpec, blocksDb, statesDb, params, }: {
7273
+ static new<T, B, S>({ nodeName, chainSpec, blocksDb, statesDb, workerParams: params, }: {
7274
7274
  nodeName: string;
7275
7275
  chainSpec: ChainSpec;
7276
7276
  blocksDb: B;
7277
7277
  statesDb: S;
7278
- params: T;
7278
+ workerParams: T;
7279
7279
  }): DirectWorkerConfig<T, B, S>;
7280
7280
  private constructor();
7281
7281
  openDatabase(_options?: {
@@ -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 pvm: PvmBackend;
9291
- constructor(chainSpec: ChainSpec, blake2b: Blake2b, state: AccumulateState, pvm: PvmBackend);
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
  *
@@ -9727,40 +9734,53 @@ interface HeaderChain {
9727
9734
  * by validators).
9728
9735
  *
9729
9736
  * After enough assurances the work-report is considered available,
9730
- * and the work outputs transform the state of their associated
9737
+ * and the work-digests transform the state of their associated
9731
9738
  * service by virtue of accumulation, covered in section 12.
9732
9739
  * The report may also be timed-out, implying it may be replaced
9733
9740
  * by another report without accumulation.
9734
9741
  *
9735
- * https://graypaper.fluffylabs.dev/#/5f542d7/133d00134200
9742
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/138801138d01?v=0.7.2
9736
9743
  */
9737
9744
  type ReportsInput = {
9738
9745
  /**
9739
9746
  * A work-package, is transformed by validators acting as
9740
9747
  * guarantors into its corresponding work-report, which
9741
- * similarly comprises several work outputs and then
9748
+ * similarly comprises several work-digests and then
9742
9749
  * presented on-chain within the guarantees extrinsic.
9743
9750
  *
9744
- * https://graypaper.fluffylabs.dev/#/5f542d7/133500133900
9751
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/138001138401?v=0.7.2
9745
9752
  */
9746
9753
  guarantees: GuaranteesExtrinsicView;
9747
9754
  /** Current time slot, excerpted from block header. */
9748
9755
  slot: TimeSlot;
9749
9756
  /** `eta_prime`: New entropy, after potential epoch transition. */
9750
9757
  newEntropy: SafroleStateUpdate["entropy"];
9751
- /** Partial update of recent blocks. (β†, https://graypaper.fluffylabs.dev/#/9a08063/0fd8010fdb01?v=0.6.6) */
9758
+ /**
9759
+ * β† - Partial update of recent blocks.
9760
+ *
9761
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/0f56020f6b02?v=0.7.2
9762
+ */
9752
9763
  recentBlocksPartialUpdate: RecentHistoryStateUpdate["recentBlocks"];
9753
9764
  /**
9754
9765
  * ρ‡ - Availability assignment resulting from assurances transition
9755
- * https://graypaper.fluffylabs.dev/#/1c979cb/141302144402?v=0.7.1
9766
+ *
9767
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/141302144402?v=0.7.2
9756
9768
  */
9757
9769
  assurancesAvailAssignment: AssurancesStateUpdate["availabilityAssignment"];
9758
9770
  /**
9759
9771
  * ψ′O - Ed25519 keys of validators that were proven to judge incorrectly.
9760
9772
  *
9761
- * https://graypaper.fluffylabs.dev/#/1c979cb/134201134201?v=0.7.1
9773
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/134201134201?v=0.7.2
9762
9774
  */
9763
9775
  offenders: HashSet<Ed25519Key>;
9776
+ /**
9777
+ * `κ' kappa prime` - Current validator data.
9778
+ */
9779
+ currentValidatorData: SafroleStateUpdate["currentValidatorData"];
9780
+ /**
9781
+ * `λ' lambda prime` - Previous validator data.
9782
+ */
9783
+ previousValidatorData: SafroleStateUpdate["previousValidatorData"];
9764
9784
  };
9765
9785
 
9766
9786
  type GuarantorAssignment = {
@@ -9768,7 +9788,7 @@ type GuarantorAssignment = {
9768
9788
  ed25519: Ed25519Key;
9769
9789
  };
9770
9790
 
9771
- type ReportsState = Pick<State, "availabilityAssignment" | "currentValidatorData" | "previousValidatorData" | "entropy" | "getService" | "recentBlocks" | "accumulationQueue" | "recentlyAccumulated"> & WithStateView<Pick<StateView, "authPoolsView">>;
9791
+ type ReportsState = Pick<State, "availabilityAssignment" | "entropy" | "getService" | "recentBlocks" | "accumulationQueue" | "recentlyAccumulated"> & WithStateView<Pick<StateView, "authPoolsView">>;
9772
9792
  /** Reports state update. */
9773
9793
  type ReportsStateUpdate = Pick<ReportsState, "availabilityAssignment">;
9774
9794
  type ReportsOutput = {
@@ -9780,7 +9800,7 @@ type ReportsOutput = {
9780
9800
  * This dictionary has the same number of items as in the input guarantees extrinsic.
9781
9801
  */
9782
9802
  reported: HashDictionary<WorkPackageHash, WorkPackageInfo>;
9783
- /** A set `R` of work package reporters. */
9803
+ /** A set `M` of work package reporters. */
9784
9804
  reporters: KnownSizeArray<Ed25519Key, "Guarantees * Credentials (at most `cores*3`)">;
9785
9805
  };
9786
9806
  declare class Reports {
@@ -9799,9 +9819,9 @@ declare class Reports {
9799
9819
  * Get the guarantor assignment (both core and validator data)
9800
9820
  * depending on the rotation.
9801
9821
  *
9802
- * https://graypaper.fluffylabs.dev/#/5f542d7/158200158200
9822
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/15df0115df01?v=0.7.2
9803
9823
  */
9804
- getGuarantorAssignment(headerTimeSlot: TimeSlot, guaranteeTimeSlot: TimeSlot, newEntropy: SafroleStateUpdate["entropy"]): Result<PerValidator<GuarantorAssignment>, ReportsError>;
9824
+ getGuarantorAssignment(headerTimeSlot: TimeSlot, guaranteeTimeSlot: TimeSlot, newEntropy: SafroleStateUpdate["entropy"], currentValidatorData: SafroleStateUpdate["currentValidatorData"], previousValidatorData: SafroleStateUpdate["previousValidatorData"]): Result<PerValidator<GuarantorAssignment>, ReportsError>;
9805
9825
  }
9806
9826
 
9807
9827
  declare class DbHeaderChain implements HeaderChain {
@@ -9850,7 +9870,7 @@ declare class OnChain {
9850
9870
  private readonly authorization;
9851
9871
  private readonly statistics;
9852
9872
  private isReadyForNextEpoch;
9853
- constructor(chainSpec: ChainSpec, state: State & WithStateView, hasher: TransitionHasher, pvm: PvmBackend, headerChain: HeaderChain);
9873
+ constructor(chainSpec: ChainSpec, state: State & WithStateView, hasher: TransitionHasher, options: AccumulateOptions, headerChain: HeaderChain);
9854
9874
  /** Pre-populate things worth caching for the next epoch. */
9855
9875
  prepareForNextEpoch(): Promise<void>;
9856
9876
  private verifySeal;
@@ -10038,6 +10058,7 @@ type index$7_ACCUMULATION_ERROR = ACCUMULATION_ERROR;
10038
10058
  type index$7_Accumulate = Accumulate;
10039
10059
  declare const index$7_Accumulate: typeof Accumulate;
10040
10060
  type index$7_AccumulateInput = AccumulateInput;
10061
+ type index$7_AccumulateOptions = AccumulateOptions;
10041
10062
  type index$7_AccumulateResult = AccumulateResult;
10042
10063
  type index$7_AccumulateRoot = AccumulateRoot;
10043
10064
  type index$7_AccumulateState = AccumulateState;
@@ -10112,7 +10133,7 @@ declare const index$7_copyAndUpdateState: typeof copyAndUpdateState;
10112
10133
  declare const index$7_stfError: typeof stfError;
10113
10134
  declare namespace index$7 {
10114
10135
  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 };
10136
+ 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
10137
  }
10117
10138
 
10118
10139
  declare enum ImporterErrorKind {