@typeberry/lib 0.5.0-6a64d40 → 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.
Files changed (4) hide show
  1. package/index.cjs +564 -1217
  2. package/index.d.ts +42 -34
  3. package/index.js +564 -1217
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2013,12 +2013,26 @@ declare namespace bandersnatch_d_exports {
2013
2013
  /* tslint:disable */
2014
2014
  /* eslint-disable */
2015
2015
  /**
2016
- * Seal verification as defined in:
2017
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
2018
- * or
2019
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
2016
+ * Compute VRF output hash from a secret seed and input data.
2017
+ *
2018
+ * This function derives a deterministic VRF output hash without generating a proof.
2019
+ * Unlike `generate_seal`, this produces only the output hash, not a verifiable signature.
2020
+ *
2021
+ * # Arguments
2022
+ * * `secret_seed` - Seed used to derive the secret key
2023
+ * * `input` - VRF input data to be hashed
2024
+ *
2025
+ * # Returns
2026
+ * A byte vector with the following format:
2027
+ * - On success (33 bytes):
2028
+ * - Byte 0: Status code `0` (RESULT_OK)
2029
+ * - Bytes 1-32: VRF output hash (32 bytes)
2030
+ * - On error (1 byte):
2031
+ * - Byte 0: Status code `1` (RESULT_ERR)
2032
+ *
2033
+ * Returns an error if the input cannot be converted to a valid VRF input point.
2020
2034
  */
2021
- declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
2035
+ declare function vrf_output_hash(secret_seed: Uint8Array, input: Uint8Array): Uint8Array;
2022
2036
  /**
2023
2037
  * Verify multiple tickets at once as defined in:
2024
2038
  * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
@@ -2026,6 +2040,17 @@ declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payl
2026
2040
  * NOTE: the aux_data of VRF function is empty!
2027
2041
  */
2028
2042
  declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
2043
+ /**
2044
+ * Generate ring commitment given concatenation of ring keys.
2045
+ */
2046
+ declare function ring_commitment(keys: Uint8Array): Uint8Array;
2047
+ /**
2048
+ * Seal verification as defined in:
2049
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
2050
+ * or
2051
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
2052
+ */
2053
+ declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
2029
2054
  /**
2030
2055
  * Generate seal that is verifiable using `verify_seal` function.
2031
2056
  *
@@ -2053,31 +2078,6 @@ declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_d
2053
2078
  * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
2054
2079
  */
2055
2080
  declare function derive_public_key(seed: Uint8Array): Uint8Array;
2056
- /**
2057
- * Compute VRF output hash from a secret seed and input data.
2058
- *
2059
- * This function derives a deterministic VRF output hash without generating a proof.
2060
- * Unlike `generate_seal`, this produces only the output hash, not a verifiable signature.
2061
- *
2062
- * # Arguments
2063
- * * `secret_seed` - Seed used to derive the secret key
2064
- * * `input` - VRF input data to be hashed
2065
- *
2066
- * # Returns
2067
- * A byte vector with the following format:
2068
- * - On success (33 bytes):
2069
- * - Byte 0: Status code `0` (RESULT_OK)
2070
- * - Bytes 1-32: VRF output hash (32 bytes)
2071
- * - On error (1 byte):
2072
- * - Byte 0: Status code `1` (RESULT_ERR)
2073
- *
2074
- * Returns an error if the input cannot be converted to a valid VRF input point.
2075
- */
2076
- declare function vrf_output_hash(secret_seed: Uint8Array, input: Uint8Array): Uint8Array;
2077
- /**
2078
- * Generate ring commitment given concatenation of ring keys.
2079
- */
2080
- declare function ring_commitment(keys: Uint8Array): Uint8Array;
2081
2081
  type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
2082
2082
  interface InitOutput$2 {
2083
2083
  readonly memory: WebAssembly.Memory;
@@ -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
  *
@@ -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, pvm: PvmBackend, headerChain: HeaderChain);
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 {