@typeberry/lib 0.5.0-3439612 → 0.5.0-5c5fc1c
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 +18 -17
- package/index.d.ts +10 -10
- package/index.js +18 -17
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -6966,6 +6966,7 @@ class Header extends WithDebug {
|
|
|
6966
6966
|
static create(h) {
|
|
6967
6967
|
return Object.assign(Header.empty(), h);
|
|
6968
6968
|
}
|
|
6969
|
+
// TODO [ToDr] the fields should be readonly
|
|
6969
6970
|
/**
|
|
6970
6971
|
* `H_p`: Hash of the parent header.
|
|
6971
6972
|
*
|
|
@@ -7144,7 +7145,8 @@ class Block extends WithDebug {
|
|
|
7144
7145
|
}
|
|
7145
7146
|
}
|
|
7146
7147
|
function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
7147
|
-
const header = Header.
|
|
7148
|
+
const header = Header.empty();
|
|
7149
|
+
header.timeSlotIndex = slot;
|
|
7148
7150
|
return Block.create({
|
|
7149
7151
|
header,
|
|
7150
7152
|
extrinsic: Extrinsic.create({
|
|
@@ -7692,22 +7694,21 @@ const headerFromJson = json.object({
|
|
|
7692
7694
|
entropy_source: bandersnatchVrfSignature,
|
|
7693
7695
|
seal: bandersnatchVrfSignature,
|
|
7694
7696
|
}, ({ parent, parent_state_root, extrinsic_hash, slot, epoch_mark, tickets_mark, offenders_mark, author_index, entropy_source, seal, }) => {
|
|
7695
|
-
const
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
});
|
|
7697
|
+
const header = Header.empty();
|
|
7698
|
+
header.parentHeaderHash = parent;
|
|
7699
|
+
header.priorStateRoot = parent_state_root;
|
|
7700
|
+
header.extrinsicHash = extrinsic_hash;
|
|
7701
|
+
header.timeSlotIndex = slot;
|
|
7702
|
+
header.epochMarker = epoch_mark ?? null;
|
|
7703
|
+
header.ticketsMarker =
|
|
7704
|
+
tickets_mark === undefined || tickets_mark === null
|
|
7705
|
+
? null
|
|
7706
|
+
: TicketsMarker.create({ tickets: asOpaqueType(tickets_mark) });
|
|
7707
|
+
header.offendersMarker = offenders_mark;
|
|
7708
|
+
header.bandersnatchBlockAuthorIndex = author_index;
|
|
7709
|
+
header.entropySource = entropy_source;
|
|
7710
|
+
header.seal = seal;
|
|
7711
|
+
return header;
|
|
7711
7712
|
});
|
|
7712
7713
|
|
|
7713
7714
|
const blockFromJson = (spec) => json.object({
|
package/index.d.ts
CHANGED
|
@@ -2767,35 +2767,35 @@ declare class Header extends WithDebug {
|
|
|
2767
2767
|
*
|
|
2768
2768
|
* In case of the genesis block, the hash will be zero.
|
|
2769
2769
|
*/
|
|
2770
|
-
|
|
2770
|
+
parentHeaderHash: HeaderHash;
|
|
2771
2771
|
/** `H_r`: The state trie root hash before executing that block. */
|
|
2772
|
-
|
|
2772
|
+
priorStateRoot: StateRootHash;
|
|
2773
2773
|
/** `H_x`: The hash of block extrinsic. */
|
|
2774
|
-
|
|
2774
|
+
extrinsicHash: ExtrinsicHash;
|
|
2775
2775
|
/** `H_t`: JAM time-slot index. */
|
|
2776
|
-
|
|
2776
|
+
timeSlotIndex: TimeSlot;
|
|
2777
2777
|
/**
|
|
2778
2778
|
* `H_e`: Key and entropy relevant to the following epoch in case the ticket
|
|
2779
2779
|
* contest does not complete adequately.
|
|
2780
2780
|
*/
|
|
2781
|
-
|
|
2781
|
+
epochMarker: EpochMarker | null;
|
|
2782
2782
|
/**
|
|
2783
2783
|
* `H_w`: Winning tickets provides the series of 600 slot sealing "tickets"
|
|
2784
2784
|
* for the next epoch.
|
|
2785
2785
|
*/
|
|
2786
|
-
|
|
2786
|
+
ticketsMarker: TicketsMarker | null;
|
|
2787
2787
|
/** `H_i`: Block author's index in the current validator set. */
|
|
2788
|
-
|
|
2788
|
+
bandersnatchBlockAuthorIndex: ValidatorIndex;
|
|
2789
2789
|
/** `H_v`: Entropy-yielding VRF signature. */
|
|
2790
|
-
|
|
2790
|
+
entropySource: BandersnatchVrfSignature;
|
|
2791
2791
|
/** `H_o`: Sequence of keys of newly misbehaving validators. */
|
|
2792
|
-
|
|
2792
|
+
offendersMarker: Ed25519Key[];
|
|
2793
2793
|
/**
|
|
2794
2794
|
* `H_s`: Block seal.
|
|
2795
2795
|
*
|
|
2796
2796
|
* https://graypaper.fluffylabs.dev/#/579bd12/0d0c010d1101
|
|
2797
2797
|
*/
|
|
2798
|
-
|
|
2798
|
+
seal: BandersnatchVrfSignature;
|
|
2799
2799
|
private constructor();
|
|
2800
2800
|
/** Create an empty header with some dummy values. */
|
|
2801
2801
|
static empty(): Header;
|
package/index.js
CHANGED
|
@@ -6963,6 +6963,7 @@ class Header extends WithDebug {
|
|
|
6963
6963
|
static create(h) {
|
|
6964
6964
|
return Object.assign(Header.empty(), h);
|
|
6965
6965
|
}
|
|
6966
|
+
// TODO [ToDr] the fields should be readonly
|
|
6966
6967
|
/**
|
|
6967
6968
|
* `H_p`: Hash of the parent header.
|
|
6968
6969
|
*
|
|
@@ -7141,7 +7142,8 @@ class Block extends WithDebug {
|
|
|
7141
7142
|
}
|
|
7142
7143
|
}
|
|
7143
7144
|
function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
7144
|
-
const header = Header.
|
|
7145
|
+
const header = Header.empty();
|
|
7146
|
+
header.timeSlotIndex = slot;
|
|
7145
7147
|
return Block.create({
|
|
7146
7148
|
header,
|
|
7147
7149
|
extrinsic: Extrinsic.create({
|
|
@@ -7689,22 +7691,21 @@ const headerFromJson = json.object({
|
|
|
7689
7691
|
entropy_source: bandersnatchVrfSignature,
|
|
7690
7692
|
seal: bandersnatchVrfSignature,
|
|
7691
7693
|
}, ({ parent, parent_state_root, extrinsic_hash, slot, epoch_mark, tickets_mark, offenders_mark, author_index, entropy_source, seal, }) => {
|
|
7692
|
-
const
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
});
|
|
7694
|
+
const header = Header.empty();
|
|
7695
|
+
header.parentHeaderHash = parent;
|
|
7696
|
+
header.priorStateRoot = parent_state_root;
|
|
7697
|
+
header.extrinsicHash = extrinsic_hash;
|
|
7698
|
+
header.timeSlotIndex = slot;
|
|
7699
|
+
header.epochMarker = epoch_mark ?? null;
|
|
7700
|
+
header.ticketsMarker =
|
|
7701
|
+
tickets_mark === undefined || tickets_mark === null
|
|
7702
|
+
? null
|
|
7703
|
+
: TicketsMarker.create({ tickets: asOpaqueType(tickets_mark) });
|
|
7704
|
+
header.offendersMarker = offenders_mark;
|
|
7705
|
+
header.bandersnatchBlockAuthorIndex = author_index;
|
|
7706
|
+
header.entropySource = entropy_source;
|
|
7707
|
+
header.seal = seal;
|
|
7708
|
+
return header;
|
|
7708
7709
|
});
|
|
7709
7710
|
|
|
7710
7711
|
const blockFromJson = (spec) => json.object({
|