@typeberry/lib 0.8.4-9587022 → 0.8.4-faebc7a

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 (82) hide show
  1. package/package.json +6 -4
  2. package/packages/jam/database/states.d.ts +7 -0
  3. package/packages/jam/database/states.d.ts.map +1 -1
  4. package/packages/jam/database-fjall/hybrid-states.d.ts +45 -0
  5. package/packages/jam/database-fjall/hybrid-states.d.ts.map +1 -0
  6. package/packages/jam/database-fjall/hybrid-states.js +113 -0
  7. package/packages/jam/database-fjall/hybrid-states.test.d.ts +2 -0
  8. package/packages/jam/database-fjall/hybrid-states.test.d.ts.map +1 -0
  9. package/packages/jam/database-fjall/hybrid-states.test.js +83 -0
  10. package/packages/jam/database-fjall/index.d.ts +3 -0
  11. package/packages/jam/database-fjall/index.d.ts.map +1 -0
  12. package/packages/jam/database-fjall/index.js +2 -0
  13. package/packages/jam/database-fjall/root.d.ts +52 -0
  14. package/packages/jam/database-fjall/root.d.ts.map +1 -0
  15. package/packages/jam/database-fjall/root.js +85 -0
  16. package/packages/jam/database-lmdb/hybrid-states.d.ts +3 -1
  17. package/packages/jam/database-lmdb/hybrid-states.d.ts.map +1 -1
  18. package/packages/jam/database-lmdb/hybrid-states.js +5 -2
  19. package/packages/jam/database-lmdb/root.d.ts +14 -1
  20. package/packages/jam/database-lmdb/root.d.ts.map +1 -1
  21. package/packages/jam/database-lmdb/root.js +25 -5
  22. package/packages/jam/database-lmdb/states.d.ts +1 -0
  23. package/packages/jam/database-lmdb/states.d.ts.map +1 -1
  24. package/packages/jam/database-lmdb/states.js +3 -0
  25. package/packages/jam/database-lmdb/states.test.js +4 -4
  26. package/packages/jam/jamnp-s/tasks/ticket-distribution.d.ts +18 -10
  27. package/packages/jam/jamnp-s/tasks/ticket-distribution.d.ts.map +1 -1
  28. package/packages/jam/jamnp-s/tasks/ticket-distribution.js +44 -68
  29. package/packages/jam/jamnp-s/tasks/ticket-distribution.test.js +30 -8
  30. package/packages/jam/node/main-fuzz.d.ts.map +1 -1
  31. package/packages/jam/node/main-fuzz.js +21 -4
  32. package/packages/jam/node/main-importer.d.ts +7 -4
  33. package/packages/jam/node/main-importer.d.ts.map +1 -1
  34. package/packages/jam/node/main-importer.js +10 -4
  35. package/packages/jam/safrole/bandersnatch-vrf.d.ts +2 -2
  36. package/packages/jam/safrole/bandersnatch-vrf.d.ts.map +1 -1
  37. package/packages/jam/safrole/bandersnatch-vrf.js +9 -6
  38. package/packages/jam/safrole/bandersnatch-vrf.test.js +9 -7
  39. package/packages/jam/safrole/safrole.js +5 -5
  40. package/packages/jam/safrole/safrole.test.js +13 -13
  41. package/packages/jam/ticket-pool/index.d.ts +4 -0
  42. package/packages/jam/ticket-pool/index.d.ts.map +1 -0
  43. package/packages/jam/ticket-pool/index.js +3 -0
  44. package/packages/jam/ticket-pool/pending-ticket-pool.d.ts +30 -0
  45. package/packages/jam/ticket-pool/pending-ticket-pool.d.ts.map +1 -0
  46. package/packages/jam/ticket-pool/pending-ticket-pool.js +56 -0
  47. package/packages/jam/ticket-pool/pending-ticket-pool.test.d.ts +2 -0
  48. package/packages/jam/ticket-pool/pending-ticket-pool.test.d.ts.map +1 -0
  49. package/packages/jam/ticket-pool/pending-ticket-pool.test.js +67 -0
  50. package/packages/jam/ticket-pool/ticket-validator.d.ts +46 -0
  51. package/packages/jam/ticket-pool/ticket-validator.d.ts.map +1 -0
  52. package/packages/jam/ticket-pool/ticket-validator.js +29 -0
  53. package/packages/jam/ticket-pool/ticket-validator.test.d.ts +2 -0
  54. package/packages/jam/ticket-pool/ticket-validator.test.d.ts.map +1 -0
  55. package/packages/jam/ticket-pool/ticket-validator.test.js +34 -0
  56. package/packages/jam/ticket-pool/verified-ticket-pool.d.ts +24 -0
  57. package/packages/jam/ticket-pool/verified-ticket-pool.d.ts.map +1 -0
  58. package/packages/jam/ticket-pool/verified-ticket-pool.js +37 -0
  59. package/packages/jam/ticket-pool/verified-ticket-pool.test.d.ts +2 -0
  60. package/packages/jam/ticket-pool/verified-ticket-pool.test.d.ts.map +1 -0
  61. package/packages/jam/ticket-pool/verified-ticket-pool.test.js +54 -0
  62. package/packages/workers/api-node/config.d.ts +14 -5
  63. package/packages/workers/api-node/config.d.ts.map +1 -1
  64. package/packages/workers/api-node/config.js +29 -20
  65. package/packages/workers/api-node/config.test.js +38 -1
  66. package/packages/workers/block-authorship/main.d.ts.map +1 -1
  67. package/packages/workers/block-authorship/main.js +22 -72
  68. package/packages/workers/block-authorship/ticket-validator.d.ts +32 -0
  69. package/packages/workers/block-authorship/ticket-validator.d.ts.map +1 -0
  70. package/packages/workers/block-authorship/ticket-validator.js +56 -0
  71. package/packages/workers/comms-authorship-network/protocol.d.ts +10 -0
  72. package/packages/workers/comms-authorship-network/protocol.d.ts.map +1 -1
  73. package/packages/workers/comms-authorship-network/protocol.js +8 -1
  74. package/packages/workers/importer/importer.d.ts +1 -1
  75. package/packages/workers/importer/importer.d.ts.map +1 -1
  76. package/packages/workers/importer/importer.js +2 -2
  77. package/packages/workers/importer/{events-logger.d.ts → stats.d.ts} +7 -2
  78. package/packages/workers/importer/stats.d.ts.map +1 -0
  79. package/packages/workers/importer/{events-logger.js → stats.js} +21 -2
  80. package/packages/workers/jam-network/main.d.ts.map +1 -1
  81. package/packages/workers/jam-network/main.js +20 -4
  82. package/packages/workers/importer/events-logger.d.ts.map +0 -1
