@aztec/stdlib 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8

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 (176) hide show
  1. package/dest/block/block_hash.d.ts +16 -18
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +21 -31
  4. package/dest/block/block_parameter.d.ts +4 -4
  5. package/dest/block/block_parameter.d.ts.map +1 -1
  6. package/dest/block/block_parameter.js +2 -2
  7. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  8. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  9. package/dest/block/checkpointed_l2_block.js +3 -3
  10. package/dest/block/in_block.d.ts +11 -11
  11. package/dest/block/in_block.d.ts.map +1 -1
  12. package/dest/block/in_block.js +4 -4
  13. package/dest/block/index.d.ts +2 -2
  14. package/dest/block/index.d.ts.map +1 -1
  15. package/dest/block/index.js +1 -1
  16. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
  17. package/dest/block/l2_block.d.ts.map +1 -0
  18. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  19. package/dest/block/l2_block_source.d.ts +39 -30
  20. package/dest/block/l2_block_source.d.ts.map +1 -1
  21. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  22. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -3
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +4 -4
  26. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  27. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  28. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  29. package/dest/checkpoint/checkpoint.d.ts +8 -8
  30. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  31. package/dest/checkpoint/checkpoint.js +4 -4
  32. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  33. package/dest/config/node-rpc-config.js +1 -1
  34. package/dest/contract/contract_address.js +1 -1
  35. package/dest/contract/contract_class_id.d.ts +1 -1
  36. package/dest/contract/contract_class_id.js +1 -1
  37. package/dest/contract/private_function.d.ts +1 -1
  38. package/dest/contract/private_function.d.ts.map +1 -1
  39. package/dest/contract/private_function.js +2 -3
  40. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  41. package/dest/contract/private_function_membership_proof.js +1 -1
  42. package/dest/database-version/database_version.d.ts +58 -0
  43. package/dest/database-version/database_version.d.ts.map +1 -0
  44. package/dest/database-version/database_version.js +69 -0
  45. package/dest/database-version/version_manager.d.ts +2 -50
  46. package/dest/database-version/version_manager.d.ts.map +1 -1
  47. package/dest/database-version/version_manager.js +1 -66
  48. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  49. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  50. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  51. package/dest/epoch-helpers/index.d.ts +3 -1
  52. package/dest/epoch-helpers/index.d.ts.map +1 -1
  53. package/dest/epoch-helpers/index.js +5 -1
  54. package/dest/hash/hash.js +2 -2
  55. package/dest/hash/map_slot.d.ts +1 -1
  56. package/dest/hash/map_slot.d.ts.map +1 -1
  57. package/dest/hash/map_slot.js +4 -3
  58. package/dest/interfaces/archiver.d.ts +1 -1
  59. package/dest/interfaces/archiver.d.ts.map +1 -1
  60. package/dest/interfaces/archiver.js +17 -16
  61. package/dest/interfaces/aztec-node-admin.d.ts +4 -1
  62. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  63. package/dest/interfaces/aztec-node.d.ts +50 -57
  64. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  65. package/dest/interfaces/aztec-node.js +13 -17
  66. package/dest/interfaces/block-builder.d.ts +13 -7
  67. package/dest/interfaces/block-builder.d.ts.map +1 -1
  68. package/dest/interfaces/block-builder.js +7 -0
  69. package/dest/interfaces/configs.d.ts +2 -2
  70. package/dest/interfaces/configs.d.ts.map +1 -1
  71. package/dest/interfaces/get_logs_response.d.ts +7 -7
  72. package/dest/interfaces/prover-client.d.ts +10 -1
  73. package/dest/interfaces/prover-client.d.ts.map +1 -1
  74. package/dest/interfaces/prover-client.js +7 -1
  75. package/dest/interfaces/tx_provider.d.ts +3 -3
  76. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  77. package/dest/interfaces/validator.d.ts +3 -3
  78. package/dest/interfaces/validator.d.ts.map +1 -1
  79. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  80. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  81. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  82. package/dest/keys/derivation.d.ts +3 -3
  83. package/dest/keys/derivation.js +8 -8
  84. package/dest/keys/key_types.d.ts +1 -1
  85. package/dest/keys/utils.d.ts +1 -1
  86. package/dest/keys/utils.d.ts.map +1 -1
  87. package/dest/keys/utils.js +7 -3
  88. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  89. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  90. package/dest/l1-contracts/slash_factory.js +1 -0
  91. package/dest/logs/extended_public_log.d.ts +6 -6
  92. package/dest/logs/log_id.d.ts +8 -8
  93. package/dest/logs/log_id.d.ts.map +1 -1
  94. package/dest/logs/log_id.js +6 -5
  95. package/dest/logs/siloed_tag.d.ts +1 -1
  96. package/dest/logs/siloed_tag.d.ts.map +1 -1
  97. package/dest/logs/siloed_tag.js +4 -3
  98. package/dest/p2p/block_proposal.d.ts +13 -6
  99. package/dest/p2p/block_proposal.d.ts.map +1 -1
  100. package/dest/p2p/block_proposal.js +1 -1
  101. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  102. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  103. package/dest/p2p/message_validator.d.ts +18 -3
  104. package/dest/p2p/message_validator.d.ts.map +1 -1
  105. package/dest/p2p/message_validator.js +2 -1
  106. package/dest/stats/stats.d.ts +1 -3
  107. package/dest/stats/stats.d.ts.map +1 -1
  108. package/dest/tests/factories.js +1 -1
  109. package/dest/tests/jest.d.ts +4 -4
  110. package/dest/tests/jest.js +9 -9
  111. package/dest/tests/mocks.d.ts +15 -10
  112. package/dest/tests/mocks.d.ts.map +1 -1
  113. package/dest/tests/mocks.js +19 -13
  114. package/dest/tx/block_header.d.ts +3 -2
  115. package/dest/tx/block_header.d.ts.map +1 -1
  116. package/dest/tx/block_header.js +3 -2
  117. package/dest/tx/in_tx.d.ts +3 -3
  118. package/dest/tx/indexed_tx_effect.d.ts +5 -5
  119. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  120. package/dest/tx/indexed_tx_effect.js +3 -2
  121. package/dest/tx/tx_receipt.d.ts +42 -14
  122. package/dest/tx/tx_receipt.d.ts.map +1 -1
  123. package/dest/tx/tx_receipt.js +46 -15
  124. package/package.json +11 -10
  125. package/src/block/block_hash.ts +26 -47
  126. package/src/block/block_parameter.ts +3 -3
  127. package/src/block/checkpointed_l2_block.ts +4 -4
  128. package/src/block/in_block.ts +7 -7
  129. package/src/block/index.ts +1 -1
  130. package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
  131. package/src/block/l2_block_source.ts +40 -31
  132. package/src/block/l2_block_stream/interfaces.ts +2 -2
  133. package/src/block/l2_block_stream/l2_block_stream.ts +5 -6
  134. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  135. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  136. package/src/checkpoint/checkpoint.ts +7 -7
  137. package/src/config/node-rpc-config.ts +1 -1
  138. package/src/contract/contract_address.ts +1 -1
  139. package/src/contract/contract_class_id.ts +1 -1
  140. package/src/contract/private_function.ts +2 -3
  141. package/src/contract/private_function_membership_proof.ts +1 -1
  142. package/src/database-version/database_version.ts +87 -0
  143. package/src/database-version/version_manager.ts +1 -77
  144. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  145. package/src/epoch-helpers/index.ts +10 -1
  146. package/src/hash/hash.ts +2 -2
  147. package/src/hash/map_slot.ts +3 -2
  148. package/src/interfaces/archiver.ts +17 -25
  149. package/src/interfaces/aztec-node.ts +72 -116
  150. package/src/interfaces/block-builder.ts +15 -5
  151. package/src/interfaces/configs.ts +1 -3
  152. package/src/interfaces/prover-client.ts +15 -0
  153. package/src/interfaces/tx_provider.ts +2 -2
  154. package/src/interfaces/validator.ts +2 -4
  155. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  156. package/src/keys/derivation.ts +8 -8
  157. package/src/keys/key_types.ts +1 -1
  158. package/src/keys/utils.ts +7 -3
  159. package/src/l1-contracts/slash_factory.ts +1 -0
  160. package/src/logs/log_id.ts +7 -6
  161. package/src/logs/siloed_tag.ts +3 -2
  162. package/src/p2p/block_proposal.ts +12 -5
  163. package/src/p2p/checkpoint_proposal.ts +9 -2
  164. package/src/p2p/message_validator.ts +14 -2
  165. package/src/stats/stats.ts +0 -2
  166. package/src/tests/factories.ts +1 -1
  167. package/src/tests/jest.ts +9 -9
  168. package/src/tests/mocks.ts +26 -17
  169. package/src/tx/block_header.ts +7 -4
  170. package/src/tx/indexed_tx_effect.ts +3 -2
  171. package/src/tx/tx_receipt.ts +75 -18
  172. package/dest/block/l2_block_new.d.ts.map +0 -1
  173. package/dest/database-version/index.d.ts +0 -2
  174. package/dest/database-version/index.d.ts.map +0 -1
  175. package/dest/database-version/index.js +0 -1
  176. package/src/database-version/index.ts +0 -1
