@aztec/foundation 0.0.1-commit.b2a5d0dd1 → 0.0.1-commit.b3d3157a
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.
- package/dest/bigint-buffer/index.d.ts +1 -1
- package/dest/bigint-buffer/index.d.ts.map +1 -1
- package/dest/bigint-buffer/index.js +6 -1
- package/dest/branded-types/block_number.d.ts +3 -3
- package/dest/branded-types/block_number.d.ts.map +1 -1
- package/dest/branded-types/block_number.js +15 -4
- package/dest/branded-types/buffer32_hash.d.ts +22 -19
- package/dest/branded-types/buffer32_hash.d.ts.map +1 -1
- package/dest/branded-types/buffer32_hash.js +8 -15
- package/dest/branded-types/checkpoint_number.d.ts +6 -3
- package/dest/branded-types/checkpoint_number.d.ts.map +1 -1
- package/dest/branded-types/checkpoint_number.js +8 -0
- package/dest/branded-types/epoch.d.ts +2 -2
- package/dest/branded-types/epoch.d.ts.map +1 -1
- package/dest/branded-types/index.d.ts +2 -2
- package/dest/branded-types/index.d.ts.map +1 -1
- package/dest/branded-types/index.js +1 -1
- package/dest/branded-types/index_within_checkpoint.d.ts +2 -2
- package/dest/branded-types/index_within_checkpoint.d.ts.map +1 -1
- package/dest/branded-types/slot.d.ts +2 -2
- package/dest/branded-types/slot.d.ts.map +1 -1
- package/dest/buffer/buffer32.js +3 -3
- package/dest/collection/array.d.ts +9 -1
- package/dest/collection/array.d.ts.map +1 -1
- package/dest/collection/array.js +18 -0
- package/dest/collection/index.d.ts +2 -1
- package/dest/collection/index.d.ts.map +1 -1
- package/dest/collection/index.js +1 -0
- package/dest/collection/lru_map.d.ts +41 -0
- package/dest/collection/lru_map.d.ts.map +1 -0
- package/dest/collection/lru_map.js +119 -0
- package/dest/committable/committable.js +1 -1
- package/dest/config/env_var.d.ts +2 -2
- package/dest/config/env_var.d.ts.map +1 -1
- package/dest/config/index.d.ts +1 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +15 -21
- package/dest/config/network_config.d.ts +11 -55
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_name.d.ts +2 -2
- package/dest/config/network_name.d.ts.map +1 -1
- package/dest/config/network_name.js +1 -3
- package/dest/config/secret_value.d.ts +2 -2
- package/dest/config/secret_value.d.ts.map +1 -1
- package/dest/crypto/bls/bn254_keystore.d.ts +9 -167
- package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -1
- package/dest/crypto/schnorr/index.d.ts +8 -7
- package/dest/crypto/schnorr/index.d.ts.map +1 -1
- package/dest/crypto/schnorr/index.js +6 -6
- package/dest/crypto/schnorr/signature.d.ts +9 -29
- package/dest/crypto/schnorr/signature.d.ts.map +1 -1
- package/dest/crypto/schnorr/signature.js +20 -36
- package/dest/curves/bls12/field.d.ts +3 -3
- package/dest/curves/bls12/field.d.ts.map +1 -1
- package/dest/curves/bls12/point.d.ts +2 -2
- package/dest/curves/bls12/point.d.ts.map +1 -1
- package/dest/curves/bn254/field.d.ts +7 -4
- package/dest/curves/bn254/field.d.ts.map +1 -1
- package/dest/curves/bn254/field.js +5 -4
- package/dest/curves/grumpkin/point.d.ts +15 -29
- package/dest/curves/grumpkin/point.d.ts.map +1 -1
- package/dest/curves/grumpkin/point.js +31 -48
- package/dest/eth-address/index.d.ts +2 -2
- package/dest/eth-address/index.d.ts.map +1 -1
- package/dest/eth-signature/eth_signature.d.ts +2 -2
- package/dest/eth-signature/eth_signature.d.ts.map +1 -1
- package/dest/fifo/fifo_frame_reader.d.ts +2 -2
- package/dest/fifo/fifo_frame_reader.d.ts.map +1 -1
- package/dest/fifo/fifo_frame_reader.js +21 -4
- package/dest/fifo_set/fifo_set.d.ts +15 -0
- package/dest/fifo_set/fifo_set.d.ts.map +1 -0
- package/dest/fifo_set/fifo_set.js +39 -0
- package/dest/fifo_set/index.d.ts +2 -0
- package/dest/fifo_set/index.d.ts.map +1 -0
- package/dest/fifo_set/index.js +1 -0
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.js +2 -2
- package/dest/json-rpc/fixtures/test_state.d.ts +4 -8
- package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/test_state.js +57 -17
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +8 -3
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.js +27 -13
- package/dest/noir/noir_package_config.d.ts +19 -104
- package/dest/noir/noir_package_config.d.ts.map +1 -1
- package/dest/noir/noir_package_config.js +1 -1
- package/dest/schemas/api.d.ts +11 -9
- package/dest/schemas/api.d.ts.map +1 -1
- package/dest/schemas/api.js +7 -1
- package/dest/schemas/parse.d.ts +4 -4
- package/dest/schemas/parse.d.ts.map +1 -1
- package/dest/schemas/parse.js +6 -5
- package/dest/schemas/schemas.d.ts +15 -15
- package/dest/schemas/types.d.ts +3 -3
- package/dest/schemas/types.d.ts.map +1 -1
- package/dest/schemas/utils.d.ts +7 -11
- package/dest/schemas/utils.d.ts.map +1 -1
- package/dest/schemas/utils.js +2 -18
- package/dest/serialize/buffer_sink.d.ts +134 -0
- package/dest/serialize/buffer_sink.d.ts.map +1 -0
- package/dest/serialize/buffer_sink.js +297 -0
- package/dest/serialize/index.d.ts +2 -1
- package/dest/serialize/index.d.ts.map +1 -1
- package/dest/serialize/index.js +1 -0
- package/dest/timer/index.d.ts +2 -2
- package/dest/timer/index.d.ts.map +1 -1
- package/dest/timer/index.js +1 -1
- package/dest/timer/timeout.d.ts +3 -1
- package/dest/timer/timeout.d.ts.map +1 -1
- package/dest/timer/timeout.js +26 -0
- package/dest/trees/membership_witness.d.ts +2 -2
- package/dest/trees/membership_witness.d.ts.map +1 -1
- package/dest/trees/sibling_path.d.ts +4 -3
- package/dest/trees/sibling_path.d.ts.map +1 -1
- package/dest/trees/sibling_path.js +9 -3
- package/dest/types/index.d.ts +23 -1
- package/dest/types/index.d.ts.map +1 -1
- package/dest/types/index.js +15 -0
- package/package.json +5 -4
- package/src/bigint-buffer/index.ts +6 -1
- package/src/branded-types/block_number.ts +20 -2
- package/src/branded-types/buffer32_hash.ts +28 -32
- package/src/branded-types/checkpoint_number.ts +11 -1
- package/src/branded-types/epoch.ts +1 -1
- package/src/branded-types/index.ts +1 -1
- package/src/branded-types/index_within_checkpoint.ts +1 -1
- package/src/branded-types/slot.ts +1 -1
- package/src/buffer/buffer32.ts +3 -3
- package/src/collection/array.ts +20 -0
- package/src/collection/index.ts +1 -0
- package/src/collection/lru_map.ts +143 -0
- package/src/committable/committable.ts +1 -1
- package/src/config/env_var.ts +16 -14
- package/src/config/index.ts +13 -20
- package/src/config/network_name.ts +2 -5
- package/src/config/secret_value.ts +1 -1
- package/src/crypto/schnorr/index.ts +9 -8
- package/src/crypto/schnorr/signature.ts +17 -46
- package/src/curves/bn254/field.ts +10 -3
- package/src/curves/grumpkin/point.ts +24 -44
- package/src/fifo/fifo_frame_reader.ts +17 -2
- package/src/fifo_set/fifo_set.ts +52 -0
- package/src/fifo_set/index.ts +1 -0
- package/src/json-rpc/client/safe_json_rpc_client.ts +2 -2
- package/src/json-rpc/fixtures/test_state.ts +10 -10
- package/src/json-rpc/server/safe_json_rpc_server.ts +31 -13
- package/src/noir/noir_package_config.ts +32 -20
- package/src/schemas/api.ts +21 -24
- package/src/schemas/parse.ts +9 -6
- package/src/schemas/schemas.ts +4 -4
- package/src/schemas/types.ts +2 -2
- package/src/schemas/utils.ts +4 -38
- package/src/serialize/buffer_sink.ts +350 -0
- package/src/serialize/index.ts +1 -0
- package/src/timer/index.ts +1 -1
- package/src/timer/timeout.ts +31 -0
- package/src/trees/sibling_path.ts +10 -4
- package/src/types/index.ts +47 -0
package/src/config/env_var.ts
CHANGED
|
@@ -5,12 +5,12 @@ export type EnvVar =
|
|
|
5
5
|
| 'ACVM_WORKING_DIRECTORY'
|
|
6
6
|
| 'API_KEY'
|
|
7
7
|
| 'API_PREFIX'
|
|
8
|
-
| 'ARCHIVER_MAX_LOGS'
|
|
9
8
|
| 'ARCHIVER_POLLING_INTERVAL_MS'
|
|
10
9
|
| 'ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK'
|
|
11
10
|
| 'ARCHIVER_URL'
|
|
12
11
|
| 'ARCHIVER_VIEM_POLLING_INTERVAL_MS'
|
|
13
12
|
| 'ARCHIVER_BATCH_SIZE'
|
|
13
|
+
| 'ARCHIVER_ORPHAN_PROPOSED_BLOCK_PRUNE_GRACE_SECONDS'
|
|
14
14
|
| 'AZTEC_ADMIN_PORT'
|
|
15
15
|
| 'AZTEC_NODE_DEBUG'
|
|
16
16
|
| 'AZTEC_ADMIN_API_KEY_HASH'
|
|
@@ -26,6 +26,7 @@ export type EnvVar =
|
|
|
26
26
|
| 'BB_IVC_CONCURRENCY'
|
|
27
27
|
| 'BB_CHONK_VERIFY_MAX_BATCH'
|
|
28
28
|
| 'BB_CHONK_VERIFY_BATCH_CONCURRENCY'
|
|
29
|
+
| 'BB_DEBUG_OUTPUT_DIR'
|
|
29
30
|
| 'BOOTSTRAP_NODES'
|
|
30
31
|
| 'BLOB_ARCHIVE_API_URL'
|
|
31
32
|
| 'BLOB_FILE_STORE_URLS'
|
|
@@ -75,6 +76,7 @@ export type EnvVar =
|
|
|
75
76
|
| 'DEBUG'
|
|
76
77
|
| 'DEBUG_P2P_DISABLE_COLOCATION_PENALTY'
|
|
77
78
|
| 'ENABLE_PROVER_NODE'
|
|
79
|
+
| 'USE_AUTOMINE_SEQUENCER'
|
|
78
80
|
| 'ETHEREUM_HOSTS'
|
|
79
81
|
| 'ETHEREUM_DEBUG_HOSTS'
|
|
80
82
|
| 'ETHEREUM_ALLOW_NO_DEBUG_HOSTS'
|
|
@@ -100,8 +102,10 @@ export type EnvVar =
|
|
|
100
102
|
| 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'
|
|
101
103
|
| 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT'
|
|
102
104
|
| 'OTEL_COLLECT_INTERVAL_MS'
|
|
105
|
+
| 'OTEL_BSP_MAX_QUEUE_SIZE'
|
|
103
106
|
| 'OTEL_EXCLUDE_METRICS'
|
|
104
107
|
| 'OTEL_INCLUDE_METRICS'
|
|
108
|
+
| 'OTEL_MIN_TRACE_DURATION_MS'
|
|
105
109
|
| 'OTEL_EXPORT_TIMEOUT_MS'
|
|
106
110
|
| 'PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT'
|
|
107
111
|
| 'PUBLIC_OTEL_INCLUDE_METRICS'
|
|
@@ -136,6 +140,7 @@ export type EnvVar =
|
|
|
136
140
|
| 'P2P_PEER_FAILED_BAN_TIME_MS'
|
|
137
141
|
| 'P2P_PEER_PENALTY_VALUES'
|
|
138
142
|
| 'P2P_QUERY_FOR_IP'
|
|
143
|
+
| 'P2P_PUBLIC_IP_SERVICES'
|
|
139
144
|
| 'P2P_REQRESP_INDIVIDUAL_REQUEST_TIMEOUT_MS'
|
|
140
145
|
| 'P2P_REQRESP_DIAL_TIMEOUT_MS'
|
|
141
146
|
| 'P2P_REQRESP_OVERALL_REQUEST_TIMEOUT_MS'
|
|
@@ -157,7 +162,9 @@ export type EnvVar =
|
|
|
157
162
|
| 'P2P_DROP_TX_CHANCE'
|
|
158
163
|
| 'P2P_TX_POOL_DELETE_TXS_AFTER_REORG'
|
|
159
164
|
| 'P2P_MIN_TX_POOL_AGE_MS'
|
|
165
|
+
| 'P2P_MISSING_TX_COLLECTION_DEADLINE_SLOTS'
|
|
160
166
|
| 'P2P_RPC_PRICE_BUMP_PERCENTAGE'
|
|
167
|
+
| 'P2P_TX_VALIDATION_CACHE_SIZE'
|
|
161
168
|
| 'DEBUG_P2P_INSTRUMENT_MESSAGES'
|
|
162
169
|
| 'PEER_ID_PRIVATE_KEY'
|
|
163
170
|
| 'PEER_ID_PRIVATE_KEY_PATH'
|
|
@@ -197,6 +204,7 @@ export type EnvVar =
|
|
|
197
204
|
| 'PROVER_TEST_DELAY_MS'
|
|
198
205
|
| 'PROVER_TEST_DELAY_TYPE'
|
|
199
206
|
| 'PROVER_TEST_VERIFICATION_DELAY_MS'
|
|
207
|
+
| 'PXE_AUTO_SYNC'
|
|
200
208
|
| 'PXE_L2_BLOCK_BATCH_SIZE'
|
|
201
209
|
| 'PXE_PROVER_ENABLED'
|
|
202
210
|
| 'PXE_SYNC_CHAIN_TIP'
|
|
@@ -206,8 +214,8 @@ export type EnvVar =
|
|
|
206
214
|
| 'RPC_SIMULATE_PUBLIC_MAX_DEBUG_LOG_MEMORY_READS'
|
|
207
215
|
| 'SENTINEL_ENABLED'
|
|
208
216
|
| 'SENTINEL_HISTORY_LENGTH_IN_EPOCHS'
|
|
209
|
-
| '
|
|
210
|
-
| '
|
|
217
|
+
| 'SENTINEL_HISTORIC_EPOCH_PERFORMANCE_LENGTH_IN_EPOCHS'
|
|
218
|
+
| 'SENTINEL_EPOCH_END_BUFFER_SLOTS'
|
|
211
219
|
| 'SEQ_MAX_TX_PER_BLOCK'
|
|
212
220
|
| 'SEQ_MAX_TX_PER_CHECKPOINT'
|
|
213
221
|
| 'SEQ_MIN_TX_PER_BLOCK'
|
|
@@ -236,17 +244,19 @@ export type EnvVar =
|
|
|
236
244
|
| 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT'
|
|
237
245
|
| 'SLASH_VALIDATORS_ALWAYS'
|
|
238
246
|
| 'SLASH_VALIDATORS_NEVER'
|
|
239
|
-
| 'SLASH_PRUNE_PENALTY'
|
|
240
247
|
| 'SLASH_DATA_WITHHOLDING_PENALTY'
|
|
248
|
+
| 'SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS'
|
|
241
249
|
| 'SLASH_INACTIVITY_PENALTY'
|
|
242
250
|
| 'SLASH_INACTIVITY_TARGET_PERCENTAGE'
|
|
243
251
|
| 'SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD'
|
|
244
252
|
| 'SLASH_INVALID_BLOCK_PENALTY'
|
|
253
|
+
| 'SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY'
|
|
245
254
|
| 'SLASH_DUPLICATE_PROPOSAL_PENALTY'
|
|
246
255
|
| 'SLASH_DUPLICATE_ATTESTATION_PENALTY'
|
|
247
256
|
| 'SLASH_OVERRIDE_PAYLOAD'
|
|
248
257
|
| 'SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY'
|
|
249
|
-
| '
|
|
258
|
+
| 'SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY'
|
|
259
|
+
| 'SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY'
|
|
250
260
|
| 'SLASH_UNKNOWN_PENALTY'
|
|
251
261
|
| 'SLASH_GRACE_PERIOD_L2_SLOTS'
|
|
252
262
|
| 'SLASH_OFFENSE_EXPIRATION_ROUNDS'
|
|
@@ -260,25 +270,16 @@ export type EnvVar =
|
|
|
260
270
|
| 'SPONSORED_FPC'
|
|
261
271
|
| 'PREFUND_ADDRESSES'
|
|
262
272
|
| 'TX_COLLECTION_FAST_NODES_TIMEOUT_BEFORE_REQ_RESP_MS'
|
|
263
|
-
| 'TX_COLLECTION_SLOW_NODES_INTERVAL_MS'
|
|
264
|
-
| 'TX_COLLECTION_SLOW_REQ_RESP_INTERVAL_MS'
|
|
265
|
-
| 'TX_COLLECTION_SLOW_REQ_RESP_TIMEOUT_MS'
|
|
266
|
-
| 'TX_COLLECTION_RECONCILE_INTERVAL_MS'
|
|
267
|
-
| 'TX_COLLECTION_DISABLE_SLOW_DURING_FAST_REQUESTS'
|
|
268
273
|
| 'TX_COLLECTION_FAST_NODE_INTERVAL_MS'
|
|
269
274
|
| 'TX_COLLECTION_FAST_MAX_PARALLEL_REQUESTS_PER_NODE'
|
|
270
275
|
| 'TX_COLLECTION_NODE_RPC_MAX_BATCH_SIZE'
|
|
271
276
|
| 'TX_COLLECTION_NODE_RPC_URLS'
|
|
272
277
|
| 'TX_COLLECTION_MISSING_TXS_COLLECTOR_TYPE'
|
|
273
278
|
| 'TX_COLLECTION_FILE_STORE_URLS'
|
|
274
|
-
| 'TX_COLLECTION_FILE_STORE_SLOW_DELAY_MS'
|
|
275
279
|
| 'TX_COLLECTION_FILE_STORE_FAST_DELAY_MS'
|
|
276
280
|
| 'TX_COLLECTION_FILE_STORE_FAST_WORKER_COUNT'
|
|
277
|
-
| 'TX_COLLECTION_FILE_STORE_SLOW_WORKER_COUNT'
|
|
278
281
|
| 'TX_COLLECTION_FILE_STORE_FAST_BACKOFF_BASE_MS'
|
|
279
|
-
| 'TX_COLLECTION_FILE_STORE_SLOW_BACKOFF_BASE_MS'
|
|
280
282
|
| 'TX_COLLECTION_FILE_STORE_FAST_BACKOFF_MAX_MS'
|
|
281
|
-
| 'TX_COLLECTION_FILE_STORE_SLOW_BACKOFF_MAX_MS'
|
|
282
283
|
| 'TX_FILE_STORE_URL'
|
|
283
284
|
| 'TX_FILE_STORE_UPLOAD_CONCURRENCY'
|
|
284
285
|
| 'TX_FILE_STORE_MAX_QUEUE_SIZE'
|
|
@@ -363,6 +364,7 @@ export type EnvVar =
|
|
|
363
364
|
| 'BLOB_FILE_STORE_TIMEOUT_MS'
|
|
364
365
|
| 'FISHERMAN_MODE'
|
|
365
366
|
| 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS'
|
|
367
|
+
| 'MAX_BLOCKS_PER_CHECKPOINT'
|
|
366
368
|
| 'LEGACY_BLS_CLI'
|
|
367
369
|
| 'DEBUG_FORCE_TX_PROOF_VERIFICATION'
|
|
368
370
|
| 'VALIDATOR_HA_SIGNING_ENABLED'
|
package/src/config/index.ts
CHANGED
|
@@ -18,7 +18,6 @@ export interface ConfigMapping<T> {
|
|
|
18
18
|
printDefault?: (val: any) => string;
|
|
19
19
|
description: string;
|
|
20
20
|
isBoolean?: boolean;
|
|
21
|
-
nested?: Record<string, ConfigMapping<any>>;
|
|
22
21
|
fallback?: EnvVar[];
|
|
23
22
|
/**
|
|
24
23
|
* List of deprecated env vars that are still supported but will log a warning.
|
|
@@ -82,26 +81,20 @@ export function getConfigFromMappings<T>(configMappings: ConfigMappingsType<T>):
|
|
|
82
81
|
const config = {} as T;
|
|
83
82
|
|
|
84
83
|
for (const key in configMappings) {
|
|
85
|
-
const { env, parseEnv, defaultValue,
|
|
86
|
-
|
|
87
|
-
(config as any)[key] =
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
(config as any)[key] = getValueFromEnvWithFallback(env, parseEnv, defaultValue, fallback);
|
|
92
|
-
} catch (e: any) {
|
|
93
|
-
throw new Error(`Failed to parse config '${key}' (env: ${env ?? 'none'}): ${e.message}`);
|
|
94
|
-
}
|
|
84
|
+
const { env, parseEnv, defaultValue, fallback, deprecatedFallback } = configMappings[key];
|
|
85
|
+
try {
|
|
86
|
+
(config as any)[key] = getValueFromEnvWithFallback(env, parseEnv, defaultValue, fallback);
|
|
87
|
+
} catch (e: any) {
|
|
88
|
+
throw new Error(`Failed to parse config '${key}' (env: ${env ?? 'none'}): ${e.message}`);
|
|
89
|
+
}
|
|
95
90
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
userLog(warningMessage, { deprecatedEnvVar: deprecatedEnv, newEnvVar: env });
|
|
104
|
-
}
|
|
91
|
+
if (deprecatedFallback?.length) {
|
|
92
|
+
const userLog = createConsoleLogger('[DEPRECATED]');
|
|
93
|
+
for (const { env: deprecatedEnv, message } of deprecatedFallback) {
|
|
94
|
+
if (process.env[deprecatedEnv]) {
|
|
95
|
+
const warningMessage =
|
|
96
|
+
message ?? `Environment variable ${deprecatedEnv} is deprecated. Please use ${env} instead.`;
|
|
97
|
+
userLog(warningMessage, { deprecatedEnvVar: deprecatedEnv, newEnvVar: env });
|
|
105
98
|
}
|
|
106
99
|
}
|
|
107
100
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type NetworkNames =
|
|
2
2
|
| 'local'
|
|
3
|
-
| 'staging
|
|
4
|
-
| 'staging-public'
|
|
3
|
+
| 'staging'
|
|
5
4
|
| 'testnet'
|
|
6
5
|
| 'mainnet'
|
|
7
6
|
| 'next-net'
|
|
@@ -12,9 +11,7 @@ export function getActiveNetworkName(name?: string): NetworkNames {
|
|
|
12
11
|
const network = name || process.env.NETWORK;
|
|
13
12
|
if (!network || network === '' || network === 'local') {
|
|
14
13
|
return 'local';
|
|
15
|
-
} else if (network === 'staging
|
|
16
|
-
return network;
|
|
17
|
-
} else if (network === 'staging-public') {
|
|
14
|
+
} else if (network === 'staging') {
|
|
18
15
|
return network;
|
|
19
16
|
} else if (network === 'testnet' || network === 'alpha-testnet') {
|
|
20
17
|
return 'testnet';
|
|
@@ -43,7 +43,7 @@ export class SecretValue<T> {
|
|
|
43
43
|
/**
|
|
44
44
|
* Returns a Zod schema
|
|
45
45
|
*/
|
|
46
|
-
static schema<O>(valueSchema: ZodType<O, any
|
|
46
|
+
static schema<O>(valueSchema: ZodType<O, any>): ZodType<SecretValue<O>, any> {
|
|
47
47
|
return valueSchema.transform(value => new SecretValue<O>(value));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BarretenbergSync } from '@aztec/bb.js';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
3
4
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
5
|
|
|
@@ -23,33 +24,33 @@ export class Schnorr {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
|
-
* Constructs a Schnorr signature
|
|
27
|
-
* @param msg -
|
|
27
|
+
* Constructs a Schnorr signature over a 32-byte message field element.
|
|
28
|
+
* @param msg - The message hash, as a grumpkin base field element.
|
|
28
29
|
* @param privateKey - The private key of the signer.
|
|
29
30
|
* @returns A Schnorr signature of the form (s, e).
|
|
30
31
|
*/
|
|
31
|
-
public async constructSignature(msg:
|
|
32
|
+
public async constructSignature(msg: Fr, privateKey: GrumpkinScalar) {
|
|
32
33
|
await BarretenbergSync.initSingleton();
|
|
33
34
|
const api = BarretenbergSync.getSingleton();
|
|
34
35
|
const response = api.schnorrConstructSignature({
|
|
35
|
-
|
|
36
|
+
messageField: msg.toBuffer(),
|
|
36
37
|
privateKey: privateKey.toBuffer(),
|
|
37
38
|
});
|
|
38
39
|
return new SchnorrSignature(Buffer.from([...response.s, ...response.e]));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
|
-
* Verifies a Schnorr signature
|
|
43
|
-
* @param msg -
|
|
43
|
+
* Verifies a Schnorr signature against a Grumpkin public key.
|
|
44
|
+
* @param msg - The message hash, as a grumpkin base field element.
|
|
44
45
|
* @param pubKey - The Grumpkin public key of the signer.
|
|
45
46
|
* @param sig - The Schnorr signature.
|
|
46
47
|
* @returns True or false.
|
|
47
48
|
*/
|
|
48
|
-
public async verifySignature(msg:
|
|
49
|
+
public async verifySignature(msg: Fr, pubKey: Point, sig: SchnorrSignature) {
|
|
49
50
|
await BarretenbergSync.initSingleton();
|
|
50
51
|
const api = BarretenbergSync.getSingleton();
|
|
51
52
|
const response = api.schnorrVerifySignature({
|
|
52
|
-
|
|
53
|
+
messageField: msg.toBuffer(),
|
|
53
54
|
publicKey: { x: pubKey.x.toBuffer(), y: pubKey.y.toBuffer() },
|
|
54
55
|
s: sig.s,
|
|
55
56
|
e: sig.e,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import {
|
|
2
|
+
import { mapTuple } from '@aztec/foundation/serialize';
|
|
4
3
|
|
|
5
4
|
import type { Signature } from '../signature/index.js';
|
|
6
5
|
|
|
@@ -14,46 +13,12 @@ export class SchnorrSignature implements Signature {
|
|
|
14
13
|
*/
|
|
15
14
|
public static SIZE = 64;
|
|
16
15
|
|
|
17
|
-
/**
|
|
18
|
-
* An empty signature.
|
|
19
|
-
*/
|
|
20
|
-
public static EMPTY = new SchnorrSignature(Buffer.alloc(64));
|
|
21
|
-
|
|
22
16
|
constructor(private buffer: Buffer) {
|
|
23
17
|
if (buffer.length !== SchnorrSignature.SIZE) {
|
|
24
18
|
throw new Error(`Invalid signature buffer of length ${buffer.length}.`);
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
/**
|
|
29
|
-
* Determines if the provided signature is valid or not.
|
|
30
|
-
* @param signature - The data to be checked.
|
|
31
|
-
* @returns Boolean indicating if the provided data is a valid schnorr signature.
|
|
32
|
-
*/
|
|
33
|
-
public static isSignature(signature: string) {
|
|
34
|
-
return /^(0x)?[0-9a-f]{128}$/i.test(signature);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Constructs a SchnorrSignature from the provided string.
|
|
39
|
-
* @param signature - The string to be converted to a schnorr signature.
|
|
40
|
-
* @returns The constructed schnorr signature.
|
|
41
|
-
*/
|
|
42
|
-
public static fromString(signature: string) {
|
|
43
|
-
if (!SchnorrSignature.isSignature(signature)) {
|
|
44
|
-
throw new Error(`Invalid signature string: ${signature}`);
|
|
45
|
-
}
|
|
46
|
-
return new SchnorrSignature(Buffer.from(signature.replace(/^0x/i, ''), 'hex'));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Generates a random schnorr signature.
|
|
51
|
-
* @returns The randomly constructed signature.
|
|
52
|
-
*/
|
|
53
|
-
public static random() {
|
|
54
|
-
return new SchnorrSignature(randomBytes(64));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
22
|
/**
|
|
58
23
|
* Returns the 's' component of the signature.
|
|
59
24
|
* @returns A buffer containing the signature's 's' component.
|
|
@@ -78,16 +43,6 @@ export class SchnorrSignature implements Signature {
|
|
|
78
43
|
return this.buffer;
|
|
79
44
|
}
|
|
80
45
|
|
|
81
|
-
/**
|
|
82
|
-
* Deserializes from a buffer.
|
|
83
|
-
* @param buffer - The buffer representation of the object.
|
|
84
|
-
* @returns The new object.
|
|
85
|
-
*/
|
|
86
|
-
static fromBuffer(buffer: Buffer | BufferReader): SchnorrSignature {
|
|
87
|
-
const reader = BufferReader.asReader(buffer);
|
|
88
|
-
return new SchnorrSignature(reader.readBytes(SchnorrSignature.SIZE));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
46
|
/**
|
|
92
47
|
* Returns the full signature as a hex string.
|
|
93
48
|
* @returns A string containing the signature in hex format.
|
|
@@ -113,4 +68,20 @@ export class SchnorrSignature implements Signature {
|
|
|
113
68
|
|
|
114
69
|
return mapTuple([buf1, buf2, buf3], Fr.fromBuffer);
|
|
115
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Splits the signature into the four 128-bit limbs that Noir's `EmbeddedCurveScalar` consumes:
|
|
74
|
+
* `[s.lo, s.hi, e.lo, e.hi]`, where each component scalar is encoded as `lo + hi * 2^128`.
|
|
75
|
+
*
|
|
76
|
+
* Each 32-byte big-endian component is sliced into its top 16 bytes (`hi`) and bottom 16 bytes
|
|
77
|
+
* (`lo`); each half is zero-padded into a 32-byte buffer and decoded as `Fr` (big-endian).
|
|
78
|
+
*/
|
|
79
|
+
toLimbFields(): [Fr, Fr, Fr, Fr] {
|
|
80
|
+
const limb = (start: number) => {
|
|
81
|
+
const buf = Buffer.alloc(32);
|
|
82
|
+
this.buffer.copy(buf, 16, start, start + 16);
|
|
83
|
+
return Fr.fromBuffer(buf);
|
|
84
|
+
};
|
|
85
|
+
return [limb(16), limb(0), limb(48), limb(32)];
|
|
86
|
+
}
|
|
116
87
|
}
|
|
@@ -6,6 +6,7 @@ import { toBigIntBE, toBufferBE } from '../../bigint-buffer/index.js';
|
|
|
6
6
|
import { randomBytes } from '../../crypto/random/index.js';
|
|
7
7
|
import { hexSchemaFor } from '../../schemas/utils.js';
|
|
8
8
|
import { BufferReader } from '../../serialize/buffer_reader.js';
|
|
9
|
+
import type { BufferSink } from '../../serialize/buffer_sink.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Represents a field derived from BaseField.
|
|
@@ -64,10 +65,16 @@ abstract class BaseField {
|
|
|
64
65
|
protected abstract modulus(): bigint;
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
|
-
* Converts the bigint to a Buffer.
|
|
68
|
+
* Converts the bigint to a Buffer. With a sink, streams the 32 big-endian bytes straight in (no allocation)
|
|
69
|
+
* and returns undefined; without one, returns a freshly allocated buffer.
|
|
68
70
|
*/
|
|
69
|
-
toBuffer(): Buffer
|
|
70
|
-
|
|
71
|
+
toBuffer(): Buffer;
|
|
72
|
+
toBuffer(sink: BufferSink): void;
|
|
73
|
+
toBuffer(sink?: BufferSink): Buffer | void {
|
|
74
|
+
if (!sink) {
|
|
75
|
+
return toBufferBE(this.asBigInt, BaseField.SIZE_IN_BYTES);
|
|
76
|
+
}
|
|
77
|
+
sink.writeField(this.asBigInt);
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
toString(): `0x${string}` {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { toBigIntBE } from '../../bigint-buffer/index.js';
|
|
2
|
-
import { poseidon2Hash } from '../../crypto/poseidon/index.js';
|
|
3
2
|
import { randomBoolean } from '../../crypto/random/index.js';
|
|
4
3
|
import { hexSchemaFor } from '../../schemas/utils.js';
|
|
5
4
|
import { BufferReader, FieldReader, serializeToBuffer } from '../../serialize/index.js';
|
|
@@ -13,13 +12,16 @@ import { Fr } from '../bn254/field.js';
|
|
|
13
12
|
* TODO(#7386): Clean up this class.
|
|
14
13
|
*/
|
|
15
14
|
export class Point {
|
|
16
|
-
static
|
|
15
|
+
static INFINITY = new Point(Fr.ZERO, Fr.ZERO);
|
|
17
16
|
static SIZE_IN_BYTES = Fr.SIZE_IN_BYTES * 2;
|
|
18
17
|
static COMPRESSED_SIZE_IN_BYTES = Fr.SIZE_IN_BYTES;
|
|
19
18
|
|
|
20
19
|
/** Used to differentiate this class from AztecAddress */
|
|
21
20
|
public readonly kind = 'point';
|
|
22
21
|
|
|
22
|
+
/** Whether the point is at infinity */
|
|
23
|
+
public readonly isInfinite: boolean;
|
|
24
|
+
|
|
23
25
|
constructor(
|
|
24
26
|
/**
|
|
25
27
|
* The point's x coordinate
|
|
@@ -29,12 +31,10 @@ export class Point {
|
|
|
29
31
|
* The point's y coordinate
|
|
30
32
|
*/
|
|
31
33
|
public readonly y: Fr,
|
|
32
|
-
/**
|
|
33
|
-
* Whether the point is at infinity
|
|
34
|
-
*/
|
|
35
|
-
public readonly isInfinite: boolean,
|
|
36
34
|
) {
|
|
37
35
|
// TODO(#7386): check if on curve
|
|
36
|
+
// NOTE: now there is no isInfinite in the struct, empty == inf, so an empty class would pass an on-curve check. This may be fine depending on the usage.
|
|
37
|
+
this.isInfinite = x.isZero() && y.isZero();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
toJSON() {
|
|
@@ -61,7 +61,7 @@ export class Point {
|
|
|
61
61
|
if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
|
|
62
62
|
return Point.fromBuffer(obj);
|
|
63
63
|
}
|
|
64
|
-
return new
|
|
64
|
+
return new this(Fr.fromPlainObject(obj.x), Fr.fromPlainObject(obj.y));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -92,7 +92,7 @@ export class Point {
|
|
|
92
92
|
*/
|
|
93
93
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
94
94
|
const reader = BufferReader.asReader(buffer);
|
|
95
|
-
return new this(Fr.fromBuffer(reader), Fr.fromBuffer(reader)
|
|
95
|
+
return new this(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -125,19 +125,17 @@ export class Point {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Returns the contents of the point as an array of
|
|
129
|
-
* @returns The point as an array of
|
|
128
|
+
* Returns the contents of the point as an array of 2 fields.
|
|
129
|
+
* @returns The point as an array of 2 fields
|
|
130
130
|
*/
|
|
131
|
-
// TODO(F-553): Once we take the breaking change and drop the custom Noir `Point` wrapper in
|
|
132
|
-
// `noir-projects/noir-protocol-circuits/crates/types/src/point.nr`, revert this to serialize as `[x, y]` (2 fields)
|
|
133
|
-
// and drop the `is_infinite` flag from `fromFields` / `toNoirStruct` below.
|
|
134
131
|
toFields() {
|
|
135
|
-
return [this.x, this.y
|
|
132
|
+
return [this.x, this.y];
|
|
136
133
|
}
|
|
137
134
|
|
|
138
135
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
139
136
|
const reader = FieldReader.asReader(fields);
|
|
140
|
-
|
|
137
|
+
const [x, y] = [reader.readField(), reader.readField()];
|
|
138
|
+
return new this(x, y);
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
/**
|
|
@@ -162,11 +160,12 @@ export class Point {
|
|
|
162
160
|
const finalY = sign ? new Fr(yPositiveBigInt) : new Fr(yNegativeBigInt);
|
|
163
161
|
|
|
164
162
|
// Create and return the new Point
|
|
165
|
-
return new this(x, finalY
|
|
163
|
+
return new this(x, finalY);
|
|
166
164
|
}
|
|
167
165
|
|
|
168
166
|
/**
|
|
169
|
-
* @
|
|
167
|
+
* @param x - The x coordinate of the point
|
|
168
|
+
* @returns y^2 such that y^2 = x^3 - 17
|
|
170
169
|
*/
|
|
171
170
|
static YFromX(x: Fr): Promise<Fr | null> {
|
|
172
171
|
// Calculate y^2 = x^3 - 17 (i.e. the Grumpkin curve equation)
|
|
@@ -194,24 +193,15 @@ export class Point {
|
|
|
194
193
|
return {
|
|
195
194
|
x: this.x.toBigInt(),
|
|
196
195
|
y: this.y.toBigInt(),
|
|
197
|
-
isInfinite: this.isInfinite ? 1n : 0n,
|
|
198
196
|
};
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
/**
|
|
202
200
|
* Converts the Point instance to a Buffer representation of the coordinates.
|
|
203
201
|
* @returns A Buffer representation of the Point instance.
|
|
204
|
-
* @dev Note that toBuffer does not include the isInfinite flag
|
|
205
|
-
* This is because currently when we work with point as bytes we don't want to populate the extra bytes for
|
|
206
|
-
* isInfinite flag because:
|
|
207
|
-
* 1. Our Grumpkin BB API currently does not handle point at infinity,
|
|
208
|
-
* 2. we use toBuffer when serializing notes and events and there we only work with public keys and point at infinity
|
|
209
|
-
* is not considered a valid public key and the extra byte would raise DA cost.
|
|
202
|
+
* @dev Note that toBuffer does not include the isInfinite flag. The point at infinity is serialized as (0, 0).
|
|
210
203
|
*/
|
|
211
204
|
toBuffer() {
|
|
212
|
-
if (this.isInfinite) {
|
|
213
|
-
throw new Error('Cannot serialize infinite point with isInfinite flag');
|
|
214
|
-
}
|
|
215
205
|
const buf = serializeToBuffer([this.x, this.y]);
|
|
216
206
|
if (buf.length !== Point.SIZE_IN_BYTES) {
|
|
217
207
|
throw new Error(`Invalid buffer length for Point: ${buf.length}`);
|
|
@@ -261,12 +251,10 @@ export class Point {
|
|
|
261
251
|
}
|
|
262
252
|
|
|
263
253
|
toNoirStruct() {
|
|
264
|
-
|
|
265
|
-
return { x: this.x, y: this.y, is_infinite: this.isInfinite };
|
|
266
|
-
/* eslint-enable camelcase */
|
|
254
|
+
return { x: this.x, y: this.y };
|
|
267
255
|
}
|
|
268
256
|
|
|
269
|
-
// Used for IvpkM
|
|
257
|
+
// Used for IvpkM. TODO(#8124): Consider removing this method.
|
|
270
258
|
toWrappedNoirStruct() {
|
|
271
259
|
return { inner: this.toNoirStruct() };
|
|
272
260
|
}
|
|
@@ -286,21 +274,13 @@ export class Point {
|
|
|
286
274
|
return this.x.isZero() && this.y.isZero();
|
|
287
275
|
}
|
|
288
276
|
|
|
289
|
-
hash() {
|
|
290
|
-
return poseidon2Hash(this.toFields());
|
|
291
|
-
}
|
|
292
|
-
|
|
293
277
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
278
|
+
* @param x - The x coordinate of the point
|
|
279
|
+
* @param y - The y coordinate of the point
|
|
280
|
+
* @returns Whether the point exists on Grumpkin
|
|
296
281
|
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
isOnGrumpkin() {
|
|
302
|
-
// TODO: Check this against how bb handles curve check and infinity point check
|
|
303
|
-
if (this.inf) {
|
|
282
|
+
isOnCurve() {
|
|
283
|
+
if (this.isInfinite) {
|
|
304
284
|
return true;
|
|
305
285
|
}
|
|
306
286
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import EventEmitter from 'node:events';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
|
+
import * as net from 'node:net';
|
|
3
4
|
import type { Readable } from 'node:stream';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -36,8 +37,22 @@ export class FifoFrameReader extends EventEmitter<FifoFrameReaderEvents> {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
/** Open a FIFO at the given path and start reading frames. */
|
|
39
|
-
start(fifoPath: string
|
|
40
|
-
|
|
40
|
+
start(fifoPath: string): void {
|
|
41
|
+
// Read the FIFO through a libuv pipe handle (net.Socket) rather than fs.createReadStream.
|
|
42
|
+
// An fs read stream services the pipe with a blocking threadpool read that destroy() cannot
|
|
43
|
+
// cancel: if a writer never closes, that read stays parked and keeps the host process alive
|
|
44
|
+
// (manifesting as Jest "did not exit"). Opening O_NONBLOCK and wrapping the fd in a pipe
|
|
45
|
+
// handle makes reads epoll-based, so stop()'s destroy() releases the handle immediately,
|
|
46
|
+
// regardless of whether the writer is still attached.
|
|
47
|
+
const fd = fs.openSync(fifoPath, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK);
|
|
48
|
+
let socket: net.Socket;
|
|
49
|
+
try {
|
|
50
|
+
socket = new net.Socket({ fd, readable: true, writable: false });
|
|
51
|
+
} catch (err) {
|
|
52
|
+
fs.closeSync(fd);
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
this.startFromStream(socket);
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
/** Start reading frames from an existing readable stream. */
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** A Set capped to a fixed number of entries, evicting the oldest inserted value when full. */
|
|
2
|
+
export class FifoSet<T> extends Set<T> {
|
|
3
|
+
private _limit: number | undefined;
|
|
4
|
+
|
|
5
|
+
private constructor(values?: Iterable<T>) {
|
|
6
|
+
super(values);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Creates a bounded set with a positive integer limit. */
|
|
10
|
+
static withLimit<T>(limit: number, values?: Iterable<T>): FifoSet<T> {
|
|
11
|
+
if (!Number.isSafeInteger(limit) || limit <= 0) {
|
|
12
|
+
throw new TypeError(`FifoSet limit must be a positive safe integer: ${limit}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const set = new FifoSet(values);
|
|
16
|
+
set._limit = limit;
|
|
17
|
+
set.compact();
|
|
18
|
+
|
|
19
|
+
return set;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override add(value: T): this {
|
|
23
|
+
super.add(value);
|
|
24
|
+
this.compact();
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Maximum number of entries retained by this set. */
|
|
29
|
+
public get limit(): number {
|
|
30
|
+
return this._limit ?? Infinity;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Evicts oldest entries until the set is within its limit. */
|
|
34
|
+
public compact(): void {
|
|
35
|
+
while (this.size > this.limit) {
|
|
36
|
+
const head = this.values().next();
|
|
37
|
+
if (head.done) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.delete(head.value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Adds a value only if it is absent, returning whether the set changed. */
|
|
45
|
+
public addIfAbsent(value: T): boolean {
|
|
46
|
+
if (this.has(value)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
this.add(value);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fifo_set.js';
|
|
@@ -2,7 +2,7 @@ import { format } from 'util';
|
|
|
2
2
|
|
|
3
3
|
import { type Logger, createLogger } from '../../log/pino-logger.js';
|
|
4
4
|
import { type PromiseWithResolvers, promiseWithResolvers } from '../../promise/utils.js';
|
|
5
|
-
import { type ApiSchema, type ApiSchemaFor, schemaHasMethod } from '../../schemas/api.js';
|
|
5
|
+
import { type ApiSchema, type ApiSchemaFor, getSchemaReturnType, schemaHasMethod } from '../../schemas/api.js';
|
|
6
6
|
import { jsonStringify } from '../convert.js';
|
|
7
7
|
import { type JsonRpcFetch, defaultFetch } from './fetch.js';
|
|
8
8
|
|
|
@@ -236,7 +236,7 @@ export function createSafeJsonRpcClient<T extends object>(
|
|
|
236
236
|
if ([null, undefined, 'null', 'undefined'].includes(response.result)) {
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
return (schema as ApiSchema)[methodName]
|
|
239
|
+
return getSchemaReturnType((schema as ApiSchema)[methodName]).parseAsync(response.result);
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
const clientId = nextClientId++;
|