@aztec/standard-contracts 0.0.1-commit.e57c76e → 0.0.1-commit.f5a9928

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 (62) hide show
  1. package/artifacts/AuthRegistry.json +2277 -1350
  2. package/artifacts/HandshakeRegistry.json +4994 -1803
  3. package/artifacts/MultiCallEntrypoint.json +1788 -1067
  4. package/artifacts/PublicChecks.json +1722 -935
  5. package/artifacts-historical/HandshakeRegistry-5.0.1.d.json.ts +4 -0
  6. package/artifacts-historical/HandshakeRegistry-5.0.1.json +1 -0
  7. package/dest/auth-registry/constants.d.ts +3 -2
  8. package/dest/auth-registry/constants.d.ts.map +1 -1
  9. package/dest/contract_data.d.ts +1 -1
  10. package/dest/contract_data.d.ts.map +1 -1
  11. package/dest/contract_data.js +4 -5
  12. package/dest/drift.js +1 -1
  13. package/dest/handshake-registry/constants.d.ts +12 -4
  14. package/dest/handshake-registry/constants.d.ts.map +1 -1
  15. package/dest/handshake-registry/constants.js +11 -0
  16. package/dest/handshake-registry/historical.d.ts +11 -0
  17. package/dest/handshake-registry/historical.d.ts.map +1 -0
  18. package/dest/handshake-registry/historical.js +38 -0
  19. package/dest/handshake-registry/index.d.ts +4 -2
  20. package/dest/handshake-registry/index.d.ts.map +1 -1
  21. package/dest/handshake-registry/index.js +15 -2
  22. package/dest/handshake-registry/lazy.d.ts +4 -2
  23. package/dest/handshake-registry/lazy.d.ts.map +1 -1
  24. package/dest/handshake-registry/lazy.js +14 -2
  25. package/dest/index.d.ts +3 -1
  26. package/dest/index.d.ts.map +1 -1
  27. package/dest/index.js +2 -0
  28. package/dest/make_standard_contract.d.ts +13 -1
  29. package/dest/make_standard_contract.d.ts.map +1 -1
  30. package/dest/make_standard_contract.js +18 -5
  31. package/dest/multi-call-entrypoint/constants.d.ts +3 -2
  32. package/dest/multi-call-entrypoint/constants.d.ts.map +1 -1
  33. package/dest/preloaded/index.d.ts +8 -0
  34. package/dest/preloaded/index.d.ts.map +1 -0
  35. package/dest/preloaded/index.js +21 -0
  36. package/dest/preloaded/lazy.d.ts +8 -0
  37. package/dest/preloaded/lazy.d.ts.map +1 -0
  38. package/dest/preloaded/lazy.js +21 -0
  39. package/dest/public-checks/constants.d.ts +3 -2
  40. package/dest/public-checks/constants.d.ts.map +1 -1
  41. package/dest/publishable_standard_contracts.d.ts +17 -0
  42. package/dest/publishable_standard_contracts.d.ts.map +1 -0
  43. package/dest/publishable_standard_contracts.js +23 -0
  44. package/dest/standard_contract_data.d.ts +1 -1
  45. package/dest/standard_contract_data.d.ts.map +1 -1
  46. package/dest/standard_contract_data.js +26 -22
  47. package/package.json +4 -3
  48. package/src/auth-registry/constants.ts +3 -1
  49. package/src/contract_data.ts +4 -7
  50. package/src/drift.ts +1 -1
  51. package/src/handshake-registry/constants.ts +18 -1
  52. package/src/handshake-registry/historical.ts +44 -0
  53. package/src/handshake-registry/index.ts +20 -1
  54. package/src/handshake-registry/lazy.ts +19 -1
  55. package/src/index.ts +2 -0
  56. package/src/make_standard_contract.ts +28 -5
  57. package/src/multi-call-entrypoint/constants.ts +3 -1
  58. package/src/preloaded/index.ts +19 -0
  59. package/src/preloaded/lazy.ts +19 -0
  60. package/src/public-checks/constants.ts +3 -1
  61. package/src/publishable_standard_contracts.ts +22 -0
  62. package/src/standard_contract_data.ts +32 -22
@@ -15,36 +15,36 @@ export const StandardContractSalt = {
15
15
  HandshakeRegistry: new Fr(1)
16
16
  };
17
17
  export const StandardContractAddress = {
18
- AuthRegistry: AztecAddress.fromString('0x2e1c8ae9471649da39ea42c4abb17ecb7028ae1e5e23bd35fd4251a69658a2e1'),
19
- MultiCallEntrypoint: AztecAddress.fromString('0x0e169f6f6864aadf1eeafdef9af209f951f997f0b5187af191af7b271334aa20'),
20
- PublicChecks: AztecAddress.fromString('0x106479f2993a73b878821b4cd0098c9bd48164b32e9b567df009732dabaa65e2'),
21
- HandshakeRegistry: AztecAddress.fromString('0x04ee9dc0b25d393c804ab6a6fc34223f3ca914a9a9043bdc6cd877efc9067383')
18
+ AuthRegistry: AztecAddress.fromStringUnsafe('0x1e8e7e73c592a1b1c9199b4b655ddc7a16fa8a8488df595610b71d3dc1cc666c'),
19
+ MultiCallEntrypoint: AztecAddress.fromStringUnsafe('0x246d60af8b79a5dceece7d2388921203401c0df02ce674c5781c6c2162922986'),
20
+ PublicChecks: AztecAddress.fromStringUnsafe('0x031b75e2c220f6a6f27da5d61f7b2a12756a127fd25b95fad5da1c5520994b18'),
21
+ HandshakeRegistry: AztecAddress.fromStringUnsafe('0x06127814dca78709650de6629637194f7381d2e05b35eb9d53a4746636c9aa9d')
22
22
  };