@@ -68,23 +68,22 @@ export class DelayedPublicMutableValues {
68
68
  }
69
69
 
70
70
  static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
71
- const fields = [];
72
- for (let i = 0; i < DELAYED_PUBLIC_MUTABLE_VALUES_LEN; i++) {
73
- fields.push(await readStorage(delayedPublicMutableSlot.add(new Fr(i))));
74
- }
75
- return DelayedPublicMutableValues.fromFields(fields);
71
+ const fieldPromises = Array.from({ length: DELAYED_PUBLIC_MUTABLE_VALUES_LEN }).map((_, i) =>
72
+ readStorage(delayedPublicMutableSlot.add(new Fr(i))),
73
+ );
74
+ return DelayedPublicMutableValues.fromFields(await Promise.all(fieldPromises));
76
75
  }
77
76
 
78
77
  isEmpty(): boolean {
79
78
  return this.svc.isEmpty() && this.sdc.isEmpty();
80
79
  }
81
80
 
82
- async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
83
- const fields = this.toFields();
81
+ writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
82
+ const fieldPromises = this.toFields().map((field, i) =>
83
+ storageWrite(delayedPublicMutableSlot.add(new Fr(i)), field),
84
+ );
84
85
 
85
- for (let i = 0; i < fields.length; i++) {
86
- await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
87
- }
86
+ return Promise.all(fieldPromises);
88
87
  }
