@aztec/stdlib 0.84.0-alpha-testnet.0 → 0.84.0-nightly.20250405

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 (36) hide show
  1. package/dest/avm/avm.d.ts +1272 -22
  2. package/dest/avm/avm.d.ts.map +1 -1
  3. package/dest/avm/avm.js +71 -3
  4. package/dest/avm/avm_proving_request.d.ts +585 -0
  5. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  6. package/dest/epoch-helpers/index.d.ts +9 -0
  7. package/dest/epoch-helpers/index.d.ts.map +1 -1
  8. package/dest/epoch-helpers/index.js +15 -2
  9. package/dest/interfaces/proving-job.d.ts +585 -0
  10. package/dest/interfaces/proving-job.d.ts.map +1 -1
  11. package/dest/logs/log_with_tx_data.d.ts +3 -2
  12. package/dest/logs/log_with_tx_data.d.ts.map +1 -1
  13. package/dest/logs/log_with_tx_data.js +3 -2
  14. package/dest/logs/pending_tagged_log.d.ts +3 -2
  15. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  16. package/dest/logs/pending_tagged_log.js +1 -1
  17. package/dest/messaging/l1_to_l2_message_source.d.ts +5 -0
  18. package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
  19. package/dest/tests/factories.d.ts +4 -1
  20. package/dest/tests/factories.d.ts.map +1 -1
  21. package/dest/tests/factories.js +14 -2
  22. package/dest/tx/index.d.ts +1 -0
  23. package/dest/tx/index.d.ts.map +1 -1
  24. package/dest/tx/index.js +1 -0
  25. package/dest/tx/validator/error_texts.d.ts +19 -0
  26. package/dest/tx/validator/error_texts.d.ts.map +1 -0
  27. package/dest/tx/validator/error_texts.js +26 -0
  28. package/package.json +6 -6
  29. package/src/avm/avm.ts +99 -1
  30. package/src/epoch-helpers/index.ts +19 -0
  31. package/src/logs/log_with_tx_data.ts +4 -3
  32. package/src/logs/pending_tagged_log.ts +3 -2
  33. package/src/messaging/l1_to_l2_message_source.ts +7 -0
  34. package/src/tests/factories.ts +35 -0
  35. package/src/tx/index.ts +1 -0
  36. package/src/tx/validator/error_texts.ts +33 -0
@@ -5,6 +5,7 @@ export type L1RollupConstants = {
5
5
  slotDuration: number;
6
6
  epochDuration: number;
7
7
  ethereumSlotDuration: number;
8
+ proofSubmissionWindow: number;
8
9
  };
9
10
  export declare const EmptyL1RollupConstants: L1RollupConstants;
10
11
  export declare const L1RollupConstantsSchema: z.ZodObject<{
@@ -13,18 +14,21 @@ export declare const L1RollupConstantsSchema: z.ZodObject<{
13
14
  slotDuration: z.ZodNumber;
14
15
  epochDuration: z.ZodNumber;
15
16
  ethereumSlotDuration: z.ZodNumber;
17
+ proofSubmissionWindow: z.ZodNumber;
16
18
  }, "strip", z.ZodTypeAny, {
17
19
  l1StartBlock: bigint;
18
20
  l1GenesisTime: bigint;
19
21
  slotDuration: number;
20
22
  epochDuration: number;
21
23
  ethereumSlotDuration: number;
24
+ proofSubmissionWindow: number;
22
25
  }, {
23
26
  l1StartBlock: string | number | bigint;
24
27
  l1GenesisTime: string | number | bigint;
25
28
  slotDuration: number;
26
29
  epochDuration: number;
27
30
  ethereumSlotDuration: number;
31
+ proofSubmissionWindow: number;
28
32
  }>;
29
33
  /** Returns the timestamp for a given L2 slot. */
30
34
  export declare function getTimestampForSlot(slot: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>): bigint;
@@ -41,4 +45,9 @@ export declare function getSlotRangeForEpoch(epochNumber: bigint, constants: Pic
41
45
  * Note that the endTimestamp is the start timestamp of the last L1 slot for the epoch.
42
46
  */
43
47
  export declare function getTimestampRangeForEpoch(epochNumber: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'ethereumSlotDuration'>): bigint[];
48
+ /**
49
+ * Returns the deadline timestamp (in seconds) for submitting a proof for a given epoch.
50
+ * Computed as the start of the given epoch plus the proof submission window.
51
+ */
52
+ export declare function getProofSubmissionDeadlineTimestamp(epochNumber: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'proofSubmissionWindow'>): bigint;
44
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/epoch-helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAMpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAME,CAAC;AAEvC,iDAAiD;AACjD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,CAAC,UAGrE;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,CAAC,UAElH;AAED,sDAAsD;AACtD,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC,UAGvF;AAED,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,UAE/F;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,YAG5G;AAED;;;GAGG;AACH,wBAAg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I,CAAC,iBAAiB,EAAE,eAAe,CAAC,YAG5G;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,sBAAsB,CAAC,YAUhH;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,uBAAuB,CAAC,UAQjH"}
@@ -5,14 +5,16 @@ export const EmptyL1RollupConstants = {
5
5
  l1GenesisTime: 0n,
6
6
  epochDuration: 1,
7
7
  slotDuration: 1,
8
- ethereumSlotDuration: 1
8
+ ethereumSlotDuration: 1,
9
+ proofSubmissionWindow: 2
9
10
  };
10
11
  export const L1RollupConstantsSchema = z.object({
11
12
  l1StartBlock: schemas.BigInt,
12
13
  l1GenesisTime: schemas.BigInt,
13
14
  slotDuration: z.number(),
14
15
  epochDuration: z.number(),
15
- ethereumSlotDuration: z.number()
16
+ ethereumSlotDuration: z.number(),
17
+ proofSubmissionWindow: z.number()
16
18
  });
17
19
  /** Returns the timestamp for a given L2 slot. */ export function getTimestampForSlot(slot, constants) {
18
20
  return constants.l1GenesisTime + slot * BigInt(constants.slotDuration);
@@ -44,3 +46,14 @@ export const L1RollupConstantsSchema = z.object({
44
46
  constants.l1GenesisTime + endSlot * BigInt(constants.slotDuration) + BigInt((ethereumSlotsPerL2Slot - 1) * constants.ethereumSlotDuration)
45
47
  ];
46
48
  }
49
+ /**
50
+ * Returns the deadline timestamp (in seconds) for submitting a proof for a given epoch.
51
+ * Computed as the start of the given epoch plus the proof submission window.
52
+ */ export function getProofSubmissionDeadlineTimestamp(epochNumber, constants) {
53
+ // See l1-contracts/src/core/libraries/rollup/EpochProofLib.sol:
54
+ // Slot deadline = startEpoch.toSlots() + Slot.wrap(rollupStore.config.proofSubmissionWindow);
55
+ const [startSlot] = getSlotRangeForEpoch(epochNumber, constants);
56
+ const deadlineSlot = startSlot + BigInt(constants.proofSubmissionWindow);
57
+ const deadlineTimestamp = getTimestampForSlot(deadlineSlot, constants);
58
+ return deadlineTimestamp;
59
+ }