@typeberry/lib 0.5.9 → 0.5.10

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.
Files changed (104) hide show
  1. package/package.json +1 -1
  2. package/packages/jam/block/block.d.ts +3 -3
  3. package/packages/jam/block/header.d.ts +6 -6
  4. package/packages/jam/block/test-helpers.d.ts +2 -2
  5. package/packages/jam/block/tickets.d.ts +5 -6
  6. package/packages/jam/block/tickets.d.ts.map +1 -1
  7. package/packages/jam/block/tickets.js +2 -10
  8. package/packages/jam/block/work-item-segment.d.ts +23 -6
  9. package/packages/jam/block/work-item-segment.d.ts.map +1 -1
  10. package/packages/jam/block/work-item-segment.js +24 -7
  11. package/packages/jam/block/work-item.d.ts +3 -3
  12. package/packages/jam/block/work-item.d.ts.map +1 -1
  13. package/packages/jam/block/work-item.js +7 -3
  14. package/packages/jam/block/work-package.d.ts +2 -2
  15. package/packages/jam/block/work-package.d.ts.map +1 -1
  16. package/packages/jam/block/work-package.js +2 -6
  17. package/packages/jam/block-json/block.d.ts +2 -2
  18. package/packages/jam/block-json/block.js +1 -1
  19. package/packages/jam/block-json/common.d.ts +1 -2
  20. package/packages/jam/block-json/common.d.ts.map +1 -1
  21. package/packages/jam/block-json/common.js +2 -2
  22. package/packages/jam/block-json/extrinsic.js +1 -1
  23. package/packages/jam/block-json/header.d.ts +1 -2
  24. package/packages/jam/block-json/header.d.ts.map +1 -1
  25. package/packages/jam/block-json/header.js +32 -34
  26. package/packages/jam/block-json/tickets-extrinsic.d.ts +1 -2
  27. package/packages/jam/block-json/tickets-extrinsic.d.ts.map +1 -1
  28. package/packages/jam/block-json/tickets-extrinsic.js +5 -7
  29. package/packages/jam/block-json/work-result.js +2 -2
  30. package/packages/jam/database/blocks.d.ts +3 -0
  31. package/packages/jam/database/blocks.d.ts.map +1 -1
  32. package/packages/jam/database/blocks.js +5 -0
  33. package/packages/jam/database-lmdb/blocks.d.ts +1 -0
  34. package/packages/jam/database-lmdb/blocks.d.ts.map +1 -1
  35. package/packages/jam/database-lmdb/blocks.js +5 -0
  36. package/packages/jam/database-lmdb/states.js +1 -1
  37. package/packages/jam/fuzz-proto/v1/types.d.ts +1 -1
  38. package/packages/jam/in-core/externalities/refine.d.ts +27 -6
  39. package/packages/jam/in-core/externalities/refine.d.ts.map +1 -1
  40. package/packages/jam/in-core/externalities/refine.js +40 -7
  41. package/packages/jam/in-core/externalities/refine.test.d.ts +2 -0
  42. package/packages/jam/in-core/externalities/refine.test.d.ts.map +1 -0
  43. package/packages/jam/in-core/externalities/refine.test.js +163 -0
  44. package/packages/jam/in-core/in-core.d.ts +1 -1
  45. package/packages/jam/in-core/in-core.d.ts.map +1 -1
  46. package/packages/jam/in-core/in-core.js +14 -5
  47. package/packages/jam/jam-host-calls/externalities/refine-externalities.d.ts +2 -0
  48. package/packages/jam/jam-host-calls/externalities/refine-externalities.d.ts.map +1 -1
  49. package/packages/jam/jam-host-calls/externalities/refine-externalities.test.d.ts +2 -0
  50. package/packages/jam/jam-host-calls/externalities/refine-externalities.test.d.ts.map +1 -1
  51. package/packages/jam/jam-host-calls/externalities/refine-externalities.test.js +5 -0
  52. package/packages/jam/jam-host-calls/refine/export.d.ts +1 -1
  53. package/packages/jam/jam-host-calls/refine/export.js +1 -1
  54. package/packages/jam/jam-host-calls/refine/export.test.js +3 -0
  55. package/packages/jam/jam-host-calls/refine/historical-lookup.d.ts +1 -1
  56. package/packages/jam/jam-host-calls/refine/historical-lookup.js +1 -1
  57. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.d.ts +1 -1
  58. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.test.js +1 -1
  59. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts +1 -1
  60. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.d.ts +1 -1
  61. package/packages/jam/jamnp-s/tasks/ticket-distribution.test.js +1 -1
  62. package/packages/jam/node/main-fuzz.d.ts.map +1 -1
  63. package/packages/jam/node/main-fuzz.js +1 -0
  64. package/packages/jam/node/main-importer.d.ts +1 -0
  65. package/packages/jam/node/main-importer.d.ts.map +1 -1
  66. package/packages/jam/node/main-importer.js +1 -0
  67. package/packages/jam/node/main.d.ts.map +1 -1
  68. package/packages/jam/node/main.js +1 -0
  69. package/packages/jam/node/reader.d.ts +2 -2
  70. package/packages/jam/node/workers.d.ts +22 -22
  71. package/packages/jam/safrole/bandersnatch-vrf.d.ts +1 -2
  72. package/packages/jam/safrole/bandersnatch-vrf.d.ts.map +1 -1
  73. package/packages/jam/safrole/bandersnatch-vrf.js +2 -2
  74. package/packages/jam/safrole/bandersnatch-vrf.test.js +2 -3
  75. package/packages/jam/safrole/safrole.test.js +72 -80
  76. package/packages/jam/state/safrole-data.d.ts +1 -1
  77. package/packages/jam/state/test.utils.js +1 -1
  78. package/packages/jam/state-json/dump.js +2 -2
  79. package/packages/jam/state-json/safrole.d.ts +2 -2
  80. package/packages/jam/state-json/safrole.d.ts.map +1 -1
  81. package/packages/jam/state-json/safrole.js +4 -4
  82. package/packages/jam/state-merkleization/in-memory-state-codec.d.ts +1 -1
  83. package/packages/jam/state-vectors/index.d.ts +7 -8
  84. package/packages/jam/state-vectors/index.d.ts.map +1 -1
  85. package/packages/jam/state-vectors/index.js +4 -6
  86. package/packages/jam/transition/hasher.test.js +1 -1
  87. package/packages/workers/block-authorship/main.d.ts.map +1 -1
  88. package/packages/workers/block-authorship/main.js +1 -1
  89. package/packages/workers/block-authorship/protocol.d.ts +4 -4
  90. package/packages/workers/block-authorship/ticket-generator.d.ts +1 -2
  91. package/packages/workers/block-authorship/ticket-generator.d.ts.map +1 -1
  92. package/packages/workers/block-authorship/ticket-generator.js +2 -2
  93. package/packages/workers/block-authorship/ticket-generator.test.js +10 -11
  94. package/packages/workers/comms-authorship-network/protocol.d.ts +1 -1
  95. package/packages/workers/comms-authorship-network/tickets-message.d.ts +1 -1
  96. package/packages/workers/importer/importer.d.ts +1 -0
  97. package/packages/workers/importer/importer.d.ts.map +1 -1
  98. package/packages/workers/importer/importer.js +7 -2
  99. package/packages/workers/importer/main.d.ts.map +1 -1
  100. package/packages/workers/importer/main.js +2 -0
  101. package/packages/workers/importer/protocol.d.ts +12 -9
  102. package/packages/workers/importer/protocol.d.ts.map +1 -1
  103. package/packages/workers/importer/protocol.js +8 -3
  104. package/packages/workers/jam-network/protocol.d.ts +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/lib",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "Typeberry Library",
