@aztec/stdlib 5.0.0-rc.2 → 5.0.1

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 (197) hide show
  1. package/dest/block/attestation_info.d.ts +1 -1
  2. package/dest/block/attestation_info.d.ts.map +1 -1
  3. package/dest/block/attestation_info.js +7 -4
  4. package/dest/block/l2_block_source.d.ts +34 -3
  5. package/dest/block/l2_block_source.d.ts.map +1 -1
  6. package/dest/block/l2_block_source.js +15 -0
  7. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
  8. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
  9. package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
  10. package/dest/block/l2_block_stream/index.d.ts +2 -1
  11. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  12. package/dest/block/l2_block_stream/index.js +1 -0
  13. package/dest/block/l2_block_stream/interfaces.d.ts +16 -2
  14. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  15. package/dest/block/l2_block_stream/interfaces.js +25 -1
  16. package/dest/block/l2_block_stream/l2_block_stream.d.ts +21 -35
  17. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  18. package/dest/block/l2_block_stream/l2_block_stream.js +5 -30
  19. package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
  20. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  21. package/dest/block/proposal/attestations_and_signers.js +47 -7
  22. package/dest/block/validate_block_result.d.ts +16 -1
  23. package/dest/block/validate_block_result.d.ts.map +1 -1
  24. package/dest/block/validate_block_result.js +18 -3
  25. package/dest/config/network-consensus-config.d.ts +1 -1
  26. package/dest/config/network-consensus-config.d.ts.map +1 -1
  27. package/dest/config/network-consensus-config.js +2 -10
  28. package/dest/contract/contract_address.d.ts +5 -4
  29. package/dest/contract/contract_address.d.ts.map +1 -1
  30. package/dest/contract/contract_instance.d.ts +16 -2
  31. package/dest/contract/contract_instance.d.ts.map +1 -1
  32. package/dest/contract/contract_instance.js +45 -0
  33. package/dest/contract/interfaces/contract_instance.d.ts +71 -10
  34. package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
  35. package/dest/contract/interfaces/contract_instance.js +7 -2
  36. package/dest/contract/partial_address.d.ts +9 -3
  37. package/dest/contract/partial_address.d.ts.map +1 -1
  38. package/dest/contract/partial_address.js +8 -2
  39. package/dest/database-version/version_manager.d.ts +18 -4
  40. package/dest/database-version/version_manager.d.ts.map +1 -1
  41. package/dest/database-version/version_manager.js +76 -6
  42. package/dest/ha-signing/config.d.ts +19 -5
  43. package/dest/ha-signing/config.d.ts.map +1 -1
  44. package/dest/ha-signing/config.js +9 -3
  45. package/dest/ha-signing/local_config.d.ts +10 -2
  46. package/dest/ha-signing/local_config.d.ts.map +1 -1
  47. package/dest/ha-signing/local_config.js +8 -2
  48. package/dest/hash/hash.d.ts +1 -2
  49. package/dest/hash/hash.d.ts.map +1 -1
  50. package/dest/hash/hash.js +0 -7
  51. package/dest/interfaces/archiver.d.ts +8 -1
  52. package/dest/interfaces/archiver.d.ts.map +1 -1
  53. package/dest/interfaces/archiver.js +2 -1
  54. package/dest/interfaces/aztec-node-admin.d.ts +5 -2
  55. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  56. package/dest/interfaces/configs.d.ts +4 -1
  57. package/dest/interfaces/configs.d.ts.map +1 -1
  58. package/dest/interfaces/configs.js +1 -0
  59. package/dest/interfaces/private_kernel_prover.d.ts +9 -11
  60. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  61. package/dest/interfaces/proving-job.d.ts +87 -74
  62. package/dest/interfaces/proving-job.d.ts.map +1 -1
  63. package/dest/interfaces/proving-job.js +13 -4
  64. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  65. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  66. package/dest/interfaces/validator.d.ts +7 -3
  67. package/dest/interfaces/validator.d.ts.map +1 -1
  68. package/dest/interfaces/world_state.d.ts +14 -1
  69. package/dest/interfaces/world_state.d.ts.map +1 -1
  70. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
  71. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
  72. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
  73. package/dest/kernel/index.d.ts +2 -2
  74. package/dest/kernel/index.d.ts.map +1 -1
  75. package/dest/kernel/index.js +1 -1
  76. package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
  77. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  78. package/dest/kernel/private_circuit_public_inputs.js +14 -7
  79. package/dest/kernel/private_context_inputs.d.ts +4 -3
  80. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  81. package/dest/kernel/private_context_inputs.js +7 -3
  82. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
  83. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  84. package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
  85. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
  86. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
  87. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
  88. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
  89. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
  90. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
  91. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
  92. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  93. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
  94. package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
  95. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  96. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
  97. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
  98. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
  99. package/dest/keys/derivation.d.ts +41 -6
  100. package/dest/keys/derivation.d.ts.map +1 -1
  101. package/dest/keys/derivation.js +49 -26
  102. package/dest/logs/app_tagging_secret.d.ts +16 -8
  103. package/dest/logs/app_tagging_secret.d.ts.map +1 -1
  104. package/dest/logs/app_tagging_secret.js +24 -27
  105. package/dest/logs/index.d.ts +1 -3
  106. package/dest/logs/index.d.ts.map +1 -1
  107. package/dest/logs/index.js +0 -2
  108. package/dest/logs/shared_secret_derivation.d.ts +29 -6
  109. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  110. package/dest/logs/shared_secret_derivation.js +44 -11
  111. package/dest/messaging/l1_to_l2_message.d.ts +23 -2
  112. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  113. package/dest/messaging/l1_to_l2_message.js +36 -11
  114. package/dest/p2p/attestation_utils.d.ts +1 -1
  115. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  116. package/dest/p2p/attestation_utils.js +8 -1
  117. package/dest/p2p/checkpoint_attestation.d.ts +9 -1
  118. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  119. package/dest/p2p/checkpoint_attestation.js +10 -0
  120. package/dest/p2p/signature_utils.d.ts +10 -1
  121. package/dest/p2p/signature_utils.d.ts.map +1 -1
  122. package/dest/p2p/signature_utils.js +9 -1
  123. package/dest/rollup/avm_proof_data.d.ts +3 -3
  124. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  125. package/dest/stats/stats.d.ts +2 -2
  126. package/dest/stats/stats.d.ts.map +1 -1
  127. package/dest/tests/factories.d.ts +1 -1
  128. package/dest/tests/factories.d.ts.map +1 -1
  129. package/dest/tests/factories.js +4 -3
  130. package/dest/tx/private_tx_constant_data.d.ts +18 -2
  131. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  132. package/dest/tx/private_tx_constant_data.js +13 -4
  133. package/dest/tx/simulated_tx.d.ts +10 -6
  134. package/dest/tx/simulated_tx.d.ts.map +1 -1
  135. package/dest/world-state/genesis_data.d.ts +9 -1
  136. package/dest/world-state/genesis_data.d.ts.map +1 -1
  137. package/dest/world-state/genesis_data.js +1 -0
  138. package/package.json +8 -8
  139. package/src/block/attestation_info.ts +7 -2
  140. package/src/block/l2_block_source.ts +54 -2
  141. package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
  142. package/src/block/l2_block_stream/index.ts +1 -0
  143. package/src/block/l2_block_stream/interfaces.ts +35 -1
  144. package/src/block/l2_block_stream/l2_block_stream.ts +35 -62
  145. package/src/block/proposal/attestations_and_signers.ts +53 -7
  146. package/src/block/validate_block_result.ts +48 -2
  147. package/src/config/network-consensus-config.ts +2 -13
  148. package/src/contract/contract_address.ts +4 -3
  149. package/src/contract/contract_instance.ts +62 -1
  150. package/src/contract/interfaces/contract_instance.ts +26 -8
  151. package/src/contract/partial_address.ts +8 -2
  152. package/src/database-version/version_manager.ts +96 -6
  153. package/src/gas/README.md +108 -36
  154. package/src/ha-signing/config.ts +23 -5
  155. package/src/ha-signing/local_config.ts +20 -1
  156. package/src/hash/hash.ts +0 -8
  157. package/src/interfaces/archiver.ts +8 -0
  158. package/src/interfaces/configs.ts +3 -0
  159. package/src/interfaces/private_kernel_prover.ts +10 -12
  160. package/src/interfaces/proving-job.ts +15 -3
  161. package/src/interfaces/server_circuit_prover.ts +2 -2
  162. package/src/interfaces/world_state.ts +14 -0
  163. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
  164. package/src/kernel/index.ts +1 -1
  165. package/src/kernel/private_circuit_public_inputs.ts +12 -1
  166. package/src/kernel/private_context_inputs.ts +10 -3
  167. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
  168. package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
  169. package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
  170. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
  171. package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
  172. package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
  173. package/src/keys/derivation.ts +69 -24
  174. package/src/logs/app_tagging_secret.ts +34 -27
  175. package/src/logs/index.ts +0 -2
  176. package/src/logs/shared_secret_derivation.ts +47 -14
  177. package/src/messaging/l1_to_l2_message.ts +51 -13
  178. package/src/p2p/attestation_utils.ts +8 -1
  179. package/src/p2p/checkpoint_attestation.ts +12 -0
  180. package/src/p2p/signature_utils.ts +9 -0
  181. package/src/rollup/avm_proof_data.ts +2 -2
  182. package/src/stats/stats.ts +2 -2
  183. package/src/tests/factories.ts +3 -6
  184. package/src/tx/private_tx_constant_data.ts +25 -2
  185. package/src/world-state/genesis_data.ts +10 -0
  186. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
  187. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
  188. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
  189. package/dest/logs/message_context.d.ts +0 -17
  190. package/dest/logs/message_context.d.ts.map +0 -1
  191. package/dest/logs/message_context.js +0 -9
  192. package/dest/logs/pending_tagged_log.d.ts +0 -11
  193. package/dest/logs/pending_tagged_log.d.ts.map +0 -1
  194. package/dest/logs/pending_tagged_log.js +0 -4
  195. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
  196. package/src/logs/message_context.ts +0 -18
  197. package/src/logs/pending_tagged_log.ts +0 -12