89
88
 
90
89
  async hash(): Promise<Fr> {
@@ -51,6 +51,15 @@ export function getSlotAtTimestamp(
51
51
  : SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
52
52
  }
53
53
 
54
+ /** Returns the L2 slot number at the next L1 block based on the current timestamp. */
55
+ export function getSlotAtNextL1Block(
56
+ currentL1Timestamp: bigint,
57
+ constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>,
58
+ ): SlotNumber {
59
+ const nextL1BlockTimestamp = currentL1Timestamp + BigInt(constants.ethereumSlotDuration);
60
+ return getSlotAtTimestamp(nextL1BlockTimestamp, constants);
61
+ }
62
+
54
63
  /** Returns the epoch number for a given timestamp. */
55
64
  export function getEpochNumberAtTimestamp(
56
65
  ts: bigint,
@@ -69,7 +78,7 @@ export function getSlotRangeForEpoch(
69
78
  epochNumber: EpochNumber,
70
79
  constants: Pick<L1RollupConstants, 'epochDuration'>,
71
80
  ): [SlotNumber, SlotNumber] {
72
- const startSlot = SlotNumber(epochNumber * constants.epochDuration);
81
+ const startSlot = SlotNumber(Number(epochNumber) * constants.epochDuration);
73
82
  return [startSlot, SlotNumber(startSlot + constants.epochDuration - 1)];
74
83
  }
75
84
 
package/src/hash/hash.ts CHANGED
@@ -55,7 +55,7 @@ export function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promis
55
55
  * @returns A siloed nullifier.
56
56
  */
57
57
  export function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promise<Fr> {
58
- return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.OUTER_NULLIFIER);
58
+ return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.SILOED_NULLIFIER);
59
59
  }
60
60
 
61
61
  /**
@@ -87,7 +87,7 @@ export function computePublicDataTreeValue(value: Fr): Fr {
87
87
 
88
88
  */
89
89
  export function computePublicDataTreeLeafSlot(contractAddress: AztecAddress, storageSlot: Fr): Promise<Fr> {
90
- return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_INDEX);
90
+ return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_SLOT);
91
91
  }
92
92
 