23
23
  export const StandardContractClassId = {
24
- AuthRegistry: Fr.fromString('0x09f06345b8e37c037d622f668d380018d2e013d04a31cbebaa9e7c23f7cc7a7d'),
25
- MultiCallEntrypoint: Fr.fromString('0x239cdcd8464627acdf64f352b0a71b4b3cb2c27e8582ff4f273faff87a33ba65'),
26
- PublicChecks: Fr.fromString('0x24ce4becc7cb6bf880726dc4358b09ada12fb0f7015c32b971822033fc5844f2'),
27
- HandshakeRegistry: Fr.fromString('0x2453d20a9e6e312567b7c088c669ae376b13773971dd055af99251c86bcc59f3')
24
+ AuthRegistry: Fr.fromString('0x04182c4b482c8e60c386e473f6dbb6bb3e2ef18e5156f7c9db5ac46af81abdcf'),
25
+ MultiCallEntrypoint: Fr.fromString('0x2f20566eaff9091697f8f5c43a19041267c7591d54074b57043eae90fca8ea64'),
26
+ PublicChecks: Fr.fromString('0x04bc93d415c4d48acab6063b6410f74e1cc257ba8e519020f8773b4ce8ccd31e'),
27
+ HandshakeRegistry: Fr.fromString('0x2e04c07c83ee8107e921c3ae4ade010ee183860a89b7534ea3367efb561d2c3b')
28
28
  };
29
29
  export const StandardContractClassIdPreimage = {
30
30
  AuthRegistry: {
31
- artifactHash: Fr.fromString('0x294cf57741ec175652921fd6fbd5ac8bcfe592ad761a5711b66a23b60ba8fbc0'),
32
- privateFunctionsRoot: Fr.fromString('0x17b584350f4c3ccafd8f688729afb9feab8976114fb40012e9dee65022c072a4'),
33
- publicBytecodeCommitment: Fr.fromString('0x2545f39893766508ce37bb5cea5e4dcab04c6f7f79f3089b1c076876e9d268b2')
31
+ artifactHash: Fr.fromString('0x0f050d2517afac6974e02937314e095569f4c7bb70d98cea097c562313872c8c'),
32
+ privateFunctionsRoot: Fr.fromString('0x1b16157ab0b322bcaf3de5cb197b276c5e29ca3668a0c440668ca56aa7dfff77'),
33
+ publicBytecodeCommitment: Fr.fromString('0x0c7984b020afc901da3b5898b8f94d1d9a09ea2b37d6e0043409abc0b0332906')
34
34
  },
35
35
  MultiCallEntrypoint: {
36
- artifactHash: Fr.fromString('0x16a1c11f78386c8e1ff3d413e05e068a81f88b2659b66b909f7215226553fa60'),
37
- privateFunctionsRoot: Fr.fromString('0x0e68dfbb256e80b08b3aef47aca1f2669e97a9c6259787893c1223ac083ad5d5'),
36
+ artifactHash: Fr.fromString('0x2c0df1970a0307e54c4445670a7f915a77ed57650ffd37a76c47e512c88e0302'),
37
+ privateFunctionsRoot: Fr.fromString('0x10228bc99b6715f15c866a1df0d9cb63c31920cb8e61a6b79058bf98658d7f39'),
38
38
  publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e')
39
39
  },
40
40
  PublicChecks: {
41
- artifactHash: Fr.fromString('0x12c44e639e8a6c994c94c913eaf37c7809b1d97ea30d2c527474b09d4367c87d'),
41
+ artifactHash: Fr.fromString('0x0e6f595db5f0830c2f52f1a5aec5cc85193b89a47408cfbbb2d6ad8f3a7c8a52'),
42
42
  privateFunctionsRoot: Fr.fromString('0x202860adb1b8975971eeaf571aaaa88a27f4035290d58532ae7d60b0dfaad54c'),
43
43
  publicBytecodeCommitment: Fr.fromString('0x013c4f854a5c87c9daf86c5f9bc07a42c2a061f1d924a5b3564ec7edc8e18cb7')
44
44
  },
45
45
  HandshakeRegistry: {
46
- artifactHash: Fr.fromString('0x16dc423d685d565f0713936fa5acec94daefe82d92c4306354c4eec35ae8aca6'),
47
- privateFunctionsRoot: Fr.fromString('0x22071f2bef1999fe9698359ef95acfeb9cd7c473d04207ed160715c81292c6b3'),
46
+ artifactHash: Fr.fromString('0x005a9c5db229999895a873e4c2bcaf6ca2523522b5c520c52c39b1bdb1b5faee'),
47
+ privateFunctionsRoot: Fr.fromString('0x1bb83fa540ba6654ffe4a4c75ec9349180a2f0ecd0d3851ca28d665ab2926c73'),
48
48
  publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e')
49
49
  }
50
50
  };
