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

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 (101) hide show
  1. package/dest/config/index.d.ts +1 -1
  2. package/dest/config/index.d.ts.map +1 -1
  3. package/dest/config/index.js +2 -1
  4. package/dest/contract_function_simulator/index.d.ts +2 -2
  5. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/index.js +1 -1
  7. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +6 -12
  8. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/noir-structs/fact_collection.js +1 -15
  10. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +5 -5
  11. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/oracle/oracle_registry.js +5 -5
  13. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +3 -2
  14. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +16 -2
  16. package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
  17. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/oracle/private_execution.js +1 -0
  19. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +6 -6
  20. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +3 -2
  22. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  23. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/pick_notes.js +1 -0
  25. package/dest/entrypoints/server/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
  26. package/dest/entrypoints/server/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
  27. package/dest/entrypoints/server/circuit_recording/simulator_recorder_wrapper.js +1 -0
  28. package/dest/entrypoints/server/utils.d.ts +1 -1
  29. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  30. package/dest/entrypoints/server/utils.js +3 -1
  31. package/dest/oracle_version.d.ts +3 -3
  32. package/dest/oracle_version.js +3 -3
  33. package/dest/private_kernel/batch_planner.d.ts +1 -1
  34. package/dest/private_kernel/batch_planner.d.ts.map +1 -1
  35. package/dest/private_kernel/batch_planner.js +1 -0
  36. package/dest/private_kernel/hints/test_utils.d.ts +1 -1
  37. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
  38. package/dest/private_kernel/hints/test_utils.js +1 -0
  39. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  40. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  41. package/dest/private_kernel/private_kernel_execution_prover.js +1 -0
  42. package/dest/pxe.d.ts +27 -2
  43. package/dest/pxe.d.ts.map +1 -1
  44. package/dest/pxe.js +201 -128
  45. package/dest/storage/address_store/address_store.d.ts +1 -1
  46. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  47. package/dest/storage/address_store/address_store.js +1 -0
  48. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +1 -1
  49. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -1
  50. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +1 -0
  51. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
  52. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
  53. package/dest/storage/backwards_compatibility_tests/schema_tests.js +23 -1
  54. package/dest/storage/contract_store/contract_store.d.ts +2 -1
  55. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  56. package/dest/storage/contract_store/contract_store.js +1 -0
  57. package/dest/storage/fact_store/fact_scope.d.ts +19 -0
  58. package/dest/storage/fact_store/fact_scope.d.ts.map +1 -0
  59. package/dest/storage/fact_store/fact_scope.js +37 -0
  60. package/dest/storage/fact_store/fact_service.d.ts +2 -2
  61. package/dest/storage/fact_store/fact_service.d.ts.map +1 -1
  62. package/dest/storage/fact_store/fact_service.js +19 -5
  63. package/dest/storage/fact_store/fact_store_keys.d.ts +6 -5
  64. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -1
  65. package/dest/storage/fact_store/fact_store_keys.js +24 -8
  66. package/dest/storage/fact_store/index.d.ts +2 -1
  67. package/dest/storage/fact_store/index.d.ts.map +1 -1
  68. package/dest/storage/fact_store/index.js +1 -0
  69. package/dest/storage/fact_store/stored_fact.d.ts +9 -3
  70. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -1
  71. package/dest/storage/fact_store/stored_fact.js +45 -3
  72. package/dest/storage/store_identity.d.ts +1 -1
  73. package/dest/storage/store_identity.d.ts.map +1 -1
  74. package/dest/storage/store_identity.js +1 -0
  75. package/package.json +21 -20
  76. package/src/config/index.ts +2 -1
  77. package/src/contract_function_simulator/index.ts +1 -0
  78. package/src/contract_function_simulator/noir-structs/fact_collection.ts +6 -22
  79. package/src/contract_function_simulator/oracle/oracle_registry.ts +5 -4
  80. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +15 -1
  81. package/src/contract_function_simulator/oracle/private_execution.ts +1 -0
  82. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +8 -7
  83. package/src/contract_function_simulator/pick_notes.ts +1 -0
  84. package/src/entrypoints/server/circuit_recording/simulator_recorder_wrapper.ts +1 -0
  85. package/src/entrypoints/server/utils.ts +4 -2
  86. package/src/oracle_version.ts +3 -3
  87. package/src/private_kernel/batch_planner.ts +1 -0
  88. package/src/private_kernel/hints/test_utils.ts +1 -0
  89. package/src/private_kernel/private_kernel_execution_prover.ts +1 -0
  90. package/src/pxe.ts +291 -189
  91. package/src/storage/address_store/address_store.ts +1 -0
  92. package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +20 -0
  93. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +1 -0
  94. package/src/storage/backwards_compatibility_tests/schema_tests.ts +18 -1
  95. package/src/storage/contract_store/contract_store.ts +1 -0
  96. package/src/storage/fact_store/fact_scope.ts +39 -0
  97. package/src/storage/fact_store/fact_service.ts +20 -5
  98. package/src/storage/fact_store/fact_store_keys.ts +28 -15
  99. package/src/storage/fact_store/index.ts +1 -0
  100. package/src/storage/fact_store/stored_fact.ts +50 -14
  101. package/src/storage/store_identity.ts +1 -0