93
93
  /**
@@ -1,4 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
1
+ import { GeneratorIndex } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
2
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
 
4
5
  /**
@@ -14,5 +15,5 @@ export function deriveStorageSlotInMap(
14
15
  toField: () => Fr;
15
16
  },
16
17
  ): Promise<Fr> {
17
- return poseidon2Hash([mapSlot, key.toField()]);
18
+ return poseidon2HashWithSeparator([mapSlot, key.toField()], GeneratorIndex.PUBLIC_STORAGE_MAP_SLOT);
18
19
  }
@@ -4,8 +4,9 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
4
4
 
5
5
  import { z } from 'zod';
6
6
 
7
+ import { BlockHash } from '../block/block_hash.js';
7
8
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
8
- import { L2BlockNew } from '../block/l2_block_new.js';
9
+ import { L2Block } from '../block/l2_block.js';
9
10
  import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
10
11
  import { ValidateCheckpointResultSchema } from '../block/validate_block_result.js';
11
12
  import { Checkpoint } from '../checkpoint/checkpoint.js';
@@ -82,7 +83,9 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
82
83
  getRegistryAddress: z.function().args().returns(schemas.EthAddress),
83
84
  getBlockNumber: z.function().args().returns(BlockNumberSchema),
84
85
  getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
85
- getBlock: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
86
+ getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
87
+ getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
88
+ getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
86
89
  getBlockHeader: z
87
90
  .function()
88
91
  .args(z.union([BlockNumberSchema, z.literal('latest')]))
@@ -90,39 +93,28 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
90
93
  getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
91
94
  getCheckpointedBlocks: z
92
95
  .function()
93
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
96
+ .args(BlockNumberSchema, schemas.Integer)
94
97
  .returns(z.array(CheckpointedL2Block.schema)),
95
- getBlocks: z
96
- .function()
97
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
98
- .returns(z.array(L2BlockNew.schema)),
99
- getPublishedCheckpoints: z
98
+ getBlocks: z.function().args(BlockNumberSchema, schemas.Integer).returns(z.array(L2Block.schema)),
99
+ getCheckpoints: z
100
100
  .function()
101
101
  .args(CheckpointNumberSchema, schemas.Integer)
102
102
  .returns(z.array(PublishedCheckpoint.schema)),
103
- getPublishedBlocks: z
104
- .function()
105
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
106
- .returns(z.array(CheckpointedL2Block.schema)),
107
- getL2BlocksNew: z
108
- .function()
109
- .args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
110
- .returns(z.array(L2BlockNew.schema)),
111
- getPublishedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
112
- getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
113
- getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
103
+ getCheckpointedBlockByHash: z.function().args(BlockHash.schema).returns(CheckpointedL2Block.schema.optional()),
104
+ getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
105
+ getBlockHeaderByHash: z.function().args(BlockHash.schema).returns(BlockHeader.schema.optional()),
114
106
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
115
- getL2BlockNew: z.function().args(BlockNumberSchema).returns(L2BlockNew.schema.optional()),
116
- getL2BlockNewByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
117
- getL2BlockNewByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
107
+ getL2Block: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
108
+ getL2BlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
109
+ getL2BlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
118
110
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
119
111
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
120
112
  getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
121
113
  getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
122
114
  getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.schema)),
123
- getBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(L2BlockNew.schema)),
124
- getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2BlockNew.schema)),
125
- getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
115
+ getCheckpointedBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointedL2Block.schema)),
116
+ getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2Block.schema)),
117
+ getCheckpointedBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
126
118
  isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
127
119
  getL2Tips: z.function().args().returns(L2TipsSchema),
128
120
  getPrivateLogsByTags: z
@@ -1,10 +1,4 @@
1
- import {
2
- ARCHIVE_HEIGHT,
3
- L1_TO_L2_MSG_TREE_HEIGHT,
4
- NOTE_HASH_TREE_HEIGHT,
5
- NULLIFIER_TREE_HEIGHT,
6
- PUBLIC_DATA_TREE_HEIGHT,
7
- } from '@aztec/constants';
1
+ import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
8
2
  import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
9
3
  import {
10
4
  BlockNumber,
@@ -23,10 +17,11 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
23
17
  import { z } from 'zod';
24
18
 
25
19
  import type { AztecAddress } from '../aztec-address/index.js';
20
+ import { BlockHash } from '../block/block_hash.js';
26
21
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
27
22
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
28
23
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
29
- import { L2BlockNew } from '../block/l2_block_new.js';
24
+ import { L2Block } from '../block/l2_block.js';
30
25
  import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
31
26
  import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
32
27
  import {
@@ -77,13 +72,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
77
72
  export interface AztecNode
78
73
  extends Pick<
79
74
  L2BlockSource,
80
- | 'getBlocks'
81
- | 'getL2BlocksNew'
82
- | 'getPublishedBlocks'
83
- | 'getPublishedCheckpoints'
84
- | 'getBlockHeader'
85
- | 'getL2Tips'
86
- | 'getCheckpointedBlocks'
75
+ 'getBlocks' | 'getCheckpoints' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpointedBlocks'
87
76
  > {
88
77
  /**
89
78
  * Returns the tips of the L2 chain.
@@ -98,63 +87,31 @@ export interface AztecNode
98
87
  /**
99
88
  * Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
100
89
  * the leaves were inserted.
101
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
90
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
102
91
  * @param treeId - The tree to search in.
103
92
  * @param leafValues - The values to search for.
104
93
  * @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
105
94
  */
