@aztec/foundation 0.0.1-commit.d3ec352c → 0.0.1-commit.fcb71a6

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 (199) hide show
  1. package/dest/array/index.d.ts +2 -1
  2. package/dest/array/index.d.ts.map +1 -1
  3. package/dest/array/index.js +1 -0
  4. package/dest/array/sorted_array.d.ts +10 -0
  5. package/dest/array/sorted_array.d.ts.map +1 -0
  6. package/dest/array/sorted_array.js +106 -0
  7. package/dest/buffer/buffer16.d.ts +2 -2
  8. package/dest/buffer/buffer16.d.ts.map +1 -1
  9. package/dest/buffer/buffer16.js +1 -1
  10. package/dest/buffer/buffer32.d.ts +2 -2
  11. package/dest/buffer/buffer32.d.ts.map +1 -1
  12. package/dest/buffer/buffer32.js +1 -1
  13. package/dest/config/env_var.d.ts +2 -2
  14. package/dest/config/env_var.d.ts.map +1 -1
  15. package/dest/config/index.d.ts +10 -2
  16. package/dest/config/index.d.ts.map +1 -1
  17. package/dest/config/index.js +16 -2
  18. package/dest/config/network_config.d.ts +13 -1
  19. package/dest/config/network_config.d.ts.map +1 -1
  20. package/dest/config/network_config.js +3 -1
  21. package/dest/crypto/bls/bn254_keystore.js +1 -1
  22. package/dest/crypto/bls/index.js +1 -1
  23. package/dest/crypto/bn254/index.d.ts +35 -51
  24. package/dest/crypto/bn254/index.d.ts.map +1 -1
  25. package/dest/crypto/bn254/index.js +51 -140
  26. package/dest/crypto/ecdsa/signature.d.ts +2 -2
  27. package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
  28. package/dest/crypto/ecdsa/signature.js +2 -2
  29. package/dest/crypto/grumpkin/index.d.ts +4 -2
  30. package/dest/crypto/grumpkin/index.d.ts.map +1 -1
  31. package/dest/crypto/grumpkin/index.js +2 -1
  32. package/dest/crypto/keys/index.d.ts +2 -2
  33. package/dest/crypto/keys/index.d.ts.map +1 -1
  34. package/dest/crypto/keys/index.js +1 -1
  35. package/dest/crypto/pedersen/pedersen.wasm.d.ts +2 -2
  36. package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
  37. package/dest/crypto/pedersen/pedersen.wasm.js +1 -1
  38. package/dest/crypto/poseidon/index.d.ts +2 -2
  39. package/dest/crypto/poseidon/index.d.ts.map +1 -1
  40. package/dest/crypto/poseidon/index.js +1 -1
  41. package/dest/crypto/schnorr/index.d.ts +3 -2
  42. package/dest/crypto/schnorr/index.d.ts.map +1 -1
  43. package/dest/crypto/schnorr/index.js +1 -1
  44. package/dest/crypto/schnorr/signature.d.ts +2 -2
  45. package/dest/crypto/schnorr/signature.d.ts.map +1 -1
  46. package/dest/crypto/schnorr/signature.js +2 -2
  47. package/dest/crypto/sha256/index.d.ts +2 -2
  48. package/dest/crypto/sha256/index.d.ts.map +1 -1
  49. package/dest/crypto/sha256/index.js +1 -1
  50. package/dest/crypto/sha512/index.d.ts +2 -2
  51. package/dest/crypto/sha512/index.d.ts.map +1 -1
  52. package/dest/crypto/sha512/index.js +1 -1
  53. package/dest/crypto/signature/index.d.ts +2 -2
  54. package/dest/crypto/signature/index.d.ts.map +1 -1
  55. package/dest/crypto/sync/pedersen/index.d.ts +2 -2
  56. package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
  57. package/dest/crypto/sync/pedersen/index.js +1 -1
  58. package/dest/crypto/sync/poseidon/index.d.ts +2 -2
  59. package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
  60. package/dest/crypto/sync/poseidon/index.js +1 -1
  61. package/dest/{fields/bls12_fields.d.ts → curves/bls12/field.d.ts} +3 -3
  62. package/dest/curves/bls12/field.d.ts.map +1 -0
  63. package/dest/{fields/bls12_fields.js → curves/bls12/field.js} +6 -6
  64. package/dest/curves/bls12/index.d.ts +3 -0
  65. package/dest/curves/bls12/index.d.ts.map +1 -0
  66. package/dest/curves/bls12/index.js +2 -0
  67. package/dest/{fields/bls12_point.d.ts → curves/bls12/point.d.ts} +4 -4
  68. package/dest/curves/bls12/point.d.ts.map +1 -0
  69. package/dest/{fields/bls12_point.js → curves/bls12/point.js} +7 -7
  70. package/dest/{fields/fields.d.ts → curves/bn254/field.d.ts} +7 -15
  71. package/dest/curves/bn254/field.d.ts.map +1 -0
  72. package/dest/{fields/fields.js → curves/bn254/field.js} +30 -47
  73. package/dest/curves/bn254/index.d.ts +3 -0
  74. package/dest/curves/bn254/index.d.ts.map +1 -0
  75. package/dest/curves/bn254/index.js +2 -0
  76. package/dest/curves/bn254/point.d.ts +54 -0
  77. package/dest/curves/bn254/point.d.ts.map +1 -0
  78. package/dest/curves/bn254/point.js +143 -0
  79. package/dest/curves/grumpkin/index.d.ts +10 -0
  80. package/dest/curves/grumpkin/index.d.ts.map +1 -0
  81. package/dest/curves/grumpkin/index.js +3 -0
  82. package/dest/{fields → curves/grumpkin}/point.d.ts +3 -3
  83. package/dest/curves/grumpkin/point.d.ts.map +1 -0
  84. package/dest/{fields → curves/grumpkin}/point.js +7 -7
  85. package/dest/eth-address/index.d.ts +3 -2
  86. package/dest/eth-address/index.d.ts.map +1 -1
  87. package/dest/eth-address/index.js +6 -1
  88. package/dest/iterator/filter.d.ts +3 -0
  89. package/dest/iterator/filter.d.ts.map +1 -0
  90. package/dest/iterator/filter.js +7 -0
  91. package/dest/iterator/index.d.ts +2 -0
  92. package/dest/iterator/index.d.ts.map +1 -0
  93. package/dest/iterator/index.js +1 -0
  94. package/dest/schemas/schemas.d.ts +7 -3
  95. package/dest/schemas/schemas.d.ts.map +1 -1
  96. package/dest/schemas/schemas.js +9 -3
  97. package/dest/schemas/types.d.ts +31 -1
  98. package/dest/schemas/types.d.ts.map +1 -1
  99. package/dest/schemas/types.js +25 -1
  100. package/dest/serialize/field_reader.d.ts +2 -2
  101. package/dest/serialize/field_reader.d.ts.map +1 -1
  102. package/dest/serialize/field_reader.js +1 -1
  103. package/dest/serialize/free_funcs.d.ts +2 -2
  104. package/dest/serialize/free_funcs.d.ts.map +1 -1
  105. package/dest/serialize/free_funcs.js +1 -1
  106. package/dest/serialize/serialize.d.ts +2 -2
  107. package/dest/serialize/serialize.d.ts.map +1 -1
  108. package/dest/serialize/serialize.js +1 -1
  109. package/dest/sleep/index.d.ts +3 -1
  110. package/dest/sleep/index.d.ts.map +1 -1
  111. package/dest/sleep/index.js +4 -0
  112. package/dest/timer/date.d.ts +2 -1
  113. package/dest/timer/date.d.ts.map +1 -1
  114. package/dest/timer/date.js +3 -0
  115. package/dest/trees/balanced_merkle_tree.d.ts +1 -1
  116. package/dest/trees/balanced_merkle_tree.d.ts.map +1 -1
  117. package/dest/trees/balanced_merkle_tree.js +3 -1
  118. package/dest/trees/indexed_merkle_tree.js +1 -1
  119. package/dest/trees/membership_witness.d.ts +2 -2
  120. package/dest/trees/membership_witness.d.ts.map +1 -1
  121. package/dest/trees/membership_witness.js +1 -1
  122. package/dest/trees/merkle_tree_calculator.js +1 -1
  123. package/dest/trees/sibling_path.d.ts +2 -2
  124. package/dest/trees/sibling_path.d.ts.map +1 -1
  125. package/dest/trees/sibling_path.js +2 -2
  126. package/dest/types/index.d.ts +3 -1
  127. package/dest/types/index.d.ts.map +1 -1
  128. package/dest/types/index.js +3 -0
  129. package/package.json +23 -5
  130. package/src/array/index.ts +1 -0
  131. package/src/array/sorted_array.ts +133 -0
  132. package/src/buffer/buffer16.ts +2 -2
  133. package/src/buffer/buffer32.ts +2 -2
  134. package/src/config/env_var.ts +16 -6
  135. package/src/config/index.ts +20 -2
  136. package/src/config/network_config.ts +2 -0
  137. package/src/crypto/bls/bn254_keystore.ts +1 -1
  138. package/src/crypto/bls/index.ts +1 -1
  139. package/src/crypto/bn254/index.ts +50 -159
  140. package/src/crypto/ecdsa/signature.ts +2 -2
  141. package/src/crypto/grumpkin/index.ts +3 -1
  142. package/src/crypto/keys/index.ts +1 -1
  143. package/src/crypto/pedersen/pedersen.wasm.ts +1 -1
  144. package/src/crypto/poseidon/index.ts +1 -1
  145. package/src/crypto/schnorr/index.ts +2 -1
  146. package/src/crypto/schnorr/signature.ts +2 -2
  147. package/src/crypto/sha256/index.ts +1 -1
  148. package/src/crypto/sha512/index.ts +1 -1
  149. package/src/crypto/signature/index.ts +1 -1
  150. package/src/crypto/sync/pedersen/index.ts +1 -1
  151. package/src/crypto/sync/poseidon/index.ts +1 -1
  152. package/src/{fields/bls12_fields.ts → curves/bls12/field.ts} +6 -6
  153. package/src/curves/bls12/index.ts +2 -0
  154. package/src/{fields/bls12_point.ts → curves/bls12/point.ts} +7 -7
  155. package/src/{fields/fields.ts → curves/bn254/field.ts} +33 -56
  156. package/src/curves/bn254/index.ts +2 -0
  157. package/src/curves/bn254/point.ts +170 -0
  158. package/src/curves/grumpkin/index.ts +11 -0
  159. package/src/{fields → curves/grumpkin}/point.ts +7 -7
  160. package/src/eth-address/index.ts +7 -1
  161. package/src/iterator/filter.ts +11 -0
  162. package/src/iterator/index.ts +1 -0
  163. package/src/schemas/schemas.ts +14 -3
  164. package/src/schemas/types.ts +33 -0
  165. package/src/serialize/field_reader.ts +1 -1
  166. package/src/serialize/free_funcs.ts +1 -1
  167. package/src/serialize/serialize.ts +1 -1
  168. package/src/sleep/index.ts +6 -0
  169. package/src/timer/date.ts +4 -0
  170. package/src/trees/balanced_merkle_tree.ts +3 -1
  171. package/src/trees/indexed_merkle_tree.ts +1 -1
  172. package/src/trees/membership_witness.ts +1 -1
  173. package/src/trees/merkle_tree_calculator.ts +1 -1
  174. package/src/trees/sibling_path.ts +2 -2
  175. package/src/types/index.ts +5 -0
  176. package/dest/crypto/bn254/bn254_utils.d.ts +0 -39
  177. package/dest/crypto/bn254/bn254_utils.d.ts.map +0 -1
  178. package/dest/crypto/bn254/bn254_utils.js +0 -56
  179. package/dest/crypto/index.d.ts +0 -17
  180. package/dest/crypto/index.d.ts.map +0 -1
  181. package/dest/crypto/index.js +0 -16
  182. package/dest/fields/bls12_fields.d.ts.map +0 -1
  183. package/dest/fields/bls12_point.d.ts.map +0 -1
  184. package/dest/fields/coordinate.d.ts +0 -63
  185. package/dest/fields/coordinate.d.ts.map +0 -1
  186. package/dest/fields/coordinate.js +0 -96
  187. package/dest/fields/fields.d.ts.map +0 -1
  188. package/dest/fields/index.d.ts +0 -6
  189. package/dest/fields/index.d.ts.map +0 -1
  190. package/dest/fields/index.js +0 -5
  191. package/dest/fields/point.d.ts.map +0 -1
  192. package/dest/index.d.ts +0 -31
  193. package/dest/index.d.ts.map +0 -1
  194. package/dest/index.js +0 -31
  195. package/src/crypto/bn254/bn254_utils.ts +0 -64
  196. package/src/crypto/index.ts +0 -16
  197. package/src/fields/coordinate.ts +0 -104
  198. package/src/fields/index.ts +0 -5
  199. package/src/index.ts +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/foundation",