@@ -18,7 +18,12 @@ import {
18
18
  computeInitializationHash,
19
19
  computeInitializationHashFromEncodedArgs,
20
20
  } from './contract_address.js';
21
- import type { ContractInstance, ContractInstanceWithAddress } from './interfaces/contract_instance.js';
21
+ import type {
22
+ ContractInstance,
23
+ ContractInstancePreimage,
24
+ ContractInstancePreimageWithAddress,
25
+ ContractInstanceWithAddress,
26
+ } from './interfaces/contract_instance.js';
22
27
 
23
28
  const VERSION = 2 as const;
24
29
 
@@ -115,6 +120,62 @@ export class SerializableContractInstance {
115
120
  }
116
121
  }
117
122
 
123
+ export class SerializableContractInstancePreimage {
124
+ public readonly version = VERSION;
125
+ public readonly salt: Fr;
126
+ public readonly deployer: AztecAddress;
127
+ public readonly originalContractClassId: Fr;
128
+ public readonly initializationHash: Fr;
129
+ public readonly immutablesHash: Fr;
130
+ public readonly publicKeys: PublicKeys;
131
+
132
+ constructor(instance: ContractInstancePreimage) {
133
+ if (instance.version !== VERSION) {
134
+ throw new Error(`Unexpected contract class version ${instance.version}`);
135
+ }
136
+ this.salt = instance.salt;
137
+ this.deployer = instance.deployer;
138
+ this.originalContractClassId = instance.originalContractClassId;
139
+ this.initializationHash = instance.initializationHash;
140
+ this.immutablesHash = instance.immutablesHash;
141
+ this.publicKeys = instance.publicKeys;
142
+ }
143
+
144
+ public toBuffer() {
145
+ return serializeToBuffer(
146
+ numToUInt8(this.version),
147
+ this.salt,
148
+ this.deployer,
149
+ this.originalContractClassId,
150
+ this.initializationHash,
151
+ this.immutablesHash,
152
+ this.publicKeys,
153
+ );
154
+ }
155
+
156
+ /** Returns a copy of this object with its address included. */
157
+ withAddress(address: AztecAddress): ContractInstancePreimageWithAddress {
158
+ return { ...this, address };
159
+ }
160
+
161
+ static fromBuffer(bufferOrReader: Buffer | BufferReader): SerializableContractInstancePreimage {
162
+ const reader = BufferReader.asReader(bufferOrReader);
163
+ const version = reader.readUInt8();
164
+ if (version !== VERSION) {
165
+ throw new Error(`Unexpected contract instance preimage version ${version}`);
166
+ }
167
+ return new SerializableContractInstancePreimage({
168
+ version: VERSION,
169
+ salt: reader.readObject(Fr),
170
+ deployer: reader.readObject(AztecAddress),
171
+ originalContractClassId: reader.readObject(Fr),
172
+ initializationHash: reader.readObject(Fr),
173
+ immutablesHash: reader.readObject(Fr),
174
+ publicKeys: reader.readObject(PublicKeys),
175
+ });
176
+ }
177
+ }
178
+
118
179
  /**
119
180
  * Generates a Contract Instance from some instantiation params.
120
181
  * @param artifact - The account contract build artifact.
@@ -9,19 +9,19 @@ import { schemas, zodFor } from '../../schemas/index.js';
9
9
  const VERSION = 2 as const;
10
10
 
11
11
  /**
12
- * A contract instance is a concrete deployment of a contract class. It always references a contract class,
13
- * which dictates what code it executes when called. It has state (both private and public), as well as an
14
- * address that acts as its identifier. It can be called into. It may have encryption and nullifying public keys.
12
+ * The address preimage of a contract instance: the immutable data that hashes to its address, i.e. everything a
13
+ * contract deployment commits to.
14
+ *
15
+ * Note that `originaContractClassId` is not necessarily the instance's _current_ class id, in case of upgrades: that
16
+ * one is not part of the preimage and is instead derived from chain state.
15
17
  */
