@aztec-labs/pxe 6.0.0-rc.1 → 6.0.0-rc.3

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 (67) hide show
  1. package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
  2. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  3. package/dest/contract_function_simulator/contract_function_simulator.js +7 -1
  4. package/dest/contract_function_simulator/index.d.ts +3 -1
  5. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/noir-structs/note_origin.d.ts +10 -0
  7. package/dest/contract_function_simulator/noir-structs/note_origin.d.ts.map +1 -0
  8. package/dest/contract_function_simulator/noir-structs/note_origin.js +1 -0
  9. package/dest/contract_function_simulator/noir-structs/nullifier_status.d.ts +9 -0
  10. package/dest/contract_function_simulator/noir-structs/nullifier_status.d.ts.map +1 -0
  11. package/dest/contract_function_simulator/noir-structs/nullifier_status.js +1 -0
  12. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +5 -2
  13. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/oracle/acir_callback.js +10 -10
  15. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +6 -5
  16. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/oracle/oracle_registry.js +37 -16
  18. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +9 -3
  19. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +31 -1
  21. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +3 -2
  22. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +16 -8
  24. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +26 -10
  25. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +60 -14
  27. package/dest/operation_queue.d.ts +6 -1
  28. package/dest/operation_queue.d.ts.map +1 -1
  29. package/dest/operation_queue.js +33 -3
  30. package/dest/oracle_version.d.ts +3 -3
  31. package/dest/oracle_version.js +3 -3
  32. package/dest/storage/fact_store/fact_service.d.ts +3 -3
  33. package/dest/storage/fact_store/fact_service.d.ts.map +1 -1
  34. package/dest/storage/fact_store/fact_store.d.ts +3 -3
  35. package/dest/storage/fact_store/fact_store.d.ts.map +1 -1
  36. package/dest/storage/fact_store/fact_store_keys.d.ts +3 -5
  37. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -1
  38. package/dest/storage/fact_store/index.d.ts +2 -2
  39. package/dest/storage/fact_store/index.d.ts.map +1 -1
  40. package/dest/storage/fact_store/origin_state.d.ts +3 -3
  41. package/dest/storage/fact_store/origin_state.d.ts.map +1 -1
  42. package/dest/storage/fact_store/stored_fact.d.ts +5 -5
  43. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -1
  44. package/package.json +18 -18
  45. package/src/contract_function_simulator/contract_function_simulator.ts +6 -1
  46. package/src/contract_function_simulator/index.ts +2 -0
  47. package/src/contract_function_simulator/noir-structs/note_origin.ts +11 -0
  48. package/src/contract_function_simulator/noir-structs/nullifier_status.ts +9 -0
  49. package/src/contract_function_simulator/oracle/acir_callback.ts +25 -14
  50. package/src/contract_function_simulator/oracle/oracle_registry.ts +26 -16
  51. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +20 -2
  52. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +13 -10
  53. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +91 -16
  54. package/src/operation_queue.ts +36 -5
  55. package/src/oracle_version.ts +3 -3
  56. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
  57. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
  58. package/src/storage/fact_store/fact_service.ts +2 -2
  59. package/src/storage/fact_store/fact_store.ts +2 -2
  60. package/src/storage/fact_store/fact_store_keys.ts +2 -4
  61. package/src/storage/fact_store/index.ts +1 -1
  62. package/src/storage/fact_store/origin_state.ts +2 -2
  63. package/src/storage/fact_store/stored_fact.ts +3 -3
  64. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +0 -11
  65. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +0 -1
  66. package/dest/contract_function_simulator/noir-structs/origin_block.js +0 -5
  67. package/src/contract_function_simulator/noir-structs/origin_block.ts +0 -8
@@ -5,7 +5,7 @@ import {
5
5
  PRIVATE_LOG_CIPHERTEXT_LEN,
6
6
  } from '@aztec-labs/constants';
7
7
  import type { BlockNumber } from '@aztec-labs/foundation/branded-types';
8
- import { uniqueBy } from '@aztec-labs/foundation/collection';
8
+ import { chunk, uniqueBy } from '@aztec-labs/foundation/collection';
9
9
  import { Aes128 } from '@aztec-labs/foundation/crypto/aes128';