@@ -58,24 +58,28 @@ export const StandardContractPrivateFunctions = {
58
58
  AuthRegistry: [
59
59
  {
60
60
  selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000079a3d418')),
61
- vkHash: Fr.fromString('0x06a5c1b3a636c954a90be43cb56a4bdd9dc8aec764151a012e0018753694ff54')
61
+ vkHash: Fr.fromString('0x2d46cdec4cc2afd813ba2b50106dba455821e4c7b3c10f1c7293bbc759dccf64')
62
62
  }
63
63
  ],
64
64
  MultiCallEntrypoint: [
65
65
  {
66
66
  selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f04908a9')),
67
- vkHash: Fr.fromString('0x0b19b2f937f2581922c2ead5411ad9ff4ed9710efe9849bde494d9a0f94812ec')
67
+ vkHash: Fr.fromString('0x0699bae67183ce084da1cd76ce05d18f45f796237f2baafaf7d4bfbf9663c433')
68
68
  }
69
69
  ],
70
70
  PublicChecks: [],
71
71
  HandshakeRegistry: [
72
72
  {
73
- selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000005d4db100')),
74
- vkHash: Fr.fromString('0x035db3173b6dc6305d989fe910690cc0a556bf30261c6b4235144403e5378635')
73
+ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000019f8b409')),
74
+ vkHash: Fr.fromString('0x195d78c4fa1f3f8accaa2dcc45115c5b0536e68cdd4c06f5999185554f7b73e4')
75
75
  },
76
76
  {
77
- selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000005fa93894')),
78
- vkHash: Fr.fromString('0x0ed3c8564b7f78e1dd558a0e38719c7056b27ae7f48aed795ffa2d6d84bae85d')
77
+ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000db548fcf')),
78
+ vkHash: Fr.fromString('0x06ea812f1c792a864a36003312327d78995fdd894fbf48d54928a315e84df342')
79
+ },
80
+ {
81
+ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f1ff839b')),
82
+ vkHash: Fr.fromString('0x049120d4c9a12a2286c83df31064637b53746ea13868b0756174dcb3e036bb9d')
79
83
  }
80
84
  ]
81
85
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aztec/standard-contracts",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/standard-contracts",
4
4
  "description": "Standard non-protocol contracts for the Aztec Network",
5
- "version": "0.0.1-commit.e57c76e",
5
+ "version": "0.0.1-commit.f5a9928",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": "./dest/index.js",
@@ -74,8 +74,8 @@
74
74
  ]
75
75
  },
76
76
  "dependencies": {
77
- "@aztec/foundation": "0.0.1-commit.e57c76e",
78
- "@aztec/stdlib": "0.0.1-commit.e57c76e",
77
+ "@aztec/foundation": "0.0.1-commit.f5a9928",
78
+ "@aztec/stdlib": "0.0.1-commit.f5a9928",
79
79
  "tslib": "^2.4.0"
80
80
  },
81
81
  "devDependencies": {
@@ -95,6 +95,7 @@
95
95
  "src",
96
96
  "!*.test.*",
97
97
  "artifacts",
98
+ "artifacts-historical",
98
99
  "!src/scripts/*"
99
100
  ],
