@typeberry/lib 0.2.0-79dc2d4 → 0.2.0-9cdd1b8
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 +313 -263
- package/index.d.ts +72 -38
- package/index.js +309 -259
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -296,8 +296,7 @@ type Uninstantiable = void & { __brand: "uninstantiable" };
|
|
|
296
296
|
|
|
297
297
|
type StringLiteral<Type> = Type extends string ? (string extends Type ? never : Type) : never;
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
declare const __OPAQUE_TYPE__ = "__INTERNAL_OPAQUE_ID__";
|
|
299
|
+
declare const __OPAQUE_TYPE__: unique symbol;
|
|
301
300
|
|
|
302
301
|
type WithOpaque<Token extends string> = {
|
|
303
302
|
readonly [__OPAQUE_TYPE__]: Token;
|
|
@@ -1277,15 +1276,12 @@ declare namespace index$s {
|
|
|
1277
1276
|
};
|
|
1278
1277
|
}
|
|
1279
1278
|
|
|
1280
|
-
|
|
1281
|
-
* TODO [ToDr] This should be `unique symbol`, but for some reason
|
|
1282
|
-
* I can't figure out how to build `@typeberry/blocks` package.
|
|
1283
|
-
*/
|
|
1284
|
-
declare const __REPRESENTATION_BYTES__: "REPRESENTATION_BYTES";
|
|
1279
|
+
declare const __REPRESENTATION_BYTES__: unique symbol;
|
|
1285
1280
|
|
|
1286
1281
|
type WithBytesRepresentation<Bytes extends number> = {
|
|
1287
1282
|
readonly [__REPRESENTATION_BYTES__]: Bytes;
|
|
1288
1283
|
};
|
|
1284
|
+
|
|
1289
1285
|
declare const asTypedNumber = <T, N extends number>(v: T): T & WithBytesRepresentation<N> =>
|
|
1290
1286
|
v as T & WithBytesRepresentation<N>;
|
|
1291
1287
|
|
|
@@ -4989,6 +4985,8 @@ declare const EC_SEGMENT_SIZE = 4104;
|
|
|
4989
4985
|
* Additional data that has to be passed to the codec to correctly parse incoming bytes.
|
|
4990
4986
|
*/
|
|
4991
4987
|
declare class ChainSpec extends WithDebug {
|
|
4988
|
+
/** Human-readable name of the chain spec. */
|
|
4989
|
+
readonly name: string;
|
|
4992
4990
|
/** Number of validators. */
|
|
4993
4991
|
readonly validatorsCount: U16;
|
|
4994
4992
|
/** 1/3 of number of validators */
|
|
@@ -5033,6 +5031,7 @@ declare class ChainSpec extends WithDebug {
|
|
|
5033
5031
|
constructor(data: Omit<ChainSpec, "validatorsSuperMajority" | "thirdOfValidators" | "erasureCodedPieceSize">) {
|
|
5034
5032
|
super();
|
|
5035
5033
|
|
|
5034
|
+
this.name = data.name;
|
|
5036
5035
|
this.validatorsCount = data.validatorsCount;
|
|
5037
5036
|
this.thirdOfValidators = tryAsU16(Math.floor(data.validatorsCount / 3));
|
|
5038
5037
|
this.validatorsSuperMajority = tryAsU16(Math.floor(data.validatorsCount / 3) * 2 + 1);
|
|
@@ -5054,6 +5053,7 @@ declare class ChainSpec extends WithDebug {
|
|
|
5054
5053
|
|
|
5055
5054
|
/** Set of values for "tiny" chain as defined in JAM test vectors. */
|
|
5056
5055
|
declare const tinyChainSpec = new ChainSpec({
|
|
5056
|
+
name: "tiny",
|
|
5057
5057
|
validatorsCount: tryAsU16(6),
|
|
5058
5058
|
coresCount: tryAsU16(2),
|
|
5059
5059
|
epochLength: tryAsU32(12),
|
|
@@ -5076,6 +5076,7 @@ declare const tinyChainSpec = new ChainSpec({
|
|
|
5076
5076
|
* Please note that only validatorsCount and epochLength are "full", the rest is copied from "tiny".
|
|
5077
5077
|
*/
|
|
5078
5078
|
declare const fullChainSpec = new ChainSpec({
|
|
5079
|
+
name: "full",
|
|
5079
5080
|
validatorsCount: tryAsU16(1023),
|
|
5080
5081
|
coresCount: tryAsU16(341),
|
|
5081
5082
|
epochLength: tryAsU32(600),
|
|
@@ -8174,7 +8175,7 @@ declare const DEFAULT_CONFIG = "default";
|
|
|
8174
8175
|
declare const NODE_DEFAULTS = {
|
|
8175
8176
|
name: isBrowser() ? "browser" : os.hostname(),
|
|
8176
8177
|
config: [DEFAULT_CONFIG],
|
|
8177
|
-
pvm: PvmBackend.
|
|
8178
|
+
pvm: PvmBackend.Ananas,
|
|
8178
8179
|
};
|
|
8179
8180
|
|
|
8180
8181
|
/** Chain spec chooser. */
|
|
@@ -9286,7 +9287,7 @@ declare function accumulationOutputComparator(a: AccumulationOutput, b: Accumula
|
|
|
9286
9287
|
return Ordering.Greater;
|
|
9287
9288
|
}
|
|
9288
9289
|
|
|
9289
|
-
return
|
|
9290
|
+
return a.output.compare(b.output);
|
|
9290
9291
|
}
|
|
9291
9292
|
|
|
9292
9293
|
/**
|
|
@@ -11021,6 +11022,18 @@ declare class InMemoryService extends WithDebug implements Service {
|
|
|
11021
11022
|
};
|
|
11022
11023
|
}
|
|
11023
11024
|
|
|
11025
|
+
/** Return identical `InMemoryService` which does not share any references. */
|
|
11026
|
+
clone(): InMemoryService {
|
|
11027
|
+
return new InMemoryService(this.serviceId, {
|
|
11028
|
+
info: ServiceAccountInfo.create(this.data.info),
|
|
11029
|
+
preimages: HashDictionary.fromEntries(Array.from(this.data.preimages.entries())),
|
|
11030
|
+
lookupHistory: HashDictionary.fromEntries(
|
|
11031
|
+
Array.from(this.data.lookupHistory.entries()).map(([k, v]) => [k, v.slice()]),
|
|
11032
|
+
),
|
|
11033
|
+
storage: new Map(this.data.storage.entries()),
|
|
11034
|
+
});
|
|
11035
|
+
}
|
|
11036
|
+
|
|
11024
11037
|
/**
|
|
11025
11038
|
* Create a new in-memory service from another state service
|
|
11026
11039
|
* by copying all given entries.
|
|
@@ -12108,7 +12121,6 @@ declare function* serializeRemovedServices(servicesRemoved: ServiceId[] | undefi
|
|
|
12108
12121
|
return;
|
|
12109
12122
|
}
|
|
12110
12123
|
for (const serviceId of servicesRemoved) {
|
|
12111
|
-
// TODO [ToDr] what about all data associated with a service?
|
|
12112
12124
|
const codec = serialize.serviceData(serviceId);
|
|
12113
12125
|
yield [StateEntryUpdateAction.Remove, codec.key, EMPTY_BLOB];
|
|
12114
12126
|
}
|
|
@@ -14243,13 +14255,6 @@ declare enum ForgetPreimageError {
|
|
|
14243
14255
|
|
|
14244
14256
|
/**
|
|
14245
14257
|
* Errors that may occur when the transfer is invoked.
|
|
14246
|
-
*
|
|
14247
|
-
* TODO [ToDr] Since I don't fully understand yet which of these
|
|
14248
|
-
* could be checked directly in the host call (i.e. if we will
|
|
14249
|
-
* have access to the service account state there) for now I keep
|
|
14250
|
-
* them safely in the `AccumulationPartialState` implementation.
|
|
14251
|
-
* However, if possible, these should be moved directly to the
|
|
14252
|
-
* host call implementation.
|
|
14253
14258
|
*/
|
|
14254
14259
|
declare enum TransferError {
|
|
14255
14260
|
/** The destination service does not exist. */
|
|
@@ -18980,7 +18985,7 @@ declare class AccumulationStateUpdate {
|
|
|
18980
18985
|
/** Pending transfers. */
|
|
18981
18986
|
public transfers: PendingTransfer[],
|
|
18982
18987
|
/** Yielded accumulation root. */
|
|
18983
|
-
public
|
|
18988
|
+
public yieldedRoot: OpaqueHash | null = null,
|
|
18984
18989
|
) {}
|
|
18985
18990
|
|
|
18986
18991
|
/** Create new empty state update. */
|
|
@@ -19019,7 +19024,7 @@ declare class AccumulationStateUpdate {
|
|
|
19019
19024
|
storage: deepCloneMapWithArray(from.services.storage),
|
|
19020
19025
|
};
|
|
19021
19026
|
const transfers = [...from.transfers];
|
|
19022
|
-
const update = new AccumulationStateUpdate(serviceUpdates, transfers,
|
|
19027
|
+
const update = new AccumulationStateUpdate(serviceUpdates, transfers, from.yieldedRoot);
|
|
19023
19028
|
|
|
19024
19029
|
// update entries
|
|
19025
19030
|
for (const [k, v] of from.authorizationQueues) {
|
|
@@ -19045,6 +19050,13 @@ declare class AccumulationStateUpdate {
|
|
|
19045
19050
|
this.transfers = [];
|
|
19046
19051
|
return transfers;
|
|
19047
19052
|
}
|
|
19053
|
+
|
|
19054
|
+
/** Retrieve and clear yielded root. */
|
|
19055
|
+
takeYieldedRoot() {
|
|
19056
|
+
const yieldedRoot = this.yieldedRoot;
|
|
19057
|
+
this.yieldedRoot = null;
|
|
19058
|
+
return yieldedRoot;
|
|
19059
|
+
}
|
|
19048
19060
|
}
|
|
19049
19061
|
|
|
19050
19062
|
type StateSlice = Pick<State, "getService" | "privilegedServices">;
|
|
@@ -19145,6 +19157,21 @@ declare class PartiallyUpdatedState<T extends StateSlice = StateSlice> {
|
|
|
19145
19157
|
hash: PreimageHash,
|
|
19146
19158
|
length: U64,
|
|
19147
19159
|
): LookupHistoryItem | null {
|
|
19160
|
+
const updatedService = this.stateUpdate.services.updated.get(serviceId);
|
|
19161
|
+
|
|
19162
|
+
/** Return lookup history item for newly created service */
|
|
19163
|
+
if (updatedService !== undefined && updatedService.action.kind === UpdateServiceKind.Create) {
|
|
19164
|
+
const lookupHistoryItem = updatedService.action.lookupHistory;
|
|
19165
|
+
|
|
19166
|
+
if (
|
|
19167
|
+
lookupHistoryItem !== null &&
|
|
19168
|
+
hash.isEqualTo(lookupHistoryItem.hash) &&
|
|
19169
|
+
length === BigInt(lookupHistoryItem.length)
|
|
19170
|
+
) {
|
|
19171
|
+
return lookupHistoryItem;
|
|
19172
|
+
}
|
|
19173
|
+
}
|
|
19174
|
+
|
|
19148
19175
|
const preimages = this.stateUpdate.services.preimages.get(serviceId) ?? [];
|
|
19149
19176
|
// TODO [ToDr] This is most likely wrong. We may have `provide` and `remove` within
|
|
19150
19177
|
// the same state update. We should however switch to proper "updated state"
|
|
@@ -19377,6 +19404,30 @@ declare function emptyRegistersBuffer(): Uint8Array {
|
|
|
19377
19404
|
return safeAllocUint8Array(NO_OF_REGISTERS * REGISTER_BYTE_SIZE);
|
|
19378
19405
|
}
|
|
19379
19406
|
|
|
19407
|
+
/**
|
|
19408
|
+
* Service account details with threshold balance.
|
|
19409
|
+
*
|
|
19410
|
+
* Used exclusively by `info` host call.
|
|
19411
|
+
*
|
|
19412
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
|
|
19413
|
+
*/
|
|
19414
|
+
declare const codecServiceAccountInfoWithThresholdBalance = codec.object(
|
|
19415
|
+
{
|
|
19416
|
+
codeHash: codec.bytes(HASH_SIZE),
|
|
19417
|
+
balance: codec.u64,
|
|
19418
|
+
thresholdBalance: codec.u64,
|
|
19419
|
+
accumulateMinGas: codec.u64.convert((i) => i, tryAsServiceGas),
|
|
19420
|
+
onTransferMinGas: codec.u64.convert((i) => i, tryAsServiceGas),
|
|
19421
|
+
storageUtilisationBytes: codec.u64,
|
|
19422
|
+
storageUtilisationCount: codec.u32,
|
|
19423
|
+
gratisStorage: codec.u64,
|
|
19424
|
+
created: codec.u32.convert((x) => x, tryAsTimeSlot),
|
|
19425
|
+
lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
|
|
19426
|
+
parentService: codec.u32.convert((x) => x, tryAsServiceId),
|
|
19427
|
+
},
|
|
19428
|
+
"ServiceAccountInfoWithThresholdBalance",
|
|
19429
|
+
);
|
|
19430
|
+
|
|
19380
19431
|
type index$4_AccumulationStateUpdate = AccumulationStateUpdate;
|
|
19381
19432
|
declare const index$4_AccumulationStateUpdate: typeof AccumulationStateUpdate;
|
|
19382
19433
|
declare const index$4_CURRENT_SERVICE_ID: typeof CURRENT_SERVICE_ID;
|
|
@@ -19440,7 +19491,7 @@ declare const index$4_tryAsMachineId: typeof tryAsMachineId;
|
|
|
19440
19491
|
declare const index$4_tryAsProgramCounter: typeof tryAsProgramCounter;
|
|
19441
19492
|
declare const index$4_writeServiceIdAsLeBytes: typeof writeServiceIdAsLeBytes;
|
|
19442
19493
|
declare namespace index$4 {
|
|
19443
|
-
export { index$4_AccumulationStateUpdate as AccumulationStateUpdate, index$4_CURRENT_SERVICE_ID as CURRENT_SERVICE_ID, index$4_EjectError as EjectError, index$4_ForgetPreimageError as ForgetPreimageError, index$4_HostCallResult as HostCallResult, index$4_MAX_U32 as MAX_U32, index$4_MAX_U32_BIG_INT as MAX_U32_BIG_INT, index$4_MachineInstance as MachineInstance, index$4_MemoryOperation as MemoryOperation, index$4_NewServiceError as NewServiceError, index$4_PagesError as PagesError, index$4_PartiallyUpdatedState as PartiallyUpdatedState, index$4_PeekPokeError as PeekPokeError, index$4_PendingTransfer as PendingTransfer, index$4_PreimageStatusKind as PreimageStatusKind, index$4_ProvidePreimageError as ProvidePreimageError, index$4_RequestPreimageError as RequestPreimageError, index$4_SERVICE_ID_BYTES as SERVICE_ID_BYTES, index$4_TransferError as TransferError, index$4_UpdatePrivilegesError as UpdatePrivilegesError, index$4_ZeroVoidError as ZeroVoidError, index$4_clampU64ToU32 as clampU64ToU32, index$4_deepCloneMapWithArray as deepCloneMapWithArray, index$4_emptyRegistersBuffer as emptyRegistersBuffer, index$4_getServiceId as getServiceId, index$4_getServiceIdOrCurrent as getServiceIdOrCurrent, index$4_preimageLenAsU32 as preimageLenAsU32, index$4_slotsToPreimageStatus as slotsToPreimageStatus, index$4_toMemoryOperation as toMemoryOperation, index$4_tryAsMachineId as tryAsMachineId, index$4_tryAsProgramCounter as tryAsProgramCounter, index$4_writeServiceIdAsLeBytes as writeServiceIdAsLeBytes };
|
|
19494
|
+
export { index$4_AccumulationStateUpdate as AccumulationStateUpdate, index$4_CURRENT_SERVICE_ID as CURRENT_SERVICE_ID, index$4_EjectError as EjectError, index$4_ForgetPreimageError as ForgetPreimageError, index$4_HostCallResult as HostCallResult, index$4_MAX_U32 as MAX_U32, index$4_MAX_U32_BIG_INT as MAX_U32_BIG_INT, index$4_MachineInstance as MachineInstance, index$4_MemoryOperation as MemoryOperation, index$4_NewServiceError as NewServiceError, index$4_PagesError as PagesError, index$4_PartiallyUpdatedState as PartiallyUpdatedState, index$4_PeekPokeError as PeekPokeError, index$4_PendingTransfer as PendingTransfer, index$4_PreimageStatusKind as PreimageStatusKind, index$4_ProvidePreimageError as ProvidePreimageError, index$4_RequestPreimageError as RequestPreimageError, index$4_SERVICE_ID_BYTES as SERVICE_ID_BYTES, index$4_TransferError as TransferError, index$4_UpdatePrivilegesError as UpdatePrivilegesError, index$4_ZeroVoidError as ZeroVoidError, index$4_clampU64ToU32 as clampU64ToU32, index$4_deepCloneMapWithArray as deepCloneMapWithArray, index$4_emptyRegistersBuffer as emptyRegistersBuffer, index$4_getServiceId as getServiceId, index$4_getServiceIdOrCurrent as getServiceIdOrCurrent, codecServiceAccountInfoWithThresholdBalance as hostCallInfoAccount, index$4_preimageLenAsU32 as preimageLenAsU32, index$4_slotsToPreimageStatus as slotsToPreimageStatus, index$4_toMemoryOperation as toMemoryOperation, index$4_tryAsMachineId as tryAsMachineId, index$4_tryAsProgramCounter as tryAsProgramCounter, index$4_writeServiceIdAsLeBytes as writeServiceIdAsLeBytes };
|
|
19444
19495
|
export type { index$4_InsufficientFundsError as InsufficientFundsError, index$4_MachineId as MachineId, index$4_MachineResult as MachineResult, index$4_MachineStatus as MachineStatus, index$4_NoMachineError as NoMachineError, index$4_PartialState as PartialState, index$4_PreimageStatus as PreimageStatus, index$4_ProgramCounter as ProgramCounter, index$4_RefineExternalities as RefineExternalities, index$4_SegmentExportError as SegmentExportError, index$4_ServiceStateUpdate as ServiceStateUpdate, index$4_StateSlice as StateSlice, index$4_TRANSFER_MEMO_BYTES as TRANSFER_MEMO_BYTES, index$4_UnprivilegedError as UnprivilegedError };
|
|
19445
19496
|
}
|
|
19446
19497
|
|
|
@@ -19451,11 +19502,6 @@ declare class DebuggerAdapter {
|
|
|
19451
19502
|
this.pvm = new Interpreter({ useSbrkGas });
|
|
19452
19503
|
}
|
|
19453
19504
|
|
|
19454
|
-
// TODO [MaSi]: a temporary solution that is needed to implement host calls in PVM debugger
|
|
19455
|
-
getInterpreter() {
|
|
19456
|
-
return this.pvm;
|
|
19457
|
-
}
|
|
19458
|
-
|
|
19459
19505
|
resetGeneric(rawProgram: Uint8Array, flatRegisters: Uint8Array, initialGas: bigint) {
|
|
19460
19506
|
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
19461
19507
|
}
|
|
@@ -19660,7 +19706,7 @@ declare const index$3_tryAsMachineId: typeof tryAsMachineId;
|
|
|
19660
19706
|
declare const index$3_tryAsProgramCounter: typeof tryAsProgramCounter;
|
|
19661
19707
|
declare const index$3_writeServiceIdAsLeBytes: typeof writeServiceIdAsLeBytes;
|
|
19662
19708
|
declare namespace index$3 {
|
|
19663
|
-
export { index$3_AccumulationStateUpdate as AccumulationStateUpdate, index$3_ArgsDecoder as ArgsDecoder, index$3_ArgumentType as ArgumentType, index$3_BasicBlocks as BasicBlocks, index$3_CURRENT_SERVICE_ID as CURRENT_SERVICE_ID, index$3_EjectError as EjectError, index$3_ExtendedWitdthImmediateDecoder as ExtendedWitdthImmediateDecoder, index$3_ForgetPreimageError as ForgetPreimageError, index$3_HostCallMemory as HostCallMemory, index$3_HostCallRegisters as HostCallRegisters, index$3_HostCallResult as HostCallResult, index$3_ImmediateDecoder as ImmediateDecoder, index$3_MAX_U32 as MAX_U32, index$3_MAX_U32_BIG_INT as MAX_U32_BIG_INT, index$3_MachineInstance as MachineInstance, index$3_Mask as Mask, index$3_MemoryOperation as MemoryOperation, index$3_MemorySegment as MemorySegment, NO_OF_REGISTERS$1 as NO_OF_REGISTERS, index$3_NewServiceError as NewServiceError, index$3_NibblesDecoder as NibblesDecoder, index$3_PagesError as PagesError, index$3_PartiallyUpdatedState as PartiallyUpdatedState, index$3_PeekPokeError as PeekPokeError, index$3_PendingTransfer as PendingTransfer, index$3_PreimageStatusKind as PreimageStatusKind, index$3_Program as Program, index$3_ProgramDecoder as ProgramDecoder, index$3_ProvidePreimageError as ProvidePreimageError, DebuggerAdapter as Pvm, index$3_Registers as Registers, index$3_RequestPreimageError as RequestPreimageError, Result$2 as Result, index$3_RichTaggedError as RichTaggedError, index$3_SERVICE_ID_BYTES as SERVICE_ID_BYTES, index$3_SpiMemory as SpiMemory, index$3_SpiProgram as SpiProgram, index$3_TransferError as TransferError, index$3_UpdatePrivilegesError as UpdatePrivilegesError, index$3_WithDebug as WithDebug, index$3_ZeroVoidError as ZeroVoidError, index$3___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$3_asOpaqueType as asOpaqueType, index$3_assertEmpty as assertEmpty, index$3_assertNever as assertNever, index$l as block, index$s as bytes, index$3_check as check, index$3_clampU64ToU32 as clampU64ToU32, index$3_createResults as createResults, index$3_decodeStandardProgram as decodeStandardProgram, index$3_deepCloneMapWithArray as deepCloneMapWithArray, index$3_emptyRegistersBuffer as emptyRegistersBuffer, index$3_extractCodeAndMetadata as extractCodeAndMetadata, index$3_getServiceId as getServiceId, index$3_getServiceIdOrCurrent as getServiceIdOrCurrent, index$p as hash, index$3_inspect as inspect, index$3_instructionArgumentTypeMap as instructionArgumentTypeMap, index$6 as interpreter, index$3_isBrowser as isBrowser, index$3_isTaggedError as isTaggedError, index$3_lazyInspect as lazyInspect, index$3_maybeTaggedErrorToString as maybeTaggedErrorToString, index$3_measure as measure, index$r as numbers, index$3_preimageLenAsU32 as preimageLenAsU32, index$3_resultToString as resultToString, index$3_seeThrough as seeThrough, index$3_slotsToPreimageStatus as slotsToPreimageStatus, index$3_toMemoryOperation as toMemoryOperation, index$3_tryAsMachineId as tryAsMachineId, index$3_tryAsProgramCounter as tryAsProgramCounter, index$3_writeServiceIdAsLeBytes as writeServiceIdAsLeBytes };
|
|
19709
|
+
export { index$3_AccumulationStateUpdate as AccumulationStateUpdate, index$3_ArgsDecoder as ArgsDecoder, index$3_ArgumentType as ArgumentType, index$3_BasicBlocks as BasicBlocks, index$3_CURRENT_SERVICE_ID as CURRENT_SERVICE_ID, index$3_EjectError as EjectError, index$3_ExtendedWitdthImmediateDecoder as ExtendedWitdthImmediateDecoder, index$3_ForgetPreimageError as ForgetPreimageError, index$3_HostCallMemory as HostCallMemory, index$3_HostCallRegisters as HostCallRegisters, index$3_HostCallResult as HostCallResult, index$3_ImmediateDecoder as ImmediateDecoder, index$3_MAX_U32 as MAX_U32, index$3_MAX_U32_BIG_INT as MAX_U32_BIG_INT, index$3_MachineInstance as MachineInstance, index$3_Mask as Mask, index$3_MemoryOperation as MemoryOperation, index$3_MemorySegment as MemorySegment, NO_OF_REGISTERS$1 as NO_OF_REGISTERS, index$3_NewServiceError as NewServiceError, index$3_NibblesDecoder as NibblesDecoder, index$3_PagesError as PagesError, index$3_PartiallyUpdatedState as PartiallyUpdatedState, index$3_PeekPokeError as PeekPokeError, index$3_PendingTransfer as PendingTransfer, index$3_PreimageStatusKind as PreimageStatusKind, index$3_Program as Program, index$3_ProgramDecoder as ProgramDecoder, index$3_ProvidePreimageError as ProvidePreimageError, DebuggerAdapter as Pvm, index$3_Registers as Registers, index$3_RequestPreimageError as RequestPreimageError, Result$2 as Result, index$3_RichTaggedError as RichTaggedError, index$3_SERVICE_ID_BYTES as SERVICE_ID_BYTES, index$3_SpiMemory as SpiMemory, index$3_SpiProgram as SpiProgram, index$3_TransferError as TransferError, index$3_UpdatePrivilegesError as UpdatePrivilegesError, index$3_WithDebug as WithDebug, index$3_ZeroVoidError as ZeroVoidError, index$3___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$3_asOpaqueType as asOpaqueType, index$3_assertEmpty as assertEmpty, index$3_assertNever as assertNever, index$l as block, index$s as bytes, index$3_check as check, index$3_clampU64ToU32 as clampU64ToU32, index$3_createResults as createResults, index$3_decodeStandardProgram as decodeStandardProgram, index$3_deepCloneMapWithArray as deepCloneMapWithArray, index$3_emptyRegistersBuffer as emptyRegistersBuffer, index$3_extractCodeAndMetadata as extractCodeAndMetadata, index$3_getServiceId as getServiceId, index$3_getServiceIdOrCurrent as getServiceIdOrCurrent, index$p as hash, codecServiceAccountInfoWithThresholdBalance as hostCallInfoAccount, index$3_inspect as inspect, index$3_instructionArgumentTypeMap as instructionArgumentTypeMap, index$6 as interpreter, index$3_isBrowser as isBrowser, index$3_isTaggedError as isTaggedError, index$3_lazyInspect as lazyInspect, index$3_maybeTaggedErrorToString as maybeTaggedErrorToString, index$3_measure as measure, index$r as numbers, index$3_preimageLenAsU32 as preimageLenAsU32, index$3_resultToString as resultToString, index$3_seeThrough as seeThrough, index$3_slotsToPreimageStatus as slotsToPreimageStatus, index$3_toMemoryOperation as toMemoryOperation, index$3_tryAsMachineId as tryAsMachineId, index$3_tryAsProgramCounter as tryAsProgramCounter, index$3_writeServiceIdAsLeBytes as writeServiceIdAsLeBytes };
|
|
19664
19710
|
export type { index$3_Args as Args, index$3_EnumMapping as EnumMapping, index$3_ErrorResult as ErrorResult, index$3_InsufficientFundsError as InsufficientFundsError, index$3_MachineId as MachineId, index$3_MachineResult as MachineResult, index$3_MachineStatus as MachineStatus, index$3_NoMachineError as NoMachineError, index$3_OK as OK, index$3_OkResult as OkResult, index$3_Opaque as Opaque, index$3_PartialState as PartialState, index$3_PreimageStatus as PreimageStatus, index$3_ProgramCounter as ProgramCounter, index$3_RefineExternalities as RefineExternalities, index$3_SegmentExportError as SegmentExportError, index$3_ServiceStateUpdate as ServiceStateUpdate, index$3_StateSlice as StateSlice, index$3_StringLiteral as StringLiteral, index$3_TRANSFER_MEMO_BYTES as TRANSFER_MEMO_BYTES, index$3_TaggedError as TaggedError, index$3_TokenOf as TokenOf, index$3_Uninstantiable as Uninstantiable, index$3_UnprivilegedError as UnprivilegedError, index$3_WithOpaque as WithOpaque };
|
|
19665
19711
|
}
|
|
19666
19712
|
|
|
@@ -20438,17 +20484,6 @@ declare class TransitionHasher implements MmrHasher<KeccakHash> {
|
|
|
20438
20484
|
|
|
20439
20485
|
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), extrinsicView, encoded);
|
|
20440
20486
|
}
|
|
20441
|
-
|
|
20442
|
-
/** Creates hash for given WorkPackage */
|
|
20443
|
-
workPackage(workPackage: WorkPackage): WithHashAndBytes<WorkPackageHash, WorkPackage> {
|
|
20444
|
-
return this.encode(WorkPackage.Codec, workPackage);
|
|
20445
|
-
}
|
|
20446
|
-
|
|
20447
|
-
private encode<T, THash extends OpaqueHash>(codec: Codec<T>, data: T): WithHashAndBytes<THash, T> {
|
|
20448
|
-
// TODO [ToDr] Use already allocated encoding destination and hash bytes from some arena.
|
|
20449
|
-
const encoded = Encoder.encodeObject(codec, data, this.context);
|
|
20450
|
-
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), data, encoded);
|
|
20451
|
-
}
|
|
20452
20487
|
}
|
|
20453
20488
|
|
|
20454
20489
|
type PreimagesState = Pick<State, "getService">;
|
|
@@ -20466,7 +20501,6 @@ declare enum PreimagesErrorCode {
|
|
|
20466
20501
|
AccountNotFound = "account_not_found",
|
|
20467
20502
|
}
|
|
20468
20503
|
|
|
20469
|
-
// TODO [SeKo] consider whether this module is the right place to remove expired preimages
|
|
20470
20504
|
declare class Preimages {
|
|
20471
20505
|
constructor(
|
|
20472
20506
|
public readonly state: PreimagesState,
|