16
- export interface ContractInstance {
18
+ export interface ContractInstancePreimage {
17
19
  /** Version identifier. Initially one, bumped for any changes to the contract instance struct. */
18
20
  version: typeof VERSION;
19
21
  /** User-generated pseudorandom value for uniqueness. */
20
22
  salt: Fr;
21
23
  /** Optional deployer address or zero if this was a universal deploy. */
22
24
  deployer: AztecAddress;
23
- /** Identifier of the contract class for this instance. */
24
- currentContractClassId: Fr;
25
25
  /** Identifier of the original (at deployment) contract class for this instance */
26
26
  originalContractClassId: Fr;
27
27
  /** Hash of the selector and arguments to the constructor. */
@@ -32,14 +32,24 @@ export interface ContractInstance {
32
32
  publicKeys: PublicKeys;
33
33
  }
34
34
 
35
+ /**
36
+ * The address preimage plus the current contract class id, which is chain-tracked state derived from the
37
+ * ContractInstanceRegistry (it equals the original class id unless the contract has been upgraded).
38
+ */
39
+ export interface ContractInstance extends ContractInstancePreimage {
40
+ /** Identifier of the contract class this instance currently runs (as of some block). */
41
+ currentContractClassId: Fr;
42
+ }
43
+
44
+ export type ContractInstancePreimageWithAddress = ContractInstancePreimage & { address: AztecAddress };
45
+
35
46
  export type ContractInstanceWithAddress = ContractInstance & { address: AztecAddress };
36
47
 
37
- export const ContractInstanceSchema = zodFor<ContractInstance>()(
48
+ export const ContractInstancePreimageSchema = zodFor<ContractInstancePreimage>()(
38
49
  z.object({
39
50
  version: z.literal(VERSION),
40
51
  salt: schemas.Fr,
41
52
  deployer: schemas.AztecAddress,
42
- currentContractClassId: schemas.Fr,
43
53
  originalContractClassId: schemas.Fr,
44
54
  initializationHash: schemas.Fr,
45
55
  immutablesHash: schemas.Fr,
@@ -47,6 +57,14 @@ export const ContractInstanceSchema = zodFor<ContractInstance>()(
47
57
  }),
48
58
  );
49
59
 
60
+ export const ContractInstanceSchema = zodFor<ContractInstance>()(
61
+ ContractInstancePreimageSchema.and(z.object({ currentContractClassId: schemas.Fr })),
62
+ );
63
+
64
+ export const ContractInstancePreimageWithAddressSchema = zodFor<ContractInstancePreimageWithAddress>()(
65
+ ContractInstancePreimageSchema.and(z.object({ address: schemas.AztecAddress })),
66
+ );
67
+
50
68
  export const ContractInstanceWithAddressSchema = zodFor<ContractInstanceWithAddress>()(
51
69
  ContractInstanceSchema.and(z.object({ address: schemas.AztecAddress })),
52
70
  );
@@ -1,7 +1,13 @@
1
1
  import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
 
3
3
  /**
4
- * A type which along with public key forms a preimage of a contract address. See the link below for more details
5
- * https://github.com/AztecProtocol/aztec-packages/blob/master/docs/docs/concepts/foundation/accounts/keys.md#addresses-partial-addresses-and-public-keys
4
+ * The contract-side preimage of an Aztec address, i.e. the commitment to a specific contract instance.
5
+ *
6
+ * A partial address commits to a contract's code and initialization
7
+ * (`hash(contract_class_id, salted_initialization_hash)`) but not to its keys. Combined with an account's `PublicKeys`,
8
+ * it fully determines the address: `address = (hash(public_keys_hash, partial_address) * G + Ivpk_m).x`. Two accounts
9
+ * therefore share an address only if they share both their public keys and their partial address.
10
+ *
11
+ * See `computePartialAddress` for the derivation.
6
12
  */
7
13
  export type PartialAddress = Fr;
@@ -6,11 +6,20 @@ import { join } from 'path';
6
6
 
7
7
  import { DatabaseVersion } from './database_version.js';
8
8
 
9
- export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'writeFile' | 'rm' | 'mkdir'>;
9
+ export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'rm' | 'mkdir' | 'rename' | 'open'>;
10
10
 
11
11
  export const DATABASE_VERSION_FILE_NAME = 'db_version';
12
12
  export type SchemaVersionMismatchPolicy = 'reset' | 'throw';
13
13
 
14
+ /**
15
+ * How to react when the version file exists but cannot be read (permissions, IO error, truncation).
16
+ * `'reset'` (default) treats the store as unversioned and lets the reset path run — safe for stores
17
+ * where an empty state is legitimate. `'throw'` refuses to open, leaving data untouched — required
18
+ * for protection stores (e.g. signing protection) that must never be silently wiped by a transient
19
+ * filesystem error. A genuinely missing file (ENOENT) is a first boot and is never affected by this.
20
+ */
21
+ export type VersionFileReadFailurePolicy = 'reset' | 'throw';
22
+
14
23
  export type DatabaseVersionManagerOptions<T> = {
15
24
  schemaVersion: number;
16
25
  rollupAddress: EthAddress;
@@ -18,6 +27,7 @@ export type DatabaseVersionManagerOptions<T> = {
18
27
  onOpen: (dataDir: string) => Promise<T>;
19
28
  onUpgrade?: (dataDir: string, currentVersion: number, latestVersion: number) => Promise<void>;
20
29
  schemaVersionMismatchPolicy?: SchemaVersionMismatchPolicy;
30
+ versionFileReadFailurePolicy?: VersionFileReadFailurePolicy;
21
31
  fileSystem?: DatabaseVersionManagerFs;
22
32
  log?: Logger;
23
33
  };
@@ -37,6 +47,7 @@ export class DatabaseVersionManager<T> {
37
47
  private onOpen: (dataDir: string) => Promise<T>;
38
48
  private onUpgrade?: (dataDir: string, currentVersion: number, latestVersion: number) => Promise<void>;
39
49
  private schemaVersionMismatchPolicy: SchemaVersionMismatchPolicy;
50
+ private versionFileReadFailurePolicy: VersionFileReadFailurePolicy;
40
51
  private fileSystem: DatabaseVersionManagerFs;
41
52
  private log: Logger;
42
53
 
@@ -47,8 +58,11 @@ export class DatabaseVersionManager<T> {
47
58
  * @param rollupAddress - The rollup contract address
48
59
  * @param dataDirectory - The directory where version information will be stored
49
60
  * @param onOpen - A callback to the open the database at the given location
50
- * @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the database
61
+ * @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
62
+ * database. Must be idempotent: since the version marker is written only after a successful open, a crash after
63
+ * onUpgrade but before the marker is written re-runs onUpgrade on the next start.
51
64
  * @param schemaVersionMismatchPolicy - Whether schema mismatches should reset data or throw
65
+ * @param versionFileReadFailurePolicy - Whether an unreadable (non-missing) version file should reset data or throw
52
66
  * @param fileSystem - An interface to access the filesystem
53
67
  * @param log - Optional custom logger
54
68
  * @param options - Configuration options
@@ -60,6 +74,7 @@ export class DatabaseVersionManager<T> {
60
74
  onOpen,
61
75
  onUpgrade,
62
76
  schemaVersionMismatchPolicy = 'reset',
77
+ versionFileReadFailurePolicy = 'reset',
63
78
  fileSystem = fs,
64
79
  log = createLogger(`foundation:version-manager`),
65
80
  }: DatabaseVersionManagerOptions<T>) {
@@ -74,13 +89,40 @@ export class DatabaseVersionManager<T> {
74
89
  this.onOpen = onOpen;
75
90
  this.onUpgrade = onUpgrade;
76
91
  this.schemaVersionMismatchPolicy = schemaVersionMismatchPolicy;
92
+ this.versionFileReadFailurePolicy = versionFileReadFailurePolicy;
77
93
  this.fileSystem = fileSystem;
78
94
  this.log = log;
79
95
  }
80
96
 
81
97
  static async writeVersion(version: DatabaseVersion, dataDir: string, fileSystem: DatabaseVersionManagerFs = fs) {
82
98
  await fileSystem.mkdir(dataDir, { recursive: true });
83
- return fileSystem.writeFile(join(dataDir, DatabaseVersionManager.VERSION_FILE), version.toBuffer());
99
+ const finalPath = join(dataDir, DatabaseVersionManager.VERSION_FILE);
100
+ const tmpPath = `${finalPath}.tmp`;
101
+
102
+ // Atomic durable write: fill a temp file, fsync it, then rename it into place. The marker only
103
+ // becomes visible under its final name once its bytes are durably on disk, so a crash mid-write
104
+ // can never leave a "valid" version file sitting over an empty or partially-populated data dir.
105
+ const handle = await fileSystem.open(tmpPath, 'w');
106
+ try {
107
+ await handle.writeFile(version.toBuffer());
108
+ await handle.sync();
109
+ } finally {
110
+ await handle.close();
111
+ }
112
+ await fileSystem.rename(tmpPath, finalPath);
113
+
114
+ // Best-effort fsync of the containing directory so the rename itself survives a crash. Not all
115
+ // filesystems support directory fsync, so a failure here is non-fatal.
116
+ try {
117
+ const dirHandle = await fileSystem.open(dataDir, 'r');
118
+ try {
119
+ await dirHandle.sync();
120
+ } finally {
121
+ await dirHandle.close();
122
+ }
123
+ } catch {
124
+ // directory fsync is best-effort
125
+ }
84
126
  }
85
127
 
86
128
  /**
@@ -105,6 +147,17 @@ export class DatabaseVersionManager<T> {
105
147
  storedVersion = DatabaseVersion.empty();
106
148
  // only turn off these logs if the data dir didn't exist before
107
149
  shouldLogDataReset = false;
150
+ } else if (this.versionFileReadFailurePolicy === 'throw') {
151
+ // The version file exists but could not be read/parsed (permissions, IO error, truncation).
152
+ // Treating this as "unversioned" would reset the data directory, silently wiping a store that
153
+ // must fail closed. Refuse to open instead, leaving the data untouched for the operator.
154
+ const code = (err as Error & { code?: string })?.code;
155
+ const message = err instanceof Error ? err.message : String(err);
156
+ throw new Error(
157
+ `Failed to read database version file at ${this.versionFile} (${code ?? 'unknown error'}: ${message}). ` +
158
+ `Refusing to open the database; data was NOT reset. Resolve the underlying filesystem error and retry.`,
159
+ { cause: err },
160
+ );
108
161
  } else {
109
162
  this.log.warn(`Failed to read stored version information: ${err}. Defaulting to empty version`);
110
163
  storedVersion = DatabaseVersion.empty();
@@ -159,10 +212,47 @@ export class DatabaseVersionManager<T> {
159
212
  await this.resetDataDirectory();
160
213
  }
161
214
 
162
- // Write the current version to disk
163
- await this.writeVersion();
215
+ // Open the database first, then record the version marker. Writing the marker only after a
216
+ // successful open makes it a post-commit record: if the process crashes between the reset and a
217
+ // durable open, no marker is left behind, so the next startup re-runs the reset instead of
218
+ // trusting a marker that sits over empty or partially-initialized data.
219
+ const instance = await this.onOpen(this.dataDirectory);
164
220
 
165
- return [await this.onOpen(this.dataDirectory), needsReset];
221
+ // Only (re)write the marker when it would actually change — first boot, reset, or upgrade. On a
222
+ // normal boot it already matches, so skipping avoids an unnecessary fsync (and the directory
223
+ // write permission the temp-file+rename needs) and, more importantly, any window where a
224
+ // marker-write failure would orphan the database we just opened.
225
+ if (!storedVersion.equals(this.currentVersion)) {
226
+ try {
227
+ await this.writeVersion();
228
+ } catch (err) {
229
+ // The database opened but recording the marker failed; close the freshly opened instance so
230
+ // we do not leak its file handles / locks before propagating the failure.
231
+ await this.closeQuietly(instance);
232
+ throw err;
233
+ }
234
+ }
235
+
236
+ return [instance, needsReset];
237
+ }
238
+
239
+ /**
240
+ * Best-effort close of a just-opened database instance, used to avoid leaking handles/locks when a
241
+ * post-open step fails. Swallows close errors so the original failure is the one that propagates.
242
+ */
243
+ private async closeQuietly(instance: T): Promise<void> {
244
+ const closable = instance as
245
+ | { close?: () => Promise<void> | void; [Symbol.asyncDispose]?: () => Promise<void> }
246
+ | undefined;
247
+ const dispose = closable?.close ?? closable?.[Symbol.asyncDispose];
248
+ if (typeof dispose !== 'function') {
249
+ return;
250
+ }
251
+ try {
252
+ await dispose.call(closable);
253
+ } catch (err) {
254
+ this.log.warn(`Failed to close database after version-write failure: ${err}`);
255
+ }
166
256
  }
167
257
 
168
258
  /**
package/src/gas/README.md CHANGED
@@ -1,47 +1,69 @@
1
1
  # Aztec Gas and Fee Model
2
2
 
3
3
  The minimum fee per mana and its components are computed on L1 in
4
- `l1-contracts/src/core/libraries/rollup/FeeLib.sol`. This document describes the
5
- formulas, the oracle lag/lifetime mechanism, and the TypeScript types in this directory.
4
+ `l1-contracts/src/core/libraries/rollup/FeeLib.sol` (`fee_math.ts` in this directory is a
5
+ TypeScript port of those formulas, used to predict fees a few slots ahead). This document
6
+ describes the formulas, the oracle lag/lifetime mechanism, how a transaction's fee is
7
+ derived from them, the gas and data limits, and the TypeScript types in this directory.
6
8
 
7
9
  ## Mana
8
10
 
9
- Aztec uses **mana** as its unit of work (analogous to Ethereum gas). Transactions consume
10
- mana in two dimensions: **DA** (data availability) and **L2** (execution). The total fee
11
- is `gasUsed * feePerMana` summed across both dimensions.
11
+ Aztec meters work as gas in two dimensions: **DA** (data availability, i.e. blob data
12
+ published to L1) and **L2** (execution). The L2 dimension is called **mana** (analogous to
13
+ Ethereum gas): block headers track `totalManaUsed`, and the fee model below prices one unit
14
+ of mana. The total fee is `gasUsed * feePerGas` summed across both dimensions.
15
+
16
+ ### The DA dimension is priced at zero
17
+
18
+ Only the L2 dimension currently carries a price. When building checkpoint global variables,
19
+ the sequencer sets `feePerDaGas = 0` and sets `feePerL2Gas` to the L1-computed minimum fee
20
+ per mana (`sequencer-client/src/global_variable_builder/global_builder.ts` and
21
+ `fee_provider.ts` in the same directory). The cost of publishing data is still recovered:
22
+ the blob gas a checkpoint pays on L1 is part of the *sequencer cost* component of the mana
23
+ fee below. DA gas remains fully metered and limited (see
24
+ [Gas and Data Limits](#gas-and-data-limits)) — it bounds how much data a tx or checkpoint
25
+ may publish — it just contributes nothing to the fee today.
12
26
 
13
27
  ## Fee Components
14
28
 
15
- The minimum fee per mana has four components:
29
+ The minimum fee per mana has four components. All are computed in ETH (wei) per mana and
30
+ converted to the fee asset at the end (see [Fee Asset Price](#fee-asset-price)).
16
31
 
17
32
  ### Sequencer Cost
18
33
 
19
34
  L1 cost to propose a checkpoint (calldata gas + blob data), amortized over `manaTarget`:
20
35
 
21
36
  ```
22
- sequencerCost = ((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
37
+ sequencerCost = ceil(((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
23
38
  + (BLOBS_PER_CHECKPOINT * BLOB_GAS_PER_BLOB * blobFee))
24
- / manaTarget
39
+ / manaTarget)
25
40
  ```
26
41
 
42
+ Note that `BLOBS_PER_CHECKPOINT` here is FeeLib's own constant (3), not the protocol blob
43
+ capacity of the same name (6) — see the note under [Key Constants](#key-constants).
44
+
27
45
  ### Prover Cost
28
46
 
29
47
  L1 cost to verify an epoch proof, amortized over epoch duration and `manaTarget`, plus a
30
48
  governance-set proving cost that compensates for off-chain proof generation:
31
49
 
32
50
  ```
33
- proverCost = (L1_GAS_PER_EPOCH_VERIFIED * baseFee / epochDuration) / manaTarget
51
+ proverCost = ceil(ceil((L1_GAS_PER_EPOCH_VERIFIED * baseFee) / epochDuration) / manaTarget)
34
52
  + provingCostPerMana
35
53
  ```
36
54
 
55
+ Updates to `provingCostPerMana` are rate-limited on L1 (`FeeLib.updateProvingCostPerMana`):
56
+ at most one update every 30 days, each moving the value by at most ×1.5 (or ÷1.5), with a
57
+ floor of 2 wei per mana.
58
+
37
59
  ### Congestion Cost
38
60
 
39
61
  An exponential surcharge when the network is congested (inspired by EIP-1559; the
40
62
  implementation uses the `fakeExponential` Taylor series approximation from EIP-4844):
41
63
 
42
64
  ```
43
- baseCost = sequencerCost + proverCost
44
- congestionCost = baseCost * congestionMultiplier / MINIMUM_CONGESTION_MULTIPLIER - baseCost
65
+ baseCost = sequencerCost + proverCost
66
+ congestionCost = floor(baseCost * congestionMultiplier / MINIMUM_CONGESTION_MULTIPLIER) - baseCost
45
67
  ```
46
68
 
47
69
  When there is no congestion the multiplier equals `MINIMUM_CONGESTION_MULTIPLIER` (1e9)
@@ -50,11 +72,15 @@ and congestion cost is zero.
50
72
  ### Congestion Multiplier
51
73
 
52
74
  ```
53
- excessMana = max(0, prevExcessMana + prevManaUsed - manaTarget)
54
- congestionMultiplier = fakeExponential(MINIMUM_CONGESTION_MULTIPLIER, excessMana, denominator)
75
+ excessMana = max(0, prevExcessMana + prevManaUsed - manaTarget)
76
+ denominator = manaTarget * 854,700,854 / 1e8 ≈ 8.547 * manaTarget
77
+ congestionMultiplier = fakeExponential(MINIMUM_CONGESTION_MULTIPLIER,
78
+ min(excessMana, 100 * denominator), denominator)
55
79
  ```
56
80
 
57
- Each additional `manaTarget` of excess mana increases the multiplier by ~12.5%.
81
+ Each additional `manaTarget` of excess mana multiplies the fee by `e^(1/8.547) ≈ 1.124`,
82
+ i.e. ~12.5%. The exponent is capped at 100 (multiplier ≤ ~2.7e43 × the minimum) to keep
83
+ the Taylor series from overflowing.
58
84
 
59
85
  ### Total
60
86
 
@@ -62,6 +88,11 @@ Each additional `manaTarget` of excess mana increases the multiplier by ~12.5%.
62
88
  minFeePerMana = sequencerCost + proverCost + congestionCost
63
89
  ```
64
90
 
91
+ Each component is converted from ETH to the fee asset individually (rounding up) before
92
+ summing. The sum is capped at `type(uint128).max` (`FeeLib.summedMinFee`) so it always fits
93
+ the proposal header's `feePerL2Gas` field — without the cap, extreme congestion could
94
+ produce a fee no valid header can represent, halting the chain.
95
+
65
96
  ## L1 Gas Oracle: Lag and Lifetime
66
97
 
67
98
  The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a two-phase
@@ -70,9 +101,9 @@ The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a t
70
101
  - **LAG = 2 slots** — when new L1 fees are observed, they activate `LAG` slots later
71
102
  (`slotOfChange = currentSlot + LAG`). This gives mempool transactions time to land
72
103
  before fees change.
73
- - **LIFETIME = 5 slots** — after an oracle update, the next update is rejected until
74
- `slotOfChange + (LIFETIME - LAG)` = 3 more slots have passed. This rate-limits how
75
- frequently L1 fee data can change.
104
+ - **LIFETIME = 5 slots** — after an oracle update, further updates are ignored
105
+ (`updateL1GasFeeOracle` returns without effect) until `slotOfChange + (LIFETIME - LAG)`
106
+ = 3 more slots have passed. This rate-limits how frequently L1 fee data can change.
76
107
 
77
108
  Fee resolution at a given timestamp:
78
109
 
@@ -84,6 +115,12 @@ else → use post (new fees)
84
115
  **Net effect**: L1 fee changes reach L2 with a 2-slot delay and can update at most once
85
116
  every 5 slots.
86
117
 
118
+ Because queued values only activate `LAG` slots later, the min fee for the next `LAG`
119
+ slots is fully determined by current on-chain state. `fee_math.ts` ports the FeeLib
120
+ formulas so the sequencer can predict min fees over that window (`FeePredictor` in
121
+ `sequencer-client/src/global_variable_builder`), under a configurable mana-usage
122
+ assumption (`ManaUsageEstimate`: none / target / limit).
123
+
87
124
  ### Worked Example
88
125
 
89
126
  Suppose the oracle is updated at slot 10 with new L1 fees. Here is the timeline:
@@ -117,34 +154,68 @@ Key observations:
117
154
 
118
155
  ## Fee Asset Price
119
156
 
120
- Fees are computed in ETH internally but converted to the fee asset (Fee Juice) via
121
- `ethPerFeeAsset` (1e12 precision). The price updates at most ±1% (±100 bps) per
122
- checkpoint:
157
+ Fees are computed in ETH (wei) internally and converted to the fee asset (Fee Juice) via
158
+ `ethPerFeeAsset` (1e12 precision), rounding up (`PriceLib.toFeeAsset` in
159
+ `l1-contracts/src/core/libraries/compressed-data/fees/FeeConfig.sol`).
160
+
161
+ Each checkpoint proposal carries a fee-asset price modifier (`OracleInput`) chosen by the
162
+ proposer, bounded to ±1% (±100 bps) per checkpoint:
123
163
 
124
164
  ```
125
165
  newPrice = currentPrice * (10000 + modifierBps) / 10000
126
166
  ```
127
167
 
168
+ The result is clamped to [`MIN_ETH_PER_FEE_ASSET` = 100, `MAX_ETH_PER_FEE_ASSET` = 1e14],
169
+ i.e. 1e-10 to 100 ETH per fee asset. The floor of 100 guarantees a ±1% step always moves
170
+ the integer price by at least 1.
171
+
172
+ ## Transaction Fees
173
+
174
+ The checkpoint's `gasFees` (the L1-computed min fee per mana, with DA priced at zero) act
175
+ as a base fee. Senders declare `GasSettings`: gas limits, teardown gas limits,
176
+ `maxFeesPerGas`, and `maxPriorityFeesPerGas`. A tx is only includable if `maxFeesPerGas`
177
+ covers the checkpoint's `gasFees` in both dimensions. The effective fee adds an
178
+ EIP-1559-style priority fee on top of the base, capped by the max
179
+ (`computeEffectiveGasFees` in `stdlib/src/fees/transaction_fee.ts`):
180
+
181
+ ```
182
+ effectiveFeePerGas = gasFees + min(maxPriorityFeePerGas, maxFeesPerGas - gasFees) (per dimension)
183
+ transactionFee = billedGas.daGas * effectiveFeePerDaGas + billedGas.l2Gas * effectiveFeePerL2Gas
184
+ ```
185
+
186
+ `billedGas` is actual consumption except for the teardown phase, which is billed at the
187
+ declared `teardownGasLimits` rather than actual usage — the fee is charged during teardown
188
+ itself, before actual teardown consumption is known.
189
+
128
190
  ## Maximum Fee Change Rate
129
191
 
130
- | Component | Bound |
131
- | ---------------------- | ------------------------------------------------------- |
132
- | L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME) |
133
- | Fee asset price | ±1% per checkpoint |
192
+ | Component | Bound |
193
+ | ---------------------- | -------------------------------------------------------- |
194
+ | L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME) |
195
+ | Fee asset price | ±1% per checkpoint |
196
+ | Proving cost per mana | At most ×1.5 (or ÷1.5) per update, one update per 30 days |
134
197
  | Congestion multiplier | Depends on excess mana accumulation/drain per checkpoint |
135
- | Sequencer/prover costs | Scale linearly with L1 fees |
198
+ | Sequencer/prover costs | Scale linearly with L1 fees |
136
199
 
137
200
  ## Key Constants
138
201
 
139
- | Constant | Value |
140
- | ------------------------------ | -------------- |
141
- | `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000 |
142
- | `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000 |
143
- | `BLOBS_PER_CHECKPOINT` | 3 |
144
- | `BLOB_GAS_PER_BLOB` | 2^17 |
145
- | `MINIMUM_CONGESTION_MULTIPLIER` | 1e9 |
146
- | `LAG` | 2 slots |
147
- | `LIFETIME` | 5 slots |
202
+ | Constant | Value |
203
+ | ------------------------------- | -------------- |
204
+ | `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000 |
205
+ | `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000 |
206
+ | `BLOBS_PER_CHECKPOINT` (FeeLib) | 3 |
207
+ | `BLOB_GAS_PER_BLOB` | 2^17 |
208
+ | `MINIMUM_CONGESTION_MULTIPLIER` | 1e9 |
209
+ | `LAG` | 2 slots |
210
+ | `LIFETIME` | 5 slots |
211
+ | `MIN_ETH_PER_FEE_ASSET` | 100 (1e-10 ETH) |
212
+ | `MAX_ETH_PER_FEE_ASSET` | 1e14 (100 ETH) |
213
+
214
+ ⚠️ Name clash: `FeeLib.sol` (and its port `fee_math.ts`) defines `BLOBS_PER_CHECKPOINT = 3`,
215
+ used only to price the sequencer's blob costs. The protocol constant of the same name in
216
+ `@aztec/constants` is **6** — the actual blob capacity of a checkpoint, used throughout the
217
+ limits section below. The FeeLib value is a holdover from the pre-checkpoint
218
+ `BLOBS_PER_BLOCK`, so the fee model prices half of a full checkpoint's blobs.
148
219
 
149
220
  ## Gas and Data Limits
150
221
 
@@ -196,7 +267,7 @@ advertises them in `NodeInfo.txsLimits` (a required field); wallets read it and
196
267
  `GasSettings.fallback` as the default gas limits when sending without explicit limits, and they are enforced
197
268
  by `GasLimitsValidator` (clamped to the per-tx protocol maxima) at three points: RPC tx acceptance
198
269
  (`aztec-node/src/aztec-node/server.ts`), gossip validation (`p2p/src/services/libp2p/libp2p_service.ts`),
199
- and pending-pool admission (`p2p/src/client/factory.ts`). They are deliberately *not* enforced at reqresp or
270
+ and pending-pool admission (`p2p/src/client/factory.ts`). They are deliberately *not* enforced at req/resp or
200
271
  block-proposal validation — admission is relay policy, not block validity.
201
272
 
202
273
  ### Per-block builder budgets
@@ -240,7 +311,8 @@ The outermost limits, enforced as proposal validity in `validateCheckpointLimits
240
311
 
241
312
  ## TypeScript Types
242
313
 
243
- - **`Gas`** — mana quantity in two dimensions (`daGas`, `l2Gas`).
314
+ - **`Gas`** — gas quantity in two dimensions (`daGas`, `l2Gas`).
244
315
  - **`GasFees`** — per-unit price in each dimension (`feePerDaGas`, `feePerL2Gas`).
245
316
  - **`GasSettings`** — sender-chosen fee parameters: gas limits, teardown limits, max fees, priority fees.
246
317
  - **`GasUsed`** — actual consumption after execution. Note: `billedGas` uses the teardown gas *limit*, not actual usage.
318
+ - **`fee_math.ts`** — TypeScript port of the FeeLib formulas, used for fee prediction over the oracle LAG window.
@@ -25,8 +25,20 @@ export type BaseSignerConfig = {
25
25
  nodeId: string;
26
26
  /** How long to wait between polls when a duty is being signed (ms) */
27
27
  pollingIntervalMs: number;
28
- /** Maximum time to wait for a duty being signed to complete (ms) */
29
- signingTimeoutMs: number;
28
+ /**
29
+ * How long (ms) to wait for a peer node's in-progress signing before giving up and treating the
30
+ * duty as already handled. This is the cross-node wait/poll timeout, distinct from
31
+ * signerCallTimeoutMs (the hard upper bound on this node's own signer call).
32
+ */
33
+ peerSigningTimeoutMs: number;
34
+ /**
35
+ * Hard upper bound (ms) on a single signer call made by this node. If the (possibly remote)
36
+ * signer does not return within this time, the call is aborted, the duty lock is released, and
37
+ * signing fails so it can be safely retried. The effective value is clamped to
38
+ * maxStuckDutiesAgeMs / 2 at construction, so a slow signer's lock is always released before
39
+ * stuck-duty cleanup could reclaim it. Defaults to 30_000 when unset.
40
+ */
41
+ signerCallTimeoutMs?: number;
30
42
  /** Maximum age of a stuck duty in ms (defaults to 2x hardcoded Aztec slot duration if not set) */
31
43
  maxStuckDutiesAgeMs?: number;
32
44
  /** Optional: clean up old duties after this many hours (disabled if not set) */
@@ -44,11 +56,16 @@ export const baseSignerConfigMappings: ConfigMappingsType<BaseSignerConfig> = {
44
56
  description: 'The number of ms to wait between polls when a duty is being signed',
45
57
  ...numberConfigHelper(100),
46
58
  },
47
- signingTimeoutMs: {
59
+ peerSigningTimeoutMs: {
48
60
  env: 'VALIDATOR_HA_SIGNING_TIMEOUT_MS',
49
- description: 'The maximum time to wait for a duty being signed to complete',
61
+ description: "How long to wait for a peer node's in-progress signing before giving up",
50
62
  ...numberConfigHelper(3_000),
51
63
  },
64
+ signerCallTimeoutMs: {
65
+ env: 'VALIDATOR_SIGNER_CALL_TIMEOUT_MS',
66
+ description: 'Hard upper bound in ms on a single signer call before it is aborted (default 30000)',
67
+ ...numberConfigHelper(30_000),
68
+ },
52
69
  maxStuckDutiesAgeMs: {
53
70
  env: 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS',
54
71
  description: 'The maximum age of a stuck duty in ms (defaults to 2x Aztec slot duration)',
@@ -65,7 +82,8 @@ export const baseSignerConfigMappings: ConfigMappingsType<BaseSignerConfig> = {
65
82
  export const BaseSignerConfigSchema = z.object({
66
83
  nodeId: z.string(),
67
84
  pollingIntervalMs: z.number().min(0),
68
- signingTimeoutMs: z.number().min(0),
85
+ peerSigningTimeoutMs: z.number().min(0),
86
+ signerCallTimeoutMs: z.number().min(0).optional(),
69
87
  maxStuckDutiesAgeMs: z.number().min(0).optional(),
70
88
  cleanupOldDutiesAfterHours: z.number().min(0).optional(),
71
89
  ...pickL1ContractAddressesSchema('rollupAddress'),