10
10
  import { Fr } from '@aztec-labs/foundation/curves/bn254';
11
11
  import { Point } from '@aztec-labs/foundation/curves/grumpkin';
@@ -28,12 +28,16 @@ import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
28
28
  import { BlockHash, type BlockParameter, type L2TipsProvider } from '@aztec-labs/stdlib/block';
29
29
  import type { CompleteAddress, ContractInstancePreimageWithAddress, PartialAddress } from '@aztec-labs/stdlib/contract';
30
30
  import { siloNullifier } from '@aztec-labs/stdlib/hash';
31
- import type { AztecNode } from '@aztec-labs/stdlib/interfaces/server';
31
+ import { type AztecNode, MAX_RPC_LEN } from '@aztec-labs/stdlib/interfaces/client';
32
32
  import type { KeyValidationRequest } from '@aztec-labs/stdlib/kernel';
33
33
  import { PublicKeys, computeAddressSecret, hashPublicKey } from '@aztec-labs/stdlib/keys';
34
34
  import { AppTaggingSecret, FlatPublicLogs, appSiloEcdhSharedSecret } from '@aztec-labs/stdlib/logs';
35
- import { type UnsiloedMessageNullifier, getL1ToL2MessageWitness } from '@aztec-labs/stdlib/messaging';
36
- import type { NoteStatus } from '@aztec-labs/stdlib/note';
35
+ import {
36
+ type UnsiloedMessageNullifier,
37
+ getL1ToL2MessageWitness,
38
+ lookUpL1ToL2MessageWitness,
39
+ } from '@aztec-labs/stdlib/messaging';
40
+ import { NoteStatus } from '@aztec-labs/stdlib/note';
37
41
  import { MerkleTreeId } from '@aztec-labs/stdlib/trees';
38
42
  import {
39
43
  type BlockHeader,
@@ -58,7 +62,7 @@ import type { AddressStore } from '../../storage/address_store/address_store.js'
58
62
  import { assertAllowedScope } from '../../storage/allowed_scopes.js';
59
63
  import type { CapsuleService } from '../../storage/capsule_store/capsule_service.js';
60
64
  import { FactCollectionKey, FactCollectionTypeKey, anchoredTipBlockNumbers } from '../../storage/fact_store/index.js';
61
- import type { FactService, OriginBlock } from '../../storage/fact_store/index.js';
65
+ import type { BlockReference, FactService } from '../../storage/fact_store/index.js';
62
66
  import type { NoteStore } from '../../storage/note_store/note_store.js';
63
67
  import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
64
68
  import type { ChangeSetId } from '../../storage/staged_write_coordinator.js';
@@ -74,11 +78,13 @@ import { type FactCollection, emptyFactCollection, toNoirFactCollection } from '
74
78
  import type { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
75
79
  import type { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
76
80
  import type { NoteData } from '../noir-structs/note_data.js';
81
+ import type { NoteOrigin } from '../noir-structs/note_origin.js';
77
82
  import type { NoteValidationRequest } from '../noir-structs/note_validation_request.js';
78
83
  import {
79
84
  type NullifierMembershipWitnessData,
80
85
  toNullifierMembershipWitnessData,
81
86
  } from '../noir-structs/nullifier_membership_witness_data.js';
87
+ import type { NullifierStatus } from '../noir-structs/nullifier_status.js';
82
88
  import { Option } from '../noir-structs/option.js';
83
89
  import type { PendingTaggedLog } from '../noir-structs/pending_tagged_log.js';
84
90
  import type { ProvidedSecret } from '../noir-structs/provided_secret.js';
@@ -506,17 +512,65 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
506
512
  }
507
513
 
508
514
  /**
509
- * Check if a nullifier exists in the nullifier tree.
510
- * @param innerNullifier - The inner nullifier.
511
- * @returns A boolean indicating whether the nullifier exists in the tree or not.
515
+ * Returns the tx and block in which a settled note of the executing contract was created, or `None` if no such note
516
+ * is known. Nullified notes are also returned.
512
517
  */
513
- public async doesNullifierExist(innerNullifier: Fr) {
514
- const [nullifier, anchor] = await allToCompletion([
515
- siloNullifier(this.contractAddress, innerNullifier!),
516
- this.anchorBlockHeader.toBlockParameter(),
517
- ]);
518
- const [leafIndex] = await this.aztecNode.findLeavesIndexes(anchor, MerkleTreeId.NULLIFIER_TREE, [nullifier]);
519
- return leafIndex?.data !== undefined;
518
+ public async getSettledNoteOrigin(
519
+ noteHash: Fr,
520
+ contractAddress: AztecAddress,
521
+ noteNonce: Fr,
522
+ ): Promise<Option<NoteOrigin>> {
523
+ this.#assertOwnContract(contractAddress);
524
+
525
+ // The store is only indexed by contract, so this scans all of the contract's notes. The query is rare enough and
526
+ // stores are small enough that this is not a concern.
527
+ const notes = await this.noteStore.getNotes(
528
+ { contractAddress, status: NoteStatus.ACTIVE_OR_NULLIFIED, scopes: this.scopes },
529
+ this.changeSetId,
530
+ );
531
+ const note = notes.find(note => note.noteHash.equals(noteHash) && note.noteNonce.equals(noteNonce));
532
+
533
+ return note
534
+ ? Option.some({
535
+ txHash: note.txHash.hash,
536
+ block: { blockNumber: note.l2BlockNumber, blockHash: Fr.fromHexString(note.l2BlockHash) },
537
+ })
538
+ : Option.none();
539
+ }
540
+
541
+ /**
542
+ * Returns the status of each inner nullifier: whether it exists in the nullifier tree at the anchor block and, if
543
+ * so, the block it was inserted in. Results are aligned with the input.
544
+ */
545
+ public async getNullifierStatuses(innerNullifiers: EphemeralArray<Fr>): Promise<EphemeralArray<NullifierStatus>> {
546
+ const siloedNullifiers = await allToCompletion(
547
+ innerNullifiers
548
+ .readAll(this.ephemeralArrayService)
549
+ .map(innerNullifier => siloNullifier(this.contractAddress, innerNullifier)),
550
+ );
551
+ const statuses = await this.getSiloedNullifierStatuses(siloedNullifiers);
552
+ return EphemeralArray.fromValues(this.ephemeralArrayService, statuses);
553
+ }
554
+
555
+ /** Looks up siloed nullifiers in the nullifier tree at the anchor block, returning one status per input. */
556
+ protected async getSiloedNullifierStatuses(siloedNullifiers: Fr[]): Promise<NullifierStatus[]> {
557
+ const anchor = await this.anchorBlockHeader.toBlockParameter();
558
+ const leaves = (
559
+ await allToCompletion(
560
+ chunk(siloedNullifiers, MAX_RPC_LEN).map(batch =>
561
+ this.aztecNode.findLeavesIndexes(anchor, MerkleTreeId.NULLIFIER_TREE, batch),
562
+ ),
563
+ )
564
+ ).flat();
565
+ return leaves.map(
566
+ (leaf): NullifierStatus =>
567
+ leaf
568
+ ? {
569
+ exists: true,
570
+ originBlock: Option.some({ blockNumber: leaf.l2BlockNumber, blockHash: leaf.l2BlockHash.toFr() }),
571
+ }
572
+ : { exists: false, originBlock: Option.none() },
573
+ );
520
574
  }
521
575
 
522
576
  /**
@@ -537,6 +591,27 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
537
591
  return new MembershipWitness(L1_TO_L2_MSG_TREE_HEIGHT, messageIndex, siblingPath.toTuple());
538
592
  }
539
593
 
594
+ /**
595
+ * Returns the membership witness of an L1 to L2 message, or none if there is no such message.
596
+ * @param messageHash - Hash of the message.
597
+ * @param nullifier - When present, the unsiloed nullifier of the message and the address to silo it with. The witness
598
+ * is only returned if the siloed nullifier is absent from the nullifier tree, i.e. the message has not been consumed.
599
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path), or none.
600
+ */
601
+ public async tryGetL1ToL2MembershipWitness(
602
+ messageHash: Fr,
603
+ nullifier: Option<UnsiloedMessageNullifier>,
604
+ ): Promise<Option<MembershipWitness<typeof L1_TO_L2_MSG_TREE_HEIGHT>>> {
605
+ const anchor = await this.anchorBlockHeader.toBlockParameter();
606
+ const lookup = await lookUpL1ToL2MessageWitness(this.aztecNode, messageHash, nullifier.value, anchor);
607
+ if (lookup.type !== 'found') {
608
+ return Option.none();
609
+ }
610
+
611
+ const [messageIndex, siblingPath] = lookup.witness;
612
+ return Option.some(new MembershipWitness(L1_TO_L2_MSG_TREE_HEIGHT, messageIndex, siblingPath.toTuple()));
613
+ }
614
+
540
615
  /**
541
616
  * Read the public storage data.
542
617
  * @param blockHash - The block hash to read storage at.
@@ -787,7 +862,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
787
862
  factCollectionId: Fr,
788
863
  factTypeId: Fr,
789
864
  payload: EphemeralArray<Fr>,
790
- originBlock: Option<OriginBlock>,
865
+ originBlock: Option<BlockReference>,
791
866
  ): Promise<void> {
792
867
  this.#assertOwnContract(contractAddress);
793
868
  return this.factService.recordFact(
@@ -37,6 +37,10 @@ export type SyncedOperationContext = {
37
37
  * {@link StagedWriteCoordinator}): staged writes are committed if the operation succeeds and discarded if it throws.
38
38
  */
39
39
  export class OperationQueue {
40
+ private static readonly WARN_QUEUE_DEPTH = 10;
41
+ private static readonly WARN_WAIT_MS = 30_000;
42
+ private static readonly WARN_INTERVAL_MS = 60_000;
43
+ private lastPressureWarningAt = -Infinity;
40
44
  private readonly queue = new SerialQueue();
41
45
  private readonly node: CachingAztecNode;
42
46
  private readonly synchronizer: BlockSynchronizer;
@@ -72,13 +76,40 @@ export class OperationQueue {
72
76
  */
73
77
  public run<T>(fn: () => Promise<T>): Promise<T> {
74
78
  // TODO(#12636): relax the conditions under which we forbid concurrency.
75
- if (this.queue.length() != 0) {
76
- this.log.warn(
77
- `PXE is already processing ${this.queue.length()} operations, concurrent execution is not supported. Will run once those are complete.`,
78
- );
79
+ const queued = new Timer();
80
+ const queueDepth = this.queue.length();
81
+ if (queueDepth >= OperationQueue.WARN_QUEUE_DEPTH) {
82
+ this.warnQueuePressure('depth', queueDepth, 0);
79
83
  }
84
+ const waitWarning = setTimeout(() => {
85
+ this.warnQueuePressure('wait', this.queue.length(), queued.ms());
86
+ }, OperationQueue.WARN_WAIT_MS);
80
87
 
81
- return this.queue.put(fn);
88
+ return this.queue
89
+ .put(() => {
90
+ clearTimeout(waitWarning);
91
+ this.log.debug('Starting queued PXE operation', {
92
+ eventName: 'pxe_operation_started',
93
+ queueDepth,
94
+ waitMs: queued.ms(),
95
+ });
96
+ return fn();
97
+ })
98
+ .finally(() => clearTimeout(waitWarning));
99
+ }
100
+
101
+ private warnQueuePressure(reason: 'depth' | 'wait', queueDepth: number, waitMs: number): void {
102
+ const now = Date.now();
103
+ if (now - this.lastPressureWarningAt < OperationQueue.WARN_INTERVAL_MS) {
104
+ return;
105
+ }
106
+ this.lastPressureWarningAt = now;
107
+ this.log.warn('PXE operation queue is congested', {
108
+ eventName: 'pxe_operation_queue_pressure',
109
+ reason,
110
+ queueDepth,
111
+ waitMs,
112
+ });
82
113
  }
83
114
 
84
115
  /**
@@ -10,8 +10,8 @@
10
10
  /// used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw immediately
11
11
  /// if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency without actually
12
12
  /// using any of the new oracles then there is no reason to throw.
13
- export const ORACLE_VERSION_MAJOR = 31;
14
- export const ORACLE_VERSION_MINOR = 0;
13
+ export const ORACLE_VERSION_MAJOR = 32;
14
+ export const ORACLE_VERSION_MINOR = 2;
15
15
 
16
16
  /// This hash is computed from `ORACLE_REGISTRY` (each oracle's name, ordered parameter names and
17
17
  /// types, and return type) and is used to detect when the oracle interface changes. When it does, you need to either:
@@ -19,7 +19,7 @@ export const ORACLE_VERSION_MINOR = 0;
19
19
  /// - increment only `ORACLE_VERSION_MINOR` if the change is additive (a new oracle was added).
20
20
  ///
21
21
  /// These constants must be kept in sync between this file and `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
22
- export const ORACLE_INTERFACE_HASH = '34050955eaba2373f10bb168a41d8ea2634cf1bb3b86048cd168fe784fc82a73';
22
+ export const ORACLE_INTERFACE_HASH = '1382416bfef61d1a54dd7dd0ab4350954b38ac2465fc19368495fffda7d69f75';
23
23
 
24
24
  /// The oracle interface served to the protocol contracts, which is versioned separately from the Aztec.nr one above.
25
25
  /// It is a single number that must match exactly: protocol contracts are only rebuilt when they are redeployed on a
@@ -2,21 +2,21 @@
2
2
  "complete_addresses": [
3
3
  {
4
4
  "index": 0,
5
- "value": "2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce4413ad6965d11a533a663d07507319f74ac3305325f6f72423c0b24aa1193268bb19e95c05f09cb86d1a6257572f9082ca15d4a02373c4d8c9cee23dc61a4c2a882f9017d51bca6616102d8a1d4dba89e4ce12881a2414576f01d2fec9492814a22a1b054e998835d166711839b515d434b1fbc207ad4fdb5b2b43d6ac6b400871019f5bb255e87523d43da83ebc9fa95169b653d4abef902e011e9eac620fc45b1006a921250e1395ef3cfc24c0e57d8f6745e7660ff70a28150f569bf66b8d5b28f331bfc59268b3f8b708104b95ed3a8065805cac8a0bdb622ce038631584c00000000000000000000000000000000000000000000000000000000000000003"
5
+ "value": "20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a13ad6965d11a533a663d07507319f74ac3305325f6f72423c0b24aa1193268bb19e95c05f09cb86d1a6257572f9082ca15d4a02373c4d8c9cee23dc61a4c2a882f9017d51bca6616102d8a1d4dba89e4ce12881a2414576f01d2fec9492814a22a1b054e998835d166711839b515d434b1fbc207ad4fdb5b2b43d6ac6b400871019f5bb255e87523d43da83ebc9fa95169b653d4abef902e011e9eac620fc45b1006a921250e1395ef3cfc24c0e57d8f6745e7660ff70a28150f569bf66b8d5b28f331bfc59268b3f8b708104b95ed3a8065805cac8a0bdb622ce038631584c00000000000000000000000000000000000000000000000000000000000000003"
6
6
  },
7
7
  {
8
8
  "index": 1,
9
- "value": "1fc97e4d0bb6609f25973d986a7b4787cdbad4fb98c8823591c67e7cd744ba6317c2df1b7355bb4c4494aa4ec85d15ff8881cea1b34691f0cc558e8aef3f3f4c267e526a2e6e9adf6a026989be005bd50d1aea76d20816b9843bc95557696f9f16c3eb259ba3e3eb27b7fe3abc36e87923990bf5c265cb0d57790eda2a4432f105a5449624125d37f10cd4c68ffd57b0dc0cdaa916cb37840be1db9bf88e3c5f0e81754454e3b12035b13448a9fe3b980bf31a9808cb93e146628fb06fa1b46f1694840b143402ffa76cba23e6a9be64b4db084fa804f61940e2d10cf41d273e2475eeff188767ebed988e7d9997d9ed9fe667ff68df9b7143bc663c242929260000000000000000000000000000000000000000000000000000000000000007"
9
+ "value": "23210e69198ab87b18f469c5e5b79dd6c51999350a8940b4b20e2b8c13ae05aa17c2df1b7355bb4c4494aa4ec85d15ff8881cea1b34691f0cc558e8aef3f3f4c267e526a2e6e9adf6a026989be005bd50d1aea76d20816b9843bc95557696f9f16c3eb259ba3e3eb27b7fe3abc36e87923990bf5c265cb0d57790eda2a4432f105a5449624125d37f10cd4c68ffd57b0dc0cdaa916cb37840be1db9bf88e3c5f0e81754454e3b12035b13448a9fe3b980bf31a9808cb93e146628fb06fa1b46f1694840b143402ffa76cba23e6a9be64b4db084fa804f61940e2d10cf41d273e2475eeff188767ebed988e7d9997d9ed9fe667ff68df9b7143bc663c242929260000000000000000000000000000000000000000000000000000000000000007"
10
10
  }
11
11
  ],
12
12
  "complete_address_index": [
13
13
  {
14
- "key": "utf8:0x1fc97e4d0bb6609f25973d986a7b4787cdbad4fb98c8823591c67e7cd744ba63",
15
- "value": "num:1"
14
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a",
15
+ "value": "num:0"
16
16
  },
17
17
  {
18
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44",
19
- "value": "num:0"
18
+ "key": "utf8:0x23210e69198ab87b18f469c5e5b79dd6c51999350a8940b4b20e2b8c13ae05aa",
19
+ "value": "num:1"
20
20
  }
21
21
  ]
22
22
  }
@@ -1,51 +1,51 @@
1
1
  {
2
2
  "key_store": [
3
3
  {
4
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-ivpk_m",
4
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-ivpk_m",
5
5
  "value": "19e95c05f09cb86d1a6257572f9082ca15d4a02373c4d8c9cee23dc61a4c2a882f9017d51bca6616102d8a1d4dba89e4ce12881a2414576f01d2fec9492814a2"
6
6
  },
7
7
  {
8
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-ivpk_m_hash",
8
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-ivpk_m_hash",
9
9
  "value": "1fd17152d394f6a43b527c531590888d610d1bcb9aa71a02498ce820bbf4dc62"
10
10
  },
11
11
  {
12
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-ivsk_m",
12
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-ivsk_m",
13
13
  "value": "1fb01c42d1aaa2662041b899c77cb19e08192193acc5a94405f1b43c974eba7a"
14
14
  },
15
15
  {
16
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-nhk_m",
16
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-nhk_m",
17
17
  "value": "2dd30220767969b10044b1322585bb4c4df4e0c5d9b4d7b3045a879a8e3e91d2"
18
18
  },
19
19
  {
20
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-npk_m",
20
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-npk_m",
21
21
  "value": "214c7a24ddf501afc8734c7379ee502296289eb24cd8cd03cd435e128c06be0000987721e0963b4a5bd81ee862e2740d8849fd90537569064d3d3a4640e858d2"
22
22
  },
23
23
  {
24
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-npk_m_hash",
24
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-npk_m_hash",
25
25
  "value": "13ad6965d11a533a663d07507319f74ac3305325f6f72423c0b24aa1193268bb"
26
26
  },
27
27
  {
28
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-ovpk_m",
28
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-ovpk_m",
29
29
  "value": "2c19ff0b089b07da436e6f7be6b26cdc17b9cee504a528c071ef6a416299683d0b369479d6e50504702d0b56bb56e4e8e0e77171429896651d0c11621e82ebc3"
30
30
  },
31
31
  {
32
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-ovpk_m_hash",
32
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-ovpk_m_hash",
33
33
  "value": "2a1b054e998835d166711839b515d434b1fbc207ad4fdb5b2b43d6ac6b400871"
34
34
  },
35
35
  {
36
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-ovsk_m",
36
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-ovsk_m",
37
37
  "value": "279fe6ef7dd2477b919327b1ebab7497c41b9a7ccfa9d5d52e32698e3b85293b"
38
38
  },
39
39
  {
40
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-tpk_m",
40
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-tpk_m",
41
41
  "value": "2fcdd0d194adafd753dc0ed279f5cfb54ddcce1dd581d4631cf343ba9ee6c1ab2858abca6c00da3def156b1f12a6464384e326d5fa724c2fc2ff2b7f3fc8ad5f"
42
42
  },
43
43
  {
44
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-tpk_m_hash",
44
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-tpk_m_hash",
45
45
  "value": "019f5bb255e87523d43da83ebc9fa95169b653d4abef902e011e9eac620fc45b"
46
46
  },
47
47
  {
48
- "key": "utf8:0x2369ead09116908cedc1642d5e0c714ef288ecbc838e4d434f800a408914ce44-tsk_m",
48
+ "key": "utf8:0x20c1641e3181d87e3383458cd994b80833d42772f0afddb5ff41611c0524493a-tsk_m",
49
49
  "value": "183cb61099458d1564aa57c90c7091ac623a14092ab314150c9cfbb416810320"
50
50
  }
51
51
  ]
@@ -4,7 +4,7 @@ import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
4
4
  import { assertAllowedScope } from '../allowed_scopes.js';
5
5
  import type { ChangeSetId } from '../staged_write_coordinator.js';
6
6
  import type { FactStore } from './fact_store.js';
7
- import type { FactCollectionKey, FactCollectionTypeKey, OriginBlock } from './fact_store_keys.js';
7
+ import type { BlockReference, FactCollectionKey, FactCollectionTypeKey } from './fact_store_keys.js';
8
8
  import {
9
9
  type FactCollectionWithOriginState,
10
10
  type FactWithOriginState,
@@ -29,7 +29,7 @@ export class FactService {
29
29
  factCollectionKey: FactCollectionKey,
30
30
  factTypeId: Fr,
31
31
  payload: Fr[],
32
- originBlock: OriginBlock | undefined,
32
+ originBlock: BlockReference | undefined,
33
33
  changeSetId: ChangeSetId,
34
34
  ): Promise<void> {
35
35
  assertAllowedScope(factCollectionKey.scope, this.allowedScopes);
@@ -5,7 +5,7 @@ import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@azte
5
5
 
6
6
  import { BaseStagingStore, type ReadonlyDb } from '../base_staging_store.js';
7
7
  import type { ChangeSetId } from '../staged_write_coordinator.js';
8
- import { FactCollectionKey, type FactCollectionTypeKey, type OriginBlock } from './fact_store_keys.js';
8
+ import { type BlockReference, FactCollectionKey, type FactCollectionTypeKey } from './fact_store_keys.js';
9
9
  import { type Fact, StoredFact, factKeyStrOf } from './stored_fact.js';
10
10
 
11
11
  type BlockNum = number;
@@ -82,7 +82,7 @@ export class FactStore extends BaseStagingStore<FactStoreChangeSet, FactStoreDb>
82
82
  factCollectionKey: FactCollectionKey,
83
83
  factTypeId: Fr,
84
84
  payload: Fr[],
85
- originBlock: OriginBlock | undefined,
85
+ originBlock: BlockReference | undefined,
86
86
  changeSetId: ChangeSetId,
87
87
  ): Promise<void> {
88
88
  return this.withChangeSet(changeSetId, changeSet => {
@@ -2,10 +2,8 @@ import { Fr } from '@aztec-labs/foundation/curves/bn254';
2
2
  import type { FieldsOf } from '@aztec-labs/foundation/types';
3
3
  import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
4
4
 
5
- /**
6
- * The block a retractable fact originates from.
7
- */
8
- export type OriginBlock = { blockNumber: number; blockHash: Fr };
5
+ /** A block, identified by its number and hash. */
6
+ export type BlockReference = { blockNumber: number; blockHash: Fr };
9
7
 
10
8
  /** Facts are always tied to a real scope; the zero address is not a valid fact scope. */
11
9
  function assertNonZeroScope(scope: AztecAddress): void {
@@ -1,6 +1,6 @@
1
1
  export { FactStore, type FactCollection } from './fact_store.js';
2
2
  export { FactService } from './fact_service.js';
3
- export { FactCollectionKey, FactCollectionTypeKey, type OriginBlock } from './fact_store_keys.js';
3
+ export { FactCollectionKey, FactCollectionTypeKey, type BlockReference } from './fact_store_keys.js';
4
4
  export type { Fact } from './stored_fact.js';
5
5
  export {
6
6
  OriginBlockState,
@@ -1,7 +1,7 @@
1
1
  import type { Fr } from '@aztec-labs/foundation/curves/bn254';
2
2
  import type { L2Tips } from '@aztec-labs/stdlib/block';
3
3
 
4
- import type { FactCollectionKey, OriginBlock } from './fact_store_keys.js';
4
+ import type { BlockReference, FactCollectionKey } from './fact_store_keys.js';
5
5
  import type { Fact } from './stored_fact.js';
6
6
 
7
7
  /**
@@ -49,7 +49,7 @@ export function anchoredTipBlockNumbers(tips: L2Tips, anchorBlockNumber: number)
49
49
  }
50
50
 
51
51
  /** A retractable fact's origin block annotated with that block's current chain state. */
52
- export type RetractableFactOrigin = OriginBlock & { blockState: OriginBlockState };
52
+ export type RetractableFactOrigin = BlockReference & { blockState: OriginBlockState };
53
53
 
54
54
  /** A fact enriched with origin-block state. `originBlock` is undefined for a non-retractable fact. */
55
55
  export type FactWithOriginState = { factTypeId: Fr; payload: Fr[]; originBlock: RetractableFactOrigin | undefined };
@@ -3,10 +3,10 @@ import { Fr } from '@aztec-labs/foundation/curves/bn254';
3
3
  import { BufferReader, serializeToBuffer } from '@aztec-labs/foundation/serialize';
4
4
  import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
5
5
 
6
- import { FactCollectionKey, type OriginBlock } from './fact_store_keys.js';
6
+ import { type BlockReference, FactCollectionKey } from './fact_store_keys.js';
7
7
 
8
8
  /** A fact as returned by the fact store. */
9
- export type Fact = { factTypeId: Fr; payload: Fr[]; originBlock: OriginBlock | undefined };
9
+ export type Fact = { factTypeId: Fr; payload: Fr[]; originBlock: BlockReference | undefined };
10
10
 
11
11
  /**
12
12
  * A single immutable fact belonging to a fact collection.
@@ -16,7 +16,7 @@ export class StoredFact {
16
16
  public readonly factCollectionKey: FactCollectionKey,
17
17
  public readonly factTypeId: Fr,
18
18
  public readonly payload: Fr[],
19
- public readonly originBlock: OriginBlock | undefined,
19
+ public readonly originBlock: BlockReference | undefined,
20
20
  ) {}
21
21
 
22
22
  /** Whether this fact is deleted on block pruning (true) or survives reorgs (false). */
@@ -1,11 +0,0 @@
1
- import type { Fr } from '@aztec-labs/foundation/curves/bn254';
2
- /**
3
- * The block a retractable fact originates from.
4
- *
5
- * A TS version of the `OriginBlock` struct in `facts/mod.nr`.
6
- */
7
- export type OriginBlock = {
8
- blockNumber: number;
9
- blockHash: Fr;
10
- };
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JpZ2luX2Jsb2NrLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL25vaXItc3RydWN0cy9vcmlnaW5fYmxvY2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFFOUQ7Ozs7R0FJRztBQUNILE1BQU0sTUFBTSxXQUFXLEdBQUc7SUFBRSxXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQUMsU0FBUyxFQUFFLEVBQUUsQ0FBQTtDQUFFLENBQUMifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"origin_block.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/noir-structs/origin_block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,EAAE,CAAA;CAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * The block a retractable fact originates from.
3
- *
4
- * A TS version of the `OriginBlock` struct in `facts/mod.nr`.
5
- */ export { };
@@ -1,8 +0,0 @@
1
- import type { Fr } from '@aztec-labs/foundation/curves/bn254';
2
-
3
- /**
4
- * The block a retractable fact originates from.
5
- *
6
- * A TS version of the `OriginBlock` struct in `facts/mod.nr`.
7
- */
8
- export type OriginBlock = { blockNumber: number; blockHash: Fr };