100
101
  "engines": {
@@ -1,8 +1,10 @@
1
1
  // Address-only leaf export for browser bundles: importing from
2
2
  // `@aztec/standard-contracts/auth-registry/constants` avoids dragging in the
3
3
  // `AuthRegistry.json` static import.
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+
4
6
  import { StandardContractAddress, StandardContractClassId, StandardContractSalt } from '../standard_contract_data.js';
5
7
 
6
- export const STANDARD_AUTH_REGISTRY_ADDRESS = StandardContractAddress.AuthRegistry;
8
+ export const STANDARD_AUTH_REGISTRY_ADDRESS: AztecAddress = StandardContractAddress.AuthRegistry;
7
9
  export const STANDARD_AUTH_REGISTRY_CLASS_ID = StandardContractClassId.AuthRegistry;
8
10
  export const STANDARD_AUTH_REGISTRY_SALT = StandardContractSalt.AuthRegistry;
@@ -32,13 +32,10 @@ export const NOIR_ARTIFACTS_SRC_PATH = path.join(NOIR_CONTRACTS_ROOT, './target'
32
32
  export const STANDARD_ARTIFACTS_DEST_DIR = './artifacts';
33
33
  /** Path of the generated TS data file (addresses, class IDs, etc.). */
34
34
  export const STANDARD_CONTRACT_DATA_OUTPUT_PATH = './src/standard_contract_data.ts';
35
- // Both consumers (aztec-nr's `aztec` crate and noir-contracts' `aztec_sublib`) need an identical
36
- // twin of the generated addresses module. `aztec_sublib` cannot depend on `aztec`, so we stamp the
37
- // same file into both locations rather than introducing a shared crate.
38
- export const NOIR_STANDARD_ADDRESSES_PATHS = [
39
- '../../noir-projects/aztec-nr/aztec/src/standard_addresses.nr',
40
- '../../noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/standard_addresses.nr',
41
- ];
35
+ // The `aztec` crate in aztec-nr needs a twin of the generated addresses module stamped into its
36
+ // source so circuits can reference standard-contract addresses at compile time (e.g. authwit and
37
+ // public_checks) without re-hashing at runtime.
38
+ export const NOIR_STANDARD_ADDRESSES_PATHS = ['../../noir-projects/aztec-nr/aztec/src/standard_addresses.nr'];
42
39
 
43
40
  /** The deployment salt baked into every standard contract instance. */
44
41
  export const STANDARD_CONTRACT_SALT = new Fr(1);
package/src/drift.ts CHANGED
@@ -37,7 +37,7 @@ function generateSalts(names: string[]) {
37
37
  function generateAddresses(names: string[], contractData: ContractData[]) {
38
38
  return `
39
39
  export const StandardContractAddress: Record<StandardContractName, AztecAddress> = {
40
- ${contractData.map((d, i) => `${names[i]}: AztecAddress.fromString('${d.address.toString()}')`).join(',\n')}
40
+ ${contractData.map((d, i) => `${names[i]}: AztecAddress.fromStringUnsafe('${d.address.toString()}')`).join(',\n')}
41
41
  };
42
42
  `;
43
43
  }
@@ -1,8 +1,25 @@
1
1
  // Lightweight metadata leaf export for browser bundles: importing from
2
2
  // `@aztec/standard-contracts/handshake-registry/constants` avoids dragging in the
3
3
  // `HandshakeRegistry.json` static import.
4
+ import { sha256ToField } from '@aztec/foundation/crypto/sha256';
5
+ import type { Fr } from '@aztec/foundation/curves/bn254';
6
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+
4
8
  import { StandardContractAddress, StandardContractClassId, StandardContractSalt } from '../standard_contract_data.js';
5
9
 
6
- export const STANDARD_HANDSHAKE_REGISTRY_ADDRESS = StandardContractAddress.HandshakeRegistry;
10
+ export { HISTORICAL_STANDARD_HANDSHAKE_REGISTRY_ADDRESSES } from './historical.js';
11
+
12
+ export const STANDARD_HANDSHAKE_REGISTRY_ADDRESS: AztecAddress = StandardContractAddress.HandshakeRegistry;
7
13
  export const STANDARD_HANDSHAKE_REGISTRY_CLASS_ID = StandardContractClassId.HandshakeRegistry;
8
14
  export const STANDARD_HANDSHAKE_REGISTRY_SALT = StandardContractSalt.HandshakeRegistry;
15
+
16
+ /**
17
+ * Request kind under which the HandshakeRegistry asks for a recipient's interactive-handshake signature through the
18
+ * `resolveCustomRequest` hook. Mirrors `INTERACTIVE_HANDSHAKE_REQUEST_KIND` in the registry contract.
19
+ */
20
+ // TODO: remove this mirrored constant and read the value from the HandshakeRegistry artifact once the contract
21
+ // global can be `#[abi]`-exported. Fixed upstream but not yet released:
22
+ // https://github.com/noir-lang/noir/pull/12714 and https://github.com/noir-lang/noir/issues/12620.
23
+ export const INTERACTIVE_HANDSHAKE_REQUEST_KIND: Fr = sha256ToField([
24
+ Buffer.from('HANDSHAKE_REGISTRY::INTERACTIVE_HANDSHAKE_REQUEST'),
25
+ ]);
@@ -0,0 +1,44 @@
1
+ // Deployment data of superseded standard HandshakeRegistry versions. When a release changes the registry (and thus
2
+ // its canonical address), contracts compiled against earlier releases keep the old address baked into their
3
+ // bytecode, and the old instance stays live onchain. Archiving the retired deployment here (data below, trimmed
4
+ // artifact under `artifacts-historical/`) lets PXE keep registering and authorizing it, so apps built on older
5
+ // releases keep working against newer aztec.js versions.
6
+ import { Fr } from '@aztec/foundation/curves/bn254';
7
+ import { FunctionSelector } from '@aztec/stdlib/abi';
8
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
9
+
10
+ import type { StandardContractData } from '../make_standard_contract.js';
11
+
12
+ /** Deployment data of the standard HandshakeRegistry released in v5.0.1 and superseded in v5.1.0. */
13
+ export const HANDSHAKE_REGISTRY_V5_0_1_DATA: StandardContractData = {
14
+ address: AztecAddress.fromStringUnsafe('0x086c3c67589e1141c70ed0ed8ae324c51d3bf7c5637043fd84c424ffb625831d'),
15
+ salt: new Fr(1),
16
+ classId: Fr.fromString('0x020ec1998d06036ddab4ba170e9b0d9b96e52beb58aa5ea83d72b22f589cbe6c'),
17
+ artifactHash: Fr.fromString('0x2dd01b80cabc352f7d01799a6e5dd6255cc0d7f01fe42d270760d0bf0a0b5daf'),
18
+ privateFunctionsRoot: Fr.fromString('0x0c80100ee31d91778c8f3d4453d056a58467b50f86d446f3209b96d87acb354e'),
19
+ publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
20
+ initializationHash: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
21
+ privateFunctions: [
22
+ {
23
+ selector: FunctionSelector.fromField(new Fr(0x19f8b409)),
24
+ vkHash: Fr.fromString('0x033a99c31fd390e320398efa03eb1a34d0db2f2e0201fbb0062aa915f406f3d7'),
25
+ },
26
+ {
27
+ selector: FunctionSelector.fromField(new Fr(0xdb548fcf)),
28
+ vkHash: Fr.fromString('0x12964f25be85fded4079591a3871e85d15967c75fd70f3d0edf10d72abfea59c'),
29
+ },
30
+ {
31
+ selector: FunctionSelector.fromField(new Fr(0xf1ff839b)),
32
+ vkHash: Fr.fromString('0x049120d4c9a12a2286c83df31064637b53746ea13868b0756174dcb3e036bb9d'),
33
+ },
34
+ ],
35
+ };
36
+
37
+ /**
38
+ * Addresses of superseded standard HandshakeRegistry deployments that remain live onchain. PXE registers these
39
+ * alongside the current deployment and authorizes their read functions, so contracts compiled against older
40
+ * releases can still reach the registry version they were built for.
41
+ */
42
+ export const HISTORICAL_STANDARD_HANDSHAKE_REGISTRY_ADDRESSES: AztecAddress[] = [
43
+ HANDSHAKE_REGISTRY_V5_0_1_DATA.address,
44
+ ];
@@ -1,11 +1,15 @@
1
1
  import { loadContractArtifact } from '@aztec/stdlib/abi';
2
2
  import type { NoirCompiledContract } from '@aztec/stdlib/noir';
3
3
 
4
+ import HandshakeRegistryV501Json from '../../artifacts-historical/HandshakeRegistry-5.0.1.json' with { type: 'json' };
4
5
  import HandshakeRegistryJson from '../../artifacts/HandshakeRegistry.json' with { type: 'json' };
5
- import { makeStandardContract } from '../make_standard_contract.js';
6
+ import { makeStandardContract, makeStandardContractFromData } from '../make_standard_contract.js';
6
7
  import type { StandardContract } from '../standard_contract.js';
8
+ import { HANDSHAKE_REGISTRY_V5_0_1_DATA } from './historical.js';
7
9
 
8
10
  export {
11
+ HISTORICAL_STANDARD_HANDSHAKE_REGISTRY_ADDRESSES,
12
+ INTERACTIVE_HANDSHAKE_REQUEST_KIND,
9
13
  STANDARD_HANDSHAKE_REGISTRY_ADDRESS,
10
14
  STANDARD_HANDSHAKE_REGISTRY_CLASS_ID,
11
15
  STANDARD_HANDSHAKE_REGISTRY_SALT,
@@ -22,3 +26,18 @@ export function getStandardHandshakeRegistry(): Promise<StandardContract> {
22
26
  }
23
27
  return Promise.resolve(standardContract);
24
28
  }
29
+
30
+ let historicalStandardContracts: StandardContract[];
31
+
32
+ /** Returns superseded standard deployments of the handshake registry that remain live onchain. */
33
+ export function getHistoricalStandardHandshakeRegistries(): Promise<StandardContract[]> {
34
+ if (!historicalStandardContracts) {
35
+ historicalStandardContracts = [
36
+ makeStandardContractFromData(
37
+ HANDSHAKE_REGISTRY_V5_0_1_DATA,
38
+ loadContractArtifact(HandshakeRegistryV501Json as NoirCompiledContract),
39
+ ),
40
+ ];
41
+ }
42
+ return Promise.resolve(historicalStandardContracts);
43
+ }
@@ -1,9 +1,11 @@
1
1
  import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
2
2
 
3
- import { makeStandardContract } from '../make_standard_contract.js';
3
+ import { makeStandardContract, makeStandardContractFromData } from '../make_standard_contract.js';
4
4
  import type { StandardContract } from '../standard_contract.js';
5
+ import { HANDSHAKE_REGISTRY_V5_0_1_DATA } from './historical.js';
5
6
 
6
7
  export {
8
+ HISTORICAL_STANDARD_HANDSHAKE_REGISTRY_ADDRESSES,
7
9
  STANDARD_HANDSHAKE_REGISTRY_ADDRESS,
8
10
  STANDARD_HANDSHAKE_REGISTRY_CLASS_ID,
9
11
  STANDARD_HANDSHAKE_REGISTRY_SALT,
@@ -33,3 +35,19 @@ export async function getStandardHandshakeRegistry(): Promise<StandardContract>
33
35
  }
34
36
  return standardContract;
35
37
  }
38
+
39
+ let historicalStandardContracts: StandardContract[];
40
+
41
+ /** Returns superseded standard deployments of the handshake registry that remain live onchain. */
42
+ export async function getHistoricalStandardHandshakeRegistries(): Promise<StandardContract[]> {
43
+ if (!historicalStandardContracts) {
44
+ // Same bundler-compatible lazy import as `getHandshakeRegistryArtifact` above.
45
+ const { default: handshakeRegistryV501Json } = await import(
46
+ '../../artifacts-historical/HandshakeRegistry-5.0.1.json'
47
+ );
48
+ historicalStandardContracts = [
49
+ makeStandardContractFromData(HANDSHAKE_REGISTRY_V5_0_1_DATA, loadContractArtifact(handshakeRegistryV501Json)),
50
+ ];
51
+ }
52
+ return historicalStandardContracts;
53
+ }
package/src/index.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './auth-registry/index.js';
2
2
  export * from './handshake-registry/index.js';
3
3
  export * from './multi-call-entrypoint/index.js';
4
+ export * from './preloaded/index.js';
4
5
  export * from './public-checks/index.js';
6
+ export * from './publishable_standard_contracts.js';
@@ -3,6 +3,7 @@ import type { ContractArtifact } from '@aztec/stdlib/abi';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { PublicKeys } from '@aztec/stdlib/keys';
5
5
 
6
+ import type { ContractData } from './contract_data.js';
6
7
  import type { StandardContract } from './standard_contract.js';
7
8
  import {
8
9
  StandardContractAddress,
@@ -14,16 +15,38 @@ import {
14
15
  StandardContractSalt,
15
16
  } from './standard_contract_data.js';
16
17
 
18
+ /** Precomputed deployment values of a standard contract, enough to reconstruct it without any hash computations. */
19
+ export type StandardContractData = ContractData & { salt: Fr };
20
+
17
21
  /**
18
22
  * Reconstructs a StandardContract from precomputed data without performing any hash computations.
19
23
  * Internal to the standard-contracts package — not part of the public API.
20
24
  */
21
25
  export function makeStandardContract(name: StandardContractName, artifact: ContractArtifact): StandardContract {
22
- const address = StandardContractAddress[name];
23
- const salt = StandardContractSalt[name];
24
- const classId = StandardContractClassId[name];
25
26
  const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment } = StandardContractClassIdPreimage[name];
26
- const initializationHash = StandardContractInitializationHash[name];
27
+ return makeStandardContractFromData(
28
+ {
29
+ address: StandardContractAddress[name],
30
+ salt: StandardContractSalt[name],
31
+ classId: StandardContractClassId[name],
32
+ artifactHash,
33
+ privateFunctionsRoot,
34
+ publicBytecodeCommitment,
35
+ initializationHash: StandardContractInitializationHash[name],
36
+ privateFunctions: StandardContractPrivateFunctions[name],
37
+ },
38
+ artifact,
39
+ );
40
+ }
41
+
42
+ /**
43
+ * Reconstructs a StandardContract from explicit precomputed data, for deployments not covered by the generated
44
+ * `standard_contract_data.ts` records (namely historical deployments from previous releases).
45
+ * Internal to the standard-contracts package, not part of the public API.
46
+ */
47
+ export function makeStandardContractFromData(data: StandardContractData, artifact: ContractArtifact): StandardContract {
48
+ const { address, salt, classId, artifactHash, privateFunctionsRoot, publicBytecodeCommitment, initializationHash } =
49
+ data;
27
50
 
28
51
  const contractClass = {
29
52
  id: classId,
@@ -32,7 +55,7 @@ export function makeStandardContract(name: StandardContractName, artifact: Contr
32
55
  privateFunctionsRoot,
33
56
  publicBytecodeCommitment,
34
57
  packedBytecode: artifact.functions.find(f => f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0),
35
- privateFunctions: StandardContractPrivateFunctions[name],
58
+ privateFunctions: data.privateFunctions,
36
59
  };
37
60
 
38
61
  const instance = {
@@ -1,8 +1,10 @@
1
1
  // Lightweight metadata leaf export for browser bundles: importing from
2
2
  // `@aztec/standard-contracts/multi-call-entrypoint/constants` avoids dragging in the
3
3
  // `MultiCallEntrypoint.json` static import.
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+
4
6
  import { StandardContractAddress, StandardContractClassId, StandardContractSalt } from '../standard_contract_data.js';
5
7
 
6
- export const STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS = StandardContractAddress.MultiCallEntrypoint;
8
+ export const STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS: AztecAddress = StandardContractAddress.MultiCallEntrypoint;
7
9
  export const STANDARD_MULTI_CALL_ENTRYPOINT_CLASS_ID = StandardContractClassId.MultiCallEntrypoint;
8
10
  export const STANDARD_MULTI_CALL_ENTRYPOINT_SALT = StandardContractSalt.MultiCallEntrypoint;
@@ -0,0 +1,19 @@
1
+ import { getStandardAuthRegistry } from '../auth-registry/index.js';
2
+ import { getHistoricalStandardHandshakeRegistries, getStandardHandshakeRegistry } from '../handshake-registry/index.js';
3
+ import { getStandardMultiCallEntrypoint } from '../multi-call-entrypoint/index.js';
4
+ import type { StandardContract } from '../standard_contract.js';
5
+
6
+ /**
7
+ * Returns the standard contracts every PXE registers by default: the MultiCallEntrypoint, the AuthRegistry, and the
8
+ * HandshakeRegistry, plus superseded HandshakeRegistry deployments that remain live onchain so contracts compiled
9
+ * against older releases keep resolving the registry version they were built for.
10
+ */
11
+ export async function getDefaultStandardPreloadedContracts(): Promise<StandardContract[]> {
12
+ const [multiCallEntrypoint, authRegistry, handshakeRegistry, historicalHandshakeRegistries] = await Promise.all([
13
+ getStandardMultiCallEntrypoint(),
14
+ getStandardAuthRegistry(),
15
+ getStandardHandshakeRegistry(),
16
+ getHistoricalStandardHandshakeRegistries(),
17
+ ]);
18
+ return [multiCallEntrypoint, authRegistry, handshakeRegistry, ...historicalHandshakeRegistries];
19
+ }
@@ -0,0 +1,19 @@
1
+ import { getStandardAuthRegistry } from '../auth-registry/lazy.js';
2
+ import { getHistoricalStandardHandshakeRegistries, getStandardHandshakeRegistry } from '../handshake-registry/lazy.js';
3
+ import { getStandardMultiCallEntrypoint } from '../multi-call-entrypoint/lazy.js';
4
+ import type { StandardContract } from '../standard_contract.js';
5
+
6
+ /**
7
+ * Returns the standard contracts every PXE registers by default: the MultiCallEntrypoint, the AuthRegistry, and the
8
+ * HandshakeRegistry, plus superseded HandshakeRegistry deployments that remain live onchain so contracts compiled
9
+ * against older releases keep resolving the registry version they were built for.
10
+ */
11
+ export async function getDefaultStandardPreloadedContracts(): Promise<StandardContract[]> {
12
+ const [multiCallEntrypoint, authRegistry, handshakeRegistry, historicalHandshakeRegistries] = await Promise.all([
13
+ getStandardMultiCallEntrypoint(),
14
+ getStandardAuthRegistry(),
15
+ getStandardHandshakeRegistry(),
16
+ getHistoricalStandardHandshakeRegistries(),
17
+ ]);
18
+ return [multiCallEntrypoint, authRegistry, handshakeRegistry, ...historicalHandshakeRegistries];
19
+ }
@@ -1,8 +1,10 @@
1
1
  // Lightweight metadata leaf export for browser bundles: importing from
2
2
  // `@aztec/standard-contracts/public-checks/constants` avoids dragging in the
3
3
  // `PublicChecks.json` static import.
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+
4
6
  import { StandardContractAddress, StandardContractClassId, StandardContractSalt } from '../standard_contract_data.js';
5
7
 
6
- export const STANDARD_PUBLIC_CHECKS_ADDRESS = StandardContractAddress.PublicChecks;
8
+ export const STANDARD_PUBLIC_CHECKS_ADDRESS: AztecAddress = StandardContractAddress.PublicChecks;
7
9
  export const STANDARD_PUBLIC_CHECKS_CLASS_ID = StandardContractClassId.PublicChecks;
8
10
  export const STANDARD_PUBLIC_CHECKS_SALT = StandardContractSalt.PublicChecks;
@@ -0,0 +1,22 @@
1
+ import { getStandardAuthRegistry } from './auth-registry/index.js';
2
+ import { getStandardHandshakeRegistry } from './handshake-registry/index.js';
3
+ import { getStandardPublicChecks } from './public-checks/index.js';
4
+ import type { StandardContract } from './standard_contract.js';
5
+
6
+ /**
7
+ * Returns the standard contracts that are published on-chain (class registration + instance
8
+ * publication) before their public functions can be called: AuthRegistry, PublicChecks, and
9
+ * HandshakeRegistry. These are exactly the contracts guarded by the `ensure*Published` e2e setup
10
+ * helpers.
11
+ *
12
+ * MultiCallEntrypoint is deliberately excluded: it is a client-side entrypoint used to encode
13
+ * batched private calls and is never published for public execution.
14
+ *
15
+ * This is the single source of truth for the set of standard contracts that test environments seed
16
+ * at genesis (registration/deployment nullifiers) and preload into the archiver contract store, so
17
+ * the two stay consistent — preloading a class whose nullifier is not seeded would recreate the
18
+ * publish-collision bug that genesis seeding avoids.
19
+ */
20
+ export function getPublishableStandardContracts(): Promise<StandardContract[]> {
21
+ return Promise.all([getStandardAuthRegistry(), getStandardPublicChecks(), getStandardHandshakeRegistry()]);
22
+ }
@@ -20,17 +20,21 @@ export const StandardContractSalt: Record<StandardContractName, Fr> = {
20
20
  };
21
21
 
22
22
  export const StandardContractAddress: Record<StandardContractName, AztecAddress> = {
23
- AuthRegistry: AztecAddress.fromString('0x2e1c8ae9471649da39ea42c4abb17ecb7028ae1e5e23bd35fd4251a69658a2e1'),
24
- MultiCallEntrypoint: AztecAddress.fromString('0x0e169f6f6864aadf1eeafdef9af209f951f997f0b5187af191af7b271334aa20'),
25
- PublicChecks: AztecAddress.fromString('0x106479f2993a73b878821b4cd0098c9bd48164b32e9b567df009732dabaa65e2'),
26
- HandshakeRegistry: AztecAddress.fromString('0x04ee9dc0b25d393c804ab6a6fc34223f3ca914a9a9043bdc6cd877efc9067383'),
23
+ AuthRegistry: AztecAddress.fromStringUnsafe('0x1e8e7e73c592a1b1c9199b4b655ddc7a16fa8a8488df595610b71d3dc1cc666c'),
24
+ MultiCallEntrypoint: AztecAddress.fromStringUnsafe(
25
+ '0x246d60af8b79a5dceece7d2388921203401c0df02ce674c5781c6c2162922986',
26
+ ),
27
+ PublicChecks: AztecAddress.fromStringUnsafe('0x031b75e2c220f6a6f27da5d61f7b2a12756a127fd25b95fad5da1c5520994b18'),
28
+ HandshakeRegistry: AztecAddress.fromStringUnsafe(
29
+ '0x06127814dca78709650de6629637194f7381d2e05b35eb9d53a4746636c9aa9d',
30
+ ),
27
31
  };
28
32
 
29
33
  export const StandardContractClassId: Record<StandardContractName, Fr> = {
30
- AuthRegistry: Fr.fromString('0x09f06345b8e37c037d622f668d380018d2e013d04a31cbebaa9e7c23f7cc7a7d'),
31
- MultiCallEntrypoint: Fr.fromString('0x239cdcd8464627acdf64f352b0a71b4b3cb2c27e8582ff4f273faff87a33ba65'),
32
- PublicChecks: Fr.fromString('0x24ce4becc7cb6bf880726dc4358b09ada12fb0f7015c32b971822033fc5844f2'),
33
- HandshakeRegistry: Fr.fromString('0x2453d20a9e6e312567b7c088c669ae376b13773971dd055af99251c86bcc59f3'),
34
+ AuthRegistry: Fr.fromString('0x04182c4b482c8e60c386e473f6dbb6bb3e2ef18e5156f7c9db5ac46af81abdcf'),
35
+ MultiCallEntrypoint: Fr.fromString('0x2f20566eaff9091697f8f5c43a19041267c7591d54074b57043eae90fca8ea64'),
36
+ PublicChecks: Fr.fromString('0x04bc93d415c4d48acab6063b6410f74e1cc257ba8e519020f8773b4ce8ccd31e'),
37
+ HandshakeRegistry: Fr.fromString('0x2e04c07c83ee8107e921c3ae4ade010ee183860a89b7534ea3367efb561d2c3b'),
34
38
  };
35
39
 
36
40
  export const StandardContractClassIdPreimage: Record<
@@ -38,23 +42,23 @@ export const StandardContractClassIdPreimage: Record<
38
42
  { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }
39
43
  > = {
40
44
  AuthRegistry: {
41
- artifactHash: Fr.fromString('0x294cf57741ec175652921fd6fbd5ac8bcfe592ad761a5711b66a23b60ba8fbc0'),
42
- privateFunctionsRoot: Fr.fromString('0x17b584350f4c3ccafd8f688729afb9feab8976114fb40012e9dee65022c072a4'),
43
- publicBytecodeCommitment: Fr.fromString('0x2545f39893766508ce37bb5cea5e4dcab04c6f7f79f3089b1c076876e9d268b2'),
45
+ artifactHash: Fr.fromString('0x0f050d2517afac6974e02937314e095569f4c7bb70d98cea097c562313872c8c'),
46
+ privateFunctionsRoot: Fr.fromString('0x1b16157ab0b322bcaf3de5cb197b276c5e29ca3668a0c440668ca56aa7dfff77'),
47
+ publicBytecodeCommitment: Fr.fromString('0x0c7984b020afc901da3b5898b8f94d1d9a09ea2b37d6e0043409abc0b0332906'),
44
48
  },
45
49
  MultiCallEntrypoint: {
46
- artifactHash: Fr.fromString('0x16a1c11f78386c8e1ff3d413e05e068a81f88b2659b66b909f7215226553fa60'),
47
- privateFunctionsRoot: Fr.fromString('0x0e68dfbb256e80b08b3aef47aca1f2669e97a9c6259787893c1223ac083ad5d5'),
50
+ artifactHash: Fr.fromString('0x2c0df1970a0307e54c4445670a7f915a77ed57650ffd37a76c47e512c88e0302'),
51
+ privateFunctionsRoot: Fr.fromString('0x10228bc99b6715f15c866a1df0d9cb63c31920cb8e61a6b79058bf98658d7f39'),
48
52
  publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
49
53
  },
50
54
  PublicChecks: {
51
- artifactHash: Fr.fromString('0x12c44e639e8a6c994c94c913eaf37c7809b1d97ea30d2c527474b09d4367c87d'),
55
+ artifactHash: Fr.fromString('0x0e6f595db5f0830c2f52f1a5aec5cc85193b89a47408cfbbb2d6ad8f3a7c8a52'),
52
56
  privateFunctionsRoot: Fr.fromString('0x202860adb1b8975971eeaf571aaaa88a27f4035290d58532ae7d60b0dfaad54c'),
53
57
  publicBytecodeCommitment: Fr.fromString('0x013c4f854a5c87c9daf86c5f9bc07a42c2a061f1d924a5b3564ec7edc8e18cb7'),
54
58
  },
55
59
  HandshakeRegistry: {
56
- artifactHash: Fr.fromString('0x16dc423d685d565f0713936fa5acec94daefe82d92c4306354c4eec35ae8aca6'),
57
- privateFunctionsRoot: Fr.fromString('0x22071f2bef1999fe9698359ef95acfeb9cd7c473d04207ed160715c81292c6b3'),
60
+ artifactHash: Fr.fromString('0x005a9c5db229999895a873e4c2bcaf6ca2523522b5c520c52c39b1bdb1b5faee'),
61
+ privateFunctionsRoot: Fr.fromString('0x1bb83fa540ba6654ffe4a4c75ec9349180a2f0ecd0d3851ca28d665ab2926c73'),
58
62
  publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
59
63
  },
60
64
  };
@@ -75,7 +79,7 @@ export const StandardContractPrivateFunctions: Record<
75
79
  selector: FunctionSelector.fromField(
76
80
  Fr.fromString('0x0000000000000000000000000000000000000000000000000000000079a3d418'),
77
81
  ),
78
- vkHash: Fr.fromString('0x06a5c1b3a636c954a90be43cb56a4bdd9dc8aec764151a012e0018753694ff54'),
82
+ vkHash: Fr.fromString('0x2d46cdec4cc2afd813ba2b50106dba455821e4c7b3c10f1c7293bbc759dccf64'),
79
83
  },
80
84
  ],
81
85
  MultiCallEntrypoint: [
@@ -83,22 +87,28 @@ export const StandardContractPrivateFunctions: Record<
83
87
  selector: FunctionSelector.fromField(
84
88
  Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f04908a9'),
85
89
  ),
86
- vkHash: Fr.fromString('0x0b19b2f937f2581922c2ead5411ad9ff4ed9710efe9849bde494d9a0f94812ec'),
90
+ vkHash: Fr.fromString('0x0699bae67183ce084da1cd76ce05d18f45f796237f2baafaf7d4bfbf9663c433'),
87
91
  },
88
92
  ],
89
93
  PublicChecks: [],
90
94
  HandshakeRegistry: [
91
95
  {
92
96
  selector: FunctionSelector.fromField(
93
- Fr.fromString('0x000000000000000000000000000000000000000000000000000000005d4db100'),
97
+ Fr.fromString('0x0000000000000000000000000000000000000000000000000000000019f8b409'),
94
98
  ),
95
- vkHash: Fr.fromString('0x035db3173b6dc6305d989fe910690cc0a556bf30261c6b4235144403e5378635'),
99
+ vkHash: Fr.fromString('0x195d78c4fa1f3f8accaa2dcc45115c5b0536e68cdd4c06f5999185554f7b73e4'),
96
100
  },
97
101
  {
98
102
  selector: FunctionSelector.fromField(
99
- Fr.fromString('0x000000000000000000000000000000000000000000000000000000005fa93894'),
103
+ Fr.fromString('0x00000000000000000000000000000000000000000000000000000000db548fcf'),
100
104
  ),
101
- vkHash: Fr.fromString('0x0ed3c8564b7f78e1dd558a0e38719c7056b27ae7f48aed795ffa2d6d84bae85d'),
105
+ vkHash: Fr.fromString('0x06ea812f1c792a864a36003312327d78995fdd894fbf48d54928a315e84df342'),
106
+ },
107
+ {
108
+ selector: FunctionSelector.fromField(
109
+ Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f1ff839b'),
110
+ ),
111
+ vkHash: Fr.fromString('0x049120d4c9a12a2286c83df31064637b53746ea13868b0756174dcb3e036bb9d'),
102
112
  },
103
113
  ],
104
114
  };