@typeberry/lib 0.4.0-203a18d → 0.4.0-248b604
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 +167 -243
- package/index.d.ts +879 -1357
- package/index.js +142 -217
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16,7 +16,11 @@ var TestSuite;
|
|
|
16
16
|
})(TestSuite || (TestSuite = {}));
|
|
17
17
|
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
18
18
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Current version is set to track the jam-conformance testing.
|
|
21
|
+
* Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
|
|
22
|
+
*/
|
|
23
|
+
const DEFAULT_VERSION = GpVersion.V0_7_1;
|
|
20
24
|
const env$1 = typeof process === "undefined" ? {} : process.env;
|
|
21
25
|
let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
|
|
22
26
|
let CURRENT_SUITE = parseCurrentSuite(env$1.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
@@ -75,8 +79,8 @@ class Compatibility {
|
|
|
75
79
|
/**
|
|
76
80
|
* Allows selecting different values for different Gray Paper versions from one record.
|
|
77
81
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
82
|
+
* fallback The default value to return if no value is found for the current.
|
|
83
|
+
* versions A record mapping versions to values, checking if the version is greater or equal to the current version.
|
|
80
84
|
* @returns The value for the current version, or the default value.
|
|
81
85
|
*/
|
|
82
86
|
static selectIfGreaterOrEqual({ fallback, versions, }) {
|
|
@@ -236,7 +240,7 @@ const workspacePathFix = env.NODE_ENV === "development"
|
|
|
236
240
|
: () => (p) => p;
|
|
237
241
|
|
|
238
242
|
/**
|
|
239
|
-
*
|
|
243
|
+
* `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
|
|
240
244
|
* specified unique token Token. It means that base type cannot be assigned to unique type by accident.
|
|
241
245
|
* Good examples of opaque types include:
|
|
242
246
|
* - JWTs or other tokens - these are special kinds of string used for authorization purposes.
|
|
@@ -579,7 +583,7 @@ function isResult(x) {
|
|
|
579
583
|
* as an afterthought.
|
|
580
584
|
*/
|
|
581
585
|
|
|
582
|
-
var index$
|
|
586
|
+
var index$u = /*#__PURE__*/Object.freeze({
|
|
583
587
|
__proto__: null,
|
|
584
588
|
get CURRENT_SUITE () { return CURRENT_SUITE; },
|
|
585
589
|
get CURRENT_VERSION () { return CURRENT_VERSION; },
|
|
@@ -736,7 +740,7 @@ class Ordering {
|
|
|
736
740
|
}
|
|
737
741
|
}
|
|
738
742
|
|
|
739
|
-
var index$
|
|
743
|
+
var index$t = /*#__PURE__*/Object.freeze({
|
|
740
744
|
__proto__: null,
|
|
741
745
|
Ordering: Ordering
|
|
742
746
|
});
|
|
@@ -988,7 +992,7 @@ function u8ArraySameLengthEqual(self, other) {
|
|
|
988
992
|
}
|
|
989
993
|
const bytesBlobComparator = (a, b) => a.compare(b);
|
|
990
994
|
|
|
991
|
-
var index$
|
|
995
|
+
var index$s = /*#__PURE__*/Object.freeze({
|
|
992
996
|
__proto__: null,
|
|
993
997
|
BitVec: BitVec,
|
|
994
998
|
Bytes: Bytes,
|
|
@@ -1090,7 +1094,7 @@ const minU64 = (a, ...values) => values.reduce((min, value) => (value > min ? mi
|
|
|
1090
1094
|
/** Get the biggest value between U64 a and values given as input parameters. */
|
|
1091
1095
|
const maxU64 = (a, ...values) => values.reduce((max, value) => (value < max ? max : value), a);
|
|
1092
1096
|
|
|
1093
|
-
var index$
|
|
1097
|
+
var index$r = /*#__PURE__*/Object.freeze({
|
|
1094
1098
|
__proto__: null,
|
|
1095
1099
|
isU16: isU16,
|
|
1096
1100
|
isU32: isU32,
|
|
@@ -2529,7 +2533,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
2529
2533
|
}, skipper);
|
|
2530
2534
|
}
|
|
2531
2535
|
|
|
2532
|
-
var index$
|
|
2536
|
+
var index$q = /*#__PURE__*/Object.freeze({
|
|
2533
2537
|
__proto__: null,
|
|
2534
2538
|
Decoder: Decoder,
|
|
2535
2539
|
Descriptor: Descriptor,
|
|
@@ -3730,7 +3734,7 @@ var keyDerivation = /*#__PURE__*/Object.freeze({
|
|
|
3730
3734
|
trivialSeed: trivialSeed
|
|
3731
3735
|
});
|
|
3732
3736
|
|
|
3733
|
-
var index$
|
|
3737
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
3734
3738
|
__proto__: null,
|
|
3735
3739
|
BANDERSNATCH_KEY_BYTES: BANDERSNATCH_KEY_BYTES,
|
|
3736
3740
|
BANDERSNATCH_PROOF_BYTES: BANDERSNATCH_PROOF_BYTES,
|
|
@@ -4368,7 +4372,7 @@ var keccak = /*#__PURE__*/Object.freeze({
|
|
|
4368
4372
|
// TODO [ToDr] (#213) this should most likely be moved to a separate
|
|
4369
4373
|
// package to avoid pulling in unnecessary deps.
|
|
4370
4374
|
|
|
4371
|
-
var index$
|
|
4375
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
4372
4376
|
__proto__: null,
|
|
4373
4377
|
Blake2b: Blake2b,
|
|
4374
4378
|
HASH_SIZE: HASH_SIZE,
|
|
@@ -5005,7 +5009,7 @@ class TruncatedHashDictionary {
|
|
|
5005
5009
|
}
|
|
5006
5010
|
}
|
|
5007
5011
|
|
|
5008
|
-
var index$
|
|
5012
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
5009
5013
|
__proto__: null,
|
|
5010
5014
|
ArrayView: ArrayView,
|
|
5011
5015
|
FixedSizeArray: FixedSizeArray,
|
|
@@ -5192,7 +5196,7 @@ var PvmBackend;
|
|
|
5192
5196
|
PvmBackend[PvmBackend["Ananas"] = 1] = "Ananas";
|
|
5193
5197
|
})(PvmBackend || (PvmBackend = {}));
|
|
5194
5198
|
|
|
5195
|
-
var index$
|
|
5199
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
5196
5200
|
__proto__: null,
|
|
5197
5201
|
Bootnode: Bootnode,
|
|
5198
5202
|
ChainSpec: ChainSpec,
|
|
@@ -6699,7 +6703,7 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
6699
6703
|
return Decoder.decodeObject(codec.View, encoded, chainSpec);
|
|
6700
6704
|
}
|
|
6701
6705
|
|
|
6702
|
-
var index$
|
|
6706
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
6703
6707
|
__proto__: null,
|
|
6704
6708
|
Block: Block,
|
|
6705
6709
|
EpochMarker: EpochMarker,
|
|
@@ -6971,7 +6975,7 @@ var json;
|
|
|
6971
6975
|
json.object = object;
|
|
6972
6976
|
})(json || (json = {}));
|
|
6973
6977
|
|
|
6974
|
-
var index$
|
|
6978
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
6975
6979
|
__proto__: null,
|
|
6976
6980
|
get json () { return json; },
|
|
6977
6981
|
parseFromJson: parseFromJson
|
|
@@ -7241,7 +7245,7 @@ const blockFromJson = (spec) => json.object({
|
|
|
7241
7245
|
extrinsic: getExtrinsicFromJson(spec),
|
|
7242
7246
|
}, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
|
|
7243
7247
|
|
|
7244
|
-
var index$
|
|
7248
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
7245
7249
|
__proto__: null,
|
|
7246
7250
|
blockFromJson: blockFromJson,
|
|
7247
7251
|
disputesExtrinsicFromJson: disputesExtrinsicFromJson,
|
|
@@ -7735,7 +7739,7 @@ class Logger {
|
|
|
7735
7739
|
}
|
|
7736
7740
|
}
|
|
7737
7741
|
|
|
7738
|
-
var index$
|
|
7742
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
7739
7743
|
__proto__: null,
|
|
7740
7744
|
get Level () { return Level; },
|
|
7741
7745
|
Logger: Logger,
|
|
@@ -7950,7 +7954,7 @@ function isJsonObject(value) {
|
|
|
7950
7954
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7951
7955
|
}
|
|
7952
7956
|
|
|
7953
|
-
var index$
|
|
7957
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
7954
7958
|
__proto__: null,
|
|
7955
7959
|
DEFAULT_CONFIG: DEFAULT_CONFIG,
|
|
7956
7960
|
DEV_CONFIG: DEV_CONFIG,
|
|
@@ -9744,7 +9748,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
|
|
|
9744
9748
|
sortKeys: (a, b) => a - b,
|
|
9745
9749
|
});
|
|
9746
9750
|
|
|
9747
|
-
var index$
|
|
9751
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
9748
9752
|
__proto__: null,
|
|
9749
9753
|
AUTHORIZATION_QUEUE_SIZE: AUTHORIZATION_QUEUE_SIZE,
|
|
9750
9754
|
AccumulationOutput: AccumulationOutput,
|
|
@@ -10375,7 +10379,6 @@ class LeafNode {
|
|
|
10375
10379
|
/**
|
|
10376
10380
|
* Get the byte length of embedded value.
|
|
10377
10381
|
*
|
|
10378
|
-
* @remark
|
|
10379
10382
|
* Note in case this node only contains hash this is going to be 0.
|
|
10380
10383
|
*/
|
|
10381
10384
|
getValueLength() {
|
|
@@ -10386,7 +10389,6 @@ class LeafNode {
|
|
|
10386
10389
|
/**
|
|
10387
10390
|
* Returns the embedded value.
|
|
10388
10391
|
*
|
|
10389
|
-
* @remark
|
|
10390
10392
|
* Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
|
|
10391
10393
|
*/
|
|
10392
10394
|
getValue() {
|
|
@@ -10396,7 +10398,6 @@ class LeafNode {
|
|
|
10396
10398
|
/**
|
|
10397
10399
|
* Returns contained value hash.
|
|
10398
10400
|
*
|
|
10399
|
-
* @remark
|
|
10400
10401
|
* Note that for embedded value this is going to be full 0-padded 32 bytes.
|
|
10401
10402
|
*/
|
|
10402
10403
|
getValueHash() {
|
|
@@ -10818,7 +10819,7 @@ const bitLookup = [
|
|
|
10818
10819
|
[0b00000000, 8],
|
|
10819
10820
|
];
|
|
10820
10821
|
|
|
10821
|
-
var index$
|
|
10822
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
10822
10823
|
__proto__: null,
|
|
10823
10824
|
BranchNode: BranchNode,
|
|
10824
10825
|
InMemoryTrie: InMemoryTrie,
|
|
@@ -11185,7 +11186,7 @@ function loadState(spec, blake2b, entries) {
|
|
|
11185
11186
|
* hashmap of `key -> value` entries.
|
|
11186
11187
|
*/
|
|
11187
11188
|
|
|
11188
|
-
var index$
|
|
11189
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
11189
11190
|
__proto__: null,
|
|
11190
11191
|
SerializedService: SerializedService,
|
|
11191
11192
|
SerializedState: SerializedState,
|
|
@@ -11434,7 +11435,7 @@ class InMemoryStates {
|
|
|
11434
11435
|
async close() { }
|
|
11435
11436
|
}
|
|
11436
11437
|
|
|
11437
|
-
var index$
|
|
11438
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
11438
11439
|
__proto__: null,
|
|
11439
11440
|
InMemoryBlocks: InMemoryBlocks,
|
|
11440
11441
|
InMemorySerializedStates: InMemorySerializedStates,
|
|
@@ -11798,7 +11799,7 @@ const initEc = async () => {
|
|
|
11798
11799
|
await init.reedSolomon();
|
|
11799
11800
|
};
|
|
11800
11801
|
|
|
11801
|
-
var index$
|
|
11802
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
11802
11803
|
__proto__: null,
|
|
11803
11804
|
N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
|
|
11804
11805
|
N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
|
|
@@ -12232,7 +12233,7 @@ class FuzzTarget {
|
|
|
12232
12233
|
}
|
|
12233
12234
|
}
|
|
12234
12235
|
|
|
12235
|
-
var index$
|
|
12236
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
12236
12237
|
__proto__: null,
|
|
12237
12238
|
AncestryItem: AncestryItem,
|
|
12238
12239
|
ErrorMessage: ErrorMessage,
|
|
@@ -12250,9 +12251,9 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
12250
12251
|
stateRootCodec: stateRootCodec
|
|
12251
12252
|
});
|
|
12252
12253
|
|
|
12253
|
-
var index$
|
|
12254
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
12254
12255
|
__proto__: null,
|
|
12255
|
-
v1: index$
|
|
12256
|
+
v1: index$b
|
|
12256
12257
|
});
|
|
12257
12258
|
|
|
12258
12259
|
/** Size of the transfer memo. */
|
|
@@ -13115,42 +13116,6 @@ class HostCallsManager {
|
|
|
13115
13116
|
}
|
|
13116
13117
|
}
|
|
13117
13118
|
|
|
13118
|
-
/** Create a new gas counter instance depending on the gas value. */
|
|
13119
|
-
function gasCounter(gas) {
|
|
13120
|
-
return new GasCounterU64(tryAsU64(gas));
|
|
13121
|
-
}
|
|
13122
|
-
class GasCounterU64 {
|
|
13123
|
-
gas;
|
|
13124
|
-
initialGas;
|
|
13125
|
-
constructor(gas) {
|
|
13126
|
-
this.gas = gas;
|
|
13127
|
-
this.initialGas = tryAsGas(gas);
|
|
13128
|
-
}
|
|
13129
|
-
set(g) {
|
|
13130
|
-
this.gas = tryAsU64(g);
|
|
13131
|
-
}
|
|
13132
|
-
get() {
|
|
13133
|
-
return tryAsGas(this.gas);
|
|
13134
|
-
}
|
|
13135
|
-
sub(g) {
|
|
13136
|
-
const result = this.gas - tryAsU64(g);
|
|
13137
|
-
if (result >= 0n) {
|
|
13138
|
-
this.gas = tryAsU64(result);
|
|
13139
|
-
return false;
|
|
13140
|
-
}
|
|
13141
|
-
this.gas = tryAsU64(0n);
|
|
13142
|
-
return true;
|
|
13143
|
-
}
|
|
13144
|
-
used() {
|
|
13145
|
-
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
13146
|
-
// In we have less than zero left we assume that all gas has been consumed.
|
|
13147
|
-
if (gasConsumed < 0) {
|
|
13148
|
-
return this.initialGas;
|
|
13149
|
-
}
|
|
13150
|
-
return tryAsGas(gasConsumed);
|
|
13151
|
-
}
|
|
13152
|
-
}
|
|
13153
|
-
|
|
13154
13119
|
const tryAsMemoryIndex = (index) => {
|
|
13155
13120
|
check `${index >= 0 && index <= MAX_MEMORY_INDEX} Incorrect memory index: ${index}!`;
|
|
13156
13121
|
return asOpaqueType(index);
|
|
@@ -13873,7 +13838,7 @@ function getRegisters(argsLength) {
|
|
|
13873
13838
|
return regs;
|
|
13874
13839
|
}
|
|
13875
13840
|
|
|
13876
|
-
var index$
|
|
13841
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
13877
13842
|
__proto__: null,
|
|
13878
13843
|
MemorySegment: MemorySegment,
|
|
13879
13844
|
SpiMemory: SpiMemory,
|
|
@@ -13932,7 +13897,7 @@ function extractCodeAndMetadata(blobWithMetadata) {
|
|
|
13932
13897
|
return { metadata, code };
|
|
13933
13898
|
}
|
|
13934
13899
|
|
|
13935
|
-
var index$
|
|
13900
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
13936
13901
|
__proto__: null,
|
|
13937
13902
|
Program: Program,
|
|
13938
13903
|
extractCodeAndMetadata: extractCodeAndMetadata
|
|
@@ -14896,6 +14861,42 @@ class BasicBlocks {
|
|
|
14896
14861
|
}
|
|
14897
14862
|
}
|
|
14898
14863
|
|
|
14864
|
+
/** Create a new gas counter instance depending on the gas value. */
|
|
14865
|
+
function gasCounter(gas) {
|
|
14866
|
+
return new GasCounterU64(tryAsU64(gas));
|
|
14867
|
+
}
|
|
14868
|
+
class GasCounterU64 {
|
|
14869
|
+
gas;
|
|
14870
|
+
initialGas;
|
|
14871
|
+
constructor(gas) {
|
|
14872
|
+
this.gas = gas;
|
|
14873
|
+
this.initialGas = tryAsGas(gas);
|
|
14874
|
+
}
|
|
14875
|
+
set(g) {
|
|
14876
|
+
this.gas = tryAsU64(g);
|
|
14877
|
+
}
|
|
14878
|
+
get() {
|
|
14879
|
+
return tryAsGas(this.gas);
|
|
14880
|
+
}
|
|
14881
|
+
sub(g) {
|
|
14882
|
+
const result = this.gas - tryAsU64(g);
|
|
14883
|
+
if (result >= 0n) {
|
|
14884
|
+
this.gas = tryAsU64(result);
|
|
14885
|
+
return false;
|
|
14886
|
+
}
|
|
14887
|
+
this.gas = tryAsU64(0n);
|
|
14888
|
+
return true;
|
|
14889
|
+
}
|
|
14890
|
+
used() {
|
|
14891
|
+
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
14892
|
+
// In we have less than zero left we assume that all gas has been consumed.
|
|
14893
|
+
if (gasConsumed < 0) {
|
|
14894
|
+
return this.initialGas;
|
|
14895
|
+
}
|
|
14896
|
+
return tryAsGas(gasConsumed);
|
|
14897
|
+
}
|
|
14898
|
+
}
|
|
14899
|
+
|
|
14899
14900
|
const instructionGasMap = (() => {
|
|
14900
14901
|
const instructionGasMap = new Array(HIGHEST_INSTRUCTION_NUMBER + 1);
|
|
14901
14902
|
for (let i = 0; i < HIGHEST_INSTRUCTION_NUMBER + 1; i++) {
|
|
@@ -16804,8 +16805,77 @@ class Interpreter {
|
|
|
16804
16805
|
}
|
|
16805
16806
|
}
|
|
16806
16807
|
|
|
16807
|
-
|
|
16808
|
+
class DebuggerAdapter {
|
|
16809
|
+
pvm;
|
|
16810
|
+
constructor(useSbrkGas = false) {
|
|
16811
|
+
this.pvm = new Interpreter({ useSbrkGas });
|
|
16812
|
+
}
|
|
16813
|
+
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
16814
|
+
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
16815
|
+
}
|
|
16816
|
+
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
16817
|
+
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
16818
|
+
}
|
|
16819
|
+
getPageDump(pageNumber) {
|
|
16820
|
+
const page = this.pvm.getMemoryPage(pageNumber);
|
|
16821
|
+
if (page === null) {
|
|
16822
|
+
// page wasn't allocated so we return an empty page
|
|
16823
|
+
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
16824
|
+
}
|
|
16825
|
+
if (page.length === PAGE_SIZE$1) {
|
|
16826
|
+
// page was allocated and has a proper size so we can simply return it
|
|
16827
|
+
return page;
|
|
16828
|
+
}
|
|
16829
|
+
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
16830
|
+
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
16831
|
+
fullPage.set(page);
|
|
16832
|
+
return fullPage;
|
|
16833
|
+
}
|
|
16834
|
+
setMemory(address, value) {
|
|
16835
|
+
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
16836
|
+
}
|
|
16837
|
+
getExitArg() {
|
|
16838
|
+
return this.pvm.getExitParam() ?? 0;
|
|
16839
|
+
}
|
|
16840
|
+
getStatus() {
|
|
16841
|
+
return this.pvm.getStatus();
|
|
16842
|
+
}
|
|
16843
|
+
nextStep() {
|
|
16844
|
+
return this.pvm.nextStep() === Status.OK;
|
|
16845
|
+
}
|
|
16846
|
+
nSteps(steps) {
|
|
16847
|
+
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
16848
|
+
for (let i = 0; i < steps; i++) {
|
|
16849
|
+
const isOk = this.nextStep();
|
|
16850
|
+
if (!isOk) {
|
|
16851
|
+
return false;
|
|
16852
|
+
}
|
|
16853
|
+
}
|
|
16854
|
+
return true;
|
|
16855
|
+
}
|
|
16856
|
+
getRegisters() {
|
|
16857
|
+
return this.pvm.registers.getAllU64();
|
|
16858
|
+
}
|
|
16859
|
+
setRegisters(registers) {
|
|
16860
|
+
this.pvm.registers.copyFrom(new Registers(registers));
|
|
16861
|
+
}
|
|
16862
|
+
getProgramCounter() {
|
|
16863
|
+
return this.pvm.getPC();
|
|
16864
|
+
}
|
|
16865
|
+
setNextProgramCounter(nextPc) {
|
|
16866
|
+
this.pvm.setNextPC(nextPc);
|
|
16867
|
+
}
|
|
16868
|
+
getGasLeft() {
|
|
16869
|
+
return BigInt(this.pvm.gas.get());
|
|
16870
|
+
}
|
|
16871
|
+
setGasLeft(gas) {
|
|
16872
|
+
this.pvm.gas.set(tryAsGas(gas));
|
|
16873
|
+
}
|
|
16874
|
+
}
|
|
16875
|
+
|
|
16876
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
16808
16877
|
__proto__: null,
|
|
16878
|
+
DebuggerAdapter: DebuggerAdapter,
|
|
16809
16879
|
Interpreter: Interpreter,
|
|
16810
16880
|
Memory: Memory,
|
|
16811
16881
|
MemoryBuilder: MemoryBuilder,
|
|
@@ -17395,7 +17465,7 @@ class InterpreterInstanceManager {
|
|
|
17395
17465
|
}
|
|
17396
17466
|
}
|
|
17397
17467
|
|
|
17398
|
-
var index$
|
|
17468
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
17399
17469
|
__proto__: null,
|
|
17400
17470
|
HostCallMemory: HostCallMemory,
|
|
17401
17471
|
HostCallRegisters: HostCallRegisters,
|
|
@@ -17488,7 +17558,7 @@ const codecServiceAccountInfoWithThresholdBalance = codec$1.object({
|
|
|
17488
17558
|
parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
|
|
17489
17559
|
}, "ServiceAccountInfoWithThresholdBalance");
|
|
17490
17560
|
|
|
17491
|
-
var index$
|
|
17561
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17492
17562
|
__proto__: null,
|
|
17493
17563
|
AccumulationStateUpdate: AccumulationStateUpdate,
|
|
17494
17564
|
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
@@ -17643,154 +17713,9 @@ class Mountain {
|
|
|
17643
17713
|
}
|
|
17644
17714
|
}
|
|
17645
17715
|
|
|
17646
|
-
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17647
|
-
__proto__: null,
|
|
17648
|
-
MerkleMountainRange: MerkleMountainRange
|
|
17649
|
-
});
|
|
17650
|
-
|
|
17651
|
-
class DebuggerAdapter {
|
|
17652
|
-
pvm;
|
|
17653
|
-
constructor(useSbrkGas = false) {
|
|
17654
|
-
this.pvm = new Interpreter({ useSbrkGas });
|
|
17655
|
-
}
|
|
17656
|
-
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
17657
|
-
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
17658
|
-
}
|
|
17659
|
-
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
17660
|
-
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
17661
|
-
}
|
|
17662
|
-
getPageDump(pageNumber) {
|
|
17663
|
-
const page = this.pvm.getMemoryPage(pageNumber);
|
|
17664
|
-
if (page === null) {
|
|
17665
|
-
// page wasn't allocated so we return an empty page
|
|
17666
|
-
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
17667
|
-
}
|
|
17668
|
-
if (page.length === PAGE_SIZE$1) {
|
|
17669
|
-
// page was allocated and has a proper size so we can simply return it
|
|
17670
|
-
return page;
|
|
17671
|
-
}
|
|
17672
|
-
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
17673
|
-
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
17674
|
-
fullPage.set(page);
|
|
17675
|
-
return fullPage;
|
|
17676
|
-
}
|
|
17677
|
-
setMemory(address, value) {
|
|
17678
|
-
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
17679
|
-
}
|
|
17680
|
-
getExitArg() {
|
|
17681
|
-
return this.pvm.getExitParam() ?? 0;
|
|
17682
|
-
}
|
|
17683
|
-
getStatus() {
|
|
17684
|
-
return this.pvm.getStatus();
|
|
17685
|
-
}
|
|
17686
|
-
nextStep() {
|
|
17687
|
-
return this.pvm.nextStep() === Status.OK;
|
|
17688
|
-
}
|
|
17689
|
-
nSteps(steps) {
|
|
17690
|
-
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
17691
|
-
for (let i = 0; i < steps; i++) {
|
|
17692
|
-
const isOk = this.nextStep();
|
|
17693
|
-
if (!isOk) {
|
|
17694
|
-
return false;
|
|
17695
|
-
}
|
|
17696
|
-
}
|
|
17697
|
-
return true;
|
|
17698
|
-
}
|
|
17699
|
-
getRegisters() {
|
|
17700
|
-
return this.pvm.registers.getAllU64();
|
|
17701
|
-
}
|
|
17702
|
-
setRegisters(registers) {
|
|
17703
|
-
this.pvm.registers.copyFrom(new Registers(registers));
|
|
17704
|
-
}
|
|
17705
|
-
getProgramCounter() {
|
|
17706
|
-
return this.pvm.getPC();
|
|
17707
|
-
}
|
|
17708
|
-
setNextProgramCounter(nextPc) {
|
|
17709
|
-
this.pvm.setNextPC(nextPc);
|
|
17710
|
-
}
|
|
17711
|
-
getGasLeft() {
|
|
17712
|
-
return BigInt(this.pvm.gas.get());
|
|
17713
|
-
}
|
|
17714
|
-
setGasLeft(gas) {
|
|
17715
|
-
this.pvm.gas.set(tryAsGas(gas));
|
|
17716
|
-
}
|
|
17717
|
-
}
|
|
17718
|
-
|
|
17719
17716
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
17720
17717
|
__proto__: null,
|
|
17721
|
-
|
|
17722
|
-
ArgsDecoder: ArgsDecoder,
|
|
17723
|
-
get ArgumentType () { return ArgumentType; },
|
|
17724
|
-
BasicBlocks: BasicBlocks,
|
|
17725
|
-
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
17726
|
-
get EjectError () { return EjectError; },
|
|
17727
|
-
ExtendedWitdthImmediateDecoder: ExtendedWitdthImmediateDecoder,
|
|
17728
|
-
get ForgetPreimageError () { return ForgetPreimageError; },
|
|
17729
|
-
HostCallMemory: HostCallMemory,
|
|
17730
|
-
HostCallRegisters: HostCallRegisters,
|
|
17731
|
-
HostCallResult: HostCallResult,
|
|
17732
|
-
ImmediateDecoder: ImmediateDecoder,
|
|
17733
|
-
InsufficientFundsError: InsufficientFundsError,
|
|
17734
|
-
MachineInstance: MachineInstance,
|
|
17735
|
-
Mask: Mask,
|
|
17736
|
-
get MemoryOperation () { return MemoryOperation; },
|
|
17737
|
-
MemorySegment: MemorySegment,
|
|
17738
|
-
NO_OF_REGISTERS: NO_OF_REGISTERS$1,
|
|
17739
|
-
get NewServiceError () { return NewServiceError; },
|
|
17740
|
-
NibblesDecoder: NibblesDecoder,
|
|
17741
|
-
NoMachineError: NoMachineError,
|
|
17742
|
-
OK: OK,
|
|
17743
|
-
get PagesError () { return PagesError; },
|
|
17744
|
-
PartiallyUpdatedState: PartiallyUpdatedState,
|
|
17745
|
-
get PeekPokeError () { return PeekPokeError; },
|
|
17746
|
-
PendingTransfer: PendingTransfer,
|
|
17747
|
-
get PreimageStatusKind () { return PreimageStatusKind; },
|
|
17748
|
-
Program: Program,
|
|
17749
|
-
ProgramDecoder: ProgramDecoder,
|
|
17750
|
-
get ProvidePreimageError () { return ProvidePreimageError; },
|
|
17751
|
-
Pvm: DebuggerAdapter,
|
|
17752
|
-
Registers: Registers,
|
|
17753
|
-
get RequestPreimageError () { return RequestPreimageError; },
|
|
17754
|
-
Result: Result$1,
|
|
17755
|
-
SERVICE_ID_BYTES: SERVICE_ID_BYTES,
|
|
17756
|
-
SegmentExportError: SegmentExportError,
|
|
17757
|
-
SpiMemory: SpiMemory,
|
|
17758
|
-
SpiProgram: SpiProgram,
|
|
17759
|
-
TRANSFER_MEMO_BYTES: TRANSFER_MEMO_BYTES,
|
|
17760
|
-
get TransferError () { return TransferError; },
|
|
17761
|
-
UnprivilegedError: UnprivilegedError,
|
|
17762
|
-
get UpdatePrivilegesError () { return UpdatePrivilegesError; },
|
|
17763
|
-
WithDebug: WithDebug,
|
|
17764
|
-
get ZeroVoidError () { return ZeroVoidError; },
|
|
17765
|
-
asOpaqueType: asOpaqueType,
|
|
17766
|
-
assertEmpty: assertEmpty,
|
|
17767
|
-
assertNever: assertNever,
|
|
17768
|
-
block: index$m,
|
|
17769
|
-
bytes: index$t,
|
|
17770
|
-
check: check,
|
|
17771
|
-
clampU64ToU32: clampU64ToU32,
|
|
17772
|
-
createResults: createResults,
|
|
17773
|
-
decodeStandardProgram: decodeStandardProgram,
|
|
17774
|
-
emptyRegistersBuffer: emptyRegistersBuffer,
|
|
17775
|
-
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
17776
|
-
getServiceId: getServiceId,
|
|
17777
|
-
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
17778
|
-
hash: index$p,
|
|
17779
|
-
hostCallInfoAccount: codecServiceAccountInfoWithThresholdBalance,
|
|
17780
|
-
inspect: inspect,
|
|
17781
|
-
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
17782
|
-
interpreter: index$8,
|
|
17783
|
-
isBrowser: isBrowser,
|
|
17784
|
-
lazyInspect: lazyInspect,
|
|
17785
|
-
measure: measure,
|
|
17786
|
-
numbers: index$s,
|
|
17787
|
-
resultToString: resultToString,
|
|
17788
|
-
seeThrough: seeThrough,
|
|
17789
|
-
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
17790
|
-
toMemoryOperation: toMemoryOperation,
|
|
17791
|
-
tryAsMachineId: tryAsMachineId,
|
|
17792
|
-
tryAsProgramCounter: tryAsProgramCounter,
|
|
17793
|
-
writeServiceIdAsLeBytes: writeServiceIdAsLeBytes
|
|
17718
|
+
MerkleMountainRange: MerkleMountainRange
|
|
17794
17719
|
});
|
|
17795
17720
|
|
|
17796
17721
|
const ENTROPY_BYTES = 32;
|
|
@@ -18432,4 +18357,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
18432
18357
|
TransitionHasher: TransitionHasher
|
|
18433
18358
|
});
|
|
18434
18359
|
|
|
18435
|
-
export { index$
|
|
18360
|
+
export { index$l as block, index$j as block_json, index$s as bytes, index$q as codec, index$n as collections, index$m as config, index$h as config_node, index$p as crypto, index$d as database, index$c as erasure_coding, index$a as fuzz_proto, index$o as hash, index$5 as jam_host_calls, index$k as json_parser, index$i as logger, index$4 as mmr, index$r as numbers, index$t as ordering, index$7 as pvm, index$6 as pvm_host_calls, index$8 as pvm_program, index$9 as pvm_spi_decoder, index$3 as shuffling, index$g as state, index$2 as state_json, index$e as state_merkleization, index$1 as state_vectors, index as transition, index$f as trie, index$u as utils };
|