3
- "version": "0.0.1-commit.d3ec352c",
3
+ "version": "0.0.1-commit.fcb71a6",
4
4
  "type": "module",
5
5
  "main": "./dest/index.js",
6
6
  "types": "./dest/index.d.ts",
@@ -15,9 +15,27 @@
15
15
  "./branded-types": "./dest/branded-types/index.js",
16
16
  "./collection": "./dest/collection/index.js",
17
17
  "./config": "./dest/config/index.js",
18
- "./crypto": "./dest/crypto/index.js",
19
- "./crypto/sync": "./dest/crypto/sync/index.js",
18
+ "./crypto/aes128": "./dest/crypto/aes128/index.js",
19
+ "./crypto/bls": "./dest/crypto/bls/index.js",
20
20
  "./crypto/bls/bn254_keystore": "./dest/crypto/bls/bn254_keystore.js",
21
+ "./crypto/bn254": "./dest/crypto/bn254/index.js",
22
+ "./crypto/ecdsa": "./dest/crypto/ecdsa/index.js",
23
+ "./crypto/grumpkin": "./dest/crypto/grumpkin/index.js",
24
+ "./crypto/keccak": "./dest/crypto/keccak/index.js",
25
+ "./crypto/keys": "./dest/crypto/keys/index.js",
26
+ "./crypto/pedersen": "./dest/crypto/pedersen/index.js",
27
+ "./crypto/poseidon": "./dest/crypto/poseidon/index.js",
28
+ "./crypto/random": "./dest/crypto/random/index.js",
29
+ "./crypto/schnorr": "./dest/crypto/schnorr/index.js",
30
+ "./crypto/secp256k1": "./dest/crypto/secp256k1/index.js",
31
+ "./crypto/secp256k1-signer": "./dest/crypto/secp256k1-signer/index.js",
32
+ "./crypto/sha256": "./dest/crypto/sha256/index.js",
33
+ "./crypto/sha512": "./dest/crypto/sha512/index.js",
34
+ "./crypto/signature": "./dest/crypto/signature/index.js",
35
+ "./crypto/sync": "./dest/crypto/sync/index.js",
36
+ "./curves/bn254": "./dest/curves/bn254/index.js",
37
+ "./curves/grumpkin": "./dest/curves/grumpkin/index.js",
38
+ "./curves/bls12": "./dest/curves/bls12/index.js",
21
39
  "./decorators": "./dest/decorators/index.js",
