@aztec/stdlib 5.0.0-nightly.20260504 → 5.0.0-nightly.20260512

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 (139) hide show
  1. package/dest/abi/abi.d.ts +18 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +25 -10
  4. package/dest/abi/contract_artifact.d.ts +1 -1
  5. package/dest/abi/contract_artifact.d.ts.map +1 -1
  6. package/dest/abi/contract_artifact.js +14 -7
  7. package/dest/avm/avm.d.ts +4 -4
  8. package/dest/avm/avm_circuit_public_inputs.d.ts +1 -1
  9. package/dest/avm/avm_proving_request.d.ts +2 -2
  10. package/dest/aztec-address/index.d.ts +3 -1
  11. package/dest/aztec-address/index.d.ts.map +1 -1
  12. package/dest/aztec-address/index.js +2 -0
  13. package/dest/block/block_data.d.ts +1 -290
  14. package/dest/block/block_data.d.ts.map +1 -1
  15. package/dest/block/block_data.js +0 -14
  16. package/dest/block/block_parameter.d.ts +31 -25
  17. package/dest/block/block_parameter.d.ts.map +1 -1
  18. package/dest/block/block_parameter.js +31 -14
  19. package/dest/block/in_block.d.ts +4 -4
  20. package/dest/block/index.d.ts +1 -2
  21. package/dest/block/index.d.ts.map +1 -1
  22. package/dest/block/index.js +0 -1
  23. package/dest/block/l2_block_info.d.ts +1 -1
  24. package/dest/block/l2_block_source.d.ts +66 -117
  25. package/dest/block/l2_block_source.d.ts.map +1 -1
  26. package/dest/block/l2_block_source.js +29 -1
  27. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -2
  28. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  29. package/dest/block/l2_block_stream/l2_block_stream.js +36 -15
  30. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +3 -1
  31. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
  32. package/dest/block/l2_block_stream/l2_tips_memory_store.js +3 -0
  33. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +4 -1
  34. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  35. package/dest/block/l2_block_stream/l2_tips_store_base.js +9 -4
  36. package/dest/block/test/l2_tips_store_test_suite.js +1 -1
  37. package/dest/checkpoint/checkpoint_data.d.ts +2 -2
  38. package/dest/hash/hash.d.ts +1 -1
  39. package/dest/hash/hash.d.ts.map +1 -1
  40. package/dest/hash/hash.js +2 -2
  41. package/dest/interfaces/archiver.d.ts +2 -2
  42. package/dest/interfaces/archiver.d.ts.map +1 -1
  43. package/dest/interfaces/archiver.js +8 -27
  44. package/dest/interfaces/aztec-node.d.ts +7 -5
  45. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  46. package/dest/interfaces/aztec-node.js +3 -4
  47. package/dest/interfaces/block_response.d.ts +1 -1
  48. package/dest/interfaces/chain_tips.d.ts +5 -5
  49. package/dest/interfaces/checkpoint_parameter.d.ts +5 -5
  50. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
  51. package/dest/interfaces/checkpoint_parameter.js +5 -5
  52. package/dest/interfaces/checkpoint_response.d.ts +2 -2
  53. package/dest/interfaces/client.d.ts +2 -1
  54. package/dest/interfaces/client.d.ts.map +1 -1
  55. package/dest/interfaces/client.js +1 -0
  56. package/dest/interfaces/get_logs_response.d.ts +1 -1
  57. package/dest/interfaces/p2p.d.ts +8 -5
  58. package/dest/interfaces/p2p.d.ts.map +1 -1
  59. package/dest/interfaces/p2p.js +1 -1
  60. package/dest/interfaces/proving-job.d.ts +2 -2
  61. package/dest/interfaces/public_storage_override.d.ts +30 -0
  62. package/dest/interfaces/public_storage_override.d.ts.map +1 -0
  63. package/dest/interfaces/public_storage_override.js +7 -0
  64. package/dest/logs/extended_public_log.d.ts +1 -1
  65. package/dest/logs/log_id.d.ts +1 -1
  66. package/dest/logs/tx_scoped_l2_log.d.ts +1 -1
  67. package/dest/noir/index.d.ts +3 -1
  68. package/dest/noir/index.d.ts.map +1 -1
  69. package/dest/p2p/block_proposal.d.ts +12 -3
  70. package/dest/p2p/block_proposal.d.ts.map +1 -1
  71. package/dest/p2p/block_proposal.js +14 -1
  72. package/dest/p2p/checkpoint_attestation.d.ts +8 -4
  73. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  74. package/dest/p2p/checkpoint_attestation.js +9 -3
  75. package/dest/p2p/checkpoint_proposal.d.ts +16 -3
  76. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  77. package/dest/p2p/checkpoint_proposal.js +17 -2
  78. package/dest/p2p/consensus_payload.d.ts +6 -1
  79. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  80. package/dest/p2p/consensus_payload.js +7 -0
  81. package/dest/tests/mocks.d.ts +2 -5
  82. package/dest/tests/mocks.d.ts.map +1 -1
  83. package/dest/tests/mocks.js +3 -24
  84. package/dest/tx/global_variables.d.ts +1 -1
  85. package/dest/tx/in_tx.d.ts +1 -1
  86. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  87. package/dest/tx/proven_tx.d.ts +3 -1
  88. package/dest/tx/proven_tx.d.ts.map +1 -1
  89. package/dest/tx/proven_tx.js +6 -0
  90. package/dest/tx/simulated_tx.d.ts +35 -1142
  91. package/dest/tx/simulated_tx.d.ts.map +1 -1
  92. package/dest/tx/simulated_tx.js +12 -10
  93. package/dest/update-checker/dev_version.d.ts +3 -0
  94. package/dest/update-checker/dev_version.d.ts.map +1 -0
  95. package/dest/update-checker/dev_version.js +1 -0
  96. package/dest/update-checker/index.d.ts +2 -1
  97. package/dest/update-checker/index.d.ts.map +1 -1
  98. package/dest/update-checker/index.js +1 -0
  99. package/dest/update-checker/package_version.d.ts +6 -3
  100. package/dest/update-checker/package_version.d.ts.map +1 -1
  101. package/dest/update-checker/package_version.js +8 -19
  102. package/dest/world-state/genesis_data.d.ts +3 -1
  103. package/dest/world-state/genesis_data.d.ts.map +1 -1
  104. package/dest/world-state/genesis_data.js +3 -0
  105. package/package.json +10 -9
  106. package/src/abi/abi.ts +47 -14
  107. package/src/abi/contract_artifact.ts +11 -6
  108. package/src/aztec-address/index.ts +4 -0
  109. package/src/block/block_data.ts +0 -17
  110. package/src/block/block_parameter.ts +47 -12
  111. package/src/block/index.ts +0 -1
  112. package/src/block/l2_block_source.ts +73 -127
  113. package/src/block/l2_block_stream/l2_block_stream.ts +34 -26
  114. package/src/block/l2_block_stream/l2_tips_memory_store.ts +5 -0
  115. package/src/block/l2_block_stream/l2_tips_store_base.ts +7 -4
  116. package/src/block/test/l2_tips_store_test_suite.ts +1 -1
  117. package/src/hash/hash.ts +2 -2
  118. package/src/interfaces/archiver.ts +8 -33
  119. package/src/interfaces/aztec-node.ts +15 -5
  120. package/src/interfaces/checkpoint_parameter.ts +3 -3
  121. package/src/interfaces/client.ts +1 -0
  122. package/src/interfaces/p2p.ts +14 -5
  123. package/src/interfaces/public_storage_override.ts +26 -0
  124. package/src/noir/index.ts +2 -0
  125. package/src/p2p/block_proposal.ts +17 -2
  126. package/src/p2p/checkpoint_attestation.ts +11 -6
  127. package/src/p2p/checkpoint_proposal.ts +21 -3
  128. package/src/p2p/consensus_payload.ts +9 -0
  129. package/src/tests/mocks.ts +3 -31
  130. package/src/tx/proven_tx.ts +6 -0
  131. package/src/tx/simulated_tx.ts +18 -21
  132. package/src/update-checker/dev_version.ts +2 -0
  133. package/src/update-checker/index.ts +1 -0
  134. package/src/update-checker/package_version.ts +10 -23
  135. package/src/world-state/genesis_data.ts +12 -0
  136. package/dest/block/checkpointed_l2_block.d.ts +0 -150
  137. package/dest/block/checkpointed_l2_block.d.ts.map +0 -1
  138. package/dest/block/checkpointed_l2_block.js +0 -46
  139. package/src/block/checkpointed_l2_block.ts +0 -70