@@ -48,6 +48,7 @@ import {
48
48
  type TxHash,
49
49
  type TxReceipt,
50
50
  } from '@aztec-labs/stdlib/tx';
51
+ import { Buffer } from 'buffer';
51
52
 
52
53
  import type { ContractSyncService } from '../../contract/contract_sync_service.js';
53
54
  import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from '../../contract_logging.js';
@@ -62,7 +63,7 @@ import type { AddressStore } from '../../storage/address_store/address_store.js'
62
63
  import { assertAllowedScope } from '../../storage/allowed_scopes.js';
63
64
  import type { CapsuleService } from '../../storage/capsule_store/capsule_service.js';
64
65
  import { FactCollectionKey, FactCollectionTypeKey, anchoredTipBlockNumbers } from '../../storage/fact_store/index.js';
65
- import type { BlockReference, FactService } from '../../storage/fact_store/index.js';
66
+ import type { BlockReference, FactScope, FactService } from '../../storage/fact_store/index.js';
66
67
  import type { NoteStore } from '../../storage/note_store/note_store.js';
67
68
  import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
68
69
  import type { ChangeSetId } from '../../storage/staged_write_coordinator.js';
@@ -74,7 +75,7 @@ import { BoundedVec } from '../noir-structs/bounded_vec.js';
74
75
  import type { EmbeddedCurvePoint } from '../noir-structs/embedded_curve_point.js';
75
76
  import { EphemeralArray } from '../noir-structs/ephemeral_array.js';
76
77
  import type { EventValidationRequest } from '../noir-structs/event_validation_request.js';
