@aztec/pxe 0.0.1-commit.b8a057fa → 0.0.1-commit.be03c316
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/bin/check_oracle_version.js +3 -8
- package/dest/bin/index.d.ts +2 -2
- package/dest/bin/index.d.ts.map +1 -1
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_version_helpers.d.ts +8 -25
- package/dest/bin/oracle_version_helpers.d.ts.map +1 -1
- package/dest/bin/oracle_version_helpers.js +11 -219
- package/dest/contract/helpers.d.ts +1 -1
- package/dest/contract/helpers.d.ts.map +1 -1
- package/dest/contract/helpers.js +3 -3
- package/dest/contract/skip_sync_contracts.d.ts +11 -0
- package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
- package/dest/contract/skip_sync_contracts.js +18 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/index.d.ts +3 -3
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -2
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +7 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +7 -9
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +3 -44
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +5 -4
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +2 -2
- package/dest/contract_function_simulator/oracle/acir_callback.js +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +3 -3
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +34 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +7 -4
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +40 -13
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +87 -35
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +286 -286
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +7 -10
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +14 -8
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +61 -34
- package/dest/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +10 -4
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +10 -4
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +42 -0
- package/dest/entrypoints/server/index.d.ts +2 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -0
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +8 -2
- package/dest/hooks/index.d.ts +2 -2
- package/dest/hooks/index.d.ts.map +1 -1
- package/dest/hooks/index.js +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +3 -1
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -1
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -3
- package/dest/logs/log_service.d.ts +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +12 -3
- package/dest/messages/tx_resolver_service.d.ts +2 -2
- package/dest/messages/tx_resolver_service.d.ts.map +1 -1
- package/dest/messages/tx_resolver_service.js +7 -2
- package/dest/notes/note_service.d.ts +1 -1
- package/dest/notes/note_service.js +1 -1
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +3 -3
- package/dest/pxe.d.ts +1 -1
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +8 -5
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +26 -2
- package/dest/storage/fact_store/index.d.ts +2 -2
- package/dest/storage/fact_store/index.d.ts.map +1 -1
- package/dest/storage/fact_store/index.js +1 -1
- package/dest/storage/fact_store/origin_state.d.ts +3 -1
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -1
- package/dest/storage/fact_store/origin_state.js +7 -0
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +48 -11
- package/dest/tagging/constants.d.ts +3 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +26 -5
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +9 -4
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +60 -25
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +6 -2
- package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
- package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
- package/dest/tagging/testing/tag_query_test_utils.js +10 -0
- package/package.json +17 -17
- package/src/bin/check_oracle_version.ts +3 -10
- package/src/bin/index.ts +1 -5
- package/src/bin/oracle_version_helpers.ts +11 -268
- package/src/contract/helpers.ts +3 -3
- package/src/contract/skip_sync_contracts.ts +23 -0
- package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/index.ts +23 -3
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +8 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +11 -45
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +4 -3
- package/src/contract_function_simulator/oracle/acir_callback.ts +1 -1
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +30 -3
- package/src/contract_function_simulator/oracle/oracle_registry.ts +32 -11
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +285 -197
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +17 -12
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +92 -39
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/bundle/utils.ts +15 -3
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +15 -3
- package/src/entrypoints/client/store.ts +54 -0
- package/src/entrypoints/server/index.ts +1 -0
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +21 -7
- package/src/hooks/index.ts +1 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +3 -0
- package/src/logs/log_service.ts +11 -2
- package/src/messages/tx_resolver_service.ts +8 -8
- package/src/notes/note_service.ts +1 -1
- package/src/oracle_version.ts +3 -3
- package/src/pxe.ts +8 -5
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +1 -1
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +30 -1
- package/src/storage/fact_store/index.ts +1 -0
- package/src/storage/fact_store/origin_state.ts +9 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +62 -15
- package/src/tagging/constants.ts +27 -5
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +103 -46
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +1 -1
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +6 -2
- package/src/tagging/testing/tag_query_test_utils.ts +11 -0
package/dest/pxe.js
CHANGED
|
@@ -9,7 +9,7 @@ import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/stdlib/block';
|
|
|
9
9
|
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
10
10
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
11
|
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
12
|
-
import { deriveEcdhSharedSecretPoint } from '@aztec/stdlib/logs';
|
|
12
|
+
import { deriveEcdhSharedSecretPoint, protectFromForgery } from '@aztec/stdlib/logs';
|
|
13
13
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
14
14
|
import { inspect } from 'util';
|
|
15
15
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
@@ -498,9 +498,11 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
498
498
|
return wasAdded;
|
|
499
499
|
}
|
|
500
500
|
/**
|
|
501
|
-
* Derives the shared secret of a handshake from its ephemeral public key:
|
|
502
|
-
*
|
|
503
|
-
*
|
|
501
|
+
* Derives the shared secret of a handshake from its ephemeral public key: the raw ECDH secret
|
|
502
|
+
* `S = addressSecret(recipient) * ephPk` with the forgery protection applied,
|
|
503
|
+
* matching the protected secret the registry stores and the derivation the recipient-side scan uses for
|
|
504
|
+
* handshakes discovered onchain. The ephemeral key is reconstructed from its x-coordinate with a positive y,
|
|
505
|
+
* matching how the protocol generates it.
|
|
504
506
|
*
|
|
505
507
|
* @throws If `ephPk` is not the x-coordinate of a Grumpkin curve point, or if `recipient` is not an account of
|
|
506
508
|
* this PXE, since the derivation needs its keys.
|
|
@@ -517,7 +519,8 @@ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
|
|
|
517
519
|
}
|
|
518
520
|
const ivskM = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
519
521
|
const addressSecret = await computeAddressSecret(await completeAddress.getPreaddress(), ivskM);
|
|
520
|
-
|
|
522
|
+
const rawSecret = await deriveEcdhSharedSecretPoint(addressSecret, ephPkPoint);
|
|
523
|
+
return protectFromForgery(rawSecret, ephPkPoint, await recipient.toAddressPoint());
|
|
521
524
|
}
|
|
522
525
|
/** Registers a resolved shared secret scoped to a recipient. Returns whether it was newly added. */ async #registerSharedSecret(recipient, kind, secret) {
|
|
523
526
|
if (!await recipient.isValid()) {
|
|
@@ -12,4 +12,4 @@ export type SchemaTest = {
|
|
|
12
12
|
snapshotStore: (kvStore: AztecAsyncKVStore) => Promise<Record<string, unknown>>;
|
|
13
13
|
};
|
|
14
14
|
export declare const SCHEMA_TESTS: readonly SchemaTest[];
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hX3Rlc3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9iYWNrd2FyZHNfY29tcGF0aWJpbGl0eV90ZXN0cy9zY2hlbWFfdGVzdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUUEsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQTBDekQ7Ozs7OztHQU1HO0FBQ0gsTUFBTSxNQUFNLFVBQVUsR0FBRztJQUN2QixJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsWUFBWSxFQUFFLENBQUMsT0FBTyxFQUFFLGlCQUFpQixLQUFLLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUM1RCxhQUFhLEVBQUUsQ0FBQyxPQUFPLEVBQUUsaUJBQWlCLEtBQUssT0FBTyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEVBQUUsT0FBTyxDQUFDLENBQUMsQ0FBQztDQUNqRixDQUFDO0FBRUYsZUFBTyxNQUFNLFlBQVksRUFBRSxTQUFTLFVBQVUsRUEybEI3QyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_tests.d.ts","sourceRoot":"","sources":["../../../src/storage/backwards_compatibility_tests/schema_tests.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema_tests.d.ts","sourceRoot":"","sources":["../../../src/storage/backwards_compatibility_tests/schema_tests.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA0CzD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjF,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EA2lB7C,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/
|
|
|
13
13
|
import { CompleteAddress, SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
14
14
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
15
15
|
import { PublicKey, PublicKeys, deriveKeys } from '@aztec/stdlib/keys';
|
|
16
|
-
import { AppTaggingSecret, ContractClassLog, ContractClassLogFields, PrivateLog, PublicLog } from '@aztec/stdlib/logs';
|
|
16
|
+
import { AppTaggingSecret, AppTaggingSecretKind, ContractClassLog, ContractClassLogFields, PrivateLog, PublicLog } from '@aztec/stdlib/logs';
|
|
17
17
|
import { Note, NoteDao } from '@aztec/stdlib/note';
|
|
18
18
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
19
19
|
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
@@ -399,9 +399,13 @@ export const SCHEMA_TESTS = [
|
|
|
399
399
|
const jobId = 'fixture-job';
|
|
400
400
|
const secretA = new AppTaggingSecret(new Fr(2n), AztecAddress.fromBigIntUnsafe(3n));
|
|
401
401
|
const secretB = new AppTaggingSecret(new Fr(5n), AztecAddress.fromBigIntUnsafe(7n));
|
|
402
|
+
// A constrained secret keys under the `constrained:` prefix, so the snapshot pins both kinds side by side.
|
|
403
|
+
const secretConstrained = new AppTaggingSecret(new Fr(19n), AztecAddress.fromBigIntUnsafe(23n), AppTaggingSecretKind.CONSTRAINED);
|
|
402
404
|
await recipientTaggingStore.updateHighestFinalizedIndex(secretA, 11, jobId);
|
|
403
405
|
await recipientTaggingStore.updateHighestAgedIndex(secretA, 13, jobId);
|
|
404
406
|
await recipientTaggingStore.updateHighestFinalizedIndex(secretB, 17, jobId);
|
|
407
|
+
await recipientTaggingStore.updateHighestFinalizedIndex(secretConstrained, 11, jobId);
|
|
408
|
+
await recipientTaggingStore.updateHighestAgedIndex(secretConstrained, 13, jobId);
|
|
405
409
|
await kvStore.transactionAsync(()=>recipientTaggingStore.commit(jobId));
|
|
406
410
|
},
|
|
407
411
|
snapshotStore: async (kvStore)=>({
|
|
@@ -433,10 +437,13 @@ export const SCHEMA_TESTS = [
|
|
|
433
437
|
const secretA = new AppTaggingSecret(new Fr(2n), AztecAddress.fromBigIntUnsafe(3n));
|
|
434
438
|
const secretB = new AppTaggingSecret(new Fr(5n), AztecAddress.fromBigIntUnsafe(7n));
|
|
435
439
|
const secretC = new AppTaggingSecret(new Fr(11n), AztecAddress.fromBigIntUnsafe(13n));
|
|
440
|
+
const secretConstrained = new AppTaggingSecret(new Fr(19n), AztecAddress.fromBigIntUnsafe(23n), AppTaggingSecretKind.CONSTRAINED);
|
|
436
441
|
const txHashA = TxHash.fromBigInt(17n);
|
|
437
442
|
const txHashB = TxHash.fromBigInt(19n);
|
|
438
443
|
const txHashC = TxHash.fromBigInt(23n);
|
|
439
444
|
const txHashD = TxHash.fromBigInt(29n);
|
|
445
|
+
const txHashE = TxHash.fromBigInt(31n);
|
|
446
|
+
const txHashF = TxHash.fromBigInt(37n);
|
|
440
447
|
// secretA receives three pending ranges (one per tx); secretB receives one. After finalizing txHashA below,
|
|
441
448
|
// secretA's array shrinks to two elements (the txHashB and txHashC ranges, both with highestIndex > 3) which
|
|
442
449
|
// pins the multi-element JSON encoding of `pending_indexes`.
|
|
@@ -485,8 +492,25 @@ export const SCHEMA_TESTS = [
|
|
|
485
492
|
highestIndex: 9
|
|
486
493
|
}
|
|
487
494
|
], txHashD, jobId);
|
|
495
|
+
// secretConstrained gets a finalized range (txHashE) plus a surviving higher pending range (txHashF), so the
|
|
496
|
+
// `constrained:` key lands in both pending_indexes and last_finalized_indexes.
|
|
497
|
+
await senderTaggingStore.storePendingIndexes([
|
|
498
|
+
{
|
|
499
|
+
extendedSecret: secretConstrained,
|
|
500
|
+
lowestIndex: 1,
|
|
501
|
+
highestIndex: 3
|
|
502
|
+
}
|
|
503
|
+
], txHashE, jobId);
|
|
504
|
+
await senderTaggingStore.storePendingIndexes([
|
|
505
|
+
{
|
|
506
|
+
extendedSecret: secretConstrained,
|
|
507
|
+
lowestIndex: 4,
|
|
508
|
+
highestIndex: 7
|
|
509
|
+
}
|
|
510
|
+
], txHashF, jobId);
|
|
488
511
|
await senderTaggingStore.finalizePendingIndexes([
|
|
489
|
-
txHashA
|
|
512
|
+
txHashA,
|
|
513
|
+
txHashE
|
|
490
514
|
], jobId);
|
|
491
515
|
await kvStore.transactionAsync(()=>senderTaggingStore.commit(jobId));
|
|
492
516
|
},
|
|
@@ -2,5 +2,5 @@ export { FactStore, type FactCollection } from './fact_store.js';
|
|
|
2
2
|
export { FactService } from './fact_service.js';
|
|
3
3
|
export { FactCollectionKey, FactCollectionTypeKey, type OriginBlock } from './fact_store_keys.js';
|
|
4
4
|
export type { Fact } from './stored_fact.js';
|
|
5
|
-
export { OriginBlockState, classifyOriginBlockState, anchoredTipBlockNumbers, toFactWithOriginState, type TipBlockNumbers, type RetractableFactOrigin, type FactWithOriginState, type FactCollectionWithOriginState, } from './origin_state.js';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
export { OriginBlockState, classifyOriginBlockState, originBlockStateFromNumber, anchoredTipBlockNumbers, toFactWithOriginState, type TipBlockNumbers, type RetractableFactOrigin, type FactWithOriginState, type FactCollectionWithOriginState, } from './origin_state.js';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2ZhY3Rfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLGNBQWMsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ2pFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNoRCxPQUFPLEVBQUUsaUJBQWlCLEVBQUUscUJBQXFCLEVBQUUsS0FBSyxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUNsRyxZQUFZLEVBQUUsSUFBSSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0MsT0FBTyxFQUNMLGdCQUFnQixFQUNoQix3QkFBd0IsRUFDeEIsMEJBQTBCLEVBQzFCLHVCQUF1QixFQUN2QixxQkFBcUIsRUFDckIsS0FBSyxlQUFlLEVBQ3BCLEtBQUsscUJBQXFCLEVBQzFCLEtBQUssbUJBQW1CLEVBQ3hCLEtBQUssNkJBQTZCLEdBQ25DLE1BQU0sbUJBQW1CLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/fact_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAClG,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,GACnC,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/fact_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAClG,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,GACnC,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { FactStore } from './fact_store.js';
|
|
2
2
|
export { FactService } from './fact_service.js';
|
|
3
3
|
export { FactCollectionKey, FactCollectionTypeKey } from './fact_store_keys.js';
|
|
4
|
-
export { OriginBlockState, classifyOriginBlockState, anchoredTipBlockNumbers, toFactWithOriginState } from './origin_state.js';
|
|
4
|
+
export { OriginBlockState, classifyOriginBlockState, originBlockStateFromNumber, anchoredTipBlockNumbers, toFactWithOriginState } from './origin_state.js';
|
|
@@ -18,6 +18,8 @@ export declare enum OriginBlockState {
|
|
|
18
18
|
Proven = 2,
|
|
19
19
|
Finalized = 3
|
|
20
20
|
}
|
|
21
|
+
/** Parses a numeric origin-block-state discriminant, rejecting unknown values. */
|
|
22
|
+
export declare function originBlockStateFromNumber(value: number): OriginBlockState;
|
|
21
23
|
/** The two chain-tip block numbers needed to classify an origin block (`finalized <= proven` always holds). */
|
|
22
24
|
export type TipBlockNumbers = {
|
|
23
25
|
provenBlockNumber: number;
|
|
@@ -54,4 +56,4 @@ export type FactCollectionWithOriginState = {
|
|
|
54
56
|
export declare function classifyOriginBlockState(blockNumber: number, tips: TipBlockNumbers): OriginBlockState;
|
|
55
57
|
/** Enriches a stored fact with the chain state of its origin block (when retractable). */
|
|
56
58
|
export declare function toFactWithOriginState(fact: Fact, tips: TipBlockNumbers): FactWithOriginState;
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JpZ2luX3N0YXRlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9mYWN0X3N0b3JlL29yaWdpbl9zdGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVsRCxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUMzRSxPQUFPLEtBQUssRUFBRSxJQUFJLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUU3Qzs7Ozs7Ozs7OztHQVVHO0FBQ0gsb0JBQVksZ0JBQWdCO0lBQzFCLE9BQU8sS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E,GAAG,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,mBAAmB,EAAE,CAAA;CAAE,CAAC;AAErG;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,gBAAgB,CAQrG;AAED,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,GAAG,mBAAmB,CAS5F"}
|
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
OriginBlockState[OriginBlockState["Finalized"] = 3] = "Finalized";
|
|
15
15
|
return OriginBlockState;
|
|
16
16
|
}({});
|
|
17
|
+
/** Parses a numeric origin-block-state discriminant, rejecting unknown values. */ export function originBlockStateFromNumber(value) {
|
|
18
|
+
if (!(value in OriginBlockState)) {
|
|
19
|
+
const validNames = Object.keys(OriginBlockState).filter((k)=>isNaN(Number(k)));
|
|
20
|
+
throw new Error(`Invalid OriginBlockState value ${value}, expected one of ${validNames.join(', ')}`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
17
24
|
/**
|
|
18
25
|
* Projects the live chain tips to the block numbers used for classification, capped at the anchor block.
|
|
19
26
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PXE_DATA_SCHEMA_VERSION =
|
|
1
|
+
export declare const PXE_DATA_SCHEMA_VERSION = 13;
|
|
2
2
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YWRhdGEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL21ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSx1QkFBdUIsS0FBSyxDQUFDIn0=
|
package/dest/storage/metadata.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PXE_DATA_SCHEMA_VERSION =
|
|
1
|
+
export const PXE_DATA_SCHEMA_VERSION = 13;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
+
/** The triple that determine which physical store a logical store name maps to. */
|
|
4
|
+
export type StoreIdentity = {
|
|
5
|
+
/** Chain ID of the L1 the rollup is deployed to. */
|
|
6
|
+
l1ChainId: number;
|
|
7
|
+
/** Address of the rollup contract the store's data pertains to. */
|
|
8
|
+
rollupAddress: EthAddress;
|
|
9
|
+
/** Schema version of the data held in the store. */
|
|
10
|
+
schemaVersion: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Composes the store-name discriminator for a store identity. Two identities map to the same physical store iff
|
|
14
|
+
* their slugs are equal, so the format must stay stable: `<l1ChainId>-<rollupAddress>-v<schemaVersion>` — changing
|
|
15
|
+
* it orphans every existing store.
|
|
16
|
+
*/
|
|
17
|
+
export declare function storeIdentitySlug({ l1ChainId, rollupAddress, schemaVersion }: StoreIdentity): string;
|
|
18
|
+
/** Composes the physical store name for a logical store name and identity. */
|
|
19
|
+
export declare function effectiveStoreName(name: string, identity: StoreIdentity): string;
|
|
20
|
+
/**
|
|
21
|
+
* Invariant check for stores whose physical name carries their identity: the recorded version can
|
|
22
|
+
* only disagree with the expected one if there is a store-naming bug.
|
|
23
|
+
*/
|
|
24
|
+
export declare function assertStoreIdentity(store: AztecAsyncKVStore, storeName: string, identity: StoreIdentity): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when a store's recorded identity does not match the identity it was opened under. Since the identity is
|
|
27
|
+
* part of the physical store name, this can only indicate a store-naming bug; the store is left untouched.
|
|
28
|
+
*/
|
|
29
|
+
export declare class StoreIdentityMismatchError extends Error {
|
|
30
|
+
readonly storeName: string;
|
|
31
|
+
readonly expected: string;
|
|
32
|
+
readonly actual: string;
|
|
33
|
+
constructor(storeName: string,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F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DatabaseVersion } from '@aztec/stdlib/database-version/version';
|
|
2
|
+
/**
|
|
3
|
+
* Composes the store-name discriminator for a store identity. Two identities map to the same physical store iff
|
|
4
|
+
* their slugs are equal, so the format must stay stable: `<l1ChainId>-<rollupAddress>-v<schemaVersion>` — changing
|
|
5
|
+
* it orphans every existing store.
|
|
6
|
+
*/ export function storeIdentitySlug({ l1ChainId, rollupAddress, schemaVersion }) {
|
|
7
|
+
return `${l1ChainId}-${rollupAddress.toString()}-v${schemaVersion}`;
|
|
8
|
+
}
|
|
9
|
+
/** Composes the physical store name for a logical store name and identity. */ export function effectiveStoreName(name, identity) {
|
|
10
|
+
return `${name}_${storeIdentitySlug(identity)}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Invariant check for stores whose physical name carries their identity: the recorded version can
|
|
14
|
+
* only disagree with the expected one if there is a store-naming bug.
|
|
15
|
+
*/ export async function assertStoreIdentity(store, storeName, identity) {
|
|
16
|
+
const expected = new DatabaseVersion(identity.schemaVersion, identity.rollupAddress);
|
|
17
|
+
const singleton = store.openSingleton('dbVersion');
|
|
18
|
+
const stored = await singleton.getAsync();
|
|
19
|
+
if (stored === undefined) {
|
|
20
|
+
await singleton.set(expected.toBuffer().toString('utf-8'));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
let storedVersion;
|
|
24
|
+
try {
|
|
25
|
+
storedVersion = DatabaseVersion.fromBuffer(Buffer.from(stored, 'utf-8'));
|
|
26
|
+
} catch {
|
|
27
|
+
throw new StoreIdentityMismatchError(storeName, expected.toString(), stored);
|
|
28
|
+
}
|
|
29
|
+
if (!storedVersion.equals(expected)) {
|
|
30
|
+
throw new StoreIdentityMismatchError(storeName, expected.toString(), storedVersion.toString());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when a store's recorded identity does not match the identity it was opened under. Since the identity is
|
|
35
|
+
* part of the physical store name, this can only indicate a store-naming bug; the store is left untouched.
|
|
36
|
+
*/ export class StoreIdentityMismatchError extends Error {
|
|
37
|
+
storeName;
|
|
38
|
+
expected;
|
|
39
|
+
actual;
|
|
40
|
+
constructor(storeName, expected, actual){
|
|
41
|
+
super(`Store '${storeName}' records identity ${actual} but was opened as ${expected}. ` + `Refusing to open; data was NOT modified.`), this.storeName = storeName, this.expected = expected, this.actual = actual;
|
|
42
|
+
this.name = 'StoreIdentityMismatchError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -19,10 +19,11 @@ export declare class SenderTaggingStore implements StagedStore {
|
|
|
19
19
|
commit(jobId: string): Promise<void>;
|
|
20
20
|
discardStaged(jobId: string): Promise<void>;
|
|
21
21
|
/**
|
|
22
|
-
* Stores pending index ranges.
|
|
22
|
+
* Stores pending index ranges, rejecting any range that disagrees with an already-stored one.
|
|
23
23
|
* @remarks If the same (secret, txHash) pair already exists in the db with an equal range, it's a no-op. This is
|
|
24
24
|
* expected to happen because whenever we start sync we start from the last finalized index and we can have pending
|
|
25
|
-
* ranges already stored from previous syncs. If the ranges differ, it throws an error as that indicates a bug
|
|
25
|
+
* ranges already stored from previous syncs. If the ranges differ, it throws an error as that indicates a bug in
|
|
26
|
+
* callers that record indexes at prove time. Discovery from onchain logs must use `mergePendingIndexes` instead.
|
|
26
27
|
* @param ranges - The tagging index ranges containing the directional app tagging secrets and the index ranges that are
|
|
27
28
|
* to be stored in the db.
|
|
28
29
|
* @param txHash - The tx in which the tagging indexes were used in private logs.
|
|
@@ -32,6 +33,21 @@ export declare class SenderTaggingStore implements StagedStore {
|
|
|
32
33
|
* @throws If a different range already exists for the same (secret, txHash) pair.
|
|
33
34
|
*/
|
|
34
35
|
storePendingIndexes(ranges: TaggingIndexRange[], txHash: TxHash, jobId: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Stores pending index ranges, widening an existing entry for the same (secret, txHash) pair to the union of the
|
|
38
|
+
* stored and incoming ranges instead of throwing on a mismatch. Discovery from onchain logs needs this: it may see
|
|
39
|
+
* only the surviving (non-revertible phase) sub-range of a partially reverted tx recorded at prove time (the
|
|
40
|
+
* finalized receipt step of the sync resolves that difference), or indexes beyond a partially discovered entry
|
|
41
|
+
* when a tx from another PXE straddles a sync window boundary. Callers that record indexes at prove time must use
|
|
42
|
+
* `storePendingIndexes` instead, so that a range disagreement surfaces as a bug rather than being absorbed.
|
|
43
|
+
* @param ranges - The tagging index ranges containing the directional app tagging secrets and the index ranges that are
|
|
44
|
+
* to be stored in the db.
|
|
45
|
+
* @param txHash - The tx in which the tagging indexes were used in private logs.
|
|
46
|
+
* @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
|
|
47
|
+
* @throws If the highestIndex is further than window length from the highest finalized index for the same secret.
|
|
48
|
+
* @throws If the lowestIndex is lower than or equal to the last finalized index for the same secret.
|
|
49
|
+
*/
|
|
50
|
+
mergePendingIndexes(ranges: TaggingIndexRange[], txHash: TxHash, jobId: string): Promise<void>;
|
|
35
51
|
/**
|
|
36
52
|
* Returns the transaction hashes of all pending transactions that contain highest indexes within a specified range
|
|
37
53
|
* for a given directional app tagging secret. We check based on the highest indexes only as that is the relevant
|
|
@@ -75,4 +91,4 @@ export declare class SenderTaggingStore implements StagedStore {
|
|
|
75
91
|
*/
|
|
76
92
|
finalizePendingIndexesOfAPartiallyRevertedTx(txEffect: TxEffect, jobId: string): Promise<void>;
|
|
77
93
|
}
|
|
78
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
94
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyX3RhZ2dpbmdfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL3RhZ2dpbmdfc3RvcmUvc2VuZGVyX3RhZ2dpbmdfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FB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;;;;;;;OAaG;IACH,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7F;IA6FD;;;;;;;;;OASG;IACH,2BAA2B,CACzB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnB;IAED;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE1F;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiBrF;IAED;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CnE;IA4CD;;;OAGG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD7E;IAED;;;;;;;OAOG;IACG,4CAA4C,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgDnG;CACF"}
|
|
@@ -100,10 +100,11 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.
|
|
|
100
100
|
return Promise.resolve();
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
|
-
* Stores pending index ranges.
|
|
103
|
+
* Stores pending index ranges, rejecting any range that disagrees with an already-stored one.
|
|
104
104
|
* @remarks If the same (secret, txHash) pair already exists in the db with an equal range, it's a no-op. This is
|
|
105
105
|
* expected to happen because whenever we start sync we start from the last finalized index and we can have pending
|
|
106
|
-
* ranges already stored from previous syncs. If the ranges differ, it throws an error as that indicates a bug
|
|
106
|
+
* ranges already stored from previous syncs. If the ranges differ, it throws an error as that indicates a bug in
|
|
107
|
+
* callers that record indexes at prove time. Discovery from onchain logs must use `mergePendingIndexes` instead.
|
|
107
108
|
* @param ranges - The tagging index ranges containing the directional app tagging secrets and the index ranges that are
|
|
108
109
|
* to be stored in the db.
|
|
109
110
|
* @param txHash - The tx in which the tagging indexes were used in private logs.
|
|
@@ -112,6 +113,25 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.
|
|
|
112
113
|
* @throws If the lowestIndex is lower than or equal to the last finalized index for the same secret.
|
|
113
114
|
* @throws If a different range already exists for the same (secret, txHash) pair.
|
|
114
115
|
*/ storePendingIndexes(ranges, txHash, jobId) {
|
|
116
|
+
return this.#storePendingIndexes(ranges, txHash, jobId, false);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Stores pending index ranges, widening an existing entry for the same (secret, txHash) pair to the union of the
|
|
120
|
+
* stored and incoming ranges instead of throwing on a mismatch. Discovery from onchain logs needs this: it may see
|
|
121
|
+
* only the surviving (non-revertible phase) sub-range of a partially reverted tx recorded at prove time (the
|
|
122
|
+
* finalized receipt step of the sync resolves that difference), or indexes beyond a partially discovered entry
|
|
123
|
+
* when a tx from another PXE straddles a sync window boundary. Callers that record indexes at prove time must use
|
|
124
|
+
* `storePendingIndexes` instead, so that a range disagreement surfaces as a bug rather than being absorbed.
|
|
125
|
+
* @param ranges - The tagging index ranges containing the directional app tagging secrets and the index ranges that are
|
|
126
|
+
* to be stored in the db.
|
|
127
|
+
* @param txHash - The tx in which the tagging indexes were used in private logs.
|
|
128
|
+
* @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
|
|
129
|
+
* @throws If the highestIndex is further than window length from the highest finalized index for the same secret.
|
|
130
|
+
* @throws If the lowestIndex is lower than or equal to the last finalized index for the same secret.
|
|
131
|
+
*/ mergePendingIndexes(ranges, txHash, jobId) {
|
|
132
|
+
return this.#storePendingIndexes(ranges, txHash, jobId, true);
|
|
133
|
+
}
|
|
134
|
+
#storePendingIndexes(ranges, txHash, jobId, mergeExisting) {
|
|
115
135
|
if (ranges.length === 0) {
|
|
116
136
|
return Promise.resolve();
|
|
117
137
|
}
|
|
@@ -144,21 +164,38 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.
|
|
|
144
164
|
}
|
|
145
165
|
// Check if an entry with the same txHash already exists
|
|
146
166
|
const existingEntry = pendingData.find((entry)=>entry.txHash === txHashStr);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
throw new Error(`Conflicting range for secret ${secretStr} and txHash ${txHashStr}: ` + `existing [${existingEntry.lowestIndex}, ${existingEntry.highestIndex}] vs ` + `new [${range.lowestIndex}, ${range.highestIndex}]`);
|
|
151
|
-
}
|
|
152
|
-
// Exact duplicate — skip
|
|
153
|
-
} else {
|
|
154
|
-
this.#writePendingIndexes(jobId, secretStr, [
|
|
167
|
+
let updatedPending;
|
|
168
|
+
if (!existingEntry) {
|
|
169
|
+
updatedPending = [
|
|
155
170
|
...pendingData,
|
|
156
171
|
{
|
|
157
172
|
lowestIndex: range.lowestIndex,
|
|
158
173
|
highestIndex: range.highestIndex,
|
|
159
174
|
txHash: txHashStr
|
|
160
175
|
}
|
|
161
|
-
]
|
|
176
|
+
];
|
|
177
|
+
} else if (mergeExisting) {
|
|
178
|
+
// Widen the entry to the union of both ranges, never shrink it: replacing would drop prove-time
|
|
179
|
+
// indexes the chain doesn't show (partially reverted tx), and skipping would drop onchain indexes
|
|
180
|
+
// discovered in a later sync window (tx straddling the window boundary).
|
|
181
|
+
const lowestIndex = Math.min(existingEntry.lowestIndex, range.lowestIndex);
|
|
182
|
+
const highestIndex = Math.max(existingEntry.highestIndex, range.highestIndex);
|
|
183
|
+
if (lowestIndex !== existingEntry.lowestIndex || highestIndex !== existingEntry.highestIndex) {
|
|
184
|
+
updatedPending = pendingData.map((entry)=>entry === existingEntry ? {
|
|
185
|
+
lowestIndex,
|
|
186
|
+
highestIndex,
|
|
187
|
+
txHash: entry.txHash
|
|
188
|
+
} : entry);
|
|
189
|
+
}
|
|
190
|
+
} else if (existingEntry.lowestIndex !== range.lowestIndex || existingEntry.highestIndex !== range.highestIndex) {
|
|
191
|
+
// Different ranges for the same (secret, txHash) indicate a bug in callers that record indexes at prove
|
|
192
|
+
// time.
|
|
193
|
+
throw new Error(`Conflicting range for secret ${secretStr} and txHash ${txHashStr}: ` + `existing [${existingEntry.lowestIndex}, ${existingEntry.highestIndex}] vs ` + `new [${range.lowestIndex}, ${range.highestIndex}]`);
|
|
194
|
+
}
|
|
195
|
+
// Remaining cases (a merge whose union equals the stored range, or an identical range without
|
|
196
|
+
// mergeExisting): duplicate evidence, nothing to write.
|
|
197
|
+
if (updatedPending) {
|
|
198
|
+
this.#writePendingIndexes(jobId, secretStr, updatedPending);
|
|
162
199
|
}
|
|
163
200
|
}
|
|
164
201
|
});
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN
|
|
2
|
-
|
|
1
|
+
export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN: number;
|
|
2
|
+
export declare const INITIAL_CONSTRAINED_PROBE_LEN = 2;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUJBLGVBQU8sTUFBTSxzQ0FBc0MsUUFBK0IsQ0FBQztBQVVuRixlQUFPLE1BQU0sNkJBQTZCLElBQUksQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sCAAsC,QAA+B,CAAC;AAUnF,eAAO,MAAM,6BAA6B,IAAI,CAAC"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
-
// This window
|
|
3
|
-
// secret
|
|
2
|
+
// This window bounds how far a sender's next tag index for a directional app tagging secret can run ahead of that
|
|
3
|
+
// secret's highest finalized index before `PXE::proveTx` throws.
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
5
|
+
// MAX_PRIVATE_LOGS_PER_TX is a floor for ordinary transaction patterns: the private kernel accumulates every
|
|
6
|
+
// surviving private log into a single tx-wide array of exactly this size, so a fresh secret's very first
|
|
7
|
+
// ordinary tx can consume that many indexes before anything is finalized.
|
|
8
|
+
//
|
|
9
|
+
// The +20 on top is headroom for multiple pending ordinary txs to the same counterparty stacking up
|
|
10
|
+
// before the first one is observed as mined. Only a run of near-MAX_PRIVATE_LOGS_PER_TX txs back-to-back would
|
|
11
|
+
// exhaust this; ordinary transfers use far fewer logs per tx, so the same margin covers many more of those. Keep the
|
|
12
|
+
// margin additive rather than another multiple of the floor. A larger window also makes recipient-side sync more
|
|
13
|
+
// expensive, since discovery has to probe ahead of the last finalized index for every active secret.
|
|
14
|
+
//
|
|
15
|
+
// TODO(F-783): MAX_PRIVATE_LOGS_PER_TX is not a hard ceiling in general — a tx that creates and nullifies (squashes)
|
|
16
|
+
// many notes/logs to the same secret can drive that secret's raw tag index arbitrarily higher, since indexes are
|
|
17
|
+
// reserved at log emission time, before squashing is decided, and the kernel's reset/squash loop is not bounded by
|
|
18
|
+
// MAX_PRIVATE_LOGS_PER_TX. No fixed window value closes that gap.
|
|
19
|
+
export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = MAX_PRIVATE_LOGS_PER_TX + 20;
|
|
20
|
+
// The number of tags probed per constrained secret in the first round.
|
|
21
|
+
//
|
|
22
|
+
// The probe doubles each round (2, 4, 8, ..., capped at UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) while every probed
|
|
23
|
+
// index is a hit, stopping at the first missing tag. Constrained delivery is gapless, so a single missing tag proves
|
|
24
|
+
// the stream has ended: at steady state this turns a full WINDOW_LEN probe into two tags. A secret K logs behind
|
|
25
|
+
// catches up in ~log2(K) round-trips while the probe is still doubling (2, 4, 8, 16, 32), but once it saturates the cap
|
|
26
|
+
// and advances WINDOW_LEN tags per round, deeper catch-up is linear at ~K/WINDOW_LEN rounds. Either way it beats both
|
|
27
|
+
// the full window every round and one round per log.
|
|
28
|
+
export const INITIAL_CONSTRAINED_PROBE_LEN = 2;
|
package/dest/tagging/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
|
|
12
12
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
13
13
|
export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
|
|
14
|
-
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
14
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN, INITIAL_CONSTRAINED_PROBE_LEN } from './constants.js';
|
|
15
15
|
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
16
16
|
export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
17
17
|
export { type PreTag, type TaggingIndexRange } from '@aztec/stdlib/logs';
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxvQ0FBb0MsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ2hHLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSw2QkFBNkIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3ZHLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEUsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLEtBQUssaUJBQWlCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dest/tagging/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/ export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
|
|
11
11
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
12
12
|
export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
|
|
13
|
-
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
13
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN, INITIAL_CONSTRAINED_PROBE_LEN } from './constants.js';
|
|
14
14
|
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
15
15
|
// Re-export tagging-related types from stdlib
|
|
16
16
|
export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
@@ -54,9 +54,14 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
|
|
|
54
54
|
* - The lower bound is `highestFinalizedIndex + 1`. The `highestAgedIndex` mechanism is unnecessary because
|
|
55
55
|
* the nullifier chain prevents out-of-order index usage: no device can fill in a lower index after a higher
|
|
56
56
|
* one is already on-chain.
|
|
57
|
-
* -
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* - Because the sequence is gapless, the scan stops at the first missing index: that gap proves the sequence has
|
|
58
|
+
* ended and no further logs exist. We exploit this with a doubling first-miss probe (see
|
|
59
|
+
* `INITIAL_CONSTRAINED_PROBE_LEN` in ../constants.ts), so a
|
|
60
|
+
* steady-state sync with no new logs costs two tags instead of the whole window. The probe length is in-memory
|
|
61
|
+
* state scoped to one sync call, so every sync restarts at the initial probe.
|
|
62
|
+
* - The upper bound is the same as unconstrained: `highestFinalizedIndex + WINDOW_LEN`. Advancing the probe is
|
|
63
|
+
* decoupled from persisting the finalized index, so unfinalized logs at the top of the run are still fetched
|
|
64
|
+
* while only the finalized prefix is persisted.
|
|
60
65
|
*
|
|
61
66
|
* # Batching across secrets
|
|
62
67
|
*
|
|
@@ -66,4 +71,4 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
|
|
|
66
71
|
* advanced are kept for the next iteration.
|
|
67
72
|
*/
|
|
68
73
|
export declare function syncTaggedPrivateLogs(secrets: AppTaggingSecret[], aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockHeader: BlockHeader, finalizedBlockNumber: BlockNumber, jobId: string): Promise<LogResult[]>;
|
|
69
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
74
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY190YWdnZWRfcHJpdmF0ZV9sb2dzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9yZWNpcGllbnRfc3luYy9zeW5jX3RhZ2dlZF9wcml2YXRlX2xvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRzlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFLcEc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWtFRztBQUNILHdCQUFzQixxQkFBcUIsQ0FDekMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLEVBQzNCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxxQkFBcUIsRUFDbkMsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixvQkFBb0IsRUFBRSxXQUFXLEVBQ2pDLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDLFNBQVMsRUFBRSxDQUFDLENBcUR0QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync_tagged_private_logs.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/sync_tagged_private_logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG
|
|
1
|
+
{"version":3,"file":"sync_tagged_private_logs.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/sync_tagged_private_logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,oBAAoB,EAAE,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC,CAqDtB"}
|