22
40
  "./error": "./dest/error/index.js",
23
41
  "./eth-address": "./dest/eth-address/index.js",
@@ -31,9 +49,9 @@
31
49
  "./json-rpc/undici": "./dest/json-rpc/client/undici.js",
32
50
  "./json-rpc/test": "./dest/json-rpc/test/index.js",
33
51
  "./iterable": "./dest/iterable/index.js",
52
+ "./iterator": "./dest/iterator/index.js",
34
53
  "./log": "./dest/log/index.js",
35
54
  "./mutex": "./dest/mutex/index.js",
36
- "./fields": "./dest/fields/index.js",
37
55
  "./retry": "./dest/retry/index.js",
38
56
  "./running-promise": "./dest/running-promise/index.js",
39
57
  "./serialize": "./dest/serialize/index.js",
@@ -105,7 +123,7 @@
105
123
  "testEnvironment": "../../foundation/src/jest/env.mjs"
106
124
  },
107
125
  "dependencies": {
108
- "@aztec/bb.js": "0.0.1-commit.d3ec352c",
126
+ "@aztec/bb.js": "0.0.1-commit.fcb71a6",
109
127
  "@koa/cors": "^5.0.0",
110
128
  "@noble/curves": "=1.7.0",
111
129
  "@noble/hashes": "^1.6.1",
@@ -1 +1,2 @@
1
1
  export * from './array.js';
2
+ export * from './sorted_array.js';
@@ -0,0 +1,133 @@
1
+ type Cmp<T> = (a: T, b: T) => -1 | 0 | 1;
2
+
3
+ export function dedupeSortedArray<T>(arr: T[], cmp: Cmp<T>): void {
4
+ for (let i = 0; i < arr.length; i++) {
5
+ let j = i + 1;
6
+ for (; j < arr.length; j++) {
7
+ const res = cmp(arr[i], arr[j]);
8
+ if (res === 0) {
9
+ continue;
10
+ } else if (res < 0) {
11
+ break;
12
+ } else {
13
+ throw new Error('Array not sorted');
14
+ }
15
+ }
16
+
17
+ if (j - i > 1) {
18
+ arr.splice(i + 1, j - i - 1);
19
+ }
20
+ }
21
+ }
22
+
23
+ export function insertIntoSortedArray<T>(arr: T[], item: T, cmp: Cmp<T>, allowDuplicates = true): boolean {
24
+ let start = 0;
25
+ let end = arr.length;
26
+
27
+ while (start < end) {
28
+ const mid = start + (((end - start) / 2) | 0);
29
+ const comparison = cmp(arr[mid], item);
30
+
31
+ if (comparison < 0) {
32
+ start = mid + 1;
33
+ } else {
34
+ end = mid;
35
+ }
36
+ }
37
+
38
+ if (!allowDuplicates) {
39
+ // Check element at insertion point
40
+ if (start < arr.length && cmp(arr[start], item) === 0) {
41
+ return false;
42
+ }
43
+
44
+ // Check element before insertion point (in case we landed after duplicates)
45
+ if (start > 0 && cmp(arr[start - 1], item) === 0) {
46
+ return false;
47
+ }
48
+ }
49
+
50
+ arr.splice(start, 0, item);
51
+ return true;
52
+ }
53
+
54
+ export function findIndexInSortedArray<T, N>(values: T[], needle: N, cmp: (a: T, b: N) => number): number {
55
+ let start = 0;
56
+ let end = values.length - 1;
57
+
58
+ while (start <= end) {
59
+ const mid = start + (((end - start) / 2) | 0);
60
+ const comparison = cmp(values[mid], needle);
61
+
62
+ if (comparison === 0) {
63
+ return mid;
64
+ }
65
+
66
+ if (comparison > 0) {
67
+ end = mid - 1;
68
+ } else {
69
+ start = mid + 1;
70
+ }
71
+ }
72
+
73
+ return -1;
74
+ }
75
+
76
+ export function findInSortedArray<T, N>(values: T[], needle: N, cmp: (a: T, b: N) => number): T | undefined {
77
+ const idx = findIndexInSortedArray(values, needle, cmp);
78
+ return idx > -1 ? values[idx] : undefined;
79
+ }
80
+
81
+ export function removeAnyOf<T, N>(arr: T[], vals: N[], cmp: (a: T, b: N) => -1 | 0 | 1): void {
82
+ let writeIdx = 0;
83
+ let readIdx = 0;
84
+ let valIdx = 0;
85
+
86
+ while (readIdx < arr.length && valIdx < vals.length) {
87
+ const comparison = cmp(arr[readIdx], vals[valIdx]);
88
+
89
+ if (comparison < 0) {
90
+ arr[writeIdx++] = arr[readIdx++];
91
+ } else if (comparison > 0) {
92
+ valIdx++;
93
+ } else {
94
+ readIdx++;
95
+ }
96
+ }
97
+
98
+ while (readIdx < arr.length) {
99
+ arr[writeIdx++] = arr[readIdx++];
100
+ }
101
+
102
+ arr.length = writeIdx;
103
+ }
104
+
105
+ export function removeFromSortedArray<T, N>(arr: T[], val: N, cmp: (a: T, b: N) => -1 | 0 | 1) {
106
+ const idx = findIndexInSortedArray(arr, val, cmp);
107
+ if (idx > -1) {
108
+ arr.splice(idx, 1);
109
+ }
110
+ }
111
+
112
+ export function merge<T>(arr: T[], toInsert: T[], cmp: (a: T, b: T) => -1 | 0 | 1): void {
113
+ const result = new Array<T>(arr.length + toInsert.length);
114
+ let i = 0,
115
+ j = 0,
116
+ k = 0;
117
+
118
+ while (i < arr.length && j < toInsert.length) {
119
+ result[k++] = cmp(arr[i], toInsert[j]) <= 0 ? arr[i++] : toInsert[j++];
120
+ }
121
+
122
+ while (i < arr.length) {
123
+ result[k++] = arr[i++];
124
+ }
125
+ while (j < toInsert.length) {
126
+ result[k++] = toInsert[j++];
127
+ }
128
+
129
+ for (i = 0; i < result.length; i++) {
130
+ arr[i] = result[i];
131
+ }
132
+ arr.length = result.length;
133
+ }
@@ -1,5 +1,5 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { BufferReader, deserializeBigInt, serializeBigInt } from '@aztec/foundation/serialize';
4
4
 
5
5
  import { inspect } from 'util';
@@ -1,5 +1,5 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { BufferReader, deserializeBigInt, serializeBigInt } from '@aztec/foundation/serialize';
4
4
 
5
5
  import { inspect } from 'util';
@@ -24,6 +24,9 @@ export type EnvVar =
24
24
  | 'BLOB_SINK_ARCHIVE_API_URL'
25
25
  | 'BLOB_SINK_PORT'
26
26
  | 'BLOB_SINK_URL'
27
+ | 'BLOB_FILE_STORE_URLS'
28
+ | 'BLOB_FILE_STORE_UPLOAD_URL'
29
+ | 'BLOB_HEALTHCHECK_UPLOAD_INTERVAL_MINUTES'
27
30
  | 'BOT_DA_GAS_LIMIT'
28
31
  | 'BOT_FEE_PAYMENT_METHOD'
29
32
  | 'BOT_BASE_FEE_PADDING'
@@ -63,8 +66,9 @@ export type EnvVar =
63
66
  | 'PUBLIC_DATA_TREE_MAP_SIZE_KB'
64
67
  | 'DEBUG'
65
68
  | 'DEBUG_P2P_DISABLE_COLOCATION_PENALTY'
66
- | 'DEPLOY_AZTEC_CONTRACTS_SALT'
67
69
  | 'ETHEREUM_HOSTS'
70
+ | 'ETHEREUM_DEBUG_HOSTS'
71
+ | 'ETHEREUM_ALLOW_NO_DEBUG_HOSTS'
68
72
  | 'FEE_RECIPIENT'
69
73
  | 'FORCE_COLOR'
70
74
  | 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS'
@@ -131,8 +135,7 @@ export type EnvVar =
131
135
  | 'P2P_TRUSTED_PEERS'
132
136
  | 'P2P_PRIVATE_PEERS'
133
137
  | 'P2P_PREFERRED_PEERS'
134
- | 'P2P_MAX_TX_POOL_SIZE'
135
- | 'P2P_TX_POOL_OVERFLOW_FACTOR'
138
+ | 'P2P_MAX_PENDING_TX_COUNT'
136
139
  | 'P2P_SEEN_MSG_CACHE_SIZE'
137
140
  | 'P2P_DROP_TX'
138
141
  | 'P2P_DROP_TX_CHANCE'
@@ -166,6 +169,7 @@ export type EnvVar =
166
169
  | 'PROVER_PUBLISHER_PRIVATE_KEYS'
167
170
  | 'PROVER_PUBLISHER_ADDRESSES'
168
171
  | 'PROVER_PUBLISHER_ALLOW_INVALID_STATES'
172
+ | 'PROVER_PUBLISHER_FORWARDER_ADDRESS'
169
173
  | 'PROVER_REAL_PROOFS'
170
174
  | 'PROVER_TEST_DELAY_FACTOR'
171
175
  | 'PROVER_TEST_DELAY_MS'
@@ -190,10 +194,13 @@ export type EnvVar =
190
194
  | 'SEQ_PUBLISHER_PRIVATE_KEYS'
191
195
  | 'SEQ_PUBLISHER_ADDRESSES'
192
196
  | 'SEQ_PUBLISHER_ALLOW_INVALID_STATES'
193
- | 'SEQ_TX_POLLING_INTERVAL_MS'
197
+ | 'SEQ_PUBLISHER_FORWARDER_ADDRESS'
198
+ | 'SEQ_POLLING_INTERVAL_MS'
194
199
  | 'SEQ_ENFORCE_TIME_TABLE'
195
- | 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT'
200
+ | 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT'
196
201
  | 'SEQ_ATTESTATION_PROPAGATION_TIME'
202
+ | 'SEQ_BLOCK_DURATION_MS'
203
+ | 'SEQ_BUILD_CHECKPOINT_IF_EMPTY'
197
204
  | 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER'
198
205
  | 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER'
199
206
  | 'SLASH_MIN_PENALTY_PERCENTAGE'
@@ -252,6 +259,7 @@ export type EnvVar =
252
259
  | 'AZTEC_TARGET_COMMITTEE_SIZE'
253
260
  | 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET'
254
261
  | 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO'
262
+ | 'AZTEC_INBOX_LAG'
255
263
  | 'AZTEC_PROOF_SUBMISSION_EPOCHS'
256
264
  | 'AZTEC_ACTIVATION_THRESHOLD'
257
265
  | 'AZTEC_EJECTION_THRESHOLD'
@@ -279,6 +287,7 @@ export type EnvVar =
279
287
  | 'L1_BLOB_FEE_PER_GAS_GWEI_MAX'
280
288
  | 'L1_PRIORITY_FEE_BUMP_PERCENTAGE'
281
289
  | 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE'
290
+ | 'L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI'
282
291
  | 'L1_FIXED_PRIORITY_FEE_PER_GAS'
283
292
  | 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'
284
293
  | 'L1_TX_MONITOR_MAX_ATTEMPTS'
@@ -304,4 +313,5 @@ export type EnvVar =
304
313
  | 'BLOB_ALLOW_EMPTY_SOURCES'
305
314
  | 'FISHERMAN_MODE'
306
315
  | 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS'
307
- | 'LEGACY_BLS_CLI';
316
+ | 'LEGACY_BLS_CLI'
317
+ | 'DEBUG_FORCE_TX_PROOF_VERIFICATION';
@@ -1,4 +1,5 @@
1
- import { Fq, Fr } from '../fields/fields.js';
1
+ import { Fq, Fr } from '../curves/bn254/field.js';
2
+ import { createConsoleLogger } from '../log/console.js';
2
3
  import type { EnvVar } from './env_var.js';
3
4
  import { type NetworkNames, getActiveNetworkName } from './network_name.js';
4
5
  import { SecretValue } from './secret_value.js';
@@ -17,6 +18,11 @@ export interface ConfigMapping {
17
18
  isBoolean?: boolean;
18
19
  nested?: Record<string, ConfigMapping>;
19
20
  fallback?: EnvVar[];
21
+ /**
22
+ * List of deprecated env vars that are still supported but will log a warning.
23
+ * These should also be included in the fallback array for parsing.
24
+ */
25
+ deprecatedFallback?: { env: EnvVar; message?: string }[];
20
26
  }
21
27
 
22
28
  export function isBooleanConfigValue<T>(obj: T, key: keyof T): boolean {
@@ -72,12 +78,24 @@ export function getConfigFromMappings<T>(configMappings: ConfigMappingsType<T>):
72
78
  const config = {} as T;
73
79
 
74
80
  for (const key in configMappings) {
75
- const { env, parseEnv, defaultValue, nested, fallback } = configMappings[key];
81
+ const { env, parseEnv, defaultValue, nested, fallback, deprecatedFallback } = configMappings[key];
76
82
  if (nested) {
77
83
  (config as any)[key] = getConfigFromMappings(nested);
78
84
  } else {
79
85
  // Use the shared utility function
80
86
  (config as any)[key] = getValueFromEnvWithFallback(env, parseEnv, defaultValue, fallback);
87
+
88
+ // Check for deprecated env vars and warn if logger is set
89
+ if (deprecatedFallback?.length) {
90
+ const userLog = createConsoleLogger('[DEPRECATED]');
91
+ for (const { env: deprecatedEnv, message } of deprecatedFallback) {
92
+ if (process.env[deprecatedEnv]) {
93
+ const warningMessage =
94
+ message ?? `Environment variable ${deprecatedEnv} is deprecated. Please use ${env} instead.`;
95
+ userLog(warningMessage, { deprecatedEnvVar: deprecatedEnv, newEnvVar: env });
96
+ }
97
+ }
98
+ }
81
99
  }
82
100
  }
83
101
 
@@ -4,9 +4,11 @@ export const NetworkConfigSchema = z
4
4
  .object({
5
5
  bootnodes: z.array(z.string()),
6
6
  snapshots: z.array(z.string()),
7
+ blobFileStoreUrls: z.array(z.string()).optional(),
7
8
  registryAddress: z.string(),
8
9
  feeAssetHandlerAddress: z.string().optional(),
9
10
  l1ChainId: z.number(),
11
+ blockDurationMs: z.number().positive().optional(),
10
12
  })
11
13
  .passthrough(); // Allow additional unknown fields to pass through
12
14
 
@@ -1,4 +1,4 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
2
 
3
3
  import { createCipheriv, createDecipheriv, createHash, pbkdf2Sync, randomUUID } from 'crypto';
4
4
  import { readFileSync } from 'fs';
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { Hex } from '@aztec/foundation/string';
3
3
 
4
4
  import { mod } from '@noble/curves/abstract/modular';
@@ -1,173 +1,64 @@
1
- import {
2
- BN254_G1_GENERATOR,
3
- BN254_G2_GENERATOR,
4
- BarretenbergSync,
5
- type Bn254G1Point as BbApiBn254G1Point,
6
- type Bn254G2Point as BbApiBn254G2Point,
7
- } from '@aztec/bb.js';
8
-
9
- import { Fq, Fr } from '../../fields/fields.js';
1
+ import { Fr } from '../../curves/bn254/field.js';
2
+ import { Bn254G1Point, Bn254G2Point } from '../../curves/bn254/point.js';
10
3
 
11
4
  /**
12
- * BN254 G1 point using foundation field classes.
13
- * Represents a point on the BN254 elliptic curve in affine coordinates.
5
+ * BN254 utility functions for point operations.
6
+ * Provides compression, decompression, and public key generation for the BN254 curve.
7
+ * Uses the bb.js Barretenberg backend for point operations.
14
8
  */
15
- export class Bn254G1Point {
16
- constructor(
17
- public readonly x: Fq,
18
- public readonly y: Fq,
19
- ) {}
20
-
21
- private toBbApiPoint(): BbApiBn254G1Point {
22
- return {
23
- x: this.x.toBuffer(),
24
- y: this.y.toBuffer(),
25
- };
26
- }
27
-
28
- private static fromBbApiPoint(point: BbApiBn254G1Point): Bn254G1Point {
29
- return new Bn254G1Point(Fq.fromBuffer(Buffer.from(point.x)), Fq.fromBuffer(Buffer.from(point.y)));
30
- }
31
-
32
- async isOnCurve(): Promise<boolean> {
33
- await BarretenbergSync.initSingleton();
34
- const api = BarretenbergSync.getSingleton();
35
-
36
- const apiPoint = this.toBbApiPoint();
37
- const response = api.bn254G1IsOnCurve({ point: apiPoint });
38
- return response.isOnCurve;
39
- }
40
-
41
- /**
42
- * Get the generator point for BN254 G1, or perform scalar multiplication.
43
- * When called without arguments, returns the base generator point.
44
- * When called with a scalar, returns scalar * generator (useful for public key derivation).
45
- */
46
- static async generator(scalar?: Fr): Promise<Bn254G1Point> {
47
- if (!scalar) {
48
- return new Bn254G1Point(
49
- Fq.fromBuffer(Buffer.from(BN254_G1_GENERATOR.x)),
50
- Fq.fromBuffer(Buffer.from(BN254_G1_GENERATOR.y)),
51
- );
52
- }
53
-
54
- await BarretenbergSync.initSingleton();
55
- const api = BarretenbergSync.getSingleton();
56
-
57
- const response = api.bn254G1Mul({
58
- point: BN254_G1_GENERATOR,
59
- scalar: scalar.toBuffer(),
60
- });
61
-
62
- return Bn254G1Point.fromBbApiPoint(response.point);
63
- }
64
-
65
- /**
66
- * Decompress a BN254 G1 point from compressed form (32 bytes).
67
- * The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
68
- * in the most significant bit.
69
- */
70
- static async fromCompressed(compressed: Buffer): Promise<Bn254G1Point> {
71
- if (compressed.length !== 32) {
72
- throw new Error('Invalid compressed point length');
73
- }
74
- await BarretenbergSync.initSingleton();
75
- const api = BarretenbergSync.getSingleton();
76
-
77
- const response = api.bn254G1FromCompressed({
78
- compressed: new Uint8Array(compressed),
79
- });
80
-
81
- return Bn254G1Point.fromBbApiPoint(response.point);
82
- }
83
9
 
84
- /**
85
- * Compress this BN254 G1 point to 32 bytes.
86
- * The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
87
- * in the most significant bit (bit 255).
88
- */
89
- compress(): Buffer {
90
- const xBytes = this.x.toBuffer();
91
- // Get the least significant bit of y to determine the sign
92
- const yLsb = this.y.toBigInt() & 1n;
93
- // If y is odd, set the most significant bit (bit 255) of the output
94
- if (yLsb === 1n) {
95
- xBytes[0] |= 0x80;
96
- }
97
- return xBytes;
98
- }
10
+ /**
11
+ * Generate a compressed BN254 G1 public key from a private key.
12
+ *
13
+ * @param privateKeyHex - Private key as 0x-prefixed hex string
14
+ * @returns Compressed G1 point (32 bytes with sign bit in MSB)
15
+ */
16
+ export async function computeBn254G1PublicKeyCompressed(privateKeyHex: string): Promise<string> {
17
+ const sk = BigInt(privateKeyHex);
18
+ const skReduced = sk % Fr.MODULUS;
99
19
 
100
- equals(other: Bn254G1Point): boolean {
101
- return this.x.equals(other.x) && this.y.equals(other.y);
102
- }
20
+ // Generate G1 point on BN254 curve using bb.js
21
+ const scalar = Fr.fromString(skReduced.toString());
22
+ const pk1 = await Bn254G1Point.generator(scalar);
103
23
 
104
- toString(): string {
105
- return `Bn254G1Point(x: ${this.x.toString()}, y: ${this.y.toString()})`;
106
- }
24
+ // Compress the point using the primitive method
25
+ return '0x' + pk1.compress().toString('hex');
107
26
  }
108
27
 
109
28
  /**
110
- * BN254 G2 point using foundation field classes.
111
- * Represents a point on the BN254 G2 curve (twist curve) in affine coordinates.
112
- * G2 points use extension field coordinates (Fq2).
29
+ * Generate uncompressed BN254 G1 public key from a private key.
30
+ *
31
+ * @param privateKeyHex - Private key as 0x-prefixed hex string
32
+ * @returns G1 point in affine coordinates
113
33
  */
114
- export class Bn254G2Point {
115
- constructor(
116
- public readonly x: [Fq, Fq],
117
- public readonly y: [Fq, Fq],
118
- ) {}
119
-
120
- private toBbApiPoint(): BbApiBn254G2Point {
121
- return {
122
- x: [this.x[0].toBuffer(), this.x[1].toBuffer()],
123
- y: [this.y[0].toBuffer(), this.y[1].toBuffer()],
124
- };
125
- }
126
-
127
- private static fromBbApiPoint(point: BbApiBn254G2Point): Bn254G2Point {
128
- return new Bn254G2Point(
129
- [Fq.fromBuffer(Buffer.from(point.x[0])), Fq.fromBuffer(Buffer.from(point.x[1]))],
130
- [Fq.fromBuffer(Buffer.from(point.y[0])), Fq.fromBuffer(Buffer.from(point.y[1]))],
131
- );
132
- }
133
-
134
- /**
135
- * Get the generator point for BN254 G2, or perform scalar multiplication.
136
- * When called without arguments, returns the base generator point.
137
- * When called with a scalar, returns scalar * generator.
138
- */
139
- static async generator(scalar?: Fr): Promise<Bn254G2Point> {
140
- if (!scalar) {
141
- return new Bn254G2Point(
142
- [Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.x[0])), Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.x[1]))],
143
- [Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.y[0])), Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.y[1]))],
144
- );
145
- }
146
-
147
- await BarretenbergSync.initSingleton();
148
- const api = BarretenbergSync.getSingleton();
34
+ export async function computeBn254G1PublicKey(privateKeyHex: string): Promise<{ x: bigint; y: bigint }> {
35
+ const sk = BigInt(privateKeyHex);
36
+ const skReduced = sk % Fr.MODULUS;
149
37
 
150
- const response = api.bn254G2Mul({
151
- point: BN254_G2_GENERATOR as BbApiBn254G2Point,
152
- scalar: scalar.toBuffer(),
153
- });
38
+ const scalar = Fr.fromString(skReduced.toString());
39
+ const pk1 = await Bn254G1Point.generator(scalar);
154
40
 
155
- return Bn254G2Point.fromBbApiPoint(response.point);
156
- }
157
-
158
- equals(other: Bn254G2Point): boolean {
159
- return (
160
- this.x[0].equals(other.x[0]) &&
161
- this.x[1].equals(other.x[1]) &&
162
- this.y[0].equals(other.y[0]) &&
163
- this.y[1].equals(other.y[1])
164
- );
165
- }
166
-
167
- toString(): string {
168
- return `Bn254G2Point(x: (${this.x[0].toString()}, ${this.x[1].toString()}), y: (${this.y[0].toString()}, ${this.y[1].toString()}))`;
169
- }
41
+ return { x: pk1.x.toBigInt(), y: pk1.y.toBigInt() };
170
42
  }
