@typeberry/lib 0.4.0-2473e55 → 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 +164 -165
- package/index.d.ts +936 -936
- package/index.js +139 -139
- 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;
|
|
@@ -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,
|
|
@@ -10815,7 +10819,7 @@ const bitLookup = [
|
|
|
10815
10819
|
[0b00000000, 8],
|
|
10816
10820
|
];
|
|
10817
10821
|
|
|
10818
|
-
var index$
|
|
10822
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
10819
10823
|
__proto__: null,
|
|
10820
10824
|
BranchNode: BranchNode,
|
|
10821
10825
|
InMemoryTrie: InMemoryTrie,
|
|
@@ -11182,7 +11186,7 @@ function loadState(spec, blake2b, entries) {
|
|
|
11182
11186
|
* hashmap of `key -> value` entries.
|
|
11183
11187
|
*/
|
|
11184
11188
|
|
|
11185
|
-
var index$
|
|
11189
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
11186
11190
|
__proto__: null,
|
|
11187
11191
|
SerializedService: SerializedService,
|
|
11188
11192
|
SerializedState: SerializedState,
|
|
@@ -11431,7 +11435,7 @@ class InMemoryStates {
|
|
|
11431
11435
|
async close() { }
|
|
11432
11436
|
}
|
|
11433
11437
|
|
|
11434
|
-
var index$
|
|
11438
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
11435
11439
|
__proto__: null,
|
|
11436
11440
|
InMemoryBlocks: InMemoryBlocks,
|
|
11437
11441
|
InMemorySerializedStates: InMemorySerializedStates,
|
|
@@ -11795,7 +11799,7 @@ const initEc = async () => {
|
|
|
11795
11799
|
await init.reedSolomon();
|
|
11796
11800
|
};
|
|
11797
11801
|
|
|
11798
|
-
var index$
|
|
11802
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
11799
11803
|
__proto__: null,
|
|
11800
11804
|
N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
|
|
11801
11805
|
N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
|
|
@@ -12229,7 +12233,7 @@ class FuzzTarget {
|
|
|
12229
12233
|
}
|
|
12230
12234
|
}
|
|
12231
12235
|
|
|
12232
|
-
var index$
|
|
12236
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
12233
12237
|
__proto__: null,
|
|
12234
12238
|
AncestryItem: AncestryItem,
|
|
12235
12239
|
ErrorMessage: ErrorMessage,
|
|
@@ -12247,9 +12251,9 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
12247
12251
|
stateRootCodec: stateRootCodec
|
|
12248
12252
|
});
|
|
12249
12253
|
|
|
12250
|
-
var index$
|
|
12254
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
12251
12255
|
__proto__: null,
|
|
12252
|
-
v1: index$
|
|
12256
|
+
v1: index$b
|
|
12253
12257
|
});
|
|
12254
12258
|
|
|
12255
12259
|
/** Size of the transfer memo. */
|
|
@@ -13112,42 +13116,6 @@ class HostCallsManager {
|
|
|
13112
13116
|
}
|
|
13113
13117
|
}
|
|
13114
13118
|
|
|
13115
|
-
/** Create a new gas counter instance depending on the gas value. */
|
|
13116
|
-
function gasCounter(gas) {
|
|
13117
|
-
return new GasCounterU64(tryAsU64(gas));
|
|
13118
|
-
}
|
|
13119
|
-
class GasCounterU64 {
|
|
13120
|
-
gas;
|
|
13121
|
-
initialGas;
|
|
13122
|
-
constructor(gas) {
|
|
13123
|
-
this.gas = gas;
|
|
13124
|
-
this.initialGas = tryAsGas(gas);
|
|
13125
|
-
}
|
|
13126
|
-
set(g) {
|
|
13127
|
-
this.gas = tryAsU64(g);
|
|
13128
|
-
}
|
|
13129
|
-
get() {
|
|
13130
|
-
return tryAsGas(this.gas);
|
|
13131
|
-
}
|
|
13132
|
-
sub(g) {
|
|
13133
|
-
const result = this.gas - tryAsU64(g);
|
|
13134
|
-
if (result >= 0n) {
|
|
13135
|
-
this.gas = tryAsU64(result);
|
|
13136
|
-
return false;
|
|
13137
|
-
}
|
|
13138
|
-
this.gas = tryAsU64(0n);
|
|
13139
|
-
return true;
|
|
13140
|
-
}
|
|
13141
|
-
used() {
|
|
13142
|
-
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
13143
|
-
// In we have less than zero left we assume that all gas has been consumed.
|
|
13144
|
-
if (gasConsumed < 0) {
|
|
13145
|
-
return this.initialGas;
|
|
13146
|
-
}
|
|
13147
|
-
return tryAsGas(gasConsumed);
|
|
13148
|
-
}
|
|
13149
|
-
}
|
|
13150
|
-
|
|
13151
13119
|
const tryAsMemoryIndex = (index) => {
|
|
13152
13120
|
check `${index >= 0 && index <= MAX_MEMORY_INDEX} Incorrect memory index: ${index}!`;
|
|
13153
13121
|
return asOpaqueType(index);
|
|
@@ -13870,7 +13838,7 @@ function getRegisters(argsLength) {
|
|
|
13870
13838
|
return regs;
|
|
13871
13839
|
}
|
|
13872
13840
|
|
|
13873
|
-
var index$
|
|
13841
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
13874
13842
|
__proto__: null,
|
|
13875
13843
|
MemorySegment: MemorySegment,
|
|
13876
13844
|
SpiMemory: SpiMemory,
|
|
@@ -13929,7 +13897,7 @@ function extractCodeAndMetadata(blobWithMetadata) {
|
|
|
13929
13897
|
return { metadata, code };
|
|
13930
13898
|
}
|
|
13931
13899
|
|
|
13932
|
-
var index$
|
|
13900
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
13933
13901
|
__proto__: null,
|
|
13934
13902
|
Program: Program,
|
|
13935
13903
|
extractCodeAndMetadata: extractCodeAndMetadata
|
|
@@ -14893,6 +14861,42 @@ class BasicBlocks {
|
|
|
14893
14861
|
}
|
|
14894
14862
|
}
|
|
14895
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
|
+
|
|
14896
14900
|
const instructionGasMap = (() => {
|
|
14897
14901
|
const instructionGasMap = new Array(HIGHEST_INSTRUCTION_NUMBER + 1);
|
|
14898
14902
|
for (let i = 0; i < HIGHEST_INSTRUCTION_NUMBER + 1; i++) {
|
|
@@ -16801,8 +16805,77 @@ class Interpreter {
|
|
|
16801
16805
|
}
|
|
16802
16806
|
}
|
|
16803
16807
|
|
|
16804
|
-
|
|
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({
|
|
16805
16877
|
__proto__: null,
|
|
16878
|
+
DebuggerAdapter: DebuggerAdapter,
|
|
16806
16879
|
Interpreter: Interpreter,
|
|
16807
16880
|
Memory: Memory,
|
|
16808
16881
|
MemoryBuilder: MemoryBuilder,
|
|
@@ -17392,7 +17465,7 @@ class InterpreterInstanceManager {
|
|
|
17392
17465
|
}
|
|
17393
17466
|
}
|
|
17394
17467
|
|
|
17395
|
-
var index$
|
|
17468
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
17396
17469
|
__proto__: null,
|
|
17397
17470
|
HostCallMemory: HostCallMemory,
|
|
17398
17471
|
HostCallRegisters: HostCallRegisters,
|
|
@@ -17485,7 +17558,7 @@ const codecServiceAccountInfoWithThresholdBalance = codec$1.object({
|
|
|
17485
17558
|
parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
|
|
17486
17559
|
}, "ServiceAccountInfoWithThresholdBalance");
|
|
17487
17560
|
|
|
17488
|
-
var index$
|
|
17561
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17489
17562
|
__proto__: null,
|
|
17490
17563
|
AccumulationStateUpdate: AccumulationStateUpdate,
|
|
17491
17564
|
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
@@ -17640,82 +17713,9 @@ class Mountain {
|
|
|
17640
17713
|
}
|
|
17641
17714
|
}
|
|
17642
17715
|
|
|
17643
|
-
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17644
|
-
__proto__: null,
|
|
17645
|
-
MerkleMountainRange: MerkleMountainRange
|
|
17646
|
-
});
|
|
17647
|
-
|
|
17648
|
-
class DebuggerAdapter {
|
|
17649
|
-
pvm;
|
|
17650
|
-
constructor(useSbrkGas = false) {
|
|
17651
|
-
this.pvm = new Interpreter({ useSbrkGas });
|
|
17652
|
-
}
|
|
17653
|
-
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
17654
|
-
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
17655
|
-
}
|
|
17656
|
-
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
17657
|
-
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
17658
|
-
}
|
|
17659
|
-
getPageDump(pageNumber) {
|
|
17660
|
-
const page = this.pvm.getMemoryPage(pageNumber);
|
|
17661
|
-
if (page === null) {
|
|
17662
|
-
// page wasn't allocated so we return an empty page
|
|
17663
|
-
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
17664
|
-
}
|
|
17665
|
-
if (page.length === PAGE_SIZE$1) {
|
|
17666
|
-
// page was allocated and has a proper size so we can simply return it
|
|
17667
|
-
return page;
|
|
17668
|
-
}
|
|
17669
|
-
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
17670
|
-
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
17671
|
-
fullPage.set(page);
|
|
17672
|
-
return fullPage;
|
|
17673
|
-
}
|
|
17674
|
-
setMemory(address, value) {
|
|
17675
|
-
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
17676
|
-
}
|
|
17677
|
-
getExitArg() {
|
|
17678
|
-
return this.pvm.getExitParam() ?? 0;
|
|
17679
|
-
}
|
|
17680
|
-
getStatus() {
|
|
17681
|
-
return this.pvm.getStatus();
|
|
17682
|
-
}
|
|
17683
|
-
nextStep() {
|
|
17684
|
-
return this.pvm.nextStep() === Status.OK;
|
|
17685
|
-
}
|
|
17686
|
-
nSteps(steps) {
|
|
17687
|
-
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
17688
|
-
for (let i = 0; i < steps; i++) {
|
|
17689
|
-
const isOk = this.nextStep();
|
|
17690
|
-
if (!isOk) {
|
|
17691
|
-
return false;
|
|
17692
|
-
}
|
|
17693
|
-
}
|
|
17694
|
-
return true;
|
|
17695
|
-
}
|
|
17696
|
-
getRegisters() {
|
|
17697
|
-
return this.pvm.registers.getAllU64();
|
|
17698
|
-
}
|
|
17699
|
-
setRegisters(registers) {
|
|
17700
|
-
this.pvm.registers.copyFrom(new Registers(registers));
|
|
17701
|
-
}
|
|
17702
|
-
getProgramCounter() {
|
|
17703
|
-
return this.pvm.getPC();
|
|
17704
|
-
}
|
|
17705
|
-
setNextProgramCounter(nextPc) {
|
|
17706
|
-
this.pvm.setNextPC(nextPc);
|
|
17707
|
-
}
|
|
17708
|
-
getGasLeft() {
|
|
17709
|
-
return BigInt(this.pvm.gas.get());
|
|
17710
|
-
}
|
|
17711
|
-
setGasLeft(gas) {
|
|
17712
|
-
this.pvm.gas.set(tryAsGas(gas));
|
|
17713
|
-
}
|
|
17714
|
-
}
|
|
17715
|
-
|
|
17716
17716
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
17717
17717
|
__proto__: null,
|
|
17718
|
-
|
|
17718
|
+
MerkleMountainRange: MerkleMountainRange
|
|
17719
17719
|
});
|
|
17720
17720
|
|
|
17721
17721
|
const ENTROPY_BYTES = 32;
|
|
@@ -18357,4 +18357,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
18357
18357
|
TransitionHasher: TransitionHasher
|
|
18358
18358
|
});
|
|
18359
18359
|
|
|
18360
|
-
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 };
|