@@ -1 +1 @@
1
- {"version":3,"file":"simulated_tx.d.ts","sourceRoot":"","sources":["../../src/tx/simulated_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM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AAoC,EACvD;IAEJ,sBAAsB,8BAErB;IAEK,aAAa,IAAI,OAAO,CAAC,EAAE,CAAC,CASjC;CACF;AAED,qBAAa,kBAAkB;IAEpB,sBAAsB,EAAE,sBAAsB;IAC9C,YAAY,EAAE,oCAAoC;IAClD,YAAY,CAAC;IACb,KAAK,CAAC;IAJf,YACS,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,oCAAoC,EAClD,YAAY,CAAC,oCAAwB,EACrC,KAAK,CAAC,6BAAiB,EAC5B;IAEJ,iEAAiE;IACjE,IAAI,eAAe,IAAI,cAAc,EAAE,CAEtC;IAED,IAAI,OAAO,IAAI,OAAO,CASrB;IAED,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAS9C;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAC,sBAOpF;IAED,MAAM,CAAC,0CAA0C,CAC/C,uBAAuB,EAAE,uBAAuB,EAChD,YAAY,CAAC,EAAE,sBAAsB,EACrC,KAAK,CAAC,EAAE,eAAe,sBAQxB;IAED,OAAa,MAAM,gCAMlB;IAED,sBAAsB,8BAErB;IAED,aAAa,IAAI,OAAO,CAAC,EAAE,CAAC,CAE3B;IAED,qBAAqB,gCAEpB;CACF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,sBAAsB,GAAG,yBAAyB,CAWhH"}
@@ -1,8 +1,8 @@
1
1
  import { optional } from '@aztec/foundation/schemas';
2
2
  import { z } from 'zod';
3
- import { ContractArtifactSchema } from '../abi/abi.js';
4
3
  import { ContractInstanceWithAddressSchema } from '../contract/interfaces/contract_instance.js';
5
4
  import { Gas } from '../gas/gas.js';
5
+ import { PublicStorageOverrideSchema } from '../interfaces/public_storage_override.js';
6
6
  import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
7
7
  import { ChonkProof } from '../proofs/chonk_proof.js';
8
8
  import { PrivateExecutionResult, collectOffchainEffects, collectSortedContractClassLogs } from './private_execution_result.js';
@@ -10,22 +10,24 @@ import { SimulationStatsSchema } from './profiling.js';
10
10
  import { NestedProcessReturnValues, PublicSimulationOutput } from './public_simulation_output.js';
11
11
  import { Tx } from './tx.js';
12
12
  /*
13
- * Optional values that can be overridden during simulation. In order to simulate a transaction with these
14
- * set, it *must* be run without the kernel circuits, or validations will fail
13
+ * Optional values that can be overridden during simulation. `publicStorage` writes to the public-data
14
+ * tree fork. `contracts` overrides contract instances in the contract DB.
15
+ * In order to simulate a transaction with these set, it *must* be run without the kernel circuits,
16
+ * or validations will fail.
15
17
  */ export class SimulationOverrides {
18
+ publicStorage;
16
19
  contracts;
17
- constructor(contracts = {}){
18
- this.contracts = Object.keys(contracts).length > 0 ? contracts : undefined;
20
+ constructor(args = {}){
21
+ this.publicStorage = args.publicStorage?.length ? args.publicStorage : undefined;
22
+ this.contracts = args.contracts && Object.keys(args.contracts).length > 0 ? args.contracts : undefined;
19
23
  }
20
24
  static get schema() {
21
25
  return z.object({
26
+ publicStorage: optional(z.array(PublicStorageOverrideSchema)),
22
27
  contracts: optional(z.record(z.string(), z.object({
23
- instance: ContractInstanceWithAddressSchema,
24
- artifact: ContractArtifactSchema
28
+ instance: ContractInstanceWithAddressSchema
25
29
  })))
26
- }).transform(({ contracts })=>{
27
- return new SimulationOverrides(contracts);
28
- });
30
+ }).transform((args)=>new SimulationOverrides(args));
29
31
  }
30
32
  }
