@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.cjs
CHANGED
|
@@ -19,7 +19,11 @@ var TestSuite;
|
|
|
19
19
|
})(TestSuite || (TestSuite = {}));
|
|
20
20
|
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
21
21
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Current version is set to track the jam-conformance testing.
|
|
24
|
+
* Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
|
|
25
|
+
*/
|
|
26
|
+
const DEFAULT_VERSION = GpVersion.V0_7_1;
|
|
23
27
|
const env$1 = typeof process === "undefined" ? {} : process.env;
|
|
24
28
|
let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
|
|
25
29
|
let CURRENT_SUITE = parseCurrentSuite(env$1.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
@@ -78,8 +82,8 @@ class Compatibility {
|
|
|
78
82
|
/**
|
|
79
83
|
* Allows selecting different values for different Gray Paper versions from one record.
|
|
80
84
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
85
|
+
* fallback The default value to return if no value is found for the current.
|
|
86
|
+
* versions A record mapping versions to values, checking if the version is greater or equal to the current version.
|
|
83
87
|
* @returns The value for the current version, or the default value.
|
|
84
88
|
*/
|
|
85
89
|
static selectIfGreaterOrEqual({ fallback, versions, }) {
|
|
@@ -239,7 +243,7 @@ const workspacePathFix = env.NODE_ENV === "development"
|
|
|
239
243
|
: () => (p) => p;
|
|
240
244
|
|
|
241
245
|
/**
|
|
242
|
-
*
|
|
246
|
+
* `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
|
|
243
247
|
* specified unique token Token. It means that base type cannot be assigned to unique type by accident.
|
|
244
248
|
* Good examples of opaque types include:
|
|
245
249
|
* - JWTs or other tokens - these are special kinds of string used for authorization purposes.
|
|
@@ -582,7 +586,7 @@ function isResult(x) {
|
|
|
582
586
|
* as an afterthought.
|
|
583
587
|
*/
|
|
584
588
|
|
|
585
|
-
var index$
|
|
589
|
+
var index$u = /*#__PURE__*/Object.freeze({
|
|
586
590
|
__proto__: null,
|
|
587
591
|
get CURRENT_SUITE () { return CURRENT_SUITE; },
|
|
588
592
|
get CURRENT_VERSION () { return CURRENT_VERSION; },
|
|
@@ -739,7 +743,7 @@ class Ordering {
|
|
|
739
743
|
}
|
|
740
744
|
}
|
|
741
745
|
|
|
742
|
-
var index$
|
|
746
|
+
var index$t = /*#__PURE__*/Object.freeze({
|
|
743
747
|
__proto__: null,
|
|
744
748
|
Ordering: Ordering
|
|
745
749
|
});
|
|
@@ -991,7 +995,7 @@ function u8ArraySameLengthEqual(self, other) {
|
|
|
991
995
|
}
|
|
992
996
|
const bytesBlobComparator = (a, b) => a.compare(b);
|
|
993
997
|
|
|
994
|
-
var index$
|
|
998
|
+
var index$s = /*#__PURE__*/Object.freeze({
|
|
995
999
|
__proto__: null,
|
|
996
1000
|
BitVec: BitVec,
|
|
997
1001
|
Bytes: Bytes,
|
|
@@ -1093,7 +1097,7 @@ const minU64 = (a, ...values) => values.reduce((min, value) => (value > min ? mi
|
|
|
1093
1097
|
/** Get the biggest value between U64 a and values given as input parameters. */
|
|
1094
1098
|
const maxU64 = (a, ...values) => values.reduce((max, value) => (value < max ? max : value), a);
|
|
1095
1099
|
|
|
1096
|
-
var index$
|
|
1100
|
+
var index$r = /*#__PURE__*/Object.freeze({
|
|
1097
1101
|
__proto__: null,
|
|
1098
1102
|
isU16: isU16,
|
|
1099
1103
|
isU32: isU32,
|
|
@@ -2532,7 +2536,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
2532
2536
|
}, skipper);
|
|
2533
2537
|
}
|
|
2534
2538
|
|
|
2535
|
-
var index$
|
|
2539
|
+
var index$q = /*#__PURE__*/Object.freeze({
|
|
2536
2540
|
__proto__: null,
|
|
2537
2541
|
Decoder: Decoder,
|
|
2538
2542
|
Descriptor: Descriptor,
|
|
@@ -3733,7 +3737,7 @@ var keyDerivation = /*#__PURE__*/Object.freeze({
|
|
|
3733
3737
|
trivialSeed: trivialSeed
|
|
3734
3738
|
});
|
|
3735
3739
|
|
|
3736
|
-
var index$
|
|
3740
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
3737
3741
|
__proto__: null,
|
|
3738
3742
|
BANDERSNATCH_KEY_BYTES: BANDERSNATCH_KEY_BYTES,
|
|
3739
3743
|
BANDERSNATCH_PROOF_BYTES: BANDERSNATCH_PROOF_BYTES,
|
|
@@ -4371,7 +4375,7 @@ var keccak = /*#__PURE__*/Object.freeze({
|
|
|
4371
4375
|
// TODO [ToDr] (#213) this should most likely be moved to a separate
|
|
4372
4376
|
// package to avoid pulling in unnecessary deps.
|
|
4373
4377
|
|
|
4374
|
-
var index$
|
|
4378
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
4375
4379
|
__proto__: null,
|
|
4376
4380
|
Blake2b: Blake2b,
|
|
4377
4381
|
HASH_SIZE: HASH_SIZE,
|
|
@@ -5008,7 +5012,7 @@ class TruncatedHashDictionary {
|
|
|
5008
5012
|
}
|
|
5009
5013
|
}
|
|
5010
5014
|
|
|
5011
|
-
var index$
|
|
5015
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
5012
5016
|
__proto__: null,
|
|
5013
5017
|
ArrayView: ArrayView,
|
|
5014
5018
|
FixedSizeArray: FixedSizeArray,
|
|
@@ -5195,7 +5199,7 @@ var PvmBackend;
|
|
|
5195
5199
|
PvmBackend[PvmBackend["Ananas"] = 1] = "Ananas";
|
|
5196
5200
|
})(PvmBackend || (PvmBackend = {}));
|
|
5197
5201
|
|
|
5198
|
-
var index$
|
|
5202
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
5199
5203
|
__proto__: null,
|
|
5200
5204
|
Bootnode: Bootnode,
|
|
5201
5205
|
ChainSpec: ChainSpec,
|
|
@@ -6702,7 +6706,7 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
6702
6706
|
return Decoder.decodeObject(codec.View, encoded, chainSpec);
|
|
6703
6707
|
}
|
|
6704
6708
|
|
|
6705
|
-
var index$
|
|
6709
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
6706
6710
|
__proto__: null,
|
|
6707
6711
|
Block: Block,
|
|
6708
6712
|
EpochMarker: EpochMarker,
|
|
@@ -6974,7 +6978,7 @@ var json;
|
|
|
6974
6978
|
json.object = object;
|
|
6975
6979
|
})(json || (json = {}));
|
|
6976
6980
|
|
|
6977
|
-
var index$
|
|
6981
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
6978
6982
|
__proto__: null,
|
|
6979
6983
|
get json () { return json; },
|
|
6980
6984
|
parseFromJson: parseFromJson
|
|
@@ -7244,7 +7248,7 @@ const blockFromJson = (spec) => json.object({
|
|
|
7244
7248
|
extrinsic: getExtrinsicFromJson(spec),
|
|
7245
7249
|
}, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
|
|
7246
7250
|
|
|
7247
|
-
var index$
|
|
7251
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
7248
7252
|
__proto__: null,
|
|
7249
7253
|
blockFromJson: blockFromJson,
|
|
7250
7254
|
disputesExtrinsicFromJson: disputesExtrinsicFromJson,
|
|
@@ -7738,7 +7742,7 @@ class Logger {
|
|
|
7738
7742
|
}
|
|
7739
7743
|
}
|
|
7740
7744
|
|
|
7741
|
-
var index$
|
|
7745
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
7742
7746
|
__proto__: null,
|
|
7743
7747
|
get Level () { return Level; },
|
|
7744
7748
|
Logger: Logger,
|
|
@@ -7953,7 +7957,7 @@ function isJsonObject(value) {
|
|
|
7953
7957
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7954
7958
|
}
|
|
7955
7959
|
|
|
7956
|
-
var index$
|
|
7960
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
7957
7961
|
__proto__: null,
|
|
7958
7962
|
DEFAULT_CONFIG: DEFAULT_CONFIG,
|
|
7959
7963
|
DEV_CONFIG: DEV_CONFIG,
|
|
@@ -9747,7 +9751,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
|
|
|
9747
9751
|
sortKeys: (a, b) => a - b,
|
|
9748
9752
|
});
|
|
9749
9753
|
|
|
9750
|
-
var index$
|
|
9754
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
9751
9755
|
__proto__: null,
|
|
9752
9756
|
AUTHORIZATION_QUEUE_SIZE: AUTHORIZATION_QUEUE_SIZE,
|
|
9753
9757
|
AccumulationOutput: AccumulationOutput,
|
|
@@ -10378,7 +10382,6 @@ class LeafNode {
|
|
|
10378
10382
|
/**
|
|
10379
10383
|
* Get the byte length of embedded value.
|
|
10380
10384
|
*
|
|
10381
|
-
* @remark
|
|
10382
10385
|
* Note in case this node only contains hash this is going to be 0.
|
|
10383
10386
|
*/
|
|
10384
10387
|
getValueLength() {
|
|
@@ -10389,7 +10392,6 @@ class LeafNode {
|
|
|
10389
10392
|
/**
|
|
10390
10393
|
* Returns the embedded value.
|
|
10391
10394
|
*
|
|
10392
|
-
* @remark
|
|
10393
10395
|
* Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
|
|
10394
10396
|
*/
|
|
10395
10397
|
getValue() {
|
|
@@ -10399,7 +10401,6 @@ class LeafNode {
|
|
|
10399
10401
|
/**
|
|
10400
10402
|
* Returns contained value hash.
|
|
10401
10403
|
*
|
|
10402
|
-
* @remark
|
|
10403
10404
|
* Note that for embedded value this is going to be full 0-padded 32 bytes.
|
|
10404
10405
|
*/
|
|
10405
10406
|
getValueHash() {
|
|
@@ -10821,7 +10822,7 @@ const bitLookup = [
|
|
|
10821
10822
|
[0b00000000, 8],
|
|
10822
10823
|
];
|
|
10823
10824
|
|
|
10824
|
-
var index$
|
|
10825
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
10825
10826
|
__proto__: null,
|
|
10826
10827
|
BranchNode: BranchNode,
|
|
10827
10828
|
InMemoryTrie: InMemoryTrie,
|
|
@@ -11188,7 +11189,7 @@ function loadState(spec, blake2b, entries) {
|
|
|
11188
11189
|
* hashmap of `key -> value` entries.
|
|
11189
11190
|
*/
|
|
11190
11191
|
|
|
11191
|
-
var index$
|
|
11192
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
11192
11193
|
__proto__: null,
|
|
11193
11194
|
SerializedService: SerializedService,
|
|
11194
11195
|
SerializedState: SerializedState,
|
|
@@ -11437,7 +11438,7 @@ class InMemoryStates {
|
|
|
11437
11438
|
async close() { }
|
|
11438
11439
|
}
|
|
11439
11440
|
|
|
11440
|
-
var index$
|
|
11441
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
11441
11442
|
__proto__: null,
|
|
11442
11443
|
InMemoryBlocks: InMemoryBlocks,
|
|
11443
11444
|
InMemorySerializedStates: InMemorySerializedStates,
|
|
@@ -11801,7 +11802,7 @@ const initEc = async () => {
|
|
|
11801
11802
|
await init.reedSolomon();
|
|
11802
11803
|
};
|
|
11803
11804
|
|
|
11804
|
-
var index$
|
|
11805
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
11805
11806
|
__proto__: null,
|
|
11806
11807
|
N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
|
|
11807
11808
|
N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
|
|
@@ -12235,7 +12236,7 @@ class FuzzTarget {
|
|
|
12235
12236
|
}
|
|
12236
12237
|
}
|
|
12237
12238
|
|
|
12238
|
-
var index$
|
|
12239
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
12239
12240
|
__proto__: null,
|
|
12240
12241
|
AncestryItem: AncestryItem,
|
|
12241
12242
|
ErrorMessage: ErrorMessage,
|
|
@@ -12253,9 +12254,9 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
12253
12254
|
stateRootCodec: stateRootCodec
|
|
12254
12255
|
});
|
|
12255
12256
|
|
|
12256
|
-
var index$
|
|
12257
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
12257
12258
|
__proto__: null,
|
|
12258
|
-
v1: index$
|
|
12259
|
+
v1: index$b
|
|
12259
12260
|
});
|
|
12260
12261
|
|
|
12261
12262
|
/** Size of the transfer memo. */
|
|
@@ -13118,42 +13119,6 @@ class HostCallsManager {
|
|
|
13118
13119
|
}
|
|
13119
13120
|
}
|
|
13120
13121
|
|
|
13121
|
-
/** Create a new gas counter instance depending on the gas value. */
|
|
13122
|
-
function gasCounter(gas) {
|
|
13123
|
-
return new GasCounterU64(tryAsU64(gas));
|
|
13124
|
-
}
|
|
13125
|
-
class GasCounterU64 {
|
|
13126
|
-
gas;
|
|
13127
|
-
initialGas;
|
|
13128
|
-
constructor(gas) {
|
|
13129
|
-
this.gas = gas;
|
|
13130
|
-
this.initialGas = tryAsGas(gas);
|
|
13131
|
-
}
|
|
13132
|
-
set(g) {
|
|
13133
|
-
this.gas = tryAsU64(g);
|
|
13134
|
-
}
|
|
13135
|
-
get() {
|
|
13136
|
-
return tryAsGas(this.gas);
|
|
13137
|
-
}
|
|
13138
|
-
sub(g) {
|
|
13139
|
-
const result = this.gas - tryAsU64(g);
|
|
13140
|
-
if (result >= 0n) {
|
|
13141
|
-
this.gas = tryAsU64(result);
|
|
13142
|
-
return false;
|
|
13143
|
-
}
|
|
13144
|
-
this.gas = tryAsU64(0n);
|
|
13145
|
-
return true;
|
|
13146
|
-
}
|
|
13147
|
-
used() {
|
|
13148
|
-
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
13149
|
-
// In we have less than zero left we assume that all gas has been consumed.
|
|
13150
|
-
if (gasConsumed < 0) {
|
|
13151
|
-
return this.initialGas;
|
|
13152
|
-
}
|
|
13153
|
-
return tryAsGas(gasConsumed);
|
|
13154
|
-
}
|
|
13155
|
-
}
|
|
13156
|
-
|
|
13157
13122
|
const tryAsMemoryIndex = (index) => {
|
|
13158
13123
|
check `${index >= 0 && index <= MAX_MEMORY_INDEX} Incorrect memory index: ${index}!`;
|
|
13159
13124
|
return asOpaqueType(index);
|
|
@@ -13876,7 +13841,7 @@ function getRegisters(argsLength) {
|
|
|
13876
13841
|
return regs;
|
|
13877
13842
|
}
|
|
13878
13843
|
|
|
13879
|
-
var index$
|
|
13844
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
13880
13845
|
__proto__: null,
|
|
13881
13846
|
MemorySegment: MemorySegment,
|
|
13882
13847
|
SpiMemory: SpiMemory,
|
|
@@ -13935,7 +13900,7 @@ function extractCodeAndMetadata(blobWithMetadata) {
|
|
|
13935
13900
|
return { metadata, code };
|
|
13936
13901
|
}
|
|
13937
13902
|
|
|
13938
|
-
var index$
|
|
13903
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
13939
13904
|
__proto__: null,
|
|
13940
13905
|
Program: Program,
|
|
13941
13906
|
extractCodeAndMetadata: extractCodeAndMetadata
|
|
@@ -14899,6 +14864,42 @@ class BasicBlocks {
|
|
|
14899
14864
|
}
|
|
14900
14865
|
}
|
|
14901
14866
|
|
|
14867
|
+
/** Create a new gas counter instance depending on the gas value. */
|
|
14868
|
+
function gasCounter(gas) {
|
|
14869
|
+
return new GasCounterU64(tryAsU64(gas));
|
|
14870
|
+
}
|
|
14871
|
+
class GasCounterU64 {
|
|
14872
|
+
gas;
|
|
14873
|
+
initialGas;
|
|
14874
|
+
constructor(gas) {
|
|
14875
|
+
this.gas = gas;
|
|
14876
|
+
this.initialGas = tryAsGas(gas);
|
|
14877
|
+
}
|
|
14878
|
+
set(g) {
|
|
14879
|
+
this.gas = tryAsU64(g);
|
|
14880
|
+
}
|
|
14881
|
+
get() {
|
|
14882
|
+
return tryAsGas(this.gas);
|
|
14883
|
+
}
|
|
14884
|
+
sub(g) {
|
|
14885
|
+
const result = this.gas - tryAsU64(g);
|
|
14886
|
+
if (result >= 0n) {
|
|
14887
|
+
this.gas = tryAsU64(result);
|
|
14888
|
+
return false;
|
|
14889
|
+
}
|
|
14890
|
+
this.gas = tryAsU64(0n);
|
|
14891
|
+
return true;
|
|
14892
|
+
}
|
|
14893
|
+
used() {
|
|
14894
|
+
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
14895
|
+
// In we have less than zero left we assume that all gas has been consumed.
|
|
14896
|
+
if (gasConsumed < 0) {
|
|
14897
|
+
return this.initialGas;
|
|
14898
|
+
}
|
|
14899
|
+
return tryAsGas(gasConsumed);
|
|
14900
|
+
}
|
|
14901
|
+
}
|
|
14902
|
+
|
|
14902
14903
|
const instructionGasMap = (() => {
|
|
14903
14904
|
const instructionGasMap = new Array(HIGHEST_INSTRUCTION_NUMBER + 1);
|
|
14904
14905
|
for (let i = 0; i < HIGHEST_INSTRUCTION_NUMBER + 1; i++) {
|
|
@@ -16807,8 +16808,77 @@ class Interpreter {
|
|
|
16807
16808
|
}
|
|
16808
16809
|
}
|
|
16809
16810
|
|
|
16810
|
-
|
|
16811
|
+
class DebuggerAdapter {
|
|
16812
|
+
pvm;
|
|
16813
|
+
constructor(useSbrkGas = false) {
|
|
16814
|
+
this.pvm = new Interpreter({ useSbrkGas });
|
|
16815
|
+
}
|
|
16816
|
+
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
16817
|
+
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
16818
|
+
}
|
|
16819
|
+
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
16820
|
+
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
16821
|
+
}
|
|
16822
|
+
getPageDump(pageNumber) {
|
|
16823
|
+
const page = this.pvm.getMemoryPage(pageNumber);
|
|
16824
|
+
if (page === null) {
|
|
16825
|
+
// page wasn't allocated so we return an empty page
|
|
16826
|
+
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
16827
|
+
}
|
|
16828
|
+
if (page.length === PAGE_SIZE$1) {
|
|
16829
|
+
// page was allocated and has a proper size so we can simply return it
|
|
16830
|
+
return page;
|
|
16831
|
+
}
|
|
16832
|
+
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
16833
|
+
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
16834
|
+
fullPage.set(page);
|
|
16835
|
+
return fullPage;
|
|
16836
|
+
}
|
|
16837
|
+
setMemory(address, value) {
|
|
16838
|
+
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
16839
|
+
}
|
|
16840
|
+
getExitArg() {
|
|
16841
|
+
return this.pvm.getExitParam() ?? 0;
|
|
16842
|
+
}
|
|
16843
|
+
getStatus() {
|
|
16844
|
+
return this.pvm.getStatus();
|
|
16845
|
+
}
|
|
16846
|
+
nextStep() {
|
|
16847
|
+
return this.pvm.nextStep() === Status.OK;
|
|
16848
|
+
}
|
|
16849
|
+
nSteps(steps) {
|
|
16850
|
+
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
16851
|
+
for (let i = 0; i < steps; i++) {
|
|
16852
|
+
const isOk = this.nextStep();
|
|
16853
|
+
if (!isOk) {
|
|
16854
|
+
return false;
|
|
16855
|
+
}
|
|
16856
|
+
}
|
|
16857
|
+
return true;
|
|
16858
|
+
}
|
|
16859
|
+
getRegisters() {
|
|
16860
|
+
return this.pvm.registers.getAllU64();
|
|
16861
|
+
}
|
|
16862
|
+
setRegisters(registers) {
|
|
16863
|
+
this.pvm.registers.copyFrom(new Registers(registers));
|
|
16864
|
+
}
|
|
16865
|
+
getProgramCounter() {
|
|
16866
|
+
return this.pvm.getPC();
|
|
16867
|
+
}
|
|
16868
|
+
setNextProgramCounter(nextPc) {
|
|
16869
|
+
this.pvm.setNextPC(nextPc);
|
|
16870
|
+
}
|
|
16871
|
+
getGasLeft() {
|
|
16872
|
+
return BigInt(this.pvm.gas.get());
|
|
16873
|
+
}
|
|
16874
|
+
setGasLeft(gas) {
|
|
16875
|
+
this.pvm.gas.set(tryAsGas(gas));
|
|
16876
|
+
}
|
|
16877
|
+
}
|
|
16878
|
+
|
|
16879
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
16811
16880
|
__proto__: null,
|
|
16881
|
+
DebuggerAdapter: DebuggerAdapter,
|
|
16812
16882
|
Interpreter: Interpreter,
|
|
16813
16883
|
Memory: Memory,
|
|
16814
16884
|
MemoryBuilder: MemoryBuilder,
|
|
@@ -17398,7 +17468,7 @@ class InterpreterInstanceManager {
|
|
|
17398
17468
|
}
|
|
17399
17469
|
}
|
|
17400
17470
|
|
|
17401
|
-
var index$
|
|
17471
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
17402
17472
|
__proto__: null,
|
|
17403
17473
|
HostCallMemory: HostCallMemory,
|
|
17404
17474
|
HostCallRegisters: HostCallRegisters,
|
|
@@ -17491,7 +17561,7 @@ const codecServiceAccountInfoWithThresholdBalance = codec$1.object({
|
|
|
17491
17561
|
parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
|
|
17492
17562
|
}, "ServiceAccountInfoWithThresholdBalance");
|
|
17493
17563
|
|
|
17494
|
-
var index$
|
|
17564
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17495
17565
|
__proto__: null,
|
|
17496
17566
|
AccumulationStateUpdate: AccumulationStateUpdate,
|
|
17497
17567
|
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
@@ -17646,154 +17716,9 @@ class Mountain {
|
|
|
17646
17716
|
}
|
|
17647
17717
|
}
|
|
17648
17718
|
|
|
17649
|
-
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17650
|
-
__proto__: null,
|
|
17651
|
-
MerkleMountainRange: MerkleMountainRange
|
|
17652
|
-
});
|
|
17653
|
-
|
|
17654
|
-
class DebuggerAdapter {
|
|
17655
|
-
pvm;
|
|
17656
|
-
constructor(useSbrkGas = false) {
|
|
17657
|
-
this.pvm = new Interpreter({ useSbrkGas });
|
|
17658
|
-
}
|
|
17659
|
-
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
17660
|
-
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
17661
|
-
}
|
|
17662
|
-
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
17663
|
-
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
17664
|
-
}
|
|
17665
|
-
getPageDump(pageNumber) {
|
|
17666
|
-
const page = this.pvm.getMemoryPage(pageNumber);
|
|
17667
|
-
if (page === null) {
|
|
17668
|
-
// page wasn't allocated so we return an empty page
|
|
17669
|
-
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
17670
|
-
}
|
|
17671
|
-
if (page.length === PAGE_SIZE$1) {
|
|
17672
|
-
// page was allocated and has a proper size so we can simply return it
|
|
17673
|
-
return page;
|
|
17674
|
-
}
|
|
17675
|
-
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
17676
|
-
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
17677
|
-
fullPage.set(page);
|
|
17678
|
-
return fullPage;
|
|
17679
|
-
}
|
|
17680
|
-
setMemory(address, value) {
|
|
17681
|
-
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
17682
|
-
}
|
|
17683
|
-
getExitArg() {
|
|
17684
|
-
return this.pvm.getExitParam() ?? 0;
|
|
17685
|
-
}
|
|
17686
|
-
getStatus() {
|
|
17687
|
-
return this.pvm.getStatus();
|
|
17688
|
-
}
|
|
17689
|
-
nextStep() {
|
|
17690
|
-
return this.pvm.nextStep() === Status.OK;
|
|
17691
|
-
}
|
|
17692
|
-
nSteps(steps) {
|
|
17693
|
-
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
17694
|
-
for (let i = 0; i < steps; i++) {
|
|
17695
|
-
const isOk = this.nextStep();
|
|
17696
|
-
if (!isOk) {
|
|
17697
|
-
return false;
|
|
17698
|
-
}
|
|
17699
|
-
}
|
|
17700
|
-
return true;
|
|
17701
|
-
}
|
|
17702
|
-
getRegisters() {
|
|
17703
|
-
return this.pvm.registers.getAllU64();
|
|
17704
|
-
}
|
|
17705
|
-
setRegisters(registers) {
|
|
17706
|
-
this.pvm.registers.copyFrom(new Registers(registers));
|
|
17707
|
-
}
|
|
17708
|
-
getProgramCounter() {
|
|
17709
|
-
return this.pvm.getPC();
|
|
17710
|
-
}
|
|
17711
|
-
setNextProgramCounter(nextPc) {
|
|
17712
|
-
this.pvm.setNextPC(nextPc);
|
|
17713
|
-
}
|
|
17714
|
-
getGasLeft() {
|
|
17715
|
-
return BigInt(this.pvm.gas.get());
|
|
17716
|
-
}
|
|
17717
|
-
setGasLeft(gas) {
|
|
17718
|
-
this.pvm.gas.set(tryAsGas(gas));
|
|
17719
|
-
}
|
|
17720
|
-
}
|
|
17721
|
-
|
|
17722
17719
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
17723
17720
|
__proto__: null,
|
|
17724
|
-
|
|
17725
|
-
ArgsDecoder: ArgsDecoder,
|
|
17726
|
-
get ArgumentType () { return ArgumentType; },
|
|
17727
|
-
BasicBlocks: BasicBlocks,
|
|
17728
|
-
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
17729
|
-
get EjectError () { return EjectError; },
|
|
17730
|
-
ExtendedWitdthImmediateDecoder: ExtendedWitdthImmediateDecoder,
|
|
17731
|
-
get ForgetPreimageError () { return ForgetPreimageError; },
|
|
17732
|
-
HostCallMemory: HostCallMemory,
|
|
17733
|
-
HostCallRegisters: HostCallRegisters,
|
|
17734
|
-
HostCallResult: HostCallResult,
|
|
17735
|
-
ImmediateDecoder: ImmediateDecoder,
|
|
17736
|
-
InsufficientFundsError: InsufficientFundsError,
|
|
17737
|
-
MachineInstance: MachineInstance,
|
|
17738
|
-
Mask: Mask,
|
|
17739
|
-
get MemoryOperation () { return MemoryOperation; },
|
|
17740
|
-
MemorySegment: MemorySegment,
|
|
17741
|
-
NO_OF_REGISTERS: NO_OF_REGISTERS$1,
|
|
17742
|
-
get NewServiceError () { return NewServiceError; },
|
|
17743
|
-
NibblesDecoder: NibblesDecoder,
|
|
17744
|
-
NoMachineError: NoMachineError,
|
|
17745
|
-
OK: OK,
|
|
17746
|
-
get PagesError () { return PagesError; },
|
|
17747
|
-
PartiallyUpdatedState: PartiallyUpdatedState,
|
|
17748
|
-
get PeekPokeError () { return PeekPokeError; },
|
|
17749
|
-
PendingTransfer: PendingTransfer,
|
|
17750
|
-
get PreimageStatusKind () { return PreimageStatusKind; },
|
|
17751
|
-
Program: Program,
|
|
17752
|
-
ProgramDecoder: ProgramDecoder,
|
|
17753
|
-
get ProvidePreimageError () { return ProvidePreimageError; },
|
|
17754
|
-
Pvm: DebuggerAdapter,
|
|
17755
|
-
Registers: Registers,
|
|
17756
|
-
get RequestPreimageError () { return RequestPreimageError; },
|
|
17757
|
-
Result: Result$1,
|
|
17758
|
-
SERVICE_ID_BYTES: SERVICE_ID_BYTES,
|
|
17759
|
-
SegmentExportError: SegmentExportError,
|
|
17760
|
-
SpiMemory: SpiMemory,
|
|
17761
|
-
SpiProgram: SpiProgram,
|
|
17762
|
-
TRANSFER_MEMO_BYTES: TRANSFER_MEMO_BYTES,
|
|
17763
|
-
get TransferError () { return TransferError; },
|
|
17764
|
-
UnprivilegedError: UnprivilegedError,
|
|
17765
|
-
get UpdatePrivilegesError () { return UpdatePrivilegesError; },
|
|
17766
|
-
WithDebug: WithDebug,
|
|
17767
|
-
get ZeroVoidError () { return ZeroVoidError; },
|
|
17768
|
-
asOpaqueType: asOpaqueType,
|
|
17769
|
-
assertEmpty: assertEmpty,
|
|
17770
|
-
assertNever: assertNever,
|
|
17771
|
-
block: index$m,
|
|
17772
|
-
bytes: index$t,
|
|
17773
|
-
check: check,
|
|
17774
|
-
clampU64ToU32: clampU64ToU32,
|
|
17775
|
-
createResults: createResults,
|
|
17776
|
-
decodeStandardProgram: decodeStandardProgram,
|
|
17777
|
-
emptyRegistersBuffer: emptyRegistersBuffer,
|
|
17778
|
-
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
17779
|
-
getServiceId: getServiceId,
|
|
17780
|
-
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
17781
|
-
hash: index$p,
|
|
17782
|
-
hostCallInfoAccount: codecServiceAccountInfoWithThresholdBalance,
|
|
17783
|
-
inspect: inspect,
|
|
17784
|
-
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
17785
|
-
interpreter: index$8,
|
|
17786
|
-
isBrowser: isBrowser,
|
|
17787
|
-
lazyInspect: lazyInspect,
|
|
17788
|
-
measure: measure,
|
|
17789
|
-
numbers: index$s,
|
|
17790
|
-
resultToString: resultToString,
|
|
17791
|
-
seeThrough: seeThrough,
|
|
17792
|
-
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
17793
|
-
toMemoryOperation: toMemoryOperation,
|
|
17794
|
-
tryAsMachineId: tryAsMachineId,
|
|
17795
|
-
tryAsProgramCounter: tryAsProgramCounter,
|
|
17796
|
-
writeServiceIdAsLeBytes: writeServiceIdAsLeBytes
|
|
17721
|
+
MerkleMountainRange: MerkleMountainRange
|
|
17797
17722
|
});
|
|
17798
17723
|
|
|
17799
17724
|
const ENTROPY_BYTES = 32;
|
|
@@ -18435,34 +18360,33 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
18435
18360
|
TransitionHasher: TransitionHasher
|
|
18436
18361
|
});
|
|
18437
18362
|
|
|
18438
|
-
exports.block = index$
|
|
18439
|
-
exports.block_json = index$
|
|
18440
|
-
exports.bytes = index$
|
|
18441
|
-
exports.codec = index$
|
|
18442
|
-
exports.collections = index$
|
|
18443
|
-
exports.config = index$
|
|
18444
|
-
exports.config_node = index$
|
|
18445
|
-
exports.crypto = index$
|
|
18446
|
-
exports.database = index$
|
|
18447
|
-
exports.erasure_coding = index$
|
|
18448
|
-
exports.fuzz_proto = index$
|
|
18449
|
-
exports.hash = index$
|
|
18450
|
-
exports.jam_host_calls = index$
|
|
18451
|
-
exports.json_parser = index$
|
|
18452
|
-
exports.logger = index$
|
|
18453
|
-
exports.mmr = index$
|
|
18454
|
-
exports.numbers = index$
|
|
18455
|
-
exports.ordering = index$
|
|
18456
|
-
exports.pvm = index$
|
|
18457
|
-
exports.pvm_host_calls = index$
|
|
18458
|
-
exports.
|
|
18459
|
-
exports.
|
|
18460
|
-
exports.pvm_spi_decoder = index$a;
|
|
18363
|
+
exports.block = index$l;
|
|
18364
|
+
exports.block_json = index$j;
|
|
18365
|
+
exports.bytes = index$s;
|
|
18366
|
+
exports.codec = index$q;
|
|
18367
|
+
exports.collections = index$n;
|
|
18368
|
+
exports.config = index$m;
|
|
18369
|
+
exports.config_node = index$h;
|
|
18370
|
+
exports.crypto = index$p;
|
|
18371
|
+
exports.database = index$d;
|
|
18372
|
+
exports.erasure_coding = index$c;
|
|
18373
|
+
exports.fuzz_proto = index$a;
|
|
18374
|
+
exports.hash = index$o;
|
|
18375
|
+
exports.jam_host_calls = index$5;
|
|
18376
|
+
exports.json_parser = index$k;
|
|
18377
|
+
exports.logger = index$i;
|
|
18378
|
+
exports.mmr = index$4;
|
|
18379
|
+
exports.numbers = index$r;
|
|
18380
|
+
exports.ordering = index$t;
|
|
18381
|
+
exports.pvm = index$7;
|
|
18382
|
+
exports.pvm_host_calls = index$6;
|
|
18383
|
+
exports.pvm_program = index$8;
|
|
18384
|
+
exports.pvm_spi_decoder = index$9;
|
|
18461
18385
|
exports.shuffling = index$3;
|
|
18462
|
-
exports.state = index$
|
|
18386
|
+
exports.state = index$g;
|
|
18463
18387
|
exports.state_json = index$2;
|
|
18464
|
-
exports.state_merkleization = index$
|
|
18388
|
+
exports.state_merkleization = index$e;
|
|
18465
18389
|
exports.state_vectors = index$1;
|
|
18466
18390
|
exports.transition = index;
|
|
18467
|
-
exports.trie = index$
|
|
18468
|
-
exports.utils = index$
|
|
18391
|
+
exports.trie = index$f;
|
|
18392
|
+
exports.utils = index$u;
|