171
43
 
172
- // Re-export BN254 point utility functions
173
- export { computeBn254G1PublicKeyCompressed, computeBn254G1PublicKey, computeBn254G2PublicKey } from './bn254_utils.js';
44
+ /**
45
+ * Generate BN254 G2 public key from a private key.
46
+ *
47
+ * @param privateKeyHex - Private key as 0x-prefixed hex string
48
+ * @returns G2 point in affine coordinates
49
+ */
50
+ export async function computeBn254G2PublicKey(privateKeyHex: string): Promise<{
51
+ x: { c0: bigint; c1: bigint };
52
+ y: { c0: bigint; c1: bigint };
53
+ }> {
54
+ const sk = BigInt(privateKeyHex);
55
+ const skReduced = sk % Fr.MODULUS;
56
+
57
+ const scalar = Fr.fromString(skReduced.toString());
58
+ const pk2 = await Bn254G2Point.generator(scalar);
59
+
60
+ return {
61
+ x: { c0: pk2.x[0].toBigInt(), c1: pk2.x[1].toBigInt() },
62
+ y: { c0: pk2.y[0].toBigInt(), c1: pk2.y[1].toBigInt() },
63
+ };
64
+ }
@@ -1,6 +1,6 @@
1
1
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
2
- import { randomBytes } from '@aztec/foundation/crypto';
3
- import { Fr } from '@aztec/foundation/fields';
2
+ import { randomBytes } from '@aztec/foundation/crypto/random';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { mapTuple } from '@aztec/foundation/serialize';
5
5
 