31
33
  export class PrivateSimulationResult {
@@ -0,0 +1,3 @@
1
+ /** Placeholder version returned when running from a local monorepo checkout rather than an npm-installed package. */
2
+ export declare const DEV_VERSION = "dev";
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGV2X3ZlcnNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cGRhdGUtY2hlY2tlci9kZXZfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxSEFBcUg7QUFDckgsZUFBTyxNQUFNLFdBQVcsUUFBUSxDQUFDIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev_version.d.ts","sourceRoot":"","sources":["../../src/update-checker/dev_version.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,eAAO,MAAM,WAAW,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ /** Placeholder version returned when running from a local monorepo checkout rather than an npm-installed package. */ export const DEV_VERSION = 'dev';
@@ -1,3 +1,4 @@
1
+ export * from './dev_version.js';
1
2
  export * from './package_version.js';
2
3
  export * from './version_checker.js';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cGRhdGUtY2hlY2tlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsc0JBQXNCLENBQUMifQ==
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cGRhdGUtY2hlY2tlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyxzQkFBc0IsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update-checker/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update-checker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from './dev_version.js';
1
2
  export * from './package_version.js';
2
3
  export * from './version_checker.js';
@@ -1,3 +1,6 @@
1
- /** Returns the package version from the release-please manifest or the package.json, or undefined if not found. */
2
- export declare function getPackageVersion(): string | undefined;
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXBkYXRlLWNoZWNrZXIvcGFja2FnZV92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLG1IQUFtSDtBQUNuSCx3QkFBZ0IsaUJBQWlCLElBQUksTUFBTSxHQUFHLFNBQVMsQ0F1QnREIn0=
1
+ /**
2
+ * Returns the package version from the stdlib `package.json`, or `DEV_VERSION` when the version is the `0.1.0`
3
+ * placeholder (which indicates a local monorepo checkout rather than an npm-installed package).
4
+ */
5
+ export declare function getPackageVersion(): string;
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXBkYXRlLWNoZWNrZXIvcGFja2FnZV92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BOzs7R0FHRztBQUNILHdCQUFnQixpQkFBaUIsSUFBSSxNQUFNLENBSzFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"package_version.d.ts","sourceRoot":"","sources":["../../src/update-checker/package_version.ts"],"names":[],"mappings":"AAKA,mHAAmH;AACnH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAuBtD"}
1
+ {"version":3,"file":"package_version.d.ts","sourceRoot":"","sources":["../../src/update-checker/package_version.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C"}
@@ -1,24 +1,13 @@
1
1
  import { fileURLToPath } from '@aztec/foundation/url';
2
2
  import { readFileSync } from 'fs';
3
3
  import { dirname, resolve } from 'path';
4
- /** Returns the package version from the release-please manifest or the package.json, or undefined if not found. */ export function getPackageVersion() {
4
+ import { DEV_VERSION } from './dev_version.js';
5
+ /**
6
+ * Returns the package version from the stdlib `package.json`, or `DEV_VERSION` when the version is the `0.1.0`
7
+ * placeholder (which indicates a local monorepo checkout rather than an npm-installed package).
8
+ */ export function getPackageVersion() {
5
9
  const dir = dirname(fileURLToPath(import.meta.url));
6
- // Try the release-please manifest first (works in dev/repo checkout).
7
- try {
8
- const releasePleaseManifestPath = resolve(dir, '../../../../.release-please-manifest.json');
9
- return JSON.parse(readFileSync(releasePleaseManifestPath).toString())['.'];
10
- } catch {
11
- // Not in a repo checkout, fall through.
12
- }
13
- // Fall back to the stdlib package.json version (works in npm-installed packages).
14
- try {
15
- const packageJsonPath = resolve(dir, '../../package.json');
16
- const version = JSON.parse(readFileSync(packageJsonPath).toString()).version;
17
- if (version && version !== '0.1.0') {
18
- return version;
19
- }
20
- } catch {
21
- // No package.json found either.
22
- }
23
- return undefined;
10
+ const packageJsonPath = resolve(dir, '../../package.json');
11
+ const version = JSON.parse(readFileSync(packageJsonPath).toString()).version;
12
+ return version === '0.1.0' ? DEV_VERSION : version;
24
13
  }
@@ -8,4 +8,6 @@ export type GenesisData = {
8
8
  };
9
9
  /** An empty genesis data with no prefilled state and a zero timestamp. */
10
10
  export declare const EMPTY_GENESIS_DATA: GenesisData;
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXNpc19kYXRhLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd29ybGQtc3RhdGUvZ2VuZXNpc19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFNUQsNkdBQTZHO0FBQzdHLE1BQU0sTUFBTSxXQUFXLEdBQUc7SUFDeEIsOEZBQThGO0lBQzlGLG1CQUFtQixFQUFFLGtCQUFrQixFQUFFLENBQUM7SUFDMUMscUdBQXFHO0lBQ3JHLGdCQUFnQixFQUFFLE1BQU0sQ0FBQztDQUMxQixDQUFDO0FBRUYsMEVBQTBFO0FBQzFFLGVBQU8sTUFBTSxrQkFBa0IsRUFBRSxXQUdoQyxDQUFDIn0=
11
+ /** Returns if an object looks like genesis data */
12
+ export declare function isGenesisData(obj: any): obj is GenesisData;
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXNpc19kYXRhLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd29ybGQtc3RhdGUvZ2VuZXNpc19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFNUQsNkdBQTZHO0FBQzdHLE1BQU0sTUFBTSxXQUFXLEdBQUc7SUFDeEIsOEZBQThGO0lBQzlGLG1CQUFtQixFQUFFLGtCQUFrQixFQUFFLENBQUM7SUFDMUMscUdBQXFHO0lBQ3JHLGdCQUFnQixFQUFFLE1BQU0sQ0FBQztDQUMxQixDQUFDO0FBRUYsMEVBQTBFO0FBQzFFLGVBQU8sTUFBTSxrQkFBa0IsRUFBRSxXQUdoQyxDQUFDO0FBRUYsbURBQW1EO0FBQ25ELHdCQUFnQixhQUFhLENBQUMsR0FBRyxFQUFFLEdBQUcsR0FBRyxHQUFHLElBQUksV0FBVyxDQVMxRCJ9
@@ -1 +1 @@
1
- {"version":3,"file":"genesis_data.d.ts","sourceRoot":"","sources":["../../src/world-state/genesis_data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,6GAA6G;AAC7G,MAAM,MAAM,WAAW,GAAG;IACxB,8FAA8F;IAC9F,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,qGAAqG;IACrG,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAE,WAGhC,CAAC"}
1
+ {"version":3,"file":"genesis_data.d.ts","sourceRoot":"","sources":["../../src/world-state/genesis_data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,6GAA6G;AAC7G,MAAM,MAAM,WAAW,GAAG;IACxB,8FAA8F;IAC9F,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,qGAAqG;IACrG,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAE,WAGhC,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,CAS1D"}
@@ -2,3 +2,6 @@
2
2
  prefilledPublicData: [],
3
3
  genesisTimestamp: 0n
4
4
  };
5
+ /** Returns if an object looks like genesis data */ export function isGenesisData(obj) {
6
+ return obj && typeof obj === 'object' && 'prefilledPublicData' in obj && Array.isArray(obj.prefilledPublicData) && 'genesisTimestamp' in obj && typeof obj.genesisTimestamp === 'bigint';
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "5.0.0-nightly.20260504",
3
+ "version": "5.0.0-nightly.20260512",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -92,13 +92,13 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@aws-sdk/client-s3": "^3.892.0",
95
- "@aztec/bb.js": "5.0.0-nightly.20260504",
96
- "@aztec/blob-lib": "5.0.0-nightly.20260504",
97
- "@aztec/constants": "5.0.0-nightly.20260504",
98
- "@aztec/ethereum": "5.0.0-nightly.20260504",
99
- "@aztec/foundation": "5.0.0-nightly.20260504",
100
- "@aztec/l1-artifacts": "5.0.0-nightly.20260504",
101
- "@aztec/noir-noirc_abi": "5.0.0-nightly.20260504",
95
+ "@aztec/bb.js": "5.0.0-nightly.20260512",
96
+ "@aztec/blob-lib": "5.0.0-nightly.20260512",
97
+ "@aztec/constants": "5.0.0-nightly.20260512",
98
+ "@aztec/ethereum": "5.0.0-nightly.20260512",
99
+ "@aztec/foundation": "5.0.0-nightly.20260512",
100
+ "@aztec/l1-artifacts": "5.0.0-nightly.20260512",
101
+ "@aztec/noir-noirc_abi": "5.0.0-nightly.20260512",
102
102
  "@google-cloud/storage": "^7.15.0",
103
103
  "axios": "^1.13.5",
104
104
  "json-stringify-deterministic": "1.0.12",
@@ -129,7 +129,8 @@
129
129
  "jest-mock-extended": "^4.0.0",
130
130
  "prettier": "^3.5.3",
131
131
  "ts-node": "^10.9.1",
132
- "typescript": "^5.3.3"
132
+ "typescript": "^5.3.3",
133
+ "vitest": "^4.0.0"
133
134
  },
134
135
  "files": [
135
136
  "dest",
package/src/abi/abi.ts CHANGED
@@ -6,6 +6,7 @@ import { schemas, zodFor } from '@aztec/foundation/schemas';
6
6
  import { inflate } from 'pako';
7
7
  import { z } from 'zod';
8
8
 
9
+ import { DEV_VERSION } from '../update-checker/dev_version.js';
9
10
  import { FunctionSelector } from './function_selector.js';
10
11
 
11
12
  /** A basic value. */
@@ -338,11 +339,17 @@ export type FieldLayout = {
338
339
  slot: Fr;
339
340
  };
340
341
 
342
+ /** Placeholder version injected into artifacts compiled before aztecVersion was added. TODO(F-557): Remove. */
343
+ export const ARTIFACT_VERSION_BEFORE_INJECTION = 'FROM_RELEASE_BEFORE_VERSION_INJECTION';
344
+
341
345
  /** Defines artifact of a contract. */
342
346
  export interface ContractArtifact {
343
347
  /** The name of the contract. */
344
348
  name: string;
345
349
 
350
+ /** The version of the Aztec stack that compiled this artifact. */
351
+ aztecVersion: string;
352
+
346
353
  /** The functions of the contract. Includes private and utility functions, plus the public dispatch function. */
347
354
  functions: FunctionArtifact[];
348
355
 
@@ -365,6 +372,7 @@ export interface ContractArtifact {
365
372
  export const ContractArtifactSchema = zodFor<ContractArtifact>()(
366
373
  z.object({
367
374
  name: z.string(),
375
+ aztecVersion: z.string().default(ARTIFACT_VERSION_BEFORE_INJECTION), // TODO(F-557): Remove default.
368
376
  functions: z.array(FunctionArtifactSchema),
369
377
  nonDispatchPublicFunctions: z.array(FunctionAbiSchema),
370
378
  outputs: z.object({
@@ -410,20 +418,10 @@ export async function getFunctionArtifact(
410
418
  artifact: ContractArtifact,
411
419
  functionNameOrSelector: string | FunctionSelector,
412
420
  ): Promise<FunctionArtifactWithContractName> {
413
- let functionArtifact;
414
- if (typeof functionNameOrSelector === 'string') {
415
- functionArtifact = artifact.functions.find(f => f.name === functionNameOrSelector);
416
- } else {
417
- const functionsAndSelectors = await Promise.all(
418
- artifact.functions.map(async fn => ({
419
- fn,
420
- selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters),
421
- })),
422
- );
423
- functionArtifact = functionsAndSelectors.find(fnAndSelector =>
424
- functionNameOrSelector.equals(fnAndSelector.selector),
425
- )?.fn;
426
- }
421
+ const functionArtifact =
422
+ typeof functionNameOrSelector === 'string'
423
+ ? artifact.functions.find(f => f.name === functionNameOrSelector)
424
+ : await findFunctionArtifactBySelector(artifact, functionNameOrSelector);
427
425
  if (!functionArtifact) {
428
426
  throw new Error(`Unknown function ${functionNameOrSelector}`);
429
427
  }
@@ -433,6 +431,40 @@ export async function getFunctionArtifact(
433
431
  return { ...functionArtifact, debug: debugMetadata, contractName: artifact.name };
434
432
  }
435
433
 
434
+ /**
435
+ * Finds the function artifact within `artifact.functions` whose selector matches `selector`.
436
+ * Returns `undefined` if no match is found.
437
+ */
438
+ export async function findFunctionArtifactBySelector(
439
+ artifact: ContractArtifact,
440
+ selector: FunctionSelector,
441
+ ): Promise<FunctionArtifact | undefined> {
442
+ const fnsAndSelectors = await Promise.all(
443
+ artifact.functions.map(async fn => ({
444
+ fn,
445
+ selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters),
446
+ })),
447
+ );
448
+ return fnsAndSelectors.find(({ selector: s }) => s.equals(selector))?.fn;
449
+ }
450
+
451
+ /**
452
+ * Finds the function abi (across both `functions` and `nonDispatchPublicFunctions`) whose selector
453
+ * matches `selector`. Returns `undefined` if no match is found.
454
+ */
455
+ export async function findFunctionAbiBySelector(
456
+ artifact: ContractArtifact,
457
+ selector: FunctionSelector,
458
+ ): Promise<FunctionAbi | undefined> {
459
+ const fnsAndSelectors = await Promise.all(
460
+ getAllFunctionAbis(artifact).map(async fn => ({
461
+ fn,
462
+ selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters),
463
+ })),
464
+ );
465
+ return fnsAndSelectors.find(({ selector: s }) => s.equals(selector))?.fn;
466
+ }
467
+
436
468
  /** Gets all function abis */
437
469
  export function getAllFunctionAbis(artifact: ContractArtifact): FunctionAbi[] {
438
470
  return artifact.functions.map(f => f as FunctionAbi).concat(artifact.nonDispatchPublicFunctions || []);
@@ -551,6 +583,7 @@ export function emptyFunctionArtifact(): FunctionArtifact {
551
583
  export function emptyContractArtifact(): ContractArtifact {
552
584
  return {
553
585
  name: '',
586
+ aztecVersion: DEV_VERSION,
554
587
  functions: [emptyFunctionArtifact()],
555
588
  nonDispatchPublicFunctions: [emptyFunctionAbi()],
556
589
  outputs: {
@@ -12,6 +12,7 @@ import {
12
12
  import {
13
13
  type ABIParameter,
14
14
  type ABIParameterVisibility,
15
+ ARTIFACT_VERSION_BEFORE_INJECTION,
15
16
  type AbiType,
16
17
  type BasicValue,
17
18
  type ContractArtifact,
@@ -51,6 +52,10 @@ export function contractArtifactFromBuffer(buffer: Buffer): ContractArtifact {
51
52
  */
52
53
  export function loadContractArtifact(input: NoirCompiledContract): ContractArtifact {
53
54
  if (isContractArtifact(input)) {
55
+ // TODO(F-557): Remove this fallback once pre-version artifacts are no longer tested.
56
+ if (!(input as unknown as Record<string, unknown>).aztecVersion) {
57
+ return { ...input, aztecVersion: ARTIFACT_VERSION_BEFORE_INJECTION };
58
+ }
54
59
  return input;
55
60
  }
56
61
  return generateContractArtifact(input);
@@ -276,10 +281,9 @@ function getStorageLayout(input: NoirCompiledContract) {
276
281
  }
277
282
 
278
283
  /**
279
- * Given a Nargo output generates an Aztec-compatible contract artifact.
284
+ * Given a post-processed Nargo output defined as `contract` generates an Aztec-compatible contract artifact.
285
+ *
280
286
  * Does not include public bytecode, apart from the public_dispatch function.
281
- * @param compiled - Noir build output.
282
- * @returns Aztec contract build artifact.
283
287
  */
284
288
  function generateContractArtifact(contract: NoirCompiledContract): ContractArtifact {
285
289
  try {
@@ -288,6 +292,7 @@ function generateContractArtifact(contract: NoirCompiledContract): ContractArtif
288
292
  }
289
293
  return ContractArtifactSchema.parse({
290
294
  name: contract.name,
295
+ aztecVersion: contract.aztec_version,
291
296
  functions: contract.functions.filter(f => retainBytecode(f)).map(f => generateFunctionArtifact(f, contract)),
292
297
  nonDispatchPublicFunctions: contract.functions
293
298
  .filter(f => !retainBytecode(f))
@@ -302,15 +307,15 @@ function generateContractArtifact(contract: NoirCompiledContract): ContractArtif
302
307
  }
303
308
 
304
309
  /**
305
- * Given a Nargo output generates an Aztec-compatible contract artifact.
310
+ * Given a post-processed Nargo output defined as `contract` generates an Aztec-compatible contract artifact.
311
+ *
306
312
  * Retains all public bytecode.
307
- * @param compiled - Noir build output.
308
- * @returns Aztec contract build artifact.
309
313
  */
310
314
  function generateContractArtifactForPublic(contract: NoirCompiledContract): ContractArtifact {
311
315
  try {
312
316
  return ContractArtifactSchema.parse({
313
317
  name: contract.name,
318
+ aztecVersion: contract.aztec_version,
314
319
  functions: contract.functions.map(f => generateFunctionArtifact(f, contract)),
315
320
  nonDispatchPublicFunctions: contract.functions
316
321
  .filter(f => !retainBytecode(f))
@@ -1,3 +1,4 @@
1
+ import { NULL_MSG_SENDER_CONTRACT_ADDRESS } from '@aztec/constants';
1
2
  import { Fr, fromBuffer } from '@aztec/foundation/curves/bn254';
2
3
  import { Point } from '@aztec/foundation/curves/grumpkin';
3
4
  import { type ZodFor, bufferSchemaFor, hexSchemaFor } from '@aztec/foundation/schemas';
@@ -41,6 +42,9 @@ export class AztecAddress {
41
42
 
42
43
  static ZERO = new AztecAddress(Buffer.alloc(32, 0));
43
44
 
45
+ /** Null msg sender address. Not part of the protocol contracts tree. */
46
+ static NULL_MSG_SENDER = AztecAddress.fromBigInt(NULL_MSG_SENDER_CONTRACT_ADDRESS);
47
+
44
48
  static zero(): AztecAddress {
45
49
  return AztecAddress.ZERO;
46
50
  }
@@ -3,12 +3,9 @@ import type { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/
3
3
 
4
4
  import { z } from 'zod';
5
5
 
6
- import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
7
- import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
8
6
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
9
7
  import { BlockHeader } from '../tx/block_header.js';
10
8
  import { BlockHash } from './block_hash.js';
11
- import { CommitteeAttestation } from './proposal/committee_attestation.js';
12
9
 
13
10
  /** L2Block metadata. Equivalent to L2Block but without block body containing tx data. */
14
11
  export type BlockData = {
@@ -26,17 +23,3 @@ export const BlockDataSchema = z.object({
26
23
  checkpointNumber: CheckpointNumberSchema,
27
24
  indexWithinCheckpoint: IndexWithinCheckpointSchema,
28
25
  });
29
-
30
- export const BlockDataWithCheckpointContextSchema = z
31
- .object({
32
- data: BlockDataSchema,
33
- checkpoint: CheckpointDataSchema.optional(),
34
- l1: L1PublishedData.schema.optional(),
35
- attestations: z.array(CommitteeAttestation.schema),
36
- })
37
- .transform(obj => ({
38
- data: obj.data,
39
- checkpoint: obj.checkpoint,
40
- l1: obj.l1,
41
- attestations: obj.attestations,
42
- }));
@@ -1,31 +1,64 @@
1
- import { BlockNumberSchema } from '@aztec/foundation/branded-types';
1
+ import { type BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import { jsonStringify } from '@aztec/foundation/json-rpc';
3
4
  import { schemas } from '@aztec/foundation/schemas';
4
5
 
5
6
  import { z } from 'zod';
6
7
 
7
- import { ChainTipSchema } from '../interfaces/chain_tips.js';
8
8
  import { BlockHash } from './block_hash.js';
9
9
 
10
+ export const BlockTag = ['latest', 'proposed', 'checkpointed', 'proven', 'finalized'] as const;
11
+
12
+ /**
13
+ * Tag identifying a block by its position in the chain rather than by an absolute identifier.
14
+ * - `latest` / `proposed`: Latest L2 block proposed (not necessarily checkpointed/proven yet).
15
+ * - `checkpointed`: Latest L2 block whose enclosing checkpoint has been published on L1.
16
+ * - `proven`: Latest L2 block whose enclosing checkpoint has been proven on L1.
17
+ * - `finalized`: Latest L2 block whose proving L1 transaction has reached L1 finality.
18
+ */
19
+ export type BlockTag = (typeof BlockTag)[number];
20
+
21
+ export const BlockTagWithoutLatestSchema = z.union([
22
+ z.literal('proposed'),
23
+ z.literal('checkpointed'),
24
+ z.literal('proven'),
25
+ z.literal('finalized'),
26
+ ]);
27
+
28
+ export const BlockTagSchema: z.ZodType<BlockTag> = z.union([z.literal('latest'), BlockTagWithoutLatestSchema]);
29
+
30
+ /**
31
+ * Object-only form of {@link BlockParameter}. Used as the building block for {@link BlockQuery}.
32
+ */
33
+ export type NormalizedBlockParameter =
34
+ | { number: BlockNumber }
35
+ | { hash: BlockHash }
36
+ | { archive: Fr }
37
+ | { tag: Exclude<BlockTag, 'latest'> };
38
+
39
+ export const NormalizedBlockParameterSchema: z.ZodType<NormalizedBlockParameter, z.ZodTypeDef, unknown> = z.union([
40
+ z.object({ number: BlockNumberSchema }).strict(),
41
+ z.object({ hash: BlockHash.schema }).strict(),
42
+ z.object({ archive: schemas.Fr }).strict(),
43
+ z.object({ tag: BlockTagWithoutLatestSchema }).strict(),
44
+ ]);
45
+
10
46
  /**
11
47
  * Selector for a block in RPC calls.
12
48
  *
13
49
  * Accepts a block number, a {@link BlockHash}, a chain-tip name (e.g. `'proven'`, `'checkpointed'`),
14
- * `'latest'` (alias for `'proposed'`), or the explicit object variants `{ number }`, `{ hash }`,
15
- * and `{ archive }`.
50
+ * `'latest'` (alias for `'proposed'`), or any of the {@link NormalizedBlockParameter} object variants
51
+ * (`{ number }`, `{ hash }`, `{ archive }`, `{ tag }`).
16
52
  */
17
- export const BlockParameterSchema = z.union([
53
+ export type BlockParameter = NormalizedBlockParameter | BlockNumber | BlockHash | BlockTag;
54
+
55
+ export const BlockParameterSchema: z.ZodType<BlockParameter, z.ZodTypeDef, unknown> = z.union([
56
+ NormalizedBlockParameterSchema,
18
57
  BlockHash.schema,
58
+ BlockTagSchema,
19
59
  BlockNumberSchema,
20
- ChainTipSchema,
21
- z.literal('latest'),
22
- z.object({ number: BlockNumberSchema }),
23
- z.object({ hash: BlockHash.schema }),
24
- z.object({ archive: schemas.Fr }),
25
60
  ]);
26
61
 
27
- export type BlockParameter = z.infer<typeof BlockParameterSchema>;
28
-
29
62
  export function inspectBlockParameter(param: BlockParameter) {
30
63
  if (typeof param === 'number') {
31
64
  return param.toString();
@@ -37,6 +70,8 @@ export function inspectBlockParameter(param: BlockParameter) {
37
70
  return `hash=${param.hash.toString()}`;
38
71
  } else if ('archive' in param) {
39
72
  return `archive=${param.archive.toString()}`;
73
+ } else if ('tag' in param) {
74
+ return `tag=${param.tag}`;
40
75
  } else {
41
76
  return jsonStringify(param);
42
77
  }
@@ -6,7 +6,6 @@ export * from './body.js';
6
6
  export * from './block_parameter.js';
7
7
  export * from './l2_block_source.js';
8
8
  export * from './block_hash.js';
9
- export * from './checkpointed_l2_block.js';
10
9
  export * from './proposal/index.js';
11
10
  export * from './validate_block_result.js';
12
11
  export * from './l2_block_info.js';