5
5
  "main": "./bin/lib/index.js",
6
6
  "types": "./bin/lib/index.d.ts",
@@ -42,7 +42,7 @@ export declare class Extrinsic extends WithDebug {
42
42
  readonly disputes: DisputesExtrinsic;
43
43
  static Codec: import("@typeberry/codec").Descriptor<Extrinsic, import("@typeberry/codec").ViewOf<Extrinsic, {
44
44
  tickets: import("@typeberry/codec").Descriptor<readonly import("./tickets.js").SignedTicket[] & import("@typeberry/utils").WithOpaque<"Size: [0..chainSpec.maxTicketsPerExtrinsic)">, import("@typeberry/codec").SequenceView<import("./tickets.js").SignedTicket, import("@typeberry/codec").ViewOf<import("./tickets.js").SignedTicket, {
45
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
45
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
46
46
  signature: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<784> & import("@typeberry/utils").WithOpaque<"BandersnatchRingSignature">, import("@typeberry/bytes").Bytes<784>>;
47
47
  }>>>;
48
48
  preimages: import("@typeberry/codec").Descriptor<import("./preimage.js").Preimage[], import("@typeberry/codec").SequenceView<import("./preimage.js").Preimage, import("@typeberry/codec").ViewOf<import("./preimage.js").Preimage, {
@@ -172,7 +172,7 @@ export declare class Block extends WithDebug {
172
172
  ticketsMarker: import("@typeberry/codec").Descriptor<import("./header.js").TicketsMarker | null, import("@typeberry/codec").ViewOf<import("./header.js").TicketsMarker, {
173
173
  tickets: import("@typeberry/codec").Descriptor<readonly import("./tickets.js").Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<import("./tickets.js").Ticket, import("@typeberry/codec").ViewOf<import("./tickets.js").Ticket, {
174
174
  id: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32>, import("@typeberry/bytes").Bytes<32>>;
175
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
175
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
176
176
  }>>>;
177
177
  }> | null>;
178
178
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, import("@typeberry/bytes").Bytes<2>>;
@@ -182,7 +182,7 @@ export declare class Block extends WithDebug {
182
182
  }>>;
183
183
  extrinsic: import("@typeberry/codec").Descriptor<Extrinsic, import("@typeberry/codec").ViewOf<Extrinsic, {
184
184
  tickets: import("@typeberry/codec").Descriptor<readonly import("./tickets.js").SignedTicket[] & import("@typeberry/utils").WithOpaque<"Size: [0..chainSpec.maxTicketsPerExtrinsic)">, import("@typeberry/codec").SequenceView<import("./tickets.js").SignedTicket, import("@typeberry/codec").ViewOf<import("./tickets.js").SignedTicket, {
185
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
185
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
186
186
  signature: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<784> & import("@typeberry/utils").WithOpaque<"BandersnatchRingSignature">, import("@typeberry/bytes").Bytes<784>>;
187
187
  }>>>;
188
188
  preimages: import("@typeberry/codec").Descriptor<import("./preimage.js").Preimage[], import("@typeberry/codec").SequenceView<import("./preimage.js").Preimage, import("@typeberry/codec").ViewOf<import("./preimage.js").Preimage, {
@@ -28,7 +28,7 @@ export declare class TicketsMarker extends WithDebug {
28
28
  static Codec: import("@typeberry/codec").Descriptor<TicketsMarker, import("@typeberry/codec").ViewOf<TicketsMarker, {
29
29
  tickets: import("@typeberry/codec").Descriptor<readonly Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
30
30
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
31
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
31
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
32
32
  }>>>;
33
33
  }>>;
34
34
  static create({ tickets }: CodecRecord<TicketsMarker>): TicketsMarker;
@@ -89,7 +89,7 @@ export declare class Header extends WithDebug {
89
89
  ticketsMarker: import("@typeberry/codec").Descriptor<TicketsMarker | null, import("@typeberry/codec").ViewOf<TicketsMarker, {
90
90
  tickets: import("@typeberry/codec").Descriptor<readonly Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
91
91
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
92
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
92
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
93
93
  }>>>;
94
94
  }> | null>;
95
95
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, Bytes<2>>;
@@ -155,7 +155,7 @@ export declare const headerViewWithHashCodec: import("@typeberry/codec").Descrip
155
155
  ticketsMarker: import("@typeberry/codec").Descriptor<TicketsMarker | null, import("@typeberry/codec").ViewOf<TicketsMarker, {
156
156
  tickets: import("@typeberry/codec").Descriptor<readonly Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
157
157
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
158
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
158
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
159
159
  }>>>;
160
160
  }> | null>;
161
161
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, Bytes<2>>;
@@ -178,7 +178,7 @@ export declare const headerViewWithHashCodec: import("@typeberry/codec").Descrip
178
178
  ticketsMarker: import("@typeberry/codec").Descriptor<TicketsMarker | null, import("@typeberry/codec").ViewOf<TicketsMarker, {
179
179
  tickets: import("@typeberry/codec").Descriptor<readonly Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
180
180
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
181
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
181
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
182
182
  }>>>;
183
183
  }> | null>;
184
184
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, Bytes<2>>;
@@ -203,7 +203,7 @@ export declare const headerViewWithHashCodec: import("@typeberry/codec").Descrip
203
203
  ticketsMarker: import("@typeberry/codec").Descriptor<TicketsMarker | null, import("@typeberry/codec").ViewOf<TicketsMarker, {
204
204
  tickets: import("@typeberry/codec").Descriptor<readonly Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
205
205
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
206
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
206
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
207
207
  }>>>;
208
208
  }> | null>;
209
209
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, Bytes<2>>;
@@ -226,7 +226,7 @@ export declare const headerViewWithHashCodec: import("@typeberry/codec").Descrip
226
226
  ticketsMarker: import("@typeberry/codec").Descriptor<TicketsMarker | null, import("@typeberry/codec").ViewOf<TicketsMarker, {
227
227
  tickets: import("@typeberry/codec").Descriptor<readonly Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
228
228
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
229
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
229
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
230
230
  }>>>;
231
231
  }> | null>;
232
232
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, Bytes<2>>;
@@ -19,7 +19,7 @@ export declare function testBlockView(): import("@typeberry/codec").ViewOf<Block
19
19
  ticketsMarker: import("@typeberry/codec").Descriptor<import("./header.js").TicketsMarker | null, import("@typeberry/codec").ViewOf<import("./header.js").TicketsMarker, {
20
20
  tickets: import("@typeberry/codec").Descriptor<readonly import("./tickets.js").Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<import("./tickets.js").Ticket, import("@typeberry/codec").ViewOf<import("./tickets.js").Ticket, {
21
21
  id: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32>, import("@typeberry/bytes").Bytes<32>>;
22
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
22
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
23
23
  }>>>;
24
24
  }> | null>;
25
25
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, import("@typeberry/bytes").Bytes<2>>;
@@ -29,7 +29,7 @@ export declare function testBlockView(): import("@typeberry/codec").ViewOf<Block
29
29
  }>>;
30
30
  extrinsic: import("@typeberry/codec").Descriptor<import("./block.js").Extrinsic, import("@typeberry/codec").ViewOf<import("./block.js").Extrinsic, {
31
31
  tickets: import("@typeberry/codec").Descriptor<readonly import("./tickets.js").SignedTicket[] & import("@typeberry/utils").WithOpaque<"Size: [0..chainSpec.maxTicketsPerExtrinsic)">, import("@typeberry/codec").SequenceView<import("./tickets.js").SignedTicket, import("@typeberry/codec").ViewOf<import("./tickets.js").SignedTicket, {
32
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
32
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
33
33
  signature: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<784> & import("@typeberry/utils").WithOpaque<"BandersnatchRingSignature">, import("@typeberry/bytes").Bytes<784>>;
34
34
  }>>>;
35
35
  preimages: import("@typeberry/codec").Descriptor<import("./preimage.js").Preimage[], import("@typeberry/codec").SequenceView<import("./preimage.js").Preimage, import("@typeberry/codec").ViewOf<import("./preimage.js").Preimage, {
@@ -1,7 +1,6 @@
1
1
  import type { Bytes } from "#@typeberry/bytes";
2
2
  import { type CodecRecord } from "#@typeberry/codec";
3
3
  import type { KnownSizeArray } from "#@typeberry/collections";
4
- import type { ChainSpec } from "#@typeberry/config";
5
4
  import { type BandersnatchProof } from "#@typeberry/crypto/bandersnatch.js";
6
5
  import { type U8 } from "#@typeberry/numbers";
7
6
  import { type Opaque, WithDebug } from "#@typeberry/utils";
@@ -11,15 +10,15 @@ import { type Opaque, WithDebug } from "#@typeberry/utils";
11
10
  * Constrained by `N = 2`:
12
11
  * https://graypaper.fluffylabs.dev/#/579bd12/417200417400
13
12
  */
14
- export type TicketAttempt = Opaque<U8, "TicketAttempt[0|1|2]">;
15
- export declare function tryAsTicketAttempt(x: number, chainSpec: ChainSpec): TicketAttempt;
13
+ export type TicketAttempt = Opaque<U8, "TicketAttempt[u8]">;
14
+ export declare function tryAsTicketAttempt(x: number): TicketAttempt;
16
15
  export declare class SignedTicket extends WithDebug {
17
16
  /** Which attempt was it? */
18
17
  readonly attempt: TicketAttempt;
19
18
  /** The bandersnatch membership proof of knowledge. */
20
19
  readonly signature: BandersnatchProof;
21
20
  static Codec: import("@typeberry/codec").Descriptor<SignedTicket, import("@typeberry/codec").ViewOf<SignedTicket, {
22
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
21
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
23
22
  signature: import("@typeberry/codec").Descriptor<Bytes<784> & import("@typeberry/utils").WithOpaque<"BandersnatchRingSignature">, Bytes<784>>;
24
23
  }>>;
25
24
  static create({ attempt, signature }: CodecRecord<SignedTicket>): SignedTicket;
@@ -37,7 +36,7 @@ export declare class Ticket extends WithDebug {
37
36
  readonly attempt: TicketAttempt;
38
37
  static Codec: import("@typeberry/codec").Descriptor<Ticket, import("@typeberry/codec").ViewOf<Ticket, {
39
38
  id: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
40
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
39
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
41
40
  }>>;
42
41
  static create({ id, attempt }: CodecRecord<Ticket>): Ticket;
43
42
  private constructor();
@@ -53,7 +52,7 @@ export declare class Ticket extends WithDebug {
53
52
  declare const TicketsExtrinsicBounds = "Size: [0..chainSpec.maxTicketsPerExtrinsic)";
54
53
  export type TicketsExtrinsic = KnownSizeArray<SignedTicket, typeof TicketsExtrinsicBounds>;
55
54
  export declare const ticketsExtrinsicCodec: import("@typeberry/codec").Descriptor<readonly SignedTicket[] & import("@typeberry/utils").WithOpaque<"Size: [0..chainSpec.maxTicketsPerExtrinsic)">, import("@typeberry/codec").SequenceView<SignedTicket, import("@typeberry/codec").ViewOf<SignedTicket, {
56
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
55
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
57
56
  signature: import("@typeberry/codec").Descriptor<Bytes<784> & import("@typeberry/utils").WithOpaque<"BandersnatchRingSignature">, Bytes<784>>;
58
57
  }>>>;
59
58
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"tickets.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block/tickets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAErG,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAgB,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGxE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,EAAE,sBAAsB,CAAC,CAAC;AAC/D,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,aAAa,CAKjF;AAaD,qBAAa,YAAa,SAAQ,SAAS;IAWvC,4BAA4B;aACZ,OAAO,EAAE,aAAa;IACtC,sDAAsD;aACtC,SAAS,EAAE,iBAAiB;IAb9C,MAAM,CAAC,KAAK;;;QAGT;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC;IAI/D,OAAO;CAQR;AAED,gDAAgD;AAChD,qBAAa,MAAO,SAAQ,SAAS;IAWjC;;;;OAIG;aACa,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;IAC7B,2BAA2B;aACX,OAAO,EAAE,aAAa;IAjBxC,MAAM,CAAC,K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ACa,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;IAC7B,2BAA2B;aACX,OAAO,EAAE,aAAa;IAjBxC,MAAM,CAAC,KAAK;;;QAGT;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,CAAC,MAAM,CAAC;IAIlD,OAAO;CAYR;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,sBAAsB,gDAAgD,CAAC;AAC7E,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,YAAY,EAAE,OAAO,sBAAsB,CAAC,CAAC;AAE3F,eAAO,MAAM,qBAAqB;;;IAUhC,CAAC"}
@@ -4,18 +4,10 @@ import { HASH_SIZE } from "#@typeberry/hash";
4
4
  import { tryAsU8, tryAsU32 } from "#@typeberry/numbers";
5
5
  import { asOpaqueType, WithDebug } from "#@typeberry/utils";
6
6
  import { codecKnownSizeArray, codecWithContext } from "./codec-utils.js";
7
- export function tryAsTicketAttempt(x, chainSpec) {
8
- if (x >= chainSpec.ticketsPerValidator) {
9
- throw new Error(`Ticket attempt ${x} is out of bounds [0, ${chainSpec.ticketsPerValidator})`);
10
- }
7
+ export function tryAsTicketAttempt(x) {
11
8
  return asOpaqueType(tryAsU8(x));
12
9
  }
13
- const ticketAttemptCodec = codecWithContext((context) => {
14
- return codec.varU32.convert((x) => {
15
- tryAsTicketAttempt(x, context);
16
- return tryAsU32(x);
17
- }, (x) => tryAsTicketAttempt(x, context));
18
- });
10
+ const ticketAttemptCodec = codec.varU32.convert((x) => tryAsU32(x), (x) => tryAsTicketAttempt(x));
19
11
  /* Bandersnatch-signed ticket contest entry. */
20
12
  export class SignedTicket extends WithDebug {
21
13
  attempt;
@@ -1,13 +1,30 @@
1
1
  import type { Bytes } from "#@typeberry/bytes";
2
2
  import { type U16 } from "#@typeberry/numbers";
3
3
  import { type Opaque } from "#@typeberry/utils";
4
- /** `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6. */
4
+ /**
5
+ * `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6.
6
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/449600449700?v=0.7.2
7
+ */
5
8
  export declare const W_E = 684;
6
- /** `W_S`: The size of an exported segment in erasure-coded pieces in octets. */
7
- export declare const W_S = 6;
8
- /** `W_M`: The maximum number of entries in a work-package manifest. */
9
- export declare const MAX_NUMBER_OF_SEGMENTS = 2048;
10
- /** `W_E * W_S`: Exported segment size in bytes. */
9
+ /**
10
+ * `W_P`: The size of an exported segment in erasure-coded pieces in octets.
11
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/44b10044b200?v=0.7.2
12
+ */
13
+ export declare const W_P = 6;
14
+ /**
15
+ * `W_M`: The maximum number of imports in a work-package manifest.
16
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/44ad0044ae00?v=0.7.2
17
+ */
18
+ export declare const MAX_NUMBER_OF_IMPORTS_WP = 3072;
19
+ /**
20
+ * `W_X`: The maximum number of exports in a work-package manifest.
21
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/44be0044bf00?v=0.7.2
22
+ */
23
+ export declare const MAX_NUMBER_OF_EXPORTS_WP = 3072;
24
+ /**
25
+ * `W_G = W_E * W_P`: Exported segment size in bytes.
26
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/449a00449b00?v=0.7.2
27
+ */
11
28
  export declare const SEGMENT_BYTES: number;
12
29
  export type SEGMENT_BYTES = typeof SEGMENT_BYTES;
13
30
  /** Exported segment data. */
@@ -1 +1 @@
1
- {"version":3,"file":"work-item-segment.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block/work-item-segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAY,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE7D,iFAAiF;AACjF,eAAO,MAAM,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O,MAAM,iBAAiB,GAAI,GAAG,MAAM,KAAG,YAAyC,CAAC"}
@@ -1,12 +1,29 @@
1
1
  import { tryAsU16 } from "#@typeberry/numbers";
2
2
  import { asOpaqueType } from "#@typeberry/utils";
3
- /** `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6. */
3
+ /**
4
+ * `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6.
5
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/449600449700?v=0.7.2
6
+ */
4
7
  export const W_E = 684;
5
- /** `W_S`: The size of an exported segment in erasure-coded pieces in octets. */
6
- export const W_S = 6;
7
- /** `W_M`: The maximum number of entries in a work-package manifest. */
8
- export const MAX_NUMBER_OF_SEGMENTS = 2048; // 2**11
9
- /** `W_E * W_S`: Exported segment size in bytes. */
10
- export const SEGMENT_BYTES = W_E * W_S;
8
+ /**
9
+ * `W_P`: The size of an exported segment in erasure-coded pieces in octets.
10
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/44b10044b200?v=0.7.2
11
+ */
12
+ export const W_P = 6;
13
+ /**
14
+ * `W_M`: The maximum number of imports in a work-package manifest.
15
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/44ad0044ae00?v=0.7.2
16
+ */
17
+ export const MAX_NUMBER_OF_IMPORTS_WP = 3072;
18
+ /**
19
+ * `W_X`: The maximum number of exports in a work-package manifest.
20
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/44be0044bf00?v=0.7.2
21
+ */
22
+ export const MAX_NUMBER_OF_EXPORTS_WP = 3072;
23
+ /**
24
+ * `W_G = W_E * W_P`: Exported segment size in bytes.
25
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/449a00449b00?v=0.7.2
26
+ */
27
+ export const SEGMENT_BYTES = W_E * W_P;
11
28
  /** Attempt to convert a number into `SegmentIndex`. */
12
29
  export const tryAsSegmentIndex = (v) => asOpaqueType(tryAsU16(v));
@@ -6,7 +6,7 @@ import { type U16, type U32 } from "#@typeberry/numbers";
6
6
  import { type Opaque, WithDebug } from "#@typeberry/utils";
7
7
  import type { ServiceGas, ServiceId } from "./common.js";
8
8
  import type { CodeHash } from "./hash.js";
9
- import { MAX_NUMBER_OF_SEGMENTS, type SegmentIndex } from "./work-item-segment.js";
9
+ import { MAX_NUMBER_OF_IMPORTS_WP, type SegmentIndex } from "./work-item-segment.js";
10
10
  type WorkItemExtrinsicHash = Opaque<OpaqueHash, "ExtrinsicHash">;
11
11
  /**
12
12
  * An opaque piece of data that the work item brings in.
@@ -80,7 +80,7 @@ export declare class WorkItem extends WithDebug {
80
80
  /** `a`: accumulate execution gas limit */
81
81
  readonly accumulateGasLimit: ServiceGas;
82
82
  /** `i`: sequence of imported data segments, which identify a prior exported segment. */
83
- readonly importSegments: KnownSizeArray<ImportSpec, `Less than ${typeof MAX_NUMBER_OF_SEGMENTS}`>;
83
+ readonly importSegments: KnownSizeArray<ImportSpec, `Less than ${typeof MAX_NUMBER_OF_IMPORTS_WP}`>;
84
84
  /** `x`: sequence of blob hashes and lengths to be introduced in this block */
85
85
  readonly extrinsic: WorkItemExtrinsicSpec[];
86
86
  /** `e`: number of data segments exported by this work item. */
@@ -92,7 +92,7 @@ export declare class WorkItem extends WithDebug {
92
92
  accumulateGasLimit: import("@typeberry/codec").Descriptor<bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">, Bytes<8>>;
93
93
  exportCount: import("@typeberry/codec").Descriptor<U16, Bytes<2>>;
94
94
  payload: import("@typeberry/codec").Descriptor<BytesBlob, BytesBlob>;
95
- importSegments: import("@typeberry/codec").Descriptor<readonly ImportSpec[] & import("@typeberry/utils").WithOpaque<"Less than 2048">, import("@typeberry/codec").SequenceView<ImportSpec, import("@typeberry/codec").ViewOf<ImportSpec, {
95
+ importSegments: import("@typeberry/codec").Descriptor<readonly ImportSpec[] & import("@typeberry/utils").WithOpaque<"Less than 3072">, import("@typeberry/codec").SequenceView<ImportSpec, import("@typeberry/codec").ViewOf<ImportSpec, {
96
96
  treeRoot: import("@typeberry/codec").Descriptor<Bytes<32>, Bytes<32>>;
97
97
  index: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"Segment Index [U16]">, Bytes<2>>;
98
98
  }>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"work-item.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block/work-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAU,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEnF,KAAK,qBAAqB,GAAG,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAChD,KAAK,CAAC,GAAG,CAAC,EACV,6DAA6D,CAC9D,CAAC;AAEF;;;GAGG;AACH,qBAAa,UAAW,SAAQ,SAAS;IAWrC;;;OAGG;aACa,QAAQ,EAAE,UAAU;IACpC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,IAAI,EAAE,qBAAqB;IAC3C,2DAA2D;aAC3C,GAAG,EAAE,GAAG;IAb1B,MAAM,CAAC,KAAK;;;QAGT;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,WAAW,CAAC,qBAAqB,CAAC;IAI/D,OAAO;CAQR;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,QAAQ,EAAE,qSAgC5D;AAED;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,SAAS;IA2CnC,2BAA2B;aACX,OAAO,EAAE,SAAS;IAClC;;;;;OAKG;aACa,QAAQ,EAAE,QAAQ;IAClC,wBAAwB;aACR,OAAO,EAAE,SAAS;IAClC,sCAAsC;aACtB,cAAc,EAAE,UAAU;IAC1C,0CAA0C;aAC1B,kBAAkB,EAAE,UAAU;IAC9C,wFAAwF;aACxE,cAAc,EAAE,cAAc,CAAC,UAAU,EAAE,aAAa,OAAO,wBAAwB,EAAE,CAAC;IAC1G,8EAA8E;aAC9D,SAAS,EAAE,qBAAqB,EAAE;IAClD,+DAA+D;aAC/C,WAAW,EAAE,GAAG;IA9DlC,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;QAiBT;IAEH,MAAM,CAAC,MAAM,CAAC,EACZ,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,WAAW,GACZ,EAAE,WAAW,CAAC,QAAQ,CAAC;IAaxB,OAAO;CAyBR"}
@@ -4,7 +4,7 @@ import { HASH_SIZE } from "#@typeberry/hash";
4
4
  import { sumU32 } from "#@typeberry/numbers";
5
5
  import { WithDebug } from "#@typeberry/utils";
6
6
  import { codecKnownSizeArray } from "./codec-utils.js";
7
- import { MAX_NUMBER_OF_SEGMENTS } from "./work-item-segment.js";
7
+ import { MAX_NUMBER_OF_IMPORTS_WP } from "./work-item-segment.js";
8
8
  /**
9
9
  * Definition of data segment that was exported by some work package earlier
10
10
  * and now is being imported by another work-item.
@@ -103,13 +103,17 @@ export class WorkItem extends WithDebug {
103
103
  codeHash: codec.bytes(HASH_SIZE).asOpaque(),
104
104
  refineGasLimit: codec.u64.asOpaque(),
105
105
  accumulateGasLimit: codec.u64.asOpaque(),
106
+ // TODO: [MaSo] It should be validated to not exceed W_X
107
+ // https://graypaper.fluffylabs.dev/#/ab2cdbd/1a0b011a1c01?v=0.7.2
106
108
  exportCount: codec.u16,
107
109
  payload: codec.blob,
108
110
  importSegments: codecKnownSizeArray(ImportSpec.Codec, {
109
111
  minLength: 0,
110
- maxLength: MAX_NUMBER_OF_SEGMENTS,
111
- typicalLength: MAX_NUMBER_OF_SEGMENTS,
112
+ maxLength: MAX_NUMBER_OF_IMPORTS_WP,
113
+ typicalLength: MAX_NUMBER_OF_IMPORTS_WP,
112
114
  }),
115
+ // TODO: [MaSo] It should be validated to not exceed T = 128
116
+ // https://graypaper.fluffylabs.dev/#/ab2cdbd/1a0b011a1c01?v=0.7.2
113
117
  extrinsic: codec.sequenceVarLen(WorkItemExtrinsicSpec.Codec),
114
118
  });
115
119
  static create({ service, codeHash, payload, refineGasLimit, accumulateGasLimit, importSegments, extrinsic, exportCount, }) {
@@ -10,7 +10,7 @@ import { WorkItem } from "./work-item.js";
10
10
  /** Possible number of work items in the package or results in the report. */
11
11
  /** Constrained by I=16 https://graypaper.fluffylabs.dev/#/68eaa1f/417a00417a00?v=0.6.4 */
12
12
  export type WorkItemsCount = U8;
13
- /** Convert the value to `WorkItemsCount` bounds. */
13
+ /** Convert the value to `WorkItemsCount`. Validation is done at runtime by `isWorkItemsCount`. */
14
14
  export declare function tryAsWorkItemsCount(len: number): WorkItemsCount;
15
15
  /** Verify the value is within the `WorkItemsCount` bounds. */
16
16
  export declare function isWorkItemsCount(len: number): len is WorkItemsCount;
@@ -63,7 +63,7 @@ export declare class WorkPackage extends WithDebug {
63
63
  accumulateGasLimit: import("@typeberry/codec").Descriptor<bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">, import("@typeberry/bytes").Bytes<8>>;
64
64
  exportCount: import("@typeberry/codec").Descriptor<import("@typeberry/numbers").U16, import("@typeberry/bytes").Bytes<2>>;
65
65
  payload: import("@typeberry/codec").Descriptor<BytesBlob, BytesBlob>;
66
- importSegments: import("@typeberry/codec").Descriptor<readonly import("./work-item.js").ImportSpec[] & import("@typeberry/utils").WithOpaque<"Less than 2048">, import("@typeberry/codec").SequenceView<import("./work-item.js").ImportSpec, import("@typeberry/codec").ViewOf<import("./work-item.js").ImportSpec, {
66
+ importSegments: import("@typeberry/codec").Descriptor<readonly import("./work-item.js").ImportSpec[] & import("@typeberry/utils").WithOpaque<"Less than 3072">, import("@typeberry/codec").SequenceView<import("./work-item.js").ImportSpec, import("@typeberry/codec").ViewOf<import("./work-item.js").ImportSpec, {
67
67
  treeRoot: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32>, import("@typeberry/bytes").Bytes<32>>;
68
68
  index: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"Segment Index [U16]">, import("@typeberry/bytes").Bytes<2>>;
69
69
  }>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"work-package.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block/work-package.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAS,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAS,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,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AAM,CAAC,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,OAAO,EACP,KAAK,GACN,EAAE,WAAW,CAAC,WAAW,CAAC;IAI3B,OAAO;CAqBR;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC"}
@@ -2,15 +2,11 @@ import { codec } from "#@typeberry/codec";
2
2
  import { FixedSizeArray } from "#@typeberry/collections";
3
3
  import { HASH_SIZE } from "#@typeberry/hash";
4
4
  import { tryAsU8 } from "#@typeberry/numbers";
5
- import { check, WithDebug } from "#@typeberry/utils";
5
+ import { WithDebug } from "#@typeberry/utils";
6
6
  import { RefineContext } from "./refine-context.js";
7
7
  import { WorkItem } from "./work-item.js";
8
- /** Convert the value to `WorkItemsCount` bounds. */
8
+ /** Convert the value to `WorkItemsCount`. Validation is done at runtime by `isWorkItemsCount`. */
9
9
  export function tryAsWorkItemsCount(len) {
10
- check `
11
- ${isWorkItemsCount(len)}
12
- WorkItemsCount: Expected '${MIN_NUMBER_OF_WORK_ITEMS} <= count <= ${MAX_NUMBER_OF_WORK_ITEMS}' got ${len}
13
- `;
14
10
  return tryAsU8(len);
15
11
  }
16
12
  /** Verify the value is within the `WorkItemsCount` bounds. */
@@ -18,7 +18,7 @@ export declare const blockViewFromJson: (spec: ChainSpec) => import("@typeberry/
18
18
  ticketsMarker: import("@typeberry/codec").Descriptor<import("@typeberry/block").TicketsMarker | null, import("@typeberry/codec").ViewOf<import("@typeberry/block").TicketsMarker, {
19
19
  tickets: import("@typeberry/codec").Descriptor<readonly import("@typeberry/block").Ticket[] & import("@typeberry/utils").WithOpaque<"EpochLength">, import("@typeberry/codec").SequenceView<import("@typeberry/block").Ticket, import("@typeberry/codec").ViewOf<import("@typeberry/block").Ticket, {
20
20
  id: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32>, import("@typeberry/bytes").Bytes<32>>;
21
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
21
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
22
22
  }>>>;
23
23
  }> | null>;
24
24
  bandersnatchBlockAuthorIndex: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<2> & import("@typeberry/utils").WithOpaque<"ValidatorIndex[u16]">, import("@typeberry/bytes").Bytes<2>>;
@@ -28,7 +28,7 @@ export declare const blockViewFromJson: (spec: ChainSpec) => import("@typeberry/
28
28
  }>>;
29
29
  extrinsic: import("@typeberry/codec").Descriptor<import("@typeberry/block").Extrinsic, import("@typeberry/codec").ViewOf<import("@typeberry/block").Extrinsic, {
30
30
  tickets: import("@typeberry/codec").Descriptor<readonly import("@typeberry/block").SignedTicket[] & import("@typeberry/utils").WithOpaque<"Size: [0..chainSpec.maxTicketsPerExtrinsic)">, import("@typeberry/codec").SequenceView<import("@typeberry/block").SignedTicket, import("@typeberry/codec").ViewOf<import("@typeberry/block").SignedTicket, {
31
- attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[0|1|2]">, import("@typeberry/numbers").U32>;
31
+ attempt: import("@typeberry/codec").Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<1> & import("@typeberry/utils").WithOpaque<"TicketAttempt[u8]">, import("@typeberry/numbers").U32>;
32
32
  signature: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<784> & import("@typeberry/utils").WithOpaque<"BandersnatchRingSignature">, import("@typeberry/bytes").Bytes<784>>;
33
33
  }>>>;
34
34
  preimages: import("@typeberry/codec").Descriptor<import("@typeberry/block").Preimage[], import("@typeberry/codec").SequenceView<import("@typeberry/block").Preimage, import("@typeberry/codec").ViewOf<import("@typeberry/block").Preimage, {
@@ -3,7 +3,7 @@ import { json, parseFromJson } from "#@typeberry/json-parser";
3
3
  import { getExtrinsicFromJson } from "./extrinsic.js";
4
4
  import { headerFromJson } from "./header.js";
5
5
  export const blockFromJson = (spec) => json.object({
6
- header: headerFromJson(spec),
6
+ header: headerFromJson,
7
7
  extrinsic: getExtrinsicFromJson(spec),
8
8
  }, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
9
9
  export const blockViewFromJson = (spec) => {
@@ -1,6 +1,5 @@
1
1
  import { type TicketAttempt } from "#@typeberry/block/tickets.js";
2
2
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
3
- import type { ChainSpec } from "#@typeberry/config";
4
3
  import { type FromJson } from "#@typeberry/json-parser";
5
4
  export declare namespace fromJson {
6
5
  const bytesN: <N extends number, T extends Bytes<N> = Bytes<N>>(n: N) => import("@typeberry/json-parser").FromJsonWithParser<string, T>;
@@ -10,7 +9,7 @@ export declare namespace fromJson {
10
9
  const bytesBlob: import("@typeberry/json-parser").FromJsonWithParser<string, BytesBlob>;
11
10
  const bytesBlobNoPrefix: import("@typeberry/json-parser").FromJsonWithParser<string, BytesBlob>;
12
11
  const ed25519Signature: import("@typeberry/json-parser").FromJsonWithParser<string, Bytes<64> & import("@typeberry/utils").WithOpaque<"Ed25519Signature">>;
13
- const ticketAttempt: (spec: ChainSpec) => FromJson<TicketAttempt>;
12
+ const ticketAttempt: FromJson<TicketAttempt>;
14
13
  const uint8Array: import("@typeberry/json-parser").FromJsonWithParser<unknown, Uint8Array<ArrayBuffer>>;
15
14
  const bigUint64Array: import("@typeberry/json-parser").FromJsonWithParser<unknown, BigUint64Array<ArrayBuffer>>;
16
15
  const bigUint64: import("@typeberry/json-parser").FromJsonWithParser<unknown, bigint>;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block-json/common.ts"],"names":[],"mappings":"AAAA,OAAO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AwB,CAAC;AAE7D,yBAAiB,QAAQ,CAAC;IACjB,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,mEACd,CAAC;IAExD,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,mEACd,CAAC;IAEhE,MAAM,OAAO,GAAI,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC,qEAAoE,CAAC;IAEzG,MAAM,eAAe,GAAI,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC,qEACoB,CAAC;IAEjE,MAAM,SAAS,wEAAuC,CAAC;IAEvD,MAAM,iBAAiB,wEAA+C,CAAC;IAEvE,MAAM,gBAAgB,oIAA+E,CAAC;IAEtG,MAAM,aAAa,EAEpB,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEvB,MAAM,UAAU,uFAUrB,CAAC;IAEI,MAAM,cAAc,2FAUzB,CAAC;IAEI,MAAM,SAAS,sEAA2C,CAAC;CACnE"}
@@ -10,8 +10,8 @@ export var fromJson;
10
10
  fromJson.bytesBlob = json.fromString(BytesBlob.parseBlob);
11
11
  fromJson.bytesBlobNoPrefix = json.fromString(BytesBlob.parseBlobNoPrefix);
12
12
  fromJson.ed25519Signature = json.fromString((v) => Bytes.parseBytes(v, 64).asOpaque());
13
- fromJson.ticketAttempt = (spec) => json.fromNumber((v) => {
14
- return tryAsTicketAttempt(v, spec);
13
+ fromJson.ticketAttempt = json.fromNumber((v) => {
14
+ return tryAsTicketAttempt(v);
15
15
  });
16
16
  fromJson.uint8Array = json.fromAny((v) => {
17
17
  if (Array.isArray(v)) {
@@ -6,7 +6,7 @@ import { guaranteesExtrinsicFromJson } from "./guarantees-extrinsic.js";
6
6
  import { preimagesExtrinsicFromJson } from "./preimages-extrinsic.js";
7
7
  import { ticketsExtrinsicFromJson } from "./tickets-extrinsic.js";
8
8
  export const getExtrinsicFromJson = (ctx) => json.object({
9
- tickets: ticketsExtrinsicFromJson(ctx),
9
+ tickets: ticketsExtrinsicFromJson,
10
10
  preimages: preimagesExtrinsicFromJson,
11
11
  guarantees: guaranteesExtrinsicFromJson,
12
12
  assurances: getAssurancesExtrinsicFromJson(ctx),
@@ -1,4 +1,3 @@
1
1
  import { Header } from "#@typeberry/block";
2
- import type { ChainSpec } from "#@typeberry/config";
3
- export declare const headerFromJson: (spec: ChainSpec) => import("@typeberry/json-parser").FromJsonWithParser<unknown, Header>;
2
+ export declare const headerFromJson: import("@typeberry/json-parser").FromJsonWithParser<unknown, Header>;
4
3
  //# sourceMappingURL=header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block-json/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAQP,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AA6CnD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,yEAqD7C,CAAC"}
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block-json/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAQP,MAAM,kBAAkB,CAAC;AAuD1B,eAAO,MAAM,cAAc,sEA2C1B,CAAC"}
@@ -14,38 +14,36 @@ const epochMark = json.object({
14
14
  tickets_entropy: fromJson.bytes32(),
15
15
  validators: json.array(validatorKeysFromJson),
16
16
  }, (x) => EpochMarker.create({ entropy: x.entropy, ticketsEntropy: x.tickets_entropy, validators: x.validators }));
17
- export const headerFromJson = (spec) => {
18
- const ticket = json.object({
19
- id: fromJson.bytes32(),
20
- attempt: fromJson.ticketAttempt(spec),
21
- }, (x) => Ticket.create({ id: x.id, attempt: x.attempt }));
22
- return json.object({
23
- parent: fromJson.bytes32(),
24
- parent_state_root: fromJson.bytes32(),
25
- extrinsic_hash: fromJson.bytes32(),
26
- slot: "number",
27
- epoch_mark: json.optional(epochMark),
28
- tickets_mark: json.optional(json.array(ticket)),
29
- offenders_mark: json.array(fromJson.bytes32()),
30
- author_index: "number",
31
- entropy_source: bandersnatchVrfSignature,
32
- seal: bandersnatchVrfSignature,
33
- }, ({ parent, parent_state_root, extrinsic_hash, slot, epoch_mark, tickets_mark, offenders_mark, author_index, entropy_source, seal, }) => {
34
- const epochMarker = epoch_mark ?? null;
35
- const ticketsMarker = tickets_mark === undefined || tickets_mark === null
36
- ? null
37
- : TicketsMarker.create({ tickets: asOpaqueType(tickets_mark) });
38
- return Header.create({
39
- parentHeaderHash: parent,
40
- priorStateRoot: parent_state_root,
41
- extrinsicHash: extrinsic_hash,
42
- timeSlotIndex: slot,
43
- epochMarker,
44
- ticketsMarker,
45
- offendersMarker: offenders_mark,
46
- bandersnatchBlockAuthorIndex: author_index,
47
- entropySource: entropy_source,
48
- seal,
49
- });
17
+ const ticket = json.object({
18
+ id: fromJson.bytes32(),
19
+ attempt: fromJson.ticketAttempt,
20
+ }, (x) => Ticket.create({ id: x.id, attempt: x.attempt }));
21
+ export const headerFromJson = json.object({
22
+ parent: fromJson.bytes32(),
23
+ parent_state_root: fromJson.bytes32(),
24
+ extrinsic_hash: fromJson.bytes32(),
25
+ slot: "number",
26
+ epoch_mark: json.optional(epochMark),
27
+ tickets_mark: json.optional(json.array(ticket)),
28
+ offenders_mark: json.array(fromJson.bytes32()),
29
+ author_index: "number",
30
+ entropy_source: bandersnatchVrfSignature,
31
+ seal: bandersnatchVrfSignature,
32
+ }, ({ parent, parent_state_root, extrinsic_hash, slot, epoch_mark, tickets_mark, offenders_mark, author_index, entropy_source, seal, }) => {
33
+ const epochMarker = epoch_mark ?? null;
34
+ const ticketsMarker = tickets_mark === undefined || tickets_mark === null
35
+ ? null
36
+ : TicketsMarker.create({ tickets: asOpaqueType(tickets_mark) });
37
+ return Header.create({
38
+ parentHeaderHash: parent,
39
+ priorStateRoot: parent_state_root,
40
+ extrinsicHash: extrinsic_hash,
41
+ timeSlotIndex: slot,
42
+ epochMarker,
43
+ ticketsMarker,
44
+ offendersMarker: offenders_mark,
45
+ bandersnatchBlockAuthorIndex: author_index,
46
+ entropySource: entropy_source,
47
+ seal,
50
48
  });
51
- };
49
+ });
@@ -1,4 +1,3 @@
1
1
  import { SignedTicket } from "#@typeberry/block/tickets.js";
2
- import type { ChainSpec } from "#@typeberry/config";
3
- export declare const ticketsExtrinsicFromJson: (spec: ChainSpec) => ["array", import("@typeberry/json-parser").FromJsonWithParser<string, SignedTicket> | import("@typeberry/json-parser").FromJsonWithParser<number, SignedTicket> | import("@typeberry/json-parser").FromJsonWithParser<unknown, SignedTicket> | import("@typeberry/json-parser").ObjectFromJson<SignedTicket> | import("@typeberry/json-parser").FromJsonOptional<SignedTicket> | import("@typeberry/json-parser").Parser<unknown, SignedTicket[]>];
2
+ export declare const ticketsExtrinsicFromJson: ["array", import("@typeberry/json-parser").FromJsonWithParser<string, SignedTicket> | import("@typeberry/json-parser").FromJsonWithParser<number, SignedTicket> | import("@typeberry/json-parser").FromJsonWithParser<unknown, SignedTicket> | import("@typeberry/json-parser").ObjectFromJson<SignedTicket> | import("@typeberry/json-parser").FromJsonOptional<SignedTicket> | import("@typeberry/json-parser").Parser<unknown, SignedTicket[]>];
4
3
  //# sourceMappingURL=tickets-extrinsic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tickets-extrinsic.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block-json/tickets-extrinsic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,ubAUvD,CAAC"}
1
+ {"version":3,"file":"tickets-extrinsic.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/block-json/tickets-extrinsic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAc3D,eAAO,MAAM,wBAAwB,obAAqC,CAAC"}