@typeberry/lib 0.4.0 → 0.4.1-0a3acb2
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 +725 -342
- package/index.d.ts +1468 -1410
- package/index.js +700 -316
- 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,
|
|
@@ -4420,8 +4424,434 @@ class ArrayView {
|
|
|
4420
4424
|
}
|
|
4421
4425
|
}
|
|
4422
4426
|
|
|
4423
|
-
/** A map which uses
|
|
4424
|
-
class
|
|
4427
|
+
/** A map which uses byte blobs as keys */
|
|
4428
|
+
class BlobDictionary extends WithDebug {
|
|
4429
|
+
mapNodeThreshold;
|
|
4430
|
+
/**
|
|
4431
|
+
* The root node of the dictionary.
|
|
4432
|
+
*
|
|
4433
|
+
* This is the main internal data structure that organizes entries
|
|
4434
|
+
* in a tree-like fashion (array-based nodes up to `mapNodeThreshold`,
|
|
4435
|
+
* map-based nodes beyond it). All insertions, updates, and deletions
|
|
4436
|
+
* operate through this structure.
|
|
4437
|
+
*/
|
|
4438
|
+
root = Node.withList();
|
|
4439
|
+
/**
|
|
4440
|
+
* Auxiliary map that stores references to the original keys and their values.
|
|
4441
|
+
*
|
|
4442
|
+
* - Overriding a value in the main structure does not replace the original key reference.
|
|
4443
|
+
* - Used for efficient iteration over `keys()`, `values()`, `entries()`, and computing `size`.
|
|
4444
|
+
*/
|
|
4445
|
+
keyvals = new Map();
|
|
4446
|
+
/**
|
|
4447
|
+
* Protected constructor used internally by `BlobDictionary.new`
|
|
4448
|
+
* and `BlobDictionary.fromEntries`.
|
|
4449
|
+
*
|
|
4450
|
+
* This enforces controlled instantiation — users should create instances
|
|
4451
|
+
* through the provided static factory methods instead of calling the
|
|
4452
|
+
* constructor directly.
|
|
4453
|
+
*
|
|
4454
|
+
* @param mapNodeThreshold - The threshold that determines when the dictionary
|
|
4455
|
+
* switches from using an array-based (`ListChildren`) node to a map-based (`MapChildren`) node for storing entries.
|
|
4456
|
+
*/
|
|
4457
|
+
constructor(mapNodeThreshold) {
|
|
4458
|
+
super();
|
|
4459
|
+
this.mapNodeThreshold = mapNodeThreshold;
|
|
4460
|
+
}
|
|
4461
|
+
/**
|
|
4462
|
+
* Returns the number of entries in the dictionary.
|
|
4463
|
+
*
|
|
4464
|
+
* The count is derived from the auxiliary `keyvals` map, which stores
|
|
4465
|
+
* all original key references and their associated values. This ensures
|
|
4466
|
+
* that the `size` reflects the actual number of entries, independent of
|
|
4467
|
+
* internal overrides in the main `root` structure.
|
|
4468
|
+
*
|
|
4469
|
+
* @returns The total number of entries in the dictionary.
|
|
4470
|
+
*/
|
|
4471
|
+
get size() {
|
|
4472
|
+
return this.keyvals.size;
|
|
4473
|
+
}
|
|
4474
|
+
[TEST_COMPARE_USING]() {
|
|
4475
|
+
const vals = Array.from(this);
|
|
4476
|
+
vals.sort((a, b) => a[0].compare(b[0]).value);
|
|
4477
|
+
return vals;
|
|
4478
|
+
}
|
|
4479
|
+
/**
|
|
4480
|
+
* Creates an empty `BlobDictionary`.
|
|
4481
|
+
*
|
|
4482
|
+
* @param mapNodeThreshold - The threshold that determines when the dictionary
|
|
4483
|
+
* switches from using an array-based (`ListChildren`) node to a map-based (`MapChildren`) node for storing entries.
|
|
4484
|
+
* Defaults to `0`.
|
|
4485
|
+
*
|
|
4486
|
+
* @returns A new, empty `BlobDictionary` instance.
|
|
4487
|
+
*/
|
|
4488
|
+
static new(mapNodeThreshold = 0) {
|
|
4489
|
+
return new BlobDictionary(mapNodeThreshold);
|
|
4490
|
+
}
|
|
4491
|
+
/**
|
|
4492
|
+
* Creates a new `BlobDictionary` initialized with the given entries.
|
|
4493
|
+
*
|
|
4494
|
+
* @param entries - An array of `[key, value]` pairs used to populate the dictionary.
|
|
4495
|
+
* @param mapNodeThreshold - The threshold that determines when the dictionary
|
|
4496
|
+
* switches from using an array-based (`ListChildren`) node to a map-based (`MapChildren`) node for storing entries.
|
|
4497
|
+
* Defaults to `0`.
|
|
4498
|
+
*
|
|
4499
|
+
* @returns A new `BlobDictionary` containing the provided entries.
|
|
4500
|
+
*/
|
|
4501
|
+
static fromEntries(entries, mapNodeThreshold) {
|
|
4502
|
+
const dict = BlobDictionary.new(mapNodeThreshold);
|
|
4503
|
+
for (const [key, value] of entries) {
|
|
4504
|
+
dict.set(key, value);
|
|
4505
|
+
}
|
|
4506
|
+
return dict;
|
|
4507
|
+
}
|
|
4508
|
+
/**
|
|
4509
|
+
* Internal helper that inserts, updates or deletes an entry in the dictionary.
|
|
4510
|
+
*
|
|
4511
|
+
* Behaviour details:
|
|
4512
|
+
* - Passing `undefined` as `value` indicates a deletion. (E.g. `delete` uses `internalSet(key, undefined)`.)
|
|
4513
|
+
* - When an add (new entry) or a delete actually changes the structure, the method returns the affected leaf node.
|
|
4514
|
+
* - When the call only overrides an existing value (no structural add/delete), the method returns `null`.
|
|
4515
|
+
*
|
|
4516
|
+
* This method is intended for internal use by the dictionary implementation and allows `undefined` as a
|
|
4517
|
+
* sentinel value to signal removals.
|
|
4518
|
+
*
|
|
4519
|
+
* @param key - The key to insert, update or remove.
|
|
4520
|
+
* @param value - The value to associate with the key, or `undefined` to remove the key.
|
|
4521
|
+
* @returns The leaf node created or removed on add/delete, or `null` if the operation only overwrote an existing value.
|
|
4522
|
+
*/
|
|
4523
|
+
internalSet(key, value) {
|
|
4524
|
+
let node = this.root;
|
|
4525
|
+
const keyChunkGenerator = key.chunks(CHUNK_SIZE);
|
|
4526
|
+
let depth = 0;
|
|
4527
|
+
for (;;) {
|
|
4528
|
+
const maybeKeyChunk = keyChunkGenerator.next().value;
|
|
4529
|
+
if (maybeKeyChunk === undefined) {
|
|
4530
|
+
if (value === undefined) {
|
|
4531
|
+
return node.remove(key);
|
|
4532
|
+
}
|
|
4533
|
+
return node.set(key, value);
|
|
4534
|
+
}
|
|
4535
|
+
const keyChunk = asOpaqueType(maybeKeyChunk);
|
|
4536
|
+
if (node.children instanceof ListChildren) {
|
|
4537
|
+
const subkey = BytesBlob.blobFrom(key.raw.subarray(CHUNK_SIZE * depth));
|
|
4538
|
+
const leaf = value !== undefined ? node.children.insert(subkey, { key, value }) : node.children.remove(subkey);
|
|
4539
|
+
if (subkey.length > CHUNK_SIZE && node.children.children.length > this.mapNodeThreshold) {
|
|
4540
|
+
node.convertListChildrenToMap();
|
|
4541
|
+
}
|
|
4542
|
+
return leaf;
|
|
4543
|
+
}
|
|
4544
|
+
depth += 1;
|
|
4545
|
+
const children = node.children;
|
|
4546
|
+
if (children instanceof ListChildren) {
|
|
4547
|
+
throw new Error("We handle list node earlier. If we fall through, we know it's for the `Map` case.");
|
|
4548
|
+
}
|
|
4549
|
+
if (children instanceof MapChildren) {
|
|
4550
|
+
const maybeNode = children.getChild(keyChunk);
|
|
4551
|
+
if (maybeNode !== undefined) {
|
|
4552
|
+
// simply go one level deeper
|
|
4553
|
+
node = maybeNode;
|
|
4554
|
+
}
|
|
4555
|
+
else {
|
|
4556
|
+
// we are trying to remove an item, but it does not exist
|
|
4557
|
+
if (value === undefined) {
|
|
4558
|
+
return null;
|
|
4559
|
+
}
|
|
4560
|
+
// no more child nodes, we insert a new one.
|
|
4561
|
+
const newNode = Node.withList();
|
|
4562
|
+
children.setChild(keyChunk, newNode);
|
|
4563
|
+
node = newNode;
|
|
4564
|
+
}
|
|
4565
|
+
continue;
|
|
4566
|
+
}
|
|
4567
|
+
assertNever(children);
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
/**
|
|
4571
|
+
* Adds a new entry to the dictionary or updates the value of an existing key.
|
|
4572
|
+
*
|
|
4573
|
+
* If an entry with the given key already exists, its value is replaced
|
|
4574
|
+
* with the new one.
|
|
4575
|
+
*
|
|
4576
|
+
* @param key - The key to add or update in the dictionary.
|
|
4577
|
+
* @param value - The value to associate with the specified key.
|
|
4578
|
+
* @returns Nothing (`void`).
|
|
4579
|
+
*/
|
|
4580
|
+
set(key, value) {
|
|
4581
|
+
const leaf = this.internalSet(key, value);
|
|
4582
|
+
if (leaf !== null) {
|
|
4583
|
+
this.keyvals.set(leaf.key, leaf);
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4586
|
+
/**
|
|
4587
|
+
* Retrieves the value associated with the given key from the dictionary.
|
|
4588
|
+
*
|
|
4589
|
+
* If the key does not exist, this method returns `undefined`.
|
|
4590
|
+
*
|
|
4591
|
+
* @param key - The key whose associated value should be retrieved.
|
|
4592
|
+
* @returns The value associated with the specified key, or `undefined` if the key is not present.
|
|
4593
|
+
*/
|
|
4594
|
+
get(key) {
|
|
4595
|
+
let node = this.root;
|
|
4596
|
+
const pathChunksGenerator = key.chunks(CHUNK_SIZE);
|
|
4597
|
+
let depth = 0;
|
|
4598
|
+
while (node !== undefined) {
|
|
4599
|
+
const maybePathChunk = pathChunksGenerator.next().value;
|
|
4600
|
+
if (node.children instanceof ListChildren) {
|
|
4601
|
+
const subkey = BytesBlob.blobFrom(key.raw.subarray(depth * CHUNK_SIZE));
|
|
4602
|
+
const child = node.children.find(subkey);
|
|
4603
|
+
if (child !== null) {
|
|
4604
|
+
return child.value;
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
if (maybePathChunk === undefined) {
|
|
4608
|
+
return node.getLeaf()?.value;
|
|
4609
|
+
}
|
|
4610
|
+
if (node.children instanceof MapChildren) {
|
|
4611
|
+
const pathChunk = asOpaqueType(maybePathChunk);
|
|
4612
|
+
node = node.children.getChild(pathChunk);
|
|
4613
|
+
depth += 1;
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
return undefined;
|
|
4617
|
+
}
|
|
4618
|
+
/**
|
|
4619
|
+
* Checks whether the dictionary contains an entry for the given key.
|
|
4620
|
+
*
|
|
4621
|
+
* ⚠️ **Note:** Avoid using `has(...)` together with `get(...)` in a pattern like this:
|
|
4622
|
+
*
|
|
4623
|
+
* ```ts
|
|
4624
|
+
* if (dict.has(key)) {
|
|
4625
|
+
* const value = dict.get(key);
|
|
4626
|
+
* ...
|
|
4627
|
+
* }
|
|
4628
|
+
* ```
|
|
4629
|
+
*
|
|
4630
|
+
* This approach performs two lookups for the same key.
|
|
4631
|
+
*
|
|
4632
|
+
* Instead, prefer the following pattern, which retrieves the value once:
|
|
4633
|
+
*
|
|
4634
|
+
* ```ts
|
|
4635
|
+
* const value = dict.get(key);
|
|
4636
|
+
* if (value !== undefined) {
|
|
4637
|
+
* ...
|
|
4638
|
+
* }
|
|
4639
|
+
* ```
|
|
4640
|
+
*
|
|
4641
|
+
* @param key - The key to check for.
|
|
4642
|
+
* @returns `true` if the dictionary contains an entry for the given key, otherwise `false`.
|
|
4643
|
+
*/
|
|
4644
|
+
has(key) {
|
|
4645
|
+
return this.get(key) !== undefined;
|
|
4646
|
+
}
|
|
4647
|
+
/**
|
|
4648
|
+
* Removes an entry with the specified key from the dictionary.
|
|
4649
|
+
*
|
|
4650
|
+
* Internally, this calls {@link internalSet} with `undefined` to mark the entry as deleted.
|
|
4651
|
+
*
|
|
4652
|
+
* @param key - The key of the entry to remove.
|
|
4653
|
+
* @returns `true` if an entry was removed (i.e. the key existed), otherwise `false`.
|
|
4654
|
+
*/
|
|
4655
|
+
delete(key) {
|
|
4656
|
+
const leaf = this.internalSet(key, undefined);
|
|
4657
|
+
if (leaf !== null) {
|
|
4658
|
+
this.keyvals.delete(leaf.key);
|
|
4659
|
+
return true;
|
|
4660
|
+
}
|
|
4661
|
+
return false;
|
|
4662
|
+
}
|
|
4663
|
+
/**
|
|
4664
|
+
* Returns an iterator over the keys in the dictionary.
|
|
4665
|
+
*
|
|
4666
|
+
* The iterator yields each key in insertion order.
|
|
4667
|
+
*
|
|
4668
|
+
* @returns An iterator over all keys in the dictionary.
|
|
4669
|
+
*/
|
|
4670
|
+
keys() {
|
|
4671
|
+
return this.keyvals.keys();
|
|
4672
|
+
}
|
|
4673
|
+
/**
|
|
4674
|
+
* Returns an iterator over the values in the dictionary.
|
|
4675
|
+
*
|
|
4676
|
+
* The iterator yields each value in insertion order.
|
|
4677
|
+
*
|
|
4678
|
+
* @returns An iterator over all values in the dictionary.
|
|
4679
|
+
*/
|
|
4680
|
+
*values() {
|
|
4681
|
+
for (const leaf of this.keyvals.values()) {
|
|
4682
|
+
yield leaf.value;
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
/**
|
|
4686
|
+
* Returns an iterator over the `[key, value]` pairs in the dictionary.
|
|
4687
|
+
*
|
|
4688
|
+
* The iterator yields entries in insertion order.
|
|
4689
|
+
*
|
|
4690
|
+
* @returns An iterator over `[key, value]` tuples for each entry in the dictionary.
|
|
4691
|
+
*/
|
|
4692
|
+
*entries() {
|
|
4693
|
+
for (const leaf of this.keyvals.values()) {
|
|
4694
|
+
yield [leaf.key, leaf.value];
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
/**
|
|
4698
|
+
* Default iterator for the dictionary.
|
|
4699
|
+
*
|
|
4700
|
+
* Equivalent to calling {@link entries}.
|
|
4701
|
+
* Enables iteration with `for...of`:
|
|
4702
|
+
*
|
|
4703
|
+
* ```ts
|
|
4704
|
+
* for (const [key, value] of dict) {
|
|
4705
|
+
* ...
|
|
4706
|
+
* }
|
|
4707
|
+
* ```
|
|
4708
|
+
*
|
|
4709
|
+
* @returns An iterator over `[key, value]` pairs.
|
|
4710
|
+
*/
|
|
4711
|
+
[Symbol.iterator]() {
|
|
4712
|
+
return this.entries();
|
|
4713
|
+
}
|
|
4714
|
+
/**
|
|
4715
|
+
* Creates a new sorted array of values, ordered by their corresponding keys.
|
|
4716
|
+
*
|
|
4717
|
+
* Iterates over all entries in the dictionary and sorts them according
|
|
4718
|
+
* to the provided comparator function applied to the keys.
|
|
4719
|
+
*
|
|
4720
|
+
* @param comparator - A comparator function that can compare two keys.
|
|
4721
|
+
*
|
|
4722
|
+
* @returns A new array containing all values from the dictionary,
|
|
4723
|
+
* sorted according to their keys.
|
|
4724
|
+
*/
|
|
4725
|
+
toSortedArray(comparator) {
|
|
4726
|
+
const vals = Array.from(this);
|
|
4727
|
+
vals.sort((a, b) => comparator(a[0], b[0]).value);
|
|
4728
|
+
return vals.map((x) => x[1]);
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
const CHUNK_SIZE = 6;
|
|
4732
|
+
/**
|
|
4733
|
+
* A function to transform a bytes chunk (up to 6 bytes into U48 number)
|
|
4734
|
+
*
|
|
4735
|
+
* Note that it uses 3 additional bits to store length(`value * 8 + len;`),
|
|
4736
|
+
* It is needed to distinguish shorter chunks that have 0s at the end, for example: [1, 2] and [1, 2, 0]
|
|
4737
|
+
* */
|
|
4738
|
+
function bytesAsU48(bytes) {
|
|
4739
|
+
const len = bytes.length;
|
|
4740
|
+
check `${len <= CHUNK_SIZE} Length has to be <= ${CHUNK_SIZE}, got: ${len}`;
|
|
4741
|
+
let value = bytes[3] | (bytes[2] << 8) | (bytes[1] << 16) | (bytes[0] << 24);
|
|
4742
|
+
for (let i = 4; i < bytes.length; i++) {
|
|
4743
|
+
value = value * 256 + bytes[i];
|
|
4744
|
+
}
|
|
4745
|
+
return value * 8 + len;
|
|
4746
|
+
}
|
|
4747
|
+
class Node {
|
|
4748
|
+
leaf;
|
|
4749
|
+
children;
|
|
4750
|
+
convertListChildrenToMap() {
|
|
4751
|
+
if (!(this.children instanceof ListChildren)) {
|
|
4752
|
+
return;
|
|
4753
|
+
}
|
|
4754
|
+
this.children = MapChildren.fromListNode(this.children);
|
|
4755
|
+
}
|
|
4756
|
+
static withList() {
|
|
4757
|
+
return new Node(undefined, ListChildren.new());
|
|
4758
|
+
}
|
|
4759
|
+
static withMap() {
|
|
4760
|
+
return new Node(undefined, MapChildren.new());
|
|
4761
|
+
}
|
|
4762
|
+
constructor(leaf, children) {
|
|
4763
|
+
this.leaf = leaf;
|
|
4764
|
+
this.children = children;
|
|
4765
|
+
}
|
|
4766
|
+
getLeaf() {
|
|
4767
|
+
return this.leaf;
|
|
4768
|
+
}
|
|
4769
|
+
remove(_key) {
|
|
4770
|
+
if (this.leaf === undefined) {
|
|
4771
|
+
return null;
|
|
4772
|
+
}
|
|
4773
|
+
const removedLeaf = this.leaf;
|
|
4774
|
+
this.leaf = undefined;
|
|
4775
|
+
return removedLeaf;
|
|
4776
|
+
}
|
|
4777
|
+
set(key, value) {
|
|
4778
|
+
if (this.leaf === undefined) {
|
|
4779
|
+
this.leaf = { key, value };
|
|
4780
|
+
return this.leaf;
|
|
4781
|
+
}
|
|
4782
|
+
this.leaf.value = value;
|
|
4783
|
+
return null;
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
class ListChildren {
|
|
4787
|
+
children = [];
|
|
4788
|
+
constructor() { }
|
|
4789
|
+
find(key) {
|
|
4790
|
+
const result = this.children.find((item) => item[0].isEqualTo(key));
|
|
4791
|
+
if (result !== undefined) {
|
|
4792
|
+
return result[1];
|
|
4793
|
+
}
|
|
4794
|
+
return null;
|
|
4795
|
+
}
|
|
4796
|
+
remove(key) {
|
|
4797
|
+
const existingIndex = this.children.findIndex((item) => item[0].isEqualTo(key));
|
|
4798
|
+
if (existingIndex >= 0) {
|
|
4799
|
+
const ret = this.children.splice(existingIndex, 1);
|
|
4800
|
+
return ret[0][1];
|
|
4801
|
+
}
|
|
4802
|
+
return null;
|
|
4803
|
+
}
|
|
4804
|
+
insert(key, leaf) {
|
|
4805
|
+
const existingIndex = this.children.findIndex((item) => item[0].isEqualTo(key));
|
|
4806
|
+
if (existingIndex >= 0) {
|
|
4807
|
+
const existing = this.children[existingIndex];
|
|
4808
|
+
existing[1].value = leaf.value;
|
|
4809
|
+
return null;
|
|
4810
|
+
}
|
|
4811
|
+
this.children.push([key, leaf]);
|
|
4812
|
+
return leaf;
|
|
4813
|
+
}
|
|
4814
|
+
static new() {
|
|
4815
|
+
return new ListChildren();
|
|
4816
|
+
}
|
|
4817
|
+
}
|
|
4818
|
+
class MapChildren {
|
|
4819
|
+
children = new Map();
|
|
4820
|
+
constructor() { }
|
|
4821
|
+
static new() {
|
|
4822
|
+
return new MapChildren();
|
|
4823
|
+
}
|
|
4824
|
+
static fromListNode(node) {
|
|
4825
|
+
const mapNode = new MapChildren();
|
|
4826
|
+
for (const [key, leaf] of node.children) {
|
|
4827
|
+
const currentKeyChunk = asOpaqueType(BytesBlob.blobFrom(key.raw.subarray(0, CHUNK_SIZE)));
|
|
4828
|
+
const subKey = BytesBlob.blobFrom(key.raw.subarray(CHUNK_SIZE));
|
|
4829
|
+
let child = mapNode.getChild(currentKeyChunk);
|
|
4830
|
+
if (child === undefined) {
|
|
4831
|
+
child = Node.withList();
|
|
4832
|
+
mapNode.setChild(currentKeyChunk, child);
|
|
4833
|
+
}
|
|
4834
|
+
const children = child.children;
|
|
4835
|
+
children.insert(subKey, leaf);
|
|
4836
|
+
}
|
|
4837
|
+
return mapNode;
|
|
4838
|
+
}
|
|
4839
|
+
getChild(keyChunk) {
|
|
4840
|
+
const chunkAsNumber = bytesAsU48(keyChunk.raw);
|
|
4841
|
+
return this.children.get(chunkAsNumber);
|
|
4842
|
+
}
|
|
4843
|
+
setChild(keyChunk, node) {
|
|
4844
|
+
const chunkAsNumber = bytesAsU48(keyChunk.raw);
|
|
4845
|
+
this.children.set(chunkAsNumber, node);
|
|
4846
|
+
}
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
/**
|
|
4850
|
+
* A map which uses hashes as keys.
|
|
4851
|
+
*
|
|
4852
|
+
* @deprecated
|
|
4853
|
+
* */
|
|
4854
|
+
class StringHashDictionary {
|
|
4425
4855
|
// TODO [ToDr] [crit] We can't use `TrieHash` directly in the map,
|
|
4426
4856
|
// because of the way it's being compared. Hence having `string` here.
|
|
4427
4857
|
// This has to be benchmarked and re-written to a custom map most likely.
|
|
@@ -4486,6 +4916,16 @@ class HashDictionary {
|
|
|
4486
4916
|
return this.map.delete(key.toString());
|
|
4487
4917
|
}
|
|
4488
4918
|
}
|
|
4919
|
+
/**
|
|
4920
|
+
* A value that indicates when `BlobDictionary` transforms Array nodes into Map nodes.
|
|
4921
|
+
* In practice, it doesn't matter much because, in real life, arrays in this structure usually have a length close to 1.
|
|
4922
|
+
*/
|
|
4923
|
+
const BLOB_DICTIONARY_THRESHOLD$1 = 5;
|
|
4924
|
+
class HashDictionary extends BlobDictionary {
|
|
4925
|
+
constructor() {
|
|
4926
|
+
super(BLOB_DICTIONARY_THRESHOLD$1);
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4489
4929
|
|
|
4490
4930
|
/** A set specialized for storing hashes. */
|
|
4491
4931
|
class HashSet {
|
|
@@ -4935,6 +5375,18 @@ class SortedSet extends SortedArray {
|
|
|
4935
5375
|
}
|
|
4936
5376
|
}
|
|
4937
5377
|
|
|
5378
|
+
function getTruncatedKey(key) {
|
|
5379
|
+
// Always return exactly TRUNCATED_HASH_SIZE bytes.
|
|
5380
|
+
if (key.length === TRUNCATED_HASH_SIZE) {
|
|
5381
|
+
return key;
|
|
5382
|
+
}
|
|
5383
|
+
return Bytes.fromBlob(key.raw.subarray(0, TRUNCATED_HASH_SIZE), TRUNCATED_HASH_SIZE);
|
|
5384
|
+
}
|
|
5385
|
+
/**
|
|
5386
|
+
* A value that indicates when `BlobDictionary` transforms Array nodes into Map nodes.
|
|
5387
|
+
* In practice, it doesn't matter much because, in real life, arrays in this structure usually have a length close to 1.
|
|
5388
|
+
*/
|
|
5389
|
+
const BLOB_DICTIONARY_THRESHOLD = 5;
|
|
4938
5390
|
/**
|
|
4939
5391
|
* A collection of hash-based keys (likely `StateKey`s) which ignores
|
|
4940
5392
|
* differences on the last byte.
|
|
@@ -4947,48 +5399,37 @@ class TruncatedHashDictionary {
|
|
|
4947
5399
|
* Each key will be copied and have the last byte replace with a 0.
|
|
4948
5400
|
*/
|
|
4949
5401
|
static fromEntries(entries) {
|
|
4950
|
-
|
|
4951
|
-
const mapped = Array.from(entries).map(([key, value]) => {
|
|
4952
|
-
const newKey = Bytes.zero(HASH_SIZE).asOpaque();
|
|
4953
|
-
newKey.raw.set(key.raw.subarray(0, TRUNCATED_HASH_SIZE));
|
|
4954
|
-
return [newKey, value];
|
|
4955
|
-
});
|
|
4956
|
-
return new TruncatedHashDictionary(HashDictionary.fromEntries(mapped));
|
|
5402
|
+
return new TruncatedHashDictionary(BlobDictionary.fromEntries(Array.from(entries).map(([key, value]) => [getTruncatedKey(key), value]), BLOB_DICTIONARY_THRESHOLD));
|
|
4957
5403
|
}
|
|
4958
|
-
/** A truncated key which we re-use to query the dictionary. */
|
|
4959
|
-
truncatedKey = Bytes.zero(HASH_SIZE).asOpaque();
|
|
4960
5404
|
constructor(dict) {
|
|
4961
5405
|
this.dict = dict;
|
|
4962
5406
|
}
|
|
4963
5407
|
[TEST_COMPARE_USING]() {
|
|
4964
|
-
return this.dict;
|
|
5408
|
+
return Array.from(this.dict);
|
|
4965
5409
|
}
|
|
4966
5410
|
/** Return number of items in the dictionary. */
|
|
4967
5411
|
get size() {
|
|
4968
5412
|
return this.dict.size;
|
|
4969
5413
|
}
|
|
4970
5414
|
/** Retrieve a value that matches the key on `TRUNCATED_HASH_SIZE`. */
|
|
4971
|
-
get(
|
|
4972
|
-
|
|
4973
|
-
return this.dict.get(
|
|
5415
|
+
get(key) {
|
|
5416
|
+
const truncatedKey = getTruncatedKey(key);
|
|
5417
|
+
return this.dict.get(truncatedKey);
|
|
4974
5418
|
}
|
|
4975
5419
|
/** Return true if the key is present in the dictionary */
|
|
4976
|
-
has(
|
|
4977
|
-
|
|
4978
|
-
return this.dict.has(
|
|
5420
|
+
has(key) {
|
|
5421
|
+
const truncatedKey = getTruncatedKey(key);
|
|
5422
|
+
return this.dict.has(truncatedKey);
|
|
4979
5423
|
}
|
|
4980
5424
|
/** Set or update a value that matches the key on `TRUNCATED_HASH_SIZE`. */
|
|
4981
|
-
set(
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
const key = Bytes.zero(HASH_SIZE);
|
|
4985
|
-
key.raw.set(fullKey.raw.subarray(0, TRUNCATED_HASH_SIZE));
|
|
4986
|
-
this.dict.set(key.asOpaque(), value);
|
|
5425
|
+
set(key, value) {
|
|
5426
|
+
const truncatedKey = getTruncatedKey(key);
|
|
5427
|
+
this.dict.set(truncatedKey, value);
|
|
4987
5428
|
}
|
|
4988
5429
|
/** Remove a value that matches the key on `TRUNCATED_HASH_SIZE`. */
|
|
4989
|
-
delete(
|
|
4990
|
-
|
|
4991
|
-
this.dict.delete(
|
|
5430
|
+
delete(key) {
|
|
5431
|
+
const truncatedKey = getTruncatedKey(key);
|
|
5432
|
+
this.dict.delete(truncatedKey);
|
|
4992
5433
|
}
|
|
4993
5434
|
/** Iterator over values of the dictionary. */
|
|
4994
5435
|
values() {
|
|
@@ -4996,26 +5437,28 @@ class TruncatedHashDictionary {
|
|
|
4996
5437
|
}
|
|
4997
5438
|
/** Iterator over entries of the dictionary (with truncated keys) */
|
|
4998
5439
|
*entries() {
|
|
4999
|
-
|
|
5000
|
-
yield [Bytes.fromBlob(key.raw.subarray(0, TRUNCATED_HASH_SIZE), TRUNCATED_HASH_SIZE).asOpaque(), value];
|
|
5001
|
-
}
|
|
5440
|
+
yield* this.dict.entries();
|
|
5002
5441
|
}
|
|
5003
5442
|
[Symbol.iterator]() {
|
|
5004
5443
|
return this.entries();
|
|
5005
5444
|
}
|
|
5006
5445
|
}
|
|
5007
5446
|
|
|
5008
|
-
var index$
|
|
5447
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
5009
5448
|
__proto__: null,
|
|
5010
5449
|
ArrayView: ArrayView,
|
|
5450
|
+
BlobDictionary: BlobDictionary,
|
|
5011
5451
|
FixedSizeArray: FixedSizeArray,
|
|
5012
5452
|
HashDictionary: HashDictionary,
|
|
5013
5453
|
HashSet: HashSet,
|
|
5454
|
+
ListChildren: ListChildren,
|
|
5014
5455
|
MultiMap: MultiMap,
|
|
5015
5456
|
SortedArray: SortedArray,
|
|
5016
5457
|
SortedSet: SortedSet,
|
|
5458
|
+
StringHashDictionary: StringHashDictionary,
|
|
5017
5459
|
TruncatedHashDictionary: TruncatedHashDictionary,
|
|
5018
|
-
asKnownSize: asKnownSize
|
|
5460
|
+
asKnownSize: asKnownSize,
|
|
5461
|
+
bytesAsU48: bytesAsU48
|
|
5019
5462
|
});
|
|
5020
5463
|
|
|
5021
5464
|
/**
|
|
@@ -5192,7 +5635,7 @@ var PvmBackend;
|
|
|
5192
5635
|
PvmBackend[PvmBackend["Ananas"] = 1] = "Ananas";
|
|
5193
5636
|
})(PvmBackend || (PvmBackend = {}));
|
|
5194
5637
|
|
|
5195
|
-
var index$
|
|
5638
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
5196
5639
|
__proto__: null,
|
|
5197
5640
|
Bootnode: Bootnode,
|
|
5198
5641
|
ChainSpec: ChainSpec,
|
|
@@ -6699,7 +7142,7 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
6699
7142
|
return Decoder.decodeObject(codec.View, encoded, chainSpec);
|
|
6700
7143
|
}
|
|
6701
7144
|
|
|
6702
|
-
var index$
|
|
7145
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
6703
7146
|
__proto__: null,
|
|
6704
7147
|
Block: Block,
|
|
6705
7148
|
EpochMarker: EpochMarker,
|
|
@@ -6709,6 +7152,8 @@ var index$m = /*#__PURE__*/Object.freeze({
|
|
|
6709
7152
|
SEGMENT_BYTES: SEGMENT_BYTES,
|
|
6710
7153
|
TicketsMarker: TicketsMarker,
|
|
6711
7154
|
ValidatorKeys: ValidatorKeys,
|
|
7155
|
+
W_E: W_E,
|
|
7156
|
+
W_S: W_S,
|
|
6712
7157
|
assurances: assurances,
|
|
6713
7158
|
codecPerEpochBlock: codecPerEpochBlock,
|
|
6714
7159
|
codecPerValidator: codecPerValidator,
|
|
@@ -6969,7 +7414,7 @@ var json;
|
|
|
6969
7414
|
json.object = object;
|
|
6970
7415
|
})(json || (json = {}));
|
|
6971
7416
|
|
|
6972
|
-
var index$
|
|
7417
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
6973
7418
|
__proto__: null,
|
|
6974
7419
|
get json () { return json; },
|
|
6975
7420
|
parseFromJson: parseFromJson
|
|
@@ -7097,12 +7542,12 @@ const workRefineLoadFromJson = json.object({
|
|
|
7097
7542
|
extrinsic_count: "number",
|
|
7098
7543
|
extrinsic_size: "number",
|
|
7099
7544
|
exports: "number",
|
|
7100
|
-
}, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports }) => WorkRefineLoad.create({
|
|
7545
|
+
}, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports: exports$1 }) => WorkRefineLoad.create({
|
|
7101
7546
|
gasUsed: tryAsServiceGas(gas_used),
|
|
7102
7547
|
importedSegments: tryAsU32(imports),
|
|
7103
7548
|
extrinsicCount: tryAsU32(extrinsic_count),
|
|
7104
7549
|
extrinsicSize: tryAsU32(extrinsic_size),
|
|
7105
|
-
exportedSegments: tryAsU32(exports),
|
|
7550
|
+
exportedSegments: tryAsU32(exports$1),
|
|
7106
7551
|
}));
|
|
7107
7552
|
const workResultFromJson = json.object({
|
|
7108
7553
|
service_id: "number",
|
|
@@ -7239,7 +7684,7 @@ const blockFromJson = (spec) => json.object({
|
|
|
7239
7684
|
extrinsic: getExtrinsicFromJson(spec),
|
|
7240
7685
|
}, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
|
|
7241
7686
|
|
|
7242
|
-
var index$
|
|
7687
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
7243
7688
|
__proto__: null,
|
|
7244
7689
|
blockFromJson: blockFromJson,
|
|
7245
7690
|
disputesExtrinsicFromJson: disputesExtrinsicFromJson,
|
|
@@ -7264,7 +7709,7 @@ function parseBootnode(v) {
|
|
|
7264
7709
|
if (name === "" || ip === "" || port === "") {
|
|
7265
7710
|
throw new Error(`Invalid bootnode format, expected: <name>@<ip>:<port>, got: "${v}"`);
|
|
7266
7711
|
}
|
|
7267
|
-
const portNumber = Number.parseInt(port);
|
|
7712
|
+
const portNumber = Number.parseInt(port, 10);
|
|
7268
7713
|
if (!isU16(portNumber)) {
|
|
7269
7714
|
throw new Error(`Invalid port number: "${port}"`);
|
|
7270
7715
|
}
|
|
@@ -7733,7 +8178,7 @@ class Logger {
|
|
|
7733
8178
|
}
|
|
7734
8179
|
}
|
|
7735
8180
|
|
|
7736
|
-
var index$
|
|
8181
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
7737
8182
|
__proto__: null,
|
|
7738
8183
|
get Level () { return Level; },
|
|
7739
8184
|
Logger: Logger,
|
|
@@ -7948,7 +8393,7 @@ function isJsonObject(value) {
|
|
|
7948
8393
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7949
8394
|
}
|
|
7950
8395
|
|
|
7951
|
-
var index$
|
|
8396
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
7952
8397
|
__proto__: null,
|
|
7953
8398
|
DEFAULT_CONFIG: DEFAULT_CONFIG,
|
|
7954
8399
|
DEV_CONFIG: DEV_CONFIG,
|
|
@@ -8869,7 +9314,7 @@ class CoreStatistics {
|
|
|
8869
9314
|
/** `i` */
|
|
8870
9315
|
imports,
|
|
8871
9316
|
/** `e` */
|
|
8872
|
-
exports,
|
|
9317
|
+
exports$1,
|
|
8873
9318
|
/** `z` */
|
|
8874
9319
|
extrinsicSize,
|
|
8875
9320
|
/** `x` */
|
|
@@ -8881,7 +9326,7 @@ class CoreStatistics {
|
|
|
8881
9326
|
this.dataAvailabilityLoad = dataAvailabilityLoad;
|
|
8882
9327
|
this.popularity = popularity;
|
|
8883
9328
|
this.imports = imports;
|
|
8884
|
-
this.exports = exports;
|
|
9329
|
+
this.exports = exports$1;
|
|
8885
9330
|
this.extrinsicSize = extrinsicSize;
|
|
8886
9331
|
this.extrinsicCount = extrinsicCount;
|
|
8887
9332
|
this.bundleSize = bundleSize;
|
|
@@ -8974,7 +9419,7 @@ class ServiceStatistics {
|
|
|
8974
9419
|
/** `i` */
|
|
8975
9420
|
imports,
|
|
8976
9421
|
/** `e` */
|
|
8977
|
-
exports,
|
|
9422
|
+
exports$1,
|
|
8978
9423
|
/** `z` */
|
|
8979
9424
|
extrinsicSize,
|
|
8980
9425
|
/** `x` */
|
|
@@ -8992,7 +9437,7 @@ class ServiceStatistics {
|
|
|
8992
9437
|
this.refinementCount = refinementCount;
|
|
8993
9438
|
this.refinementGasUsed = refinementGasUsed;
|
|
8994
9439
|
this.imports = imports;
|
|
8995
|
-
this.exports = exports;
|
|
9440
|
+
this.exports = exports$1;
|
|
8996
9441
|
this.extrinsicSize = extrinsicSize;
|
|
8997
9442
|
this.extrinsicCount = extrinsicCount;
|
|
8998
9443
|
this.accumulateCount = accumulateCount;
|
|
@@ -9157,11 +9602,32 @@ const ENTROPY_ENTRIES = 4;
|
|
|
9157
9602
|
|
|
9158
9603
|
var UpdatePreimageKind;
|
|
9159
9604
|
(function (UpdatePreimageKind) {
|
|
9160
|
-
/**
|
|
9605
|
+
/**
|
|
9606
|
+
* Insert new preimage and optionally update it's lookup history.
|
|
9607
|
+
*
|
|
9608
|
+
* Used in: `provide`
|
|
9609
|
+
*
|
|
9610
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/383904383904?v=0.7.2
|
|
9611
|
+
*/
|
|
9161
9612
|
UpdatePreimageKind[UpdatePreimageKind["Provide"] = 0] = "Provide";
|
|
9162
|
-
/**
|
|
9613
|
+
/**
|
|
9614
|
+
* Remove a preimage and it's lookup history.
|
|
9615
|
+
*
|
|
9616
|
+
* Used in: `forget` and `eject`
|
|
9617
|
+
*
|
|
9618
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/38c701380202?v=0.7.2
|
|
9619
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/379102379302?v=0.7.2
|
|
9620
|
+
*/
|
|
9163
9621
|
UpdatePreimageKind[UpdatePreimageKind["Remove"] = 1] = "Remove";
|
|
9164
|
-
/**
|
|
9622
|
+
/**
|
|
9623
|
+
* Update or add lookup history for preimage hash/len to given value.
|
|
9624
|
+
*
|
|
9625
|
+
* Used in: `solicit` and `forget`
|
|
9626
|
+
*
|
|
9627
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/382802382802?v=0.7.2
|
|
9628
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/384002384b02?v=0.7.2
|
|
9629
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/38c60038ea00?v=0.7.2
|
|
9630
|
+
*/
|
|
9165
9631
|
UpdatePreimageKind[UpdatePreimageKind["UpdateOrAdd"] = 2] = "UpdateOrAdd";
|
|
9166
9632
|
})(UpdatePreimageKind || (UpdatePreimageKind = {}));
|
|
9167
9633
|
/**
|
|
@@ -9169,7 +9635,7 @@ var UpdatePreimageKind;
|
|
|
9169
9635
|
*
|
|
9170
9636
|
* Can be one of the following cases:
|
|
9171
9637
|
* 1. Provide a new preimage blob and set the lookup history to available at `slot`.
|
|
9172
|
-
* 2. Remove (
|
|
9638
|
+
* 2. Remove (forget) a preimage and it's lookup history.
|
|
9173
9639
|
* 3. Update `LookupHistory` with given value.
|
|
9174
9640
|
*/
|
|
9175
9641
|
class UpdatePreimage {
|
|
@@ -9742,7 +10208,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
|
|
|
9742
10208
|
sortKeys: (a, b) => a - b,
|
|
9743
10209
|
});
|
|
9744
10210
|
|
|
9745
|
-
var index$
|
|
10211
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
9746
10212
|
__proto__: null,
|
|
9747
10213
|
AUTHORIZATION_QUEUE_SIZE: AUTHORIZATION_QUEUE_SIZE,
|
|
9748
10214
|
AccumulationOutput: AccumulationOutput,
|
|
@@ -10373,7 +10839,6 @@ class LeafNode {
|
|
|
10373
10839
|
/**
|
|
10374
10840
|
* Get the byte length of embedded value.
|
|
10375
10841
|
*
|
|
10376
|
-
* @remark
|
|
10377
10842
|
* Note in case this node only contains hash this is going to be 0.
|
|
10378
10843
|
*/
|
|
10379
10844
|
getValueLength() {
|
|
@@ -10384,7 +10849,6 @@ class LeafNode {
|
|
|
10384
10849
|
/**
|
|
10385
10850
|
* Returns the embedded value.
|
|
10386
10851
|
*
|
|
10387
|
-
* @remark
|
|
10388
10852
|
* Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
|
|
10389
10853
|
*/
|
|
10390
10854
|
getValue() {
|
|
@@ -10394,7 +10858,6 @@ class LeafNode {
|
|
|
10394
10858
|
/**
|
|
10395
10859
|
* Returns contained value hash.
|
|
10396
10860
|
*
|
|
10397
|
-
* @remark
|
|
10398
10861
|
* Note that for embedded value this is going to be full 0-padded 32 bytes.
|
|
10399
10862
|
*/
|
|
10400
10863
|
getValueHash() {
|
|
@@ -10816,7 +11279,7 @@ const bitLookup = [
|
|
|
10816
11279
|
[0b00000000, 8],
|
|
10817
11280
|
];
|
|
10818
11281
|
|
|
10819
|
-
var index$
|
|
11282
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
10820
11283
|
__proto__: null,
|
|
10821
11284
|
BranchNode: BranchNode,
|
|
10822
11285
|
InMemoryTrie: InMemoryTrie,
|
|
@@ -11183,7 +11646,7 @@ function loadState(spec, blake2b, entries) {
|
|
|
11183
11646
|
* hashmap of `key -> value` entries.
|
|
11184
11647
|
*/
|
|
11185
11648
|
|
|
11186
|
-
var index$
|
|
11649
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
11187
11650
|
__proto__: null,
|
|
11188
11651
|
SerializedService: SerializedService,
|
|
11189
11652
|
SerializedState: SerializedState,
|
|
@@ -11432,7 +11895,7 @@ class InMemoryStates {
|
|
|
11432
11895
|
async close() { }
|
|
11433
11896
|
}
|
|
11434
11897
|
|
|
11435
|
-
var index$
|
|
11898
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
11436
11899
|
__proto__: null,
|
|
11437
11900
|
InMemoryBlocks: InMemoryBlocks,
|
|
11438
11901
|
InMemorySerializedStates: InMemorySerializedStates,
|
|
@@ -11796,7 +12259,7 @@ const initEc = async () => {
|
|
|
11796
12259
|
await init.reedSolomon();
|
|
11797
12260
|
};
|
|
11798
12261
|
|
|
11799
|
-
var index$
|
|
12262
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
11800
12263
|
__proto__: null,
|
|
11801
12264
|
N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
|
|
11802
12265
|
N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
|
|
@@ -12230,7 +12693,7 @@ class FuzzTarget {
|
|
|
12230
12693
|
}
|
|
12231
12694
|
}
|
|
12232
12695
|
|
|
12233
|
-
var index$
|
|
12696
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
12234
12697
|
__proto__: null,
|
|
12235
12698
|
AncestryItem: AncestryItem,
|
|
12236
12699
|
ErrorMessage: ErrorMessage,
|
|
@@ -12248,9 +12711,9 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
12248
12711
|
stateRootCodec: stateRootCodec
|
|
12249
12712
|
});
|
|
12250
12713
|
|
|
12251
|
-
var index$
|
|
12714
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
12252
12715
|
__proto__: null,
|
|
12253
|
-
v1: index$
|
|
12716
|
+
v1: index$b
|
|
12254
12717
|
});
|
|
12255
12718
|
|
|
12256
12719
|
/** Size of the transfer memo. */
|
|
@@ -12679,7 +13142,11 @@ class PartiallyUpdatedState {
|
|
|
12679
13142
|
const service = this.state.getService(serviceId);
|
|
12680
13143
|
return service?.getPreimage(hash) ?? null;
|
|
12681
13144
|
}
|
|
12682
|
-
/**
|
|
13145
|
+
/**
|
|
13146
|
+
* Get status of a preimage of current service taking into account any updates.
|
|
13147
|
+
*
|
|
13148
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/110201110201?v=0.7.2
|
|
13149
|
+
*/
|
|
12683
13150
|
getLookupHistory(currentTimeslot, serviceId, hash, length) {
|
|
12684
13151
|
const updatedService = this.stateUpdate.services.updated.get(serviceId);
|
|
12685
13152
|
/** Return lookup history item for newly created service */
|
|
@@ -12716,12 +13183,7 @@ class PartiallyUpdatedState {
|
|
|
12716
13183
|
return new LookupHistoryItem(hash, updatedPreimage.length, tryAsLookupHistorySlots([currentTimeslot]));
|
|
12717
13184
|
}
|
|
12718
13185
|
case UpdatePreimageKind.Remove: {
|
|
12719
|
-
|
|
12720
|
-
// kinda impossible, since we know it's there because it's removed.
|
|
12721
|
-
if (state === null) {
|
|
12722
|
-
return null;
|
|
12723
|
-
}
|
|
12724
|
-
return new LookupHistoryItem(hash, state.length, tryAsLookupHistorySlots([...state.slots, currentTimeslot]));
|
|
13186
|
+
return null;
|
|
12725
13187
|
}
|
|
12726
13188
|
case UpdatePreimageKind.UpdateOrAdd: {
|
|
12727
13189
|
return action.item;
|
|
@@ -13113,42 +13575,6 @@ class HostCallsManager {
|
|
|
13113
13575
|
}
|
|
13114
13576
|
}
|
|
13115
13577
|
|
|
13116
|
-
/** Create a new gas counter instance depending on the gas value. */
|
|
13117
|
-
function gasCounter(gas) {
|
|
13118
|
-
return new GasCounterU64(tryAsU64(gas));
|
|
13119
|
-
}
|
|
13120
|
-
class GasCounterU64 {
|
|
13121
|
-
gas;
|
|
13122
|
-
initialGas;
|
|
13123
|
-
constructor(gas) {
|
|
13124
|
-
this.gas = gas;
|
|
13125
|
-
this.initialGas = tryAsGas(gas);
|
|
13126
|
-
}
|
|
13127
|
-
set(g) {
|
|
13128
|
-
this.gas = tryAsU64(g);
|
|
13129
|
-
}
|
|
13130
|
-
get() {
|
|
13131
|
-
return tryAsGas(this.gas);
|
|
13132
|
-
}
|
|
13133
|
-
sub(g) {
|
|
13134
|
-
const result = this.gas - tryAsU64(g);
|
|
13135
|
-
if (result >= 0n) {
|
|
13136
|
-
this.gas = tryAsU64(result);
|
|
13137
|
-
return false;
|
|
13138
|
-
}
|
|
13139
|
-
this.gas = tryAsU64(0n);
|
|
13140
|
-
return true;
|
|
13141
|
-
}
|
|
13142
|
-
used() {
|
|
13143
|
-
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
13144
|
-
// In we have less than zero left we assume that all gas has been consumed.
|
|
13145
|
-
if (gasConsumed < 0) {
|
|
13146
|
-
return this.initialGas;
|
|
13147
|
-
}
|
|
13148
|
-
return tryAsGas(gasConsumed);
|
|
13149
|
-
}
|
|
13150
|
-
}
|
|
13151
|
-
|
|
13152
13578
|
const tryAsMemoryIndex = (index) => {
|
|
13153
13579
|
check `${index >= 0 && index <= MAX_MEMORY_INDEX} Incorrect memory index: ${index}!`;
|
|
13154
13580
|
return asOpaqueType(index);
|
|
@@ -13871,7 +14297,7 @@ function getRegisters(argsLength) {
|
|
|
13871
14297
|
return regs;
|
|
13872
14298
|
}
|
|
13873
14299
|
|
|
13874
|
-
var index$
|
|
14300
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
13875
14301
|
__proto__: null,
|
|
13876
14302
|
MemorySegment: MemorySegment,
|
|
13877
14303
|
SpiMemory: SpiMemory,
|
|
@@ -13930,7 +14356,7 @@ function extractCodeAndMetadata(blobWithMetadata) {
|
|
|
13930
14356
|
return { metadata, code };
|
|
13931
14357
|
}
|
|
13932
14358
|
|
|
13933
|
-
var index$
|
|
14359
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
13934
14360
|
__proto__: null,
|
|
13935
14361
|
Program: Program,
|
|
13936
14362
|
extractCodeAndMetadata: extractCodeAndMetadata
|
|
@@ -14894,6 +15320,42 @@ class BasicBlocks {
|
|
|
14894
15320
|
}
|
|
14895
15321
|
}
|
|
14896
15322
|
|
|
15323
|
+
/** Create a new gas counter instance depending on the gas value. */
|
|
15324
|
+
function gasCounter(gas) {
|
|
15325
|
+
return new GasCounterU64(tryAsU64(gas));
|
|
15326
|
+
}
|
|
15327
|
+
class GasCounterU64 {
|
|
15328
|
+
gas;
|
|
15329
|
+
initialGas;
|
|
15330
|
+
constructor(gas) {
|
|
15331
|
+
this.gas = gas;
|
|
15332
|
+
this.initialGas = tryAsGas(gas);
|
|
15333
|
+
}
|
|
15334
|
+
set(g) {
|
|
15335
|
+
this.gas = tryAsU64(g);
|
|
15336
|
+
}
|
|
15337
|
+
get() {
|
|
15338
|
+
return tryAsGas(this.gas);
|
|
15339
|
+
}
|
|
15340
|
+
sub(g) {
|
|
15341
|
+
const result = this.gas - tryAsU64(g);
|
|
15342
|
+
if (result >= 0n) {
|
|
15343
|
+
this.gas = tryAsU64(result);
|
|
15344
|
+
return false;
|
|
15345
|
+
}
|
|
15346
|
+
this.gas = tryAsU64(0n);
|
|
15347
|
+
return true;
|
|
15348
|
+
}
|
|
15349
|
+
used() {
|
|
15350
|
+
const gasConsumed = tryAsU64(this.initialGas) - this.gas;
|
|
15351
|
+
// In we have less than zero left we assume that all gas has been consumed.
|
|
15352
|
+
if (gasConsumed < 0) {
|
|
15353
|
+
return this.initialGas;
|
|
15354
|
+
}
|
|
15355
|
+
return tryAsGas(gasConsumed);
|
|
15356
|
+
}
|
|
15357
|
+
}
|
|
15358
|
+
|
|
14897
15359
|
const instructionGasMap = (() => {
|
|
14898
15360
|
const instructionGasMap = new Array(HIGHEST_INSTRUCTION_NUMBER + 1);
|
|
14899
15361
|
for (let i = 0; i < HIGHEST_INSTRUCTION_NUMBER + 1; i++) {
|
|
@@ -16802,8 +17264,77 @@ class Interpreter {
|
|
|
16802
17264
|
}
|
|
16803
17265
|
}
|
|
16804
17266
|
|
|
16805
|
-
|
|
17267
|
+
class DebuggerAdapter {
|
|
17268
|
+
pvm;
|
|
17269
|
+
constructor(useSbrkGas = false) {
|
|
17270
|
+
this.pvm = new Interpreter({ useSbrkGas });
|
|
17271
|
+
}
|
|
17272
|
+
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
17273
|
+
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
17274
|
+
}
|
|
17275
|
+
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
17276
|
+
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
17277
|
+
}
|
|
17278
|
+
getPageDump(pageNumber) {
|
|
17279
|
+
const page = this.pvm.getMemoryPage(pageNumber);
|
|
17280
|
+
if (page === null) {
|
|
17281
|
+
// page wasn't allocated so we return an empty page
|
|
17282
|
+
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
17283
|
+
}
|
|
17284
|
+
if (page.length === PAGE_SIZE$1) {
|
|
17285
|
+
// page was allocated and has a proper size so we can simply return it
|
|
17286
|
+
return page;
|
|
17287
|
+
}
|
|
17288
|
+
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
17289
|
+
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
17290
|
+
fullPage.set(page);
|
|
17291
|
+
return fullPage;
|
|
17292
|
+
}
|
|
17293
|
+
setMemory(address, value) {
|
|
17294
|
+
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
17295
|
+
}
|
|
17296
|
+
getExitArg() {
|
|
17297
|
+
return this.pvm.getExitParam() ?? 0;
|
|
17298
|
+
}
|
|
17299
|
+
getStatus() {
|
|
17300
|
+
return this.pvm.getStatus();
|
|
17301
|
+
}
|
|
17302
|
+
nextStep() {
|
|
17303
|
+
return this.pvm.nextStep() === Status.OK;
|
|
17304
|
+
}
|
|
17305
|
+
nSteps(steps) {
|
|
17306
|
+
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
17307
|
+
for (let i = 0; i < steps; i++) {
|
|
17308
|
+
const isOk = this.nextStep();
|
|
17309
|
+
if (!isOk) {
|
|
17310
|
+
return false;
|
|
17311
|
+
}
|
|
17312
|
+
}
|
|
17313
|
+
return true;
|
|
17314
|
+
}
|
|
17315
|
+
getRegisters() {
|
|
17316
|
+
return this.pvm.registers.getAllU64();
|
|
17317
|
+
}
|
|
17318
|
+
setRegisters(registers) {
|
|
17319
|
+
this.pvm.registers.copyFrom(new Registers(registers));
|
|
17320
|
+
}
|
|
17321
|
+
getProgramCounter() {
|
|
17322
|
+
return this.pvm.getPC();
|
|
17323
|
+
}
|
|
17324
|
+
setNextProgramCounter(nextPc) {
|
|
17325
|
+
this.pvm.setNextPC(nextPc);
|
|
17326
|
+
}
|
|
17327
|
+
getGasLeft() {
|
|
17328
|
+
return BigInt(this.pvm.gas.get());
|
|
17329
|
+
}
|
|
17330
|
+
setGasLeft(gas) {
|
|
17331
|
+
this.pvm.gas.set(tryAsGas(gas));
|
|
17332
|
+
}
|
|
17333
|
+
}
|
|
17334
|
+
|
|
17335
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
16806
17336
|
__proto__: null,
|
|
17337
|
+
DebuggerAdapter: DebuggerAdapter,
|
|
16807
17338
|
Interpreter: Interpreter,
|
|
16808
17339
|
Memory: Memory,
|
|
16809
17340
|
MemoryBuilder: MemoryBuilder,
|
|
@@ -16834,18 +17365,18 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16834
17365
|
},
|
|
16835
17366
|
}, Object.assign(Object.create(globalThis), imports.env || {})),
|
|
16836
17367
|
};
|
|
16837
|
-
const { exports } = await WebAssembly.instantiate(module, adaptedImports);
|
|
16838
|
-
const memory = exports.memory || imports.env.memory;
|
|
17368
|
+
const { exports: exports$1 } = await WebAssembly.instantiate(module, adaptedImports);
|
|
17369
|
+
const memory = exports$1.memory || imports.env.memory;
|
|
16839
17370
|
const adaptedExports = Object.setPrototypeOf({
|
|
16840
17371
|
getAssembly(p) {
|
|
16841
17372
|
// assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
|
|
16842
17373
|
p = __lowerInternref(p) || __notnull();
|
|
16843
|
-
return __liftString(exports.getAssembly(p) >>> 0);
|
|
17374
|
+
return __liftString(exports$1.getAssembly(p) >>> 0);
|
|
16844
17375
|
},
|
|
16845
17376
|
wrapAsProgram(bytecode) {
|
|
16846
17377
|
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
16847
17378
|
bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
|
|
16848
|
-
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
17379
|
+
return __liftTypedArray(Uint8Array, exports$1.wrapAsProgram(bytecode) >>> 0);
|
|
16849
17380
|
},
|
|
16850
17381
|
resetJAM(program, pc, initialGas, args, hasMetadata) {
|
|
16851
17382
|
// assembly/api-debugger/resetJAM(~lib/array/Array<u8>, f64, i64, ~lib/array/Array<u8>, bool?) => void
|
|
@@ -16854,8 +17385,8 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16854
17385
|
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
16855
17386
|
hasMetadata = hasMetadata ? 1 : 0;
|
|
16856
17387
|
try {
|
|
16857
|
-
exports.__setArgumentsLength(arguments.length);
|
|
16858
|
-
exports.resetJAM(program, pc, initialGas, args, hasMetadata);
|
|
17388
|
+
exports$1.__setArgumentsLength(arguments.length);
|
|
17389
|
+
exports$1.resetJAM(program, pc, initialGas, args, hasMetadata);
|
|
16859
17390
|
} finally {
|
|
16860
17391
|
__release(program);
|
|
16861
17392
|
}
|
|
@@ -16867,8 +17398,8 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16867
17398
|
initialGas = initialGas || 0n;
|
|
16868
17399
|
hasMetadata = hasMetadata ? 1 : 0;
|
|
16869
17400
|
try {
|
|
16870
|
-
exports.__setArgumentsLength(arguments.length);
|
|
16871
|
-
exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
|
|
17401
|
+
exports$1.__setArgumentsLength(arguments.length);
|
|
17402
|
+
exports$1.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
|
|
16872
17403
|
} finally {
|
|
16873
17404
|
__release(program);
|
|
16874
17405
|
}
|
|
@@ -16882,8 +17413,8 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16882
17413
|
initialGas = initialGas || 0n;
|
|
16883
17414
|
hasMetadata = hasMetadata ? 1 : 0;
|
|
16884
17415
|
try {
|
|
16885
|
-
exports.__setArgumentsLength(arguments.length);
|
|
16886
|
-
exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
|
|
17416
|
+
exports$1.__setArgumentsLength(arguments.length);
|
|
17417
|
+
exports$1.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
|
|
16887
17418
|
} finally {
|
|
16888
17419
|
__release(program);
|
|
16889
17420
|
__release(flatRegisters);
|
|
@@ -16892,68 +17423,68 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16892
17423
|
},
|
|
16893
17424
|
nextStep() {
|
|
16894
17425
|
// assembly/api-debugger/nextStep() => bool
|
|
16895
|
-
return exports.nextStep() != 0;
|
|
17426
|
+
return exports$1.nextStep() != 0;
|
|
16896
17427
|
},
|
|
16897
17428
|
nSteps(steps) {
|
|
16898
17429
|
// assembly/api-debugger/nSteps(u32) => bool
|
|
16899
|
-
return exports.nSteps(steps) != 0;
|
|
17430
|
+
return exports$1.nSteps(steps) != 0;
|
|
16900
17431
|
},
|
|
16901
17432
|
getProgramCounter() {
|
|
16902
17433
|
// assembly/api-debugger/getProgramCounter() => u32
|
|
16903
|
-
return exports.getProgramCounter() >>> 0;
|
|
17434
|
+
return exports$1.getProgramCounter() >>> 0;
|
|
16904
17435
|
},
|
|
16905
17436
|
getExitArg() {
|
|
16906
17437
|
// assembly/api-debugger/getExitArg() => u32
|
|
16907
|
-
return exports.getExitArg() >>> 0;
|
|
17438
|
+
return exports$1.getExitArg() >>> 0;
|
|
16908
17439
|
},
|
|
16909
17440
|
setGasLeft(gas) {
|
|
16910
17441
|
// assembly/api-debugger/setGasLeft(i64) => void
|
|
16911
17442
|
gas = gas || 0n;
|
|
16912
|
-
exports.setGasLeft(gas);
|
|
17443
|
+
exports$1.setGasLeft(gas);
|
|
16913
17444
|
},
|
|
16914
17445
|
getRegisters() {
|
|
16915
17446
|
// assembly/api-debugger/getRegisters() => ~lib/typedarray/Uint8Array
|
|
16916
|
-
return __liftTypedArray(Uint8Array, exports.getRegisters() >>> 0);
|
|
17447
|
+
return __liftTypedArray(Uint8Array, exports$1.getRegisters() >>> 0);
|
|
16917
17448
|
},
|
|
16918
17449
|
setRegisters(flatRegisters) {
|
|
16919
17450
|
// assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
|
|
16920
17451
|
flatRegisters = __lowerArray(__setU8, 6, 0, flatRegisters) || __notnull();
|
|
16921
|
-
exports.setRegisters(flatRegisters);
|
|
17452
|
+
exports$1.setRegisters(flatRegisters);
|
|
16922
17453
|
},
|
|
16923
17454
|
getPageDump(index) {
|
|
16924
17455
|
// assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
|
|
16925
|
-
return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
|
|
17456
|
+
return __liftTypedArray(Uint8Array, exports$1.getPageDump(index) >>> 0);
|
|
16926
17457
|
},
|
|
16927
17458
|
getMemory(address, length) {
|
|
16928
17459
|
// assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array | null
|
|
16929
|
-
return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
|
|
17460
|
+
return __liftTypedArray(Uint8Array, exports$1.getMemory(address, length) >>> 0);
|
|
16930
17461
|
},
|
|
16931
17462
|
setMemory(address, data) {
|
|
16932
17463
|
// assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
|
|
16933
17464
|
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
|
16934
|
-
return exports.setMemory(address, data) != 0;
|
|
17465
|
+
return exports$1.setMemory(address, data) != 0;
|
|
16935
17466
|
},
|
|
16936
17467
|
InputKind: (values => (
|
|
16937
17468
|
// assembly/api-utils/InputKind
|
|
16938
|
-
values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
|
|
16939
|
-
values[values.SPI = exports["InputKind.SPI"].valueOf()] = "SPI",
|
|
17469
|
+
values[values.Generic = exports$1["InputKind.Generic"].valueOf()] = "Generic",
|
|
17470
|
+
values[values.SPI = exports$1["InputKind.SPI"].valueOf()] = "SPI",
|
|
16940
17471
|
values
|
|
16941
17472
|
))({}),
|
|
16942
17473
|
HasMetadata: (values => (
|
|
16943
17474
|
// assembly/api-utils/HasMetadata
|
|
16944
|
-
values[values.Yes = exports["HasMetadata.Yes"].valueOf()] = "Yes",
|
|
16945
|
-
values[values.No = exports["HasMetadata.No"].valueOf()] = "No",
|
|
17475
|
+
values[values.Yes = exports$1["HasMetadata.Yes"].valueOf()] = "Yes",
|
|
17476
|
+
values[values.No = exports$1["HasMetadata.No"].valueOf()] = "No",
|
|
16946
17477
|
values
|
|
16947
17478
|
))({}),
|
|
16948
17479
|
getGasCosts(input, kind, withMetadata) {
|
|
16949
17480
|
// assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
|
|
16950
17481
|
input = __lowerArray(__setU8, 6, 0, input) || __notnull();
|
|
16951
|
-
return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
|
|
17482
|
+
return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports$1.getGasCosts(input, kind, withMetadata) >>> 0);
|
|
16952
17483
|
},
|
|
16953
17484
|
disassemble(input, kind, withMetadata) {
|
|
16954
17485
|
// assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
|
|
16955
17486
|
input = __lowerArray(__setU8, 6, 0, input) || __notnull();
|
|
16956
|
-
return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
|
|
17487
|
+
return __liftString(exports$1.disassemble(input, kind, withMetadata) >>> 0);
|
|
16957
17488
|
},
|
|
16958
17489
|
prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) {
|
|
16959
17490
|
// assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-internal/InitialPage>, ~lib/array/Array<assembly/api-internal/InitialChunk>, ~lib/array/Array<u8>) => assembly/spi/StandardProgram
|
|
@@ -16963,7 +17494,7 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16963
17494
|
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord48(value) || __notnull()); }, 49, 2, initialMemory) || __notnull());
|
|
16964
17495
|
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
16965
17496
|
try {
|
|
16966
|
-
return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
|
|
17497
|
+
return __liftInternref(exports$1.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
|
|
16967
17498
|
} finally {
|
|
16968
17499
|
__release(program);
|
|
16969
17500
|
__release(initialRegisters);
|
|
@@ -16977,10 +17508,10 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16977
17508
|
initialGas = initialGas || 0n;
|
|
16978
17509
|
logs = logs ? 1 : 0;
|
|
16979
17510
|
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
16980
|
-
exports.__setArgumentsLength(arguments.length);
|
|
16981
|
-
return __liftRecord55(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
|
|
17511
|
+
exports$1.__setArgumentsLength(arguments.length);
|
|
17512
|
+
return __liftRecord55(exports$1.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
|
|
16982
17513
|
},
|
|
16983
|
-
}, exports);
|
|
17514
|
+
}, exports$1);
|
|
16984
17515
|
function __liftRecord50(pointer) {
|
|
16985
17516
|
// assembly/gas-costs/BlockGasCost
|
|
16986
17517
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
@@ -16994,21 +17525,21 @@ async function instantiate$1(module, imports = {}) {
|
|
|
16994
17525
|
// assembly/api-internal/InitialPage
|
|
16995
17526
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
16996
17527
|
if (value == null) return 0;
|
|
16997
|
-
const pointer = exports.__pin(exports.__new(12, 46));
|
|
17528
|
+
const pointer = exports$1.__pin(exports$1.__new(12, 46));
|
|
16998
17529
|
__setU32(pointer + 0, value.address);
|
|
16999
17530
|
__setU32(pointer + 4, value.length);
|
|
17000
17531
|
__setU32(pointer + 8, value.access);
|
|
17001
|
-
exports.__unpin(pointer);
|
|
17532
|
+
exports$1.__unpin(pointer);
|
|
17002
17533
|
return pointer;
|
|
17003
17534
|
}
|
|
17004
17535
|
function __lowerRecord48(value) {
|
|
17005
17536
|
// assembly/api-internal/InitialChunk
|
|
17006
17537
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
17007
17538
|
if (value == null) return 0;
|
|
17008
|
-
const pointer = exports.__pin(exports.__new(8, 48));
|
|
17539
|
+
const pointer = exports$1.__pin(exports$1.__new(8, 48));
|
|
17009
17540
|
__setU32(pointer + 0, value.address);
|
|
17010
17541
|
__setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
|
|
17011
|
-
exports.__unpin(pointer);
|
|
17542
|
+
exports$1.__unpin(pointer);
|
|
17012
17543
|
return pointer;
|
|
17013
17544
|
}
|
|
17014
17545
|
function __liftRecord48(pointer) {
|
|
@@ -17057,15 +17588,15 @@ async function instantiate$1(module, imports = {}) {
|
|
|
17057
17588
|
if (values == null) return 0;
|
|
17058
17589
|
const
|
|
17059
17590
|
length = values.length,
|
|
17060
|
-
buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
|
|
17061
|
-
header = exports.__pin(exports.__new(16, id)) >>> 0;
|
|
17591
|
+
buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
|
|
17592
|
+
header = exports$1.__pin(exports$1.__new(16, id)) >>> 0;
|
|
17062
17593
|
__setU32(header + 0, buffer);
|
|
17063
17594
|
__dataview.setUint32(header + 4, buffer, true);
|
|
17064
17595
|
__dataview.setUint32(header + 8, length << align, true);
|
|
17065
17596
|
__dataview.setUint32(header + 12, length, true);
|
|
17066
17597
|
for (let i = 0; i < length; ++i) lowerElement(buffer + (i << align >>> 0), values[i]);
|
|
17067
|
-
exports.__unpin(buffer);
|
|
17068
|
-
exports.__unpin(header);
|
|
17598
|
+
exports$1.__unpin(buffer);
|
|
17599
|
+
exports$1.__unpin(header);
|
|
17069
17600
|
return header;
|
|
17070
17601
|
}
|
|
17071
17602
|
function __liftTypedArray(constructor, pointer) {
|
|
@@ -17080,13 +17611,13 @@ async function instantiate$1(module, imports = {}) {
|
|
|
17080
17611
|
if (values == null) return 0;
|
|
17081
17612
|
const
|
|
17082
17613
|
length = values.length,
|
|
17083
|
-
buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
|
|
17084
|
-
header = exports.__new(12, id) >>> 0;
|
|
17614
|
+
buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
|
|
17615
|
+
header = exports$1.__new(12, id) >>> 0;
|
|
17085
17616
|
__setU32(header + 0, buffer);
|
|
17086
17617
|
__dataview.setUint32(header + 4, buffer, true);
|
|
17087
17618
|
__dataview.setUint32(header + 8, length << align, true);
|
|
17088
17619
|
new constructor(memory.buffer, buffer, length).set(values);
|
|
17089
|
-
exports.__unpin(buffer);
|
|
17620
|
+
exports$1.__unpin(buffer);
|
|
17090
17621
|
return header;
|
|
17091
17622
|
}
|
|
17092
17623
|
class Internref extends Number {}
|
|
@@ -17107,14 +17638,14 @@ async function instantiate$1(module, imports = {}) {
|
|
|
17107
17638
|
if (pointer) {
|
|
17108
17639
|
const refcount = refcounts.get(pointer);
|
|
17109
17640
|
if (refcount) refcounts.set(pointer, refcount + 1);
|
|
17110
|
-
else refcounts.set(exports.__pin(pointer), 1);
|
|
17641
|
+
else refcounts.set(exports$1.__pin(pointer), 1);
|
|
17111
17642
|
}
|
|
17112
17643
|
return pointer;
|
|
17113
17644
|
}
|
|
17114
17645
|
function __release(pointer) {
|
|
17115
17646
|
if (pointer) {
|
|
17116
17647
|
const refcount = refcounts.get(pointer);
|
|
17117
|
-
if (refcount === 1) exports.__unpin(pointer), refcounts.delete(pointer);
|
|
17648
|
+
if (refcount === 1) exports$1.__unpin(pointer), refcounts.delete(pointer);
|
|
17118
17649
|
else if (refcount) refcounts.set(pointer, refcount - 1);
|
|
17119
17650
|
else throw Error(`invalid refcount '${refcount}' for reference '${pointer}'`);
|
|
17120
17651
|
}
|
|
@@ -17393,7 +17924,7 @@ class InterpreterInstanceManager {
|
|
|
17393
17924
|
}
|
|
17394
17925
|
}
|
|
17395
17926
|
|
|
17396
|
-
var index$
|
|
17927
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
17397
17928
|
__proto__: null,
|
|
17398
17929
|
HostCallMemory: HostCallMemory,
|
|
17399
17930
|
HostCallRegisters: HostCallRegisters,
|
|
@@ -17486,7 +18017,7 @@ const codecServiceAccountInfoWithThresholdBalance = codec$1.object({
|
|
|
17486
18017
|
parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
|
|
17487
18018
|
}, "ServiceAccountInfoWithThresholdBalance");
|
|
17488
18019
|
|
|
17489
|
-
var index$
|
|
18020
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17490
18021
|
__proto__: null,
|
|
17491
18022
|
AccumulationStateUpdate: AccumulationStateUpdate,
|
|
17492
18023
|
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
@@ -17641,154 +18172,9 @@ class Mountain {
|
|
|
17641
18172
|
}
|
|
17642
18173
|
}
|
|
17643
18174
|
|
|
17644
|
-
var index$5 = /*#__PURE__*/Object.freeze({
|
|
17645
|
-
__proto__: null,
|
|
17646
|
-
MerkleMountainRange: MerkleMountainRange
|
|
17647
|
-
});
|
|
17648
|
-
|
|
17649
|
-
class DebuggerAdapter {
|
|
17650
|
-
pvm;
|
|
17651
|
-
constructor(useSbrkGas = false) {
|
|
17652
|
-
this.pvm = new Interpreter({ useSbrkGas });
|
|
17653
|
-
}
|
|
17654
|
-
resetGeneric(rawProgram, flatRegisters, initialGas) {
|
|
17655
|
-
this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
|
|
17656
|
-
}
|
|
17657
|
-
reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
|
|
17658
|
-
this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
|
|
17659
|
-
}
|
|
17660
|
-
getPageDump(pageNumber) {
|
|
17661
|
-
const page = this.pvm.getMemoryPage(pageNumber);
|
|
17662
|
-
if (page === null) {
|
|
17663
|
-
// page wasn't allocated so we return an empty page
|
|
17664
|
-
return safeAllocUint8Array(PAGE_SIZE$1);
|
|
17665
|
-
}
|
|
17666
|
-
if (page.length === PAGE_SIZE$1) {
|
|
17667
|
-
// page was allocated and has a proper size so we can simply return it
|
|
17668
|
-
return page;
|
|
17669
|
-
}
|
|
17670
|
-
// page was allocated but it is shorter than PAGE_SIZE so we have to extend it
|
|
17671
|
-
const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
|
|
17672
|
-
fullPage.set(page);
|
|
17673
|
-
return fullPage;
|
|
17674
|
-
}
|
|
17675
|
-
setMemory(address, value) {
|
|
17676
|
-
this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
|
|
17677
|
-
}
|
|
17678
|
-
getExitArg() {
|
|
17679
|
-
return this.pvm.getExitParam() ?? 0;
|
|
17680
|
-
}
|
|
17681
|
-
getStatus() {
|
|
17682
|
-
return this.pvm.getStatus();
|
|
17683
|
-
}
|
|
17684
|
-
nextStep() {
|
|
17685
|
-
return this.pvm.nextStep() === Status.OK;
|
|
17686
|
-
}
|
|
17687
|
-
nSteps(steps) {
|
|
17688
|
-
check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
|
|
17689
|
-
for (let i = 0; i < steps; i++) {
|
|
17690
|
-
const isOk = this.nextStep();
|
|
17691
|
-
if (!isOk) {
|
|
17692
|
-
return false;
|
|
17693
|
-
}
|
|
17694
|
-
}
|
|
17695
|
-
return true;
|
|
17696
|
-
}
|
|
17697
|
-
getRegisters() {
|
|
17698
|
-
return this.pvm.registers.getAllU64();
|
|
17699
|
-
}
|
|
17700
|
-
setRegisters(registers) {
|
|
17701
|
-
this.pvm.registers.copyFrom(new Registers(registers));
|
|
17702
|
-
}
|
|
17703
|
-
getProgramCounter() {
|
|
17704
|
-
return this.pvm.getPC();
|
|
17705
|
-
}
|
|
17706
|
-
setNextProgramCounter(nextPc) {
|
|
17707
|
-
this.pvm.setNextPC(nextPc);
|
|
17708
|
-
}
|
|
17709
|
-
getGasLeft() {
|
|
17710
|
-
return BigInt(this.pvm.gas.get());
|
|
17711
|
-
}
|
|
17712
|
-
setGasLeft(gas) {
|
|
17713
|
-
this.pvm.gas.set(tryAsGas(gas));
|
|
17714
|
-
}
|
|
17715
|
-
}
|
|
17716
|
-
|
|
17717
18175
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
17718
18176
|
__proto__: null,
|
|
17719
|
-
|
|
17720
|
-
ArgsDecoder: ArgsDecoder,
|
|
17721
|
-
get ArgumentType () { return ArgumentType; },
|
|
17722
|
-
BasicBlocks: BasicBlocks,
|
|
17723
|
-
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
17724
|
-
get EjectError () { return EjectError; },
|
|
17725
|
-
ExtendedWitdthImmediateDecoder: ExtendedWitdthImmediateDecoder,
|
|
17726
|
-
get ForgetPreimageError () { return ForgetPreimageError; },
|
|
17727
|
-
HostCallMemory: HostCallMemory,
|
|
17728
|
-
HostCallRegisters: HostCallRegisters,
|
|
17729
|
-
HostCallResult: HostCallResult,
|
|
17730
|
-
ImmediateDecoder: ImmediateDecoder,
|
|
17731
|
-
InsufficientFundsError: InsufficientFundsError,
|
|
17732
|
-
MachineInstance: MachineInstance,
|
|
17733
|
-
Mask: Mask,
|
|
17734
|
-
get MemoryOperation () { return MemoryOperation; },
|
|
17735
|
-
MemorySegment: MemorySegment,
|
|
17736
|
-
NO_OF_REGISTERS: NO_OF_REGISTERS$1,
|
|
17737
|
-
get NewServiceError () { return NewServiceError; },
|
|
17738
|
-
NibblesDecoder: NibblesDecoder,
|
|
17739
|
-
NoMachineError: NoMachineError,
|
|
17740
|
-
OK: OK,
|
|
17741
|
-
get PagesError () { return PagesError; },
|
|
17742
|
-
PartiallyUpdatedState: PartiallyUpdatedState,
|
|
17743
|
-
get PeekPokeError () { return PeekPokeError; },
|
|
17744
|
-
PendingTransfer: PendingTransfer,
|
|
17745
|
-
get PreimageStatusKind () { return PreimageStatusKind; },
|
|
17746
|
-
Program: Program,
|
|
17747
|
-
ProgramDecoder: ProgramDecoder,
|
|
17748
|
-
get ProvidePreimageError () { return ProvidePreimageError; },
|
|
17749
|
-
Pvm: DebuggerAdapter,
|
|
17750
|
-
Registers: Registers,
|
|
17751
|
-
get RequestPreimageError () { return RequestPreimageError; },
|
|
17752
|
-
Result: Result$1,
|
|
17753
|
-
SERVICE_ID_BYTES: SERVICE_ID_BYTES,
|
|
17754
|
-
SegmentExportError: SegmentExportError,
|
|
17755
|
-
SpiMemory: SpiMemory,
|
|
17756
|
-
SpiProgram: SpiProgram,
|
|
17757
|
-
TRANSFER_MEMO_BYTES: TRANSFER_MEMO_BYTES,
|
|
17758
|
-
get TransferError () { return TransferError; },
|
|
17759
|
-
UnprivilegedError: UnprivilegedError,
|
|
17760
|
-
get UpdatePrivilegesError () { return UpdatePrivilegesError; },
|
|
17761
|
-
WithDebug: WithDebug,
|
|
17762
|
-
get ZeroVoidError () { return ZeroVoidError; },
|
|
17763
|
-
asOpaqueType: asOpaqueType,
|
|
17764
|
-
assertEmpty: assertEmpty,
|
|
17765
|
-
assertNever: assertNever,
|
|
17766
|
-
block: index$m,
|
|
17767
|
-
bytes: index$t,
|
|
17768
|
-
check: check,
|
|
17769
|
-
clampU64ToU32: clampU64ToU32,
|
|
17770
|
-
createResults: createResults,
|
|
17771
|
-
decodeStandardProgram: decodeStandardProgram,
|
|
17772
|
-
emptyRegistersBuffer: emptyRegistersBuffer,
|
|
17773
|
-
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
17774
|
-
getServiceId: getServiceId,
|
|
17775
|
-
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
17776
|
-
hash: index$p,
|
|
17777
|
-
hostCallInfoAccount: codecServiceAccountInfoWithThresholdBalance,
|
|
17778
|
-
inspect: inspect,
|
|
17779
|
-
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
17780
|
-
interpreter: index$8,
|
|
17781
|
-
isBrowser: isBrowser,
|
|
17782
|
-
lazyInspect: lazyInspect,
|
|
17783
|
-
measure: measure,
|
|
17784
|
-
numbers: index$s,
|
|
17785
|
-
resultToString: resultToString,
|
|
17786
|
-
seeThrough: seeThrough,
|
|
17787
|
-
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
17788
|
-
toMemoryOperation: toMemoryOperation,
|
|
17789
|
-
tryAsMachineId: tryAsMachineId,
|
|
17790
|
-
tryAsProgramCounter: tryAsProgramCounter,
|
|
17791
|
-
writeServiceIdAsLeBytes: writeServiceIdAsLeBytes
|
|
18177
|
+
MerkleMountainRange: MerkleMountainRange
|
|
17792
18178
|
});
|
|
17793
18179
|
|
|
17794
18180
|
const ENTROPY_BYTES = 32;
|
|
@@ -18062,12 +18448,12 @@ class JsonCoreStatistics {
|
|
|
18062
18448
|
extrinsic_count: "number",
|
|
18063
18449
|
bundle_size: "number",
|
|
18064
18450
|
gas_used: json.fromBigInt(tryAsServiceGas),
|
|
18065
|
-
}, ({ da_load, popularity, imports, exports, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
|
|
18451
|
+
}, ({ da_load, popularity, imports, exports: exports$1, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
|
|
18066
18452
|
return CoreStatistics.create({
|
|
18067
18453
|
dataAvailabilityLoad: da_load,
|
|
18068
18454
|
popularity,
|
|
18069
18455
|
imports,
|
|
18070
|
-
exports,
|
|
18456
|
+
exports: exports$1,
|
|
18071
18457
|
extrinsicSize: extrinsic_size,
|
|
18072
18458
|
extrinsicCount: extrinsic_count,
|
|
18073
18459
|
bundleSize: bundle_size,
|
|
@@ -18101,14 +18487,14 @@ class JsonServiceStatistics {
|
|
|
18101
18487
|
on_transfers_gas_used: json.fromBigInt(tryAsServiceGas),
|
|
18102
18488
|
}
|
|
18103
18489
|
: {}),
|
|
18104
|
-
}, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
|
|
18490
|
+
}, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports: exports$1, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
|
|
18105
18491
|
return ServiceStatistics.create({
|
|
18106
18492
|
providedCount: provided_count,
|
|
18107
18493
|
providedSize: provided_size,
|
|
18108
18494
|
refinementCount: refinement_count,
|
|
18109
18495
|
refinementGasUsed: refinement_gas_used,
|
|
18110
18496
|
imports,
|
|
18111
|
-
exports,
|
|
18497
|
+
exports: exports$1,
|
|
18112
18498
|
extrinsicSize: extrinsic_size,
|
|
18113
18499
|
extrinsicCount: extrinsic_count,
|
|
18114
18500
|
accumulateCount: accumulate_count,
|
|
@@ -18316,11 +18702,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
18316
18702
|
|
|
18317
18703
|
/** Helper function to create most used hashes in the block */
|
|
18318
18704
|
class TransitionHasher {
|
|
18319
|
-
context;
|
|
18320
18705
|
keccakHasher;
|
|
18321
18706
|
blake2b;
|
|
18322
|
-
constructor(
|
|
18323
|
-
this.context = context;
|
|
18707
|
+
constructor(keccakHasher, blake2b) {
|
|
18324
18708
|
this.keccakHasher = keccakHasher;
|
|
18325
18709
|
this.blake2b = blake2b;
|
|
18326
18710
|
}
|
|
@@ -18432,4 +18816,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
18432
18816
|
TransitionHasher: TransitionHasher
|
|
18433
18817
|
});
|
|
18434
18818
|
|
|
18435
|
-
export { index$
|
|
18819
|
+
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 };
|