106
95
  findLeavesIndexes(
107
- block: BlockParameter,
96
+ referenceBlock: BlockParameter,
108
97
  treeId: MerkleTreeId,
109
98
  leafValues: Fr[],
110
99
  ): Promise<(DataInBlock<bigint> | undefined)[]>;
111
100
 
112
- /**
113
- * Returns a sibling path for the given index in the nullifier tree.
114
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
115
- * @param leafIndex - The index of the leaf for which the sibling path is required.
116
- * @returns The sibling path for the leaf index.
117
- */
118
- getNullifierSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>>;
119
-
120
- /**
121
- * Returns a sibling path for the given index in the note hash tree.
122
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
123
- * @param leafIndex - The index of the leaf for which the sibling path is required.
124
- * @returns The sibling path for the leaf index.
125
- */
126
- getNoteHashSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
127
-
128
- /**
129
- * Returns a sibling path for a leaf in the committed historic blocks tree.
130
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
131
- * @param leafIndex - Index of the leaf in the tree.
132
- * @returns The sibling path.
133
- */
134
- getArchiveSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>>;
135
-
136
- /**
137
- * Returns a sibling path for a leaf in the committed public data tree.
138
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
139
- * @param leafIndex - Index of the leaf in the tree.
140
- * @returns The sibling path.
141
- */
142
- getPublicDataSiblingPath(
143
- block: BlockParameter,
144
- leafIndex: bigint,
145
- ): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>>;
146
-
147
101
  /**
148
102
  * Returns a nullifier membership witness for a given nullifier at a given block.
149
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
103
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
150
104
  * @param nullifier - Nullifier we try to find witness for.
151
105
  * @returns The nullifier membership witness (if found).
152
106
  */