@@ -67,10 +67,10 @@ const fakeSealingKeys = {
67
67
  describe("Safrole", () => {
68
68
  let blake2b;
69
69
  beforeEach(async () => {
70
- mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve([
71
- { isValid: true, entropyHash: Bytes.zero(HASH_SIZE) },
72
- { isValid: true, entropyHash: Bytes.fill(HASH_SIZE, 1) },
73
- ]));
70
+ mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve({
71
+ isValid: true,
72
+ tickets: [Bytes.zero(HASH_SIZE), Bytes.fill(HASH_SIZE, 1)],
73
+ }));
74
74
  blake2b = await Blake2b.createHasher();
75
75
  });
76
76
  afterEach(() => {
@@ -146,7 +146,7 @@ describe("Safrole", () => {
146
146
  }
147
147
  });
148
148
  it("should return bad ticket proof error", async () => {
149
- mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve([{ isValid: false, entropyHash: Bytes.zero(HASH_SIZE) }]));
149
+ mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve({ isValid: false, tickets: [Bytes.zero(HASH_SIZE)] }));
150
150
  const punishSet = SortedSet.fromArray(hashComparator);
151
151
  const state = {
152
152
  timeslot: tryAsTimeSlot(1),
@@ -188,10 +188,10 @@ describe("Safrole", () => {
188
188
  }
189
189
  });
190
190
  it("should return duplicated ticket error", async () => {
191
- mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve([
192
- { isValid: true, entropyHash: Bytes.zero(HASH_SIZE) },
193
- { isValid: true, entropyHash: Bytes.zero(HASH_SIZE) },
194
- ]));
191
+ mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve({
192
+ isValid: true,
193
+ tickets: [Bytes.zero(HASH_SIZE), Bytes.zero(HASH_SIZE)],
194
+ }));
195
195
  const punishSet = SortedSet.fromArray(hashComparator);
196
196
  const state = {
197
197
  timeslot: tryAsTimeSlot(1),
@@ -237,10 +237,10 @@ describe("Safrole", () => {
237
237
  }
238
238
  });
239
239
  it("should return bad ticket order error", async () => {
240
- mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve([
241
- { isValid: true, entropyHash: Bytes.fill(HASH_SIZE, 1) },
242
- { isValid: true, entropyHash: Bytes.zero(HASH_SIZE) },
243
- ]));
240
+ mock.method(bandersnatchVrf, "verifyTickets", () => Promise.resolve({
241
+ isValid: true,
242
+ tickets: [Bytes.fill(HASH_SIZE, 1), Bytes.zero(HASH_SIZE)],
243
+ }));
244
244
  const punishSet = SortedSet.fromArray(hashComparator);
245
245
  const state = {
246
246
  timeslot: tryAsTimeSlot(1),
@@ -0,0 +1,4 @@
1
+ export * from "./pending-ticket-pool.js";
2
+ export * from "./ticket-validator.js";
3
+ export * from "./verified-ticket-pool.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./pending-ticket-pool.js";
2
+ export * from "./ticket-validator.js";
3
+ export * from "./verified-ticket-pool.js";
@@ -0,0 +1,30 @@
1
+ import type { Epoch } from "#@typeberry/block";
2
+ import type { SignedTicket } from "#@typeberry/block/tickets.js";
3
+ /**
4
+ * An ordered, signature-deduplicated pool of tickets waiting to be redistributed to peers.
5
+ *
6
+ * Used on the networking side. Indices are stable within an epoch so callers can track
7
+ * per-peer "sent" sets by index. The pool is cleared whenever a new epoch is observed,
8
+ * and tickets for older epochs are dropped (can happen when an async validation completes
9
+ * after the epoch already advanced).
10
+ */
11
+ export declare class PendingTicketPool {
12
+ private tickets;
13
+ private currentEpochValue;
14
+ /** Epoch the pool is currently holding tickets for, or `null` if empty. */
15
+ get currentEpoch(): Epoch | null;
16
+ /** Returns the ordered tickets currently in the pool. Caller must not mutate the array. */
17
+ getTickets(): readonly {
18
+ epochIndex: Epoch;
19
+ ticket: SignedTicket;
20
+ }[];
21
+ /** Returns true if the ticket was added, false if it was a duplicate or dropped (old epoch). */
22
+ addTicket(epochIndex: Epoch, ticket: SignedTicket): boolean;
23
+ /**
24
+ * Replace the pool contents for the given epoch with the supplied tickets. Used when the
25
+ * authorship worker pushes an authoritative pool dump on an epoch boundary; any tickets
26
+ * that aren't in the dump are dropped, and dedup runs over the new set.
27
+ */
28
+ replace(epochIndex: Epoch, tickets: readonly SignedTicket[]): void;
29
+ }
30
+ //# sourceMappingURL=pending-ticket-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-ticket-pool.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/pending-ticket-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA0D;IACzE,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,2EAA2E;IAC3E,IAAI,YAAY,IAAI,KAAK,GAAG,IAAI,CAE/B;IAED,2FAA2F;IAC3F,UAAU,IAAI,SAAS;QAAE,UAAU,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,EAAE;IAIpE,gGAAgG;IAChG,SAAS,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO;IAyB3D;;;;OAIG;IACH,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI;CAWnE"}
@@ -0,0 +1,56 @@
1
+ import { Logger } from "#@typeberry/logger";
2
+ const logger = Logger.new(import.meta.filename, "pending-pool");
3
+ /**
4
+ * An ordered, signature-deduplicated pool of tickets waiting to be redistributed to peers.
5
+ *
6
+ * Used on the networking side. Indices are stable within an epoch so callers can track
7
+ * per-peer "sent" sets by index. The pool is cleared whenever a new epoch is observed,
8
+ * and tickets for older epochs are dropped (can happen when an async validation completes
9
+ * after the epoch already advanced).
10
+ */
11
+ export class PendingTicketPool {
12
+ tickets = [];
13
+ currentEpochValue = null;
14
+ /** Epoch the pool is currently holding tickets for, or `null` if empty. */
15
+ get currentEpoch() {
16
+ return this.currentEpochValue;
17
+ }
18
+ /** Returns the ordered tickets currently in the pool. Caller must not mutate the array. */
19
+ getTickets() {
20
+ return this.tickets;
21
+ }
22
+ /** Returns true if the ticket was added, false if it was a duplicate or dropped (old epoch). */
23
+ addTicket(epochIndex, ticket) {
24
+ if (this.currentEpochValue !== null && epochIndex < this.currentEpochValue) {
25
+ return false;
26
+ }
27
+ if (this.currentEpochValue !== null && epochIndex > this.currentEpochValue) {
28
+ logger.log `Epoch changed from ${this.currentEpochValue} to ${epochIndex}, clearing ${this.tickets.length} old tickets`;
29
+ this.tickets = [];
30
+ }
31
+ this.currentEpochValue = epochIndex;
32
+ const isDuplicate = this.tickets.some((pending) => pending.epochIndex === epochIndex && pending.ticket.signature.isEqualTo(ticket.signature));
33
+ if (isDuplicate) {
34
+ return false;
35
+ }
36
+ this.tickets.push({ epochIndex, ticket });
37
+ logger.info `[addTicket] Added ticket for epoch ${epochIndex}, total: ${this.tickets.length}`;
38
+ return true;
39
+ }
40
+ /**
41
+ * Replace the pool contents for the given epoch with the supplied tickets. Used when the
42
+ * authorship worker pushes an authoritative pool dump on an epoch boundary; any tickets
43
+ * that aren't in the dump are dropped, and dedup runs over the new set.
44
+ */
45
+ replace(epochIndex, tickets) {
46
+ this.tickets = [];
47
+ this.currentEpochValue = epochIndex;
48
+ for (const ticket of tickets) {
49
+ const isDuplicate = this.tickets.some((pending) => pending.ticket.signature.isEqualTo(ticket.signature));
50
+ if (!isDuplicate) {
51
+ this.tickets.push({ epochIndex, ticket });
52
+ }
53
+ }
54
+ logger.log `Pool replaced for epoch ${epochIndex} with ${this.tickets.length} tickets`;
55
+ }
56
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pending-ticket-pool.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-ticket-pool.test.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/pending-ticket-pool.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ import assert from "node:assert";
2
+ import { describe, it } from "node:test";
3
+ import { tryAsEpoch } from "#@typeberry/block";
4
+ import { SignedTicket, tryAsTicketAttempt } from "#@typeberry/block/tickets.js";
5
+ import { Bytes } from "#@typeberry/bytes";
6
+ import { BANDERSNATCH_PROOF_BYTES } from "#@typeberry/crypto";
7
+ import { PendingTicketPool } from "./pending-ticket-pool.js";
8
+ const E1 = tryAsEpoch(1);
9
+ const E2 = tryAsEpoch(2);
10
+ function makeTicket(seed, attempt = 0) {
11
+ const sig = Bytes.zero(BANDERSNATCH_PROOF_BYTES);
12
+ sig.raw[0] = seed;
13
+ return SignedTicket.create({
14
+ attempt: tryAsTicketAttempt(attempt),
15
+ signature: sig.asOpaque(),
16
+ });
17
+ }
18
+ describe("PendingTicketPool", () => {
19
+ it("starts empty with no current epoch", () => {
20
+ const pool = new PendingTicketPool();
21
+ assert.strictEqual(pool.currentEpoch, null);
22
+ assert.deepStrictEqual(pool.getTickets(), []);
23
+ });
24
+ it("adds a ticket and tracks the epoch", () => {
25
+ const pool = new PendingTicketPool();
26
+ const t = makeTicket(1);
27
+ assert.strictEqual(pool.addTicket(E1, t), true);
28
+ assert.strictEqual(pool.currentEpoch, E1);
29
+ assert.strictEqual(pool.getTickets().length, 1);
30
+ });
31
+ it("dedups by signature within an epoch", () => {
32
+ const pool = new PendingTicketPool();
33
+ const t = makeTicket(1);
34
+ pool.addTicket(E1, t);
35
+ assert.strictEqual(pool.addTicket(E1, t), false);
36
+ assert.strictEqual(pool.getTickets().length, 1);
37
+ });
38
+ it("clears tickets when a newer epoch arrives", () => {
39
+ const pool = new PendingTicketPool();
40
+ pool.addTicket(E1, makeTicket(1));
41
+ pool.addTicket(E1, makeTicket(2));
42
+ pool.addTicket(E2, makeTicket(3));
43
+ const tickets = pool.getTickets();
44
+ assert.strictEqual(tickets.length, 1);
45
+ assert.strictEqual(tickets[0].epochIndex, E2);
46
+ assert.strictEqual(pool.currentEpoch, E2);
47
+ });
48
+ it("drops late tickets for older epochs", () => {
49
+ const pool = new PendingTicketPool();
50
+ pool.addTicket(E2, makeTicket(1));
51
+ assert.strictEqual(pool.addTicket(E1, makeTicket(2)), false);
52
+ assert.strictEqual(pool.getTickets().length, 1);
53
+ assert.strictEqual(pool.currentEpoch, E2);
54
+ });
55
+ it("replace clears existing tickets and dedups the new set", () => {
56
+ const pool = new PendingTicketPool();
57
+ pool.addTicket(E1, makeTicket(1));
58
+ pool.addTicket(E1, makeTicket(2));
59
+ const dump = [makeTicket(3), makeTicket(4), makeTicket(3)];
60
+ pool.replace(E2, dump);
61
+ const tickets = pool.getTickets();
62
+ assert.strictEqual(tickets.length, 2);
63
+ assert.strictEqual(pool.currentEpoch, E2);
64
+ assert.strictEqual(tickets[0].ticket.signature.raw[0], 3);
65
+ assert.strictEqual(tickets[1].ticket.signature.raw[0], 4);
66
+ });
67
+ });
@@ -0,0 +1,46 @@
1
+ import type { EntropyHash, Epoch } from "#@typeberry/block";
2
+ import type { SignedTicket } from "#@typeberry/block/tickets.js";
3
+ import { Result } from "#@typeberry/utils";
4
+ /**
5
+ * Outcome of a successful validation.
6
+ *
7
+ * `id` is the entropy hash the validator computed for this ticket. It is `null` when the
8
+ * concrete validator doesn't actually verify (e.g. {@link AcceptTicketsValidator}) or when
9
+ * it delegates to another process that doesn't bother to send the id back over the wire.
10
+ */
11
+ export type ValidatedTicket = {
12
+ id: EntropyHash | null;
13
+ };
14
+ /** Reasons a ticket may fail validation. */
15
+ export declare enum ValidationError {
16
+ /** Verifier rejected the signature / proof. */
17
+ InvalidProof = "invalid_proof",
18
+ /** Validator could not run (e.g. state unavailable, transient internal failure). */
19
+ ValidatorUnavailable = "validator_unavailable",
20
+ /** Ticket is for an epoch outside the validator's window of interest. */
21
+ WrongEpoch = "wrong_epoch"
22
+ }
23
+ /**
24
+ * Strategy for verifying tickets arriving from peers.
25
+ *
26
+ * The concrete implementation may call into the bandersnatch verifier, defer to another
27
+ * worker via IPC, or short-circuit (Accept/Deny defaults for tests).
28
+ */
29
+ export interface TicketValidator {
30
+ validate(epochIndex: Epoch, ticket: SignedTicket): Promise<Result<ValidatedTicket, ValidationError>>;
31
+ }
32
+ /**
33
+ * Accepts every ticket without inspection. Useful for unit tests where the validator
34
+ * isn't the subject under test. Must never be used in production.
35
+ */
36
+ export declare class AcceptTicketsValidator implements TicketValidator {
37
+ validate(_epochIndex: Epoch, _ticket: SignedTicket): Promise<Result<ValidatedTicket, ValidationError>>;
38
+ }
39
+ /**
40
+ * Rejects every ticket. Used as the default for any task that needs an explicit, real
41
+ * validator wired in before it will accept anything from the network.
42
+ */
43
+ export declare class DenyTicketsValidator implements TicketValidator {
44
+ validate(_epochIndex: Epoch, _ticket: SignedTicket): Promise<Result<ValidatedTicket, ValidationError>>;
45
+ }
46
+ //# sourceMappingURL=ticket-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ticket-validator.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/ticket-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,4CAA4C;AAC5C,oBAAY,eAAe;IACzB,+CAA+C;IAC/C,YAAY,kBAAkB;IAC9B,oFAAoF;IACpF,oBAAoB,0BAA0B;IAC9C,yEAAyE;IACzE,UAAU,gBAAgB;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;CACtG;AAED;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IACtD,QAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;CAG7G;AAED;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IACpD,QAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;CAG7G"}
@@ -0,0 +1,29 @@
1
+ import { Result } from "#@typeberry/utils";
2
+ /** Reasons a ticket may fail validation. */
3
+ export var ValidationError;
4
+ (function (ValidationError) {
5
+ /** Verifier rejected the signature / proof. */
6
+ ValidationError["InvalidProof"] = "invalid_proof";
7
+ /** Validator could not run (e.g. state unavailable, transient internal failure). */
8
+ ValidationError["ValidatorUnavailable"] = "validator_unavailable";
9
+ /** Ticket is for an epoch outside the validator's window of interest. */
10
+ ValidationError["WrongEpoch"] = "wrong_epoch";
11
+ })(ValidationError || (ValidationError = {}));
12
+ /**
13
+ * Accepts every ticket without inspection. Useful for unit tests where the validator
14
+ * isn't the subject under test. Must never be used in production.
15
+ */
16
+ export class AcceptTicketsValidator {
17
+ async validate(_epochIndex, _ticket) {
18
+ return Result.ok({ id: null });
19
+ }
20
+ }
21
+ /**
22
+ * Rejects every ticket. Used as the default for any task that needs an explicit, real
23
+ * validator wired in before it will accept anything from the network.
24
+ */
25
+ export class DenyTicketsValidator {
26
+ async validate(_epochIndex, _ticket) {
27
+ return Result.error(ValidationError.ValidatorUnavailable, () => "no ticket validator wired");
28
+ }
29
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ticket-validator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ticket-validator.test.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/ticket-validator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import assert from "node:assert";
2
+ import { describe, it } from "node:test";
3
+ import { tryAsEpoch } from "#@typeberry/block";
4
+ import { SignedTicket, tryAsTicketAttempt } from "#@typeberry/block/tickets.js";
5
+ import { Bytes } from "#@typeberry/bytes";
6
+ import { BANDERSNATCH_PROOF_BYTES } from "#@typeberry/crypto";
7
+ import { AcceptTicketsValidator, DenyTicketsValidator, ValidationError } from "./ticket-validator.js";
8
+ const E1 = tryAsEpoch(1);
9
+ function makeTicket() {
10
+ return SignedTicket.create({
11
+ attempt: tryAsTicketAttempt(0),
12
+ signature: Bytes.zero(BANDERSNATCH_PROOF_BYTES).asOpaque(),
13
+ });
14
+ }
15
+ describe("AcceptTicketsValidator", () => {
16
+ it("returns ok with null id", async () => {
17
+ const v = new AcceptTicketsValidator();
18
+ const res = await v.validate(E1, makeTicket());
19
+ assert.strictEqual(res.isOk, true);
20
+ if (res.isOk) {
21
+ assert.strictEqual(res.ok.id, null);
22
+ }
23
+ });
24
+ });
25
+ describe("DenyTicketsValidator", () => {
26
+ it("returns ValidatorUnavailable", async () => {
27
+ const v = new DenyTicketsValidator();
28
+ const res = await v.validate(E1, makeTicket());
29
+ assert.strictEqual(res.isError, true);
30
+ if (res.isError) {
31
+ assert.strictEqual(res.error, ValidationError.ValidatorUnavailable);
32
+ }
33
+ });
34
+ });
@@ -0,0 +1,24 @@
1
+ import type { EntropyHash, Epoch } from "#@typeberry/block";
2
+ import type { SignedTicket } from "#@typeberry/block/tickets.js";
3
+ /** A ticket the validator already verified, paired with the entropy hash (ticket id). */
4
+ export type VerifiedTicket = {
5
+ ticket: SignedTicket;
6
+ id: EntropyHash;
7
+ };
8
+ /**
9
+ * In-memory pool of verified tickets for the current epoch, keyed by ticket id.
10
+ *
11
+ * Used on the authorship side. Tickets are stored per epoch and deduplicated by their
12
+ * computed entropy hash (so duplicates arriving via different peers / paths are coalesced
13
+ * cheaply). The pool only ever needs to hold tickets for one epoch at a time; switching
14
+ * to a new epoch clears everything older.
15
+ */
16
+ export declare class VerifiedTicketPool {
17
+ private readonly perEpoch;
18
+ private readonly idSets;
19
+ /** Add pre-verified tickets to the pool, deduping by id. */
20
+ add(epochIndex: Epoch, verifiedTickets: readonly VerifiedTicket[]): void;
21
+ /** Returns the verified tickets for the given epoch, or an empty array if none. */
22
+ getForEpoch(epochIndex: Epoch): readonly VerifiedTicket[];
23
+ }
24
+ //# sourceMappingURL=verified-ticket-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verified-ticket-pool.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/verified-ticket-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,EAAE,EAAE,WAAW,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsC;IAC/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;IAEjE,4DAA4D;IAC5D,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,cAAc,EAAE,GAAG,IAAI;IAoBxE,mFAAmF;IACnF,WAAW,CAAC,UAAU,EAAE,KAAK,GAAG,SAAS,cAAc,EAAE;CAG1D"}
@@ -0,0 +1,37 @@
1
+ import { HashSet } from "#@typeberry/collections/hash-set.js";
2
+ /**
3
+ * In-memory pool of verified tickets for the current epoch, keyed by ticket id.
4
+ *
5
+ * Used on the authorship side. Tickets are stored per epoch and deduplicated by their
6
+ * computed entropy hash (so duplicates arriving via different peers / paths are coalesced
7
+ * cheaply). The pool only ever needs to hold tickets for one epoch at a time; switching
8
+ * to a new epoch clears everything older.
9
+ */
10
+ export class VerifiedTicketPool {
11
+ perEpoch = new Map();
12
+ idSets = new Map();
13
+ /** Add pre-verified tickets to the pool, deduping by id. */
14
+ add(epochIndex, verifiedTickets) {
15
+ if (this.perEpoch.size > 0 && !this.perEpoch.has(epochIndex)) {
16
+ this.perEpoch.clear();
17
+ this.idSets.clear();
18
+ }
19
+ const existing = this.perEpoch.get(epochIndex) ?? [];
20
+ let idSet = this.idSets.get(epochIndex) ?? null;
21
+ if (idSet === null) {
22
+ idSet = HashSet.new();
23
+ this.idSets.set(epochIndex, idSet);
24
+ }
25
+ for (const entry of verifiedTickets) {
26
+ if (!idSet.has(entry.id)) {
27
+ existing.push(entry);
28
+ idSet.insert(entry.id);
29
+ }
30
+ }
31
+ this.perEpoch.set(epochIndex, existing);
32
+ }
33
+ /** Returns the verified tickets for the given epoch, or an empty array if none. */
34
+ getForEpoch(epochIndex) {
35
+ return this.perEpoch.get(epochIndex) ?? [];
36
+ }
37
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=verified-ticket-pool.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verified-ticket-pool.test.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/ticket-pool/verified-ticket-pool.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import assert from "node:assert";
2
+ import { describe, it } from "node:test";
3
+ import { tryAsEpoch } from "#@typeberry/block";
4
+ import { SignedTicket, tryAsTicketAttempt } from "#@typeberry/block/tickets.js";
5
+ import { Bytes } from "#@typeberry/bytes";
6
+ import { BANDERSNATCH_PROOF_BYTES } from "#@typeberry/crypto";
7
+ import { HASH_SIZE } from "#@typeberry/hash";
8
+ import { VerifiedTicketPool } from "./verified-ticket-pool.js";
9
+ const E1 = tryAsEpoch(1);
10
+ const E2 = tryAsEpoch(2);
11
+ function makeTicket(seed) {
12
+ const sig = Bytes.zero(BANDERSNATCH_PROOF_BYTES);
13
+ sig.raw[0] = seed;
14
+ return SignedTicket.create({
15
+ attempt: tryAsTicketAttempt(0),
16
+ signature: sig.asOpaque(),
17
+ });
18
+ }
19
+ function makeId(byte) {
20
+ return Bytes.fill(HASH_SIZE, byte).asOpaque();
21
+ }
22
+ describe("VerifiedTicketPool", () => {
23
+ it("starts empty", () => {
24
+ const pool = new VerifiedTicketPool();
25
+ assert.deepStrictEqual(pool.getForEpoch(E1), []);
26
+ });
27
+ it("adds and retrieves tickets per epoch", () => {
28
+ const pool = new VerifiedTicketPool();
29
+ pool.add(E1, [{ ticket: makeTicket(1), id: makeId(0xaa) }]);
30
+ assert.strictEqual(pool.getForEpoch(E1).length, 1);
31
+ assert.deepStrictEqual(pool.getForEpoch(E2), []);
32
+ });
33
+ it("dedups by id", () => {
34
+ const pool = new VerifiedTicketPool();
35
+ const id = makeId(0x01);
36
+ pool.add(E1, [{ ticket: makeTicket(1), id }]);
37
+ pool.add(E1, [{ ticket: makeTicket(2), id }]);
38
+ assert.strictEqual(pool.getForEpoch(E1).length, 1);
39
+ assert.strictEqual(pool.getForEpoch(E1)[0].ticket.signature.raw[0], 1);
40
+ });
41
+ it("clears previous epochs when a new epoch is added", () => {
42
+ const pool = new VerifiedTicketPool();
43
+ pool.add(E1, [{ ticket: makeTicket(1), id: makeId(1) }]);
44
+ pool.add(E2, [{ ticket: makeTicket(2), id: makeId(2) }]);
45
+ assert.deepStrictEqual(pool.getForEpoch(E1), []);
46
+ assert.strictEqual(pool.getForEpoch(E2).length, 1);
47
+ });
48
+ it("appends across multiple add() calls for the same epoch", () => {
49
+ const pool = new VerifiedTicketPool();
50
+ pool.add(E1, [{ ticket: makeTicket(1), id: makeId(1) }]);
51
+ pool.add(E1, [{ ticket: makeTicket(2), id: makeId(2) }]);
52
+ assert.strictEqual(pool.getForEpoch(E1).length, 2);
53
+ });
54
+ });
@@ -71,13 +71,19 @@ export declare class InMemWorkerConfig<T = undefined> implements WorkerConfig<T,
71
71
  readonly: boolean;
72
72
  }): RootDb<BlocksDb, SerializedStatesDb>;
73
73
  }
74
+ /** Persistent values store backing the hybrid config. */
75
+ export type HybridBackend = "lmdb" | "fjall";
74
76
  /**
75
77
  * Hybrid worker config for the fuzz target: in-memory blocks and leaf sets,
76
- * but large values persisted to LMDB.
78
+ * but large values persisted to disk (LMDB or fjall, selected by `backend`).
79
+ *
80
+ * The fjall backend is opt-in so its performance can be compared against LMDB
81
+ * before committing to it. fjall opens its keyspace asynchronously, hence the
82
+ * async `new`.
77
83
  *
78
84
  * Like `InMemWorkerConfig`, the blocks and leaf sets are shared across the
79
85
  * open/close/reopen dance that genesis init performs, so `openDatabase`
80
- * returns the same instances and a no-op close. The LMDB root is opened once
86
+ * returns the same instances and a no-op close. The values store is opened once
81
87
  * here and closed by `HybridSerializedStates.close()` at importer teardown.
82
88
  *
83
89
  * In-process only: it holds shared mutable state (the in-memory leaf
@@ -91,16 +97,19 @@ export declare class HybridWorkerConfig<T = undefined> implements WorkerConfig<T
91
97
  readonly blake2b: Blake2b;
92
98
  readonly dbPath: string;
93
99
  readonly ephemeral: boolean;
94
- static new<T>({ nodeName, chainSpec, workerParams, blake2b, dbPath, ephemeral, }: {
100
+ readonly compression: boolean;
101
+ private readonly states;
102
+ static new<T>({ nodeName, chainSpec, workerParams, blake2b, dbPath, ephemeral, compression, backend, }: {
95
103
  nodeName: string;
96
104
  chainSpec: ChainSpec;
97
105
  workerParams: T;
98
106
  blake2b: Blake2b;
99
107
  dbPath: string;
100
108
  ephemeral?: boolean;
101
- }): HybridWorkerConfig<T>;
109
+ compression?: boolean;
110
+ backend?: HybridBackend;
111
+ }): Promise<HybridWorkerConfig<T>>;
102
112
  private readonly blocks;
103
- private readonly states;
104
113
  private constructor();
105
114
  openDatabase(_options?: {
106
115
  readonly: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../packages/workers/api-node/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,MAAM,EAAW,KAAK,MAAM,EAAW,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,KAAK,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