6
6
  import type { Signature } from '../signature/index.js';
@@ -1,5 +1,7 @@
1
1
  import { BarretenbergSync } from '@aztec/bb.js';
2
- import { Fr, type GrumpkinScalar, Point } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
4
+ import { Point } from '@aztec/foundation/curves/grumpkin';
3
5
 
4
6
  /**
5
7
  * Grumpkin elliptic curve operations.
@@ -1,6 +1,6 @@
1
1
  import { BarretenbergSync } from '@aztec/bb.js';
2
2
 
3
- import { Fr } from '../../fields/fields.js';
3
+ import { Fr } from '../../curves/bn254/field.js';
4
4
 
5
5
  export async function vkAsFieldsMegaHonk(input: Buffer): Promise<Fr[]> {
6
6
  await BarretenbergSync.initSingleton();
@@ -1,6 +1,6 @@
1
1
  import { BarretenbergSync } from '@aztec/bb.js';
2
2
 
3
- import { Fr } from '../../fields/fields.js';
3
+ import { Fr } from '../../curves/bn254/field.js';
4
4
  import { type Fieldable, serializeToFields } from '../../serialize/serialize.js';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { BarretenbergSync } from '@aztec/bb.js';
2
2
 
3
- import { Fr } from '../../fields/fields.js';
3
+ import { Fr } from '../../curves/bn254/field.js';
4
4
  import { type Fieldable, serializeToFields } from '../../serialize/serialize.js';
5
5
 
6
6
  /**
@@ -1,5 +1,6 @@
1
1
  import { BarretenbergSync } from '@aztec/bb.js';
2
- import { type GrumpkinScalar, Point } from '@aztec/foundation/fields';
2
+ import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
3
+ import { Point } from '@aztec/foundation/curves/grumpkin';
3
4
 
4
5
  import { SchnorrSignature } from './signature.js';
5
6
 
@@ -1,5 +1,5 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { BufferReader, mapTuple } from '@aztec/foundation/serialize';
4
4
 
5
5
  import type { Signature } from '../signature/index.js';
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable camelcase */
2
2
  import { default as hash } from 'hash.js';
3
3
 
4
- import { Fr } from '../../fields/fields.js';
4
+ import { Fr } from '../../curves/bn254/field.js';
5
5
  import { truncateAndPad } from '../../serialize/free_funcs.js';
6
6
  import { type Bufferable, serializeToBuffer } from '../../serialize/serialize.js';
7
7
  import type { Hasher } from '../../trees/hasher.js';