153
- getNullifierMembershipWitness(block: BlockParameter, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
107
+ getNullifierMembershipWitness(
108
+ referenceBlock: BlockParameter,
109
+ nullifier: Fr,
110
+ ): Promise<NullifierMembershipWitness | undefined>;
154
111
 
155
112
  /**
156
113
  * Returns a low nullifier membership witness for a given nullifier at a given block.
157
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
114
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
158
115
  * @param nullifier - Nullifier we try to find the low nullifier witness for.
159
116
  * @returns The low nullifier membership witness (if found).
160
117
  * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
@@ -162,49 +119,56 @@ export interface AztecNode
162
119
  * we are trying to prove non-inclusion for.
163
120
  */
164
121
  getLowNullifierMembershipWitness(
165
- block: BlockParameter,
122
+ referenceBlock: BlockParameter,
166
123
  nullifier: Fr,
167
124
  ): Promise<NullifierMembershipWitness | undefined>;
168
125
 
169
126
  /**
170
127
  * Returns a public data tree witness for a given leaf slot at a given block.
171
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
128
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
172
129
  * @param leafSlot - The leaf slot we try to find the witness for.
173
130
  * @returns The public data witness (if found).
174
131
  * @remarks The witness can be used to compute the current value of the public data tree leaf. If the low leaf preimage corresponds to an
175
132
  * "in range" slot, means that the slot doesn't exist and the value is 0. If the low leaf preimage corresponds to the exact slot, the current value
176
133
  * is contained in the leaf preimage.
177
134
  */
178
- getPublicDataWitness(block: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
135
+ getPublicDataWitness(referenceBlock: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
179
136
 
180
137
  /**
181
- * Returns a membership witness for a given archive leaf at a given block.
182
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
183
- * @param archive - The archive leaf we try to find the witness for.
138
+ * Returns a membership witness for a given block hash in the archive tree.
139
+ *
140
+ * Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
141
+ * its block hash is appended as a new leaf to the archive tree. This method finds the membership
142
+ * witness (leaf index and sibling path) for a given block hash, which can be used to prove that
143
+ * a specific block exists in the chain's history.
144
+ *
145
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data
146
+ * (which contains the root of the archive tree in which we are searching for the block hash).
147
+ * @param blockHash - The block hash to find in the archive tree.
184
148
  */
185
- getArchiveMembershipWitness(
186
- block: BlockParameter,
187
- archive: Fr,
149
+ getBlockHashMembershipWitness(
150
+ referenceBlock: BlockParameter,
151
+ blockHash: BlockHash,
188
152
  ): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
189
153
 
190
154
  /**
191
155
  * Returns a membership witness for a given note hash at a given block.
192
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
156
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
193
157
  * @param noteHash - The note hash we try to find the witness for.
194
158
  */
195
159
  getNoteHashMembershipWitness(
196
- block: BlockParameter,
160
+ referenceBlock: BlockParameter,
197
161
  noteHash: Fr,
198
162
  ): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
199
163
 
200
164
  /**
201
165
  * Returns the index and a sibling path for a leaf in the committed l1 to l2 data tree.
202
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
166
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
203
167
  * @param l1ToL2Message - The l1ToL2Message to get the index / sibling path for.
204
168
  * @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
205
169
  */
206
170
  getL1ToL2MessageMembershipWitness(
207
- block: BlockParameter,
171
+ referenceBlock: BlockParameter,
208
172
  l1ToL2Message: Fr,
209
173
  ): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
210
174
 
@@ -229,24 +193,24 @@ export interface AztecNode
229
193
 
230
194
  /**
231
195
  * Get a block specified by its block number or 'latest'.
232
- * @param number - The block number or 'latest'.
196
+ * @param blockParameter - The block parameter (block number, block hash, or 'latest').
233
197
  * @returns The requested block.
234
198
  */
235
- getBlock(number: BlockParameter): Promise<L2BlockNew | undefined>;
199
+ getBlock(blockParameter: BlockParameter): Promise<L2Block | undefined>;
236
200
 
237
201
  /**
238
202
  * Get a block specified by its hash.
239
203
  * @param blockHash - The block hash being requested.
240
204
  * @returns The requested block.
241
205
  */
242
- getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
206
+ getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
243
207
 
244
208
  /**
245
209
  * Get a block specified by its archive root.
246
210
  * @param archive - The archive root being requested.
247
211
  * @returns The requested block.
248
212
  */
249
- getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
213
+ getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
250
214
 
251
215
  /**
252
216
  * Method to fetch the latest block number synchronized by the node.
@@ -260,6 +224,12 @@ export interface AztecNode
260
224
  */
261
225
  getProvenBlockNumber(): Promise<BlockNumber>;
262
226
 
227
+ /**
228
+ * Fetches the latest checkpointed block number.
229
+ * @returns The block number.
230
+ */
231
+ getCheckpointedBlockNumber(): Promise<BlockNumber>;
232
+
263
233
  /**
264
234
  * Method to determine if the node is ready to accept transactions.
265
235
  * @returns - Flag indicating the readiness for tx submission.
@@ -279,7 +249,7 @@ export interface AztecNode
279
249
  * @param limit - The maximum number of blocks to return.
280
250
  * @returns The blocks requested.
281
251
  */
282
- getBlocks(from: BlockNumber, limit: number): Promise<L2BlockNew[]>;
252
+ getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
283
253
 
284
254
  /**
285
255
  * Method to fetch the current min fees.
@@ -347,10 +317,14 @@ export interface AztecNode
347
317
  * array implies no logs match that tag.
348
318
  * @param tags - The tags to search for.
349
319
  * @param page - The page number (0-indexed) for pagination.
320
+ * @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
321
+ * This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
322
+ * If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
323
+ * undefined behavior in the client's code.
350
324
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
351
325
  * for a tag, the caller should fetch the next page to check for more logs.
352
326
  */
353
- getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
327
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: BlockHash): Promise<TxScopedL2Log[][]>;
354
328
 
355
329
  /**
356
330
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -358,6 +332,10 @@ export interface AztecNode
358
332
  * @param contractAddress - The contract address to search logs for.
359
333
  * @param tags - The tags to search for.
360
334
  * @param page - The page number (0-indexed) for pagination.
335
+ * @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
336
+ * This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
337
+ * If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
338
+ * undefined behavior in the client's code.
361
339
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
362
340
  * for a tag, the caller should fetch the next page to check for more logs.
363
341
  */
@@ -365,6 +343,7 @@ export interface AztecNode
365
343
  contractAddress: AztecAddress,
366
344
  tags: Tag[],
367
345
  page?: number,
346
+ referenceBlock?: BlockHash,
368
347
  ): Promise<TxScopedL2Log[][]>;
369
348
 
370
349
  /**
@@ -423,12 +402,12 @@ export interface AztecNode
423
402
  * @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
424
403
  * Aztec's version of `eth_getStorageAt`.
425
404
  *
426
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
405
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
427
406
  * @param contract - Address of the contract to query.
428
407
  * @param slot - Slot to query.
429
408
  * @returns Storage value at the given contract slot.
430
409
  */
431
- getPublicStorageAt(block: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
410
+ getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
432
411
 
433
412
  /**
434
413
  * Returns the block header for a given block number, block hash, or 'latest'.
@@ -508,26 +487,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
508
487
  .args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
509
488
  .returns(z.array(optional(dataInBlockSchemaFor(schemas.BigInt)))),
510
489
 
511
- getNullifierSiblingPath: z
512
- .function()
513
- .args(BlockParameterSchema, schemas.BigInt)
514
- .returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
515
-
516
- getNoteHashSiblingPath: z
517
- .function()
518
- .args(BlockParameterSchema, schemas.BigInt)
519
- .returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
520
-
521
- getArchiveSiblingPath: z
522
- .function()
523
- .args(BlockParameterSchema, schemas.BigInt)
524
- .returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
525
-
526
- getPublicDataSiblingPath: z
527
- .function()
528
- .args(BlockParameterSchema, schemas.BigInt)
529
- .returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
530
-
531
490
  getNullifierMembershipWitness: z
532
491
  .function()
533
492
  .args(BlockParameterSchema, schemas.Fr)
@@ -543,9 +502,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
543
502
  .args(BlockParameterSchema, schemas.Fr)
544
503
  .returns(PublicDataWitness.schema.optional()),
545
504
 
546
- getArchiveMembershipWitness: z
505
+ getBlockHashMembershipWitness: z
547
506
  .function()
548
- .args(BlockParameterSchema, schemas.Fr)
507
+ .args(BlockParameterSchema, BlockHash.schema)
549
508
  .returns(MembershipWitness.schemaFor(ARCHIVE_HEIGHT).optional()),
550
509
 
551
510
  getNoteHashMembershipWitness: z
@@ -567,16 +526,18 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
567
526
  .args(EpochNumberSchema)
568
527
  .returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
569
528
 
570
- getBlock: z.function().args(BlockParameterSchema).returns(L2BlockNew.schema.optional()),
529
+ getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
571
530
 
572
- getBlockByHash: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
531
+ getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
573
532
 
574
- getBlockByArchive: z.function().args(schemas.Fr).returns(L2BlockNew.schema.optional()),
533
+ getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
575
534
 
576
535
  getBlockNumber: z.function().returns(BlockNumberSchema),
577
536
 
578
537
  getProvenBlockNumber: z.function().returns(BlockNumberSchema),
579
538
 
539
+ getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
540
+
580
541
  isReady: z.function().returns(z.boolean()),
581
542
 
582
543
  getNodeInfo: z.function().returns(NodeInfoSchema),
@@ -584,26 +545,16 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
584
545
  getBlocks: z
585
546
  .function()
586
547
  .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
587
- .returns(z.array(L2BlockNew.schema)),
548
+ .returns(z.array(L2Block.schema)),
588
549
 
589
- getPublishedBlocks: z
590
- .function()
591
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
592
- .returns(z.array(CheckpointedL2Block.schema)),
593
-
594
- getPublishedCheckpoints: z
550
+ getCheckpoints: z
595
551
  .function()
596
552
  .args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
597
553
  .returns(z.array(PublishedCheckpoint.schema)),
598
554
 
599
- getL2BlocksNew: z
600
- .function()
601
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
602
- .returns(z.array(L2BlockNew.schema)),
603
-
604
555
  getCheckpointedBlocks: z
605
556
  .function()
606
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(z.boolean()))
557
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
607
558
  .returns(z.array(CheckpointedL2Block.schema)),
608
559
 
609
560
  getCurrentMinFees: z.function().returns(GasFees.schema),
@@ -631,12 +582,17 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
631
582
 
632
583
  getPrivateLogsByTags: z
633
584
  .function()
634
- .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
585
+ .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(BlockHash.schema))
635
586
  .returns(z.array(z.array(TxScopedL2Log.schema))),
636
587
 
637
588
  getPublicLogsByTagsFromContract: z
638
589
  .function()
639
- .args(schemas.AztecAddress, z.array(Tag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)))
590
+ .args(
591
+ schemas.AztecAddress,
592
+ z.array(Tag.schema).max(MAX_RPC_LEN),
593
+ optional(z.number().gte(0)),
594
+ optional(BlockHash.schema),
595
+ )
640
596
  .returns(z.array(z.array(TxScopedL2Log.schema))),
641
597
 
642
598
  sendTx: z.function().args(Tx.schema).returns(z.void()),
@@ -1,7 +1,8 @@
1
1
  import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
2
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { LoggerBindings } from '@aztec/foundation/log';
3
4
 
4
- import type { L2BlockNew } from '../block/l2_block_new.js';
5
+ import type { L2Block } from '../block/l2_block.js';
5
6
  import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
6
7
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
7
8
  import type { Gas } from '../gas/gas.js';
@@ -31,7 +32,7 @@ export interface IBlockFactory extends ProcessedTxHandler {
31
32
  /**
32
33
  * Assembles the block and updates the archive tree.
33
34
  */
34
- setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2BlockNew>;
35
+ setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
35
36
  }
36
37
 
37
38
  export interface PublicProcessorLimits {
@@ -61,16 +62,24 @@ export const FullNodeBlockBuilderConfigKeys: (keyof FullNodeBlockBuilderConfig)[
61
62
  'fakeThrowAfterProcessingTxCount',
62
63
  ] as const;
63
64
 
65
+ /** Thrown when no valid transactions are available to include in a block after processing, and this is not the first block in a checkpoint. */
66
+ export class NoValidTxsError extends Error {
67
+ constructor(public readonly failedTxs: FailedTx[]) {
68
+ super('No valid transactions to include in block');
69
+ this.name = 'NoValidTxsError';
70
+ }
71
+ }
72
+
64
73
  /** Result of building a block within a checkpoint. */
65
- export interface BuildBlockInCheckpointResult {
66
- block: L2BlockNew;
74
+ export type BuildBlockInCheckpointResult = {
75
+ block: L2Block;
67
76
  publicGas: Gas;
68
77
  publicProcessorDuration: number;
69
78
  numTxs: number;
70
79
  failedTxs: FailedTx[];
71
80
  usedTxs: Tx[];
72
81
  usedTxBlobFields: number;
73
- }
82
+ };
74
83
 
75
84
  /** Interface for building blocks within a checkpoint context. */
76
85
  export interface ICheckpointBlockBuilder {
@@ -92,5 +101,6 @@ export interface ICheckpointsBuilder {
92
101
  l1ToL2Messages: Fr[],
93
102
  previousCheckpointOutHashes: Fr[],
94
103
  fork: MerkleTreeWriteOperations,
104
+ bindings?: LoggerBindings,
95
105
  ): Promise<ICheckpointBlockBuilder>;
96
106
  }
@@ -67,9 +67,7 @@ export interface SequencerConfig {
67
67
  blockDurationMs?: number;
68
68
  /** Have sequencer build and publish an empty checkpoint if there are no txs */
69
69
  buildCheckpointIfEmpty?: boolean;
70
-
71
- // TODO(palla/mbps): Change default to false once block sync is stable
72
- /** Skip pushing proposed blocks to archiver (default: true) */
70
+ /** Skip pushing proposed blocks to archiver (default: false) */
73
71
  skipPushProposedBlocksToArchiver?: boolean;
74
72
  }
75
73
 
@@ -17,6 +17,12 @@ export type ActualProverConfig = {
17
17
  proverTestDelayMs: number;
18
18
  /** If using realistic delays, what percentage of realistic times to apply. */
19
19
  proverTestDelayFactor: number;
20
+ /**
21
+ * Whether to abort pending proving jobs when the orchestrator is cancelled.
22
+ * When false (default), jobs remain in the broker queue and can be reused on restart/reorg.
23
+ * When true, jobs are explicitly cancelled with the broker, which prevents reuse.
24
+ */
25
+ cancelJobsOnStop: boolean;
20
26
  };
21
27
 
22
28
  /**
@@ -43,6 +49,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
43
49
  proverTestDelayFactor: z.number(),
44
50
  proverAgentCount: z.number(),
45
51
  failedProofStore: z.string().optional(),
52
+ cancelJobsOnStop: z.boolean(),
46
53
  }),
47
54
  );
48
55
 
@@ -85,6 +92,14 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
85
92
  description:
86
93
  'Store for failed proof inputs. Google cloud storage is only supported at the moment. Set this value as gs://bucket-name/path/to/store.',
87
94
  },
95
+ cancelJobsOnStop: {
96
+ env: 'PROVER_CANCEL_JOBS_ON_STOP',
97
+ description:
98
+ 'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
99
+ 'When false (default), jobs remain in the broker queue and can be reused on restart/reorg. ' +
100
+ 'When true, jobs are explicitly cancelled with the broker, which prevents reuse.',
101
+ ...booleanConfigHelper(false),
102
+ },
88
103
  };
89
104
 
90
105
  function parseProverId(str?: string) {