77
- import { type FactCollection, emptyFactCollection, toNoirFactCollection } from '../noir-structs/fact_collection.js';
78
+ import { type FactCollection, toNoirFactCollection } from '../noir-structs/fact_collection.js';
78
79
  import type { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
79
80
  import type { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
80
81
  import type { NoteData } from '../noir-structs/note_data.js';
@@ -857,7 +858,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
857
858
  */
858
859
  public recordFact(
859
860
  contractAddress: AztecAddress,
860
- scope: AztecAddress,
861
+ scope: FactScope,
861
862
  factCollectionTypeId: Fr,
862
863
  factCollectionId: Fr,
863
864
  factTypeId: Fr,
@@ -879,7 +880,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
879
880
  */
880
881
  public deleteFactCollection(
881
882
  contractAddress: AztecAddress,
882
- scope: AztecAddress,
883
+ scope: FactScope,
883
884
  factCollectionTypeId: Fr,
884
885
  factCollectionId: Fr,
885
886
  ): Promise<void> {
@@ -895,7 +896,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
895
896
  */
896
897
  public async getFactCollection(
897
898
  contractAddress: AztecAddress,
898
- scope: AztecAddress,
899
+ scope: FactScope,
899
900
  factCollectionTypeId: Fr,
900
901
  factCollectionId: Fr,
901
902
  ): Promise<Option<FactCollection>> {
@@ -917,13 +918,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
917
918
  collection.facts,
918
919
  ),
919
920
  )
920
- : Option.none(emptyFactCollection(this.ephemeralArrayService));
921
+ : Option.none();
921
922
  }
922
923
 
923
924
  /** Returns every fact collection of `factCollectionTypeId`. */
924
925
  public async getFactCollectionsByType(
925
926
  contractAddress: AztecAddress,
926
- scope: AztecAddress,
927
+ scope: FactScope,
927
928
  factCollectionTypeId: Fr,
928
929
  ): Promise<EphemeralArray<FactCollection>> {
929
930
  this.#assertOwnContract(contractAddress);
@@ -1,5 +1,6 @@
1
1
  import { Fr } from '@aztec-labs/foundation/curves/bn254';
2
2
  import { Comparator, type Note } from '@aztec-labs/stdlib/note';
3
+ import { Buffer } from 'buffer';
3
4
 
4
5
  export interface PropertySelector {
5
6
  index: number;
@@ -13,6 +13,7 @@ import type {
13
13
  } from '@aztec-labs/simulator/client';
14
14
  import type { FunctionArtifactWithContractName } from '@aztec-labs/stdlib/abi';
15
15
  import type { NoirCompiledCircuitWithName } from '@aztec-labs/stdlib/noir';
16
+ import { Buffer } from 'buffer';
16
17
 
17
18
  import type { CircuitRecorder } from './circuit_recorder.js';
18
19
 
@@ -1,5 +1,6 @@
1
1
  import { BBBundlePrivateKernelProver } from '@aztec-labs/bb-prover/client/bundle';
2
2
  import type { L1ContractAddresses } from '@aztec-labs/ethereum/l1-contract-addresses';
3
+ import { getEnv } from '@aztec-labs/foundation/config/env';
3
4
  import { createLogger } from '@aztec-labs/foundation/log';
4
5
  import { openTmpStore } from '@aztec-labs/kv-store/lmdb-v2';
5
6
  import { BundledProtocolContractsProvider } from '@aztec-labs/protocol-contracts/providers/bundle';
@@ -30,8 +31,9 @@ export async function createPXE(
30
31
  ) {
31
32
  const actor = options.loggerActorLabel;
32
33
  const recorderLogger = createLogger('simulator:acvm:recording', { actor });
33
- const recorder = process.env.CIRCUIT_RECORD_DIR
34
- ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR, recorderLogger)
34
+ const { CIRCUIT_RECORD_DIR } = getEnv();
35
+ const recorder = CIRCUIT_RECORD_DIR
36
+ ? new FileCircuitRecorder(CIRCUIT_RECORD_DIR, recorderLogger)
35
37
  : new MemoryCircuitRecorder(recorderLogger);
36
38
  const simulatorLogger = createLogger('wasm-simulator', { actor });
37
39
  const simulator = new SimulatorRecorderWrapper(new WASMSimulator(simulatorLogger), recorder);
@@ -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 = 32;
14
- export const ORACLE_VERSION_MINOR = 2;
13
+ export const ORACLE_VERSION_MAJOR = 33;
14
+ export const ORACLE_VERSION_MINOR = 0;
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 = 2;
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 = '1382416bfef61d1a54dd7dd0ab4350954b38ac2465fc19368495fffda7d69f75';
22
+ export const ORACLE_INTERFACE_HASH = '318f8f81844b3bb827aeea6cb480eed35c94e67ac4330bd9d640b23975d3fe9f';
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
@@ -9,6 +9,7 @@ import {
9
9
  } from '@aztec-labs/stdlib/kernel';
10
10
  import type { PrivateCallExecutionResult } from '@aztec-labs/stdlib/tx';
11
11
  import { VerificationKeyData } from '@aztec-labs/stdlib/vks';
12
+ import { Buffer } from 'buffer';
12
13
 
13
14
  import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
14
15
 
@@ -35,6 +35,7 @@ import { PrivateLogData, ScopedPrivateLogData } from '@aztec-labs/stdlib/kernel'
35
35
  import { PrivateLog } from '@aztec-labs/stdlib/logs';
36
36
  import { PrivateCallExecutionResult } from '@aztec-labs/stdlib/tx';
37
37
  import { VerificationKeyData } from '@aztec-labs/stdlib/vks';
38
+ import { Buffer } from 'buffer';
38
39
 
39
40
  const DEFAULT_CONTRACT_ADDRESS = AztecAddress.fromBigIntUnsafe(987654n);
40
41
 
@@ -47,6 +47,7 @@ import {
47
47
  getFinalMinRevertibleSideEffectCounter,
48
48
  } from '@aztec-labs/stdlib/tx';
49
49
  import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec-labs/stdlib/vks';
50
+ import { Buffer } from 'buffer';
50
51
 
51
52
  import { BatchPlanner } from './batch_planner.js';
52
53
  import { computeTxExpirationTimestamp } from './hints/compute_tx_expiration_timestamp.js';