@aztec/protocol-contracts 0.65.2 → 0.67.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 (45) hide show
  1. package/artifacts/AuthRegistry.json +546 -574
  2. package/artifacts/ContractClassRegisterer.json +419 -494
  3. package/artifacts/ContractInstanceDeployer.json +157 -221
  4. package/artifacts/FeeJuice.json +685 -753
  5. package/artifacts/MultiCallEntrypoint.json +89 -121
  6. package/artifacts/Router.json +595 -659
  7. package/dest/class-registerer/contract_class_registered_event.d.ts +17 -0
  8. package/dest/class-registerer/contract_class_registered_event.d.ts.map +1 -0
  9. package/dest/class-registerer/contract_class_registered_event.js +60 -0
  10. package/dest/class-registerer/index.d.ts +3 -0
  11. package/dest/class-registerer/index.d.ts.map +1 -1
  12. package/dest/class-registerer/index.js +4 -1
  13. package/dest/class-registerer/private_function_broadcasted_event.d.ts +43 -0
  14. package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +1 -0
  15. package/dest/class-registerer/private_function_broadcasted_event.js +87 -0
  16. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +37 -0
  17. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +1 -0
  18. package/dest/class-registerer/unconstrained_function_broadcasted_event.js +83 -0
  19. package/dest/index.d.ts +5 -0
  20. package/dest/index.d.ts.map +1 -1
  21. package/dest/index.js +6 -1
  22. package/dest/instance-deployer/contract_instance_deployed_event.d.ts +18 -0
  23. package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +1 -0
  24. package/dest/instance-deployer/contract_instance_deployed_event.js +47 -0
  25. package/dest/instance-deployer/index.d.ts +1 -0
  26. package/dest/instance-deployer/index.d.ts.map +1 -1
  27. package/dest/instance-deployer/index.js +2 -1
  28. package/dest/protocol_contract_data.d.ts +4 -0
  29. package/dest/protocol_contract_data.d.ts.map +1 -1
  30. package/dest/protocol_contract_data.js +12 -8
  31. package/dest/scripts/generate_data.js +20 -6
  32. package/dest/tests/fixtures.d.ts +8 -0
  33. package/dest/tests/fixtures.d.ts.map +1 -0
  34. package/dest/tests/fixtures.js +27 -0
  35. package/package.json +10 -4
  36. package/src/class-registerer/contract_class_registered_event.ts +86 -0
  37. package/src/class-registerer/index.ts +4 -0
  38. package/src/class-registerer/private_function_broadcasted_event.ts +115 -0
  39. package/src/class-registerer/unconstrained_function_broadcasted_event.ts +109 -0
  40. package/src/index.ts +5 -0
  41. package/src/instance-deployer/contract_instance_deployed_event.ts +61 -0
  42. package/src/instance-deployer/index.ts +2 -0
  43. package/src/protocol_contract_data.ts +21 -8
  44. package/src/scripts/generate_data.ts +23 -4
  45. package/src/tests/fixtures.ts +31 -0
@@ -2,23 +2,28 @@ import {
2
2
  AztecAddress,
3
3
  CANONICAL_AUTH_REGISTRY_ADDRESS,
4
4
  DEPLOYER_CONTRACT_ADDRESS,
5
+ DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE,
5
6
  FEE_JUICE_ADDRESS,
6
7
  Fr,
7
8
  MULTI_CALL_ENTRYPOINT_ADDRESS,
8
9
  REGISTERER_CONTRACT_ADDRESS,
10
+ REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE,
11
+ REGISTERER_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE,
12
+ REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE,
9
13
  ROUTER_ADDRESS,
10
14
  getContractInstanceFromDeployParams,
11
15
  } from '@aztec/circuits.js';
16
+ import { poseidon2Hash } from '@aztec/foundation/crypto';
12
17
  import { createConsoleLogger } from '@aztec/foundation/log';
13
18
  import { loadContractArtifact } from '@aztec/types/abi';
14
19
  import { type NoirCompiledContract } from '@aztec/types/noir';
15
20
 
16
- import fs from 'fs/promises';
21
+ import { promises as fs } from 'fs';
17
22
  import path from 'path';
18
23
 
19
24
  import { buildProtocolContractTree } from '../build_protocol_contract_tree.js';
20
25
 
21
- const log = createConsoleLogger('aztec:autogenerate');
26
+ const log = createConsoleLogger('autogenerate');
22
27
 
23
28
  const noirContractsRoot = '../../noir-projects/noir-contracts';
24
29
  const srcPath = path.join(noirContractsRoot, './target');
@@ -132,7 +137,7 @@ function generateContractAddresses(names: string[]) {
132
137
  function generateContractLeaves(names: string[], leaves: Fr[]) {
133
138
  return `
134
139
  export const ProtocolContractLeaf = {
135
- ${leaves.map((leaf, i) => `${names[i]}: Fr.fromString('${leaf.toString()}')`).join(',\n')}
140
+ ${leaves.map((leaf, i) => `${names[i]}: Fr.fromHexString('${leaf.toString()}')`).join(',\n')}
136
141
  };
137
142
  `;
138
143
  }
@@ -140,7 +145,19 @@ function generateContractLeaves(names: string[], leaves: Fr[]) {
140
145
  function generateRoot(names: string[], leaves: Fr[]) {
141
146
  const root = computeRoot(names, leaves);
142
147
  return `
143
- export const protocolContractTreeRoot = Fr.fromString('${root.toString()}');
148
+ export const protocolContractTreeRoot = Fr.fromHexString('${root.toString()}');
149
+ `;
150
+ }
151
+
152
+ function generateLogTags() {
153
+ return `
154
+ export const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG = new Fr(${REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE}n);
155
+ export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG = new Fr(${REGISTERER_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE}n);
156
+ export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG = new Fr(${REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE}n);
157
+ export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG = Fr.fromHexString('${poseidon2Hash([
158
+ DEPLOYER_CONTRACT_ADDRESS,
159
+ DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE,
160
+ ])}');
144
161
  `;
145
162
  }
146
163
 
@@ -163,6 +180,8 @@ async function generateOutputFile(names: string[], leaves: Fr[]) {
163
180
  ${generateContractLeaves(names, leaves)}
164
181
 
165
182
  ${generateRoot(names, leaves)}
183
+
184
+ ${generateLogTags()}
166
185
  `;
167
186
  await fs.writeFile(outputFilePath, content);
168
187
  }
@@ -0,0 +1,31 @@
1
+ import { readFileSync } from 'fs';
2
+ import { dirname, resolve } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
6
+ export function getSampleContractClassRegisteredEventPayload(): Buffer {
7
+ const path = getPathToFixture('ContractClassRegisteredEventData.hex');
8
+ return Buffer.from(readFileSync(path).toString(), 'hex');
9
+ }
10
+
11
+ // Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
12
+ export function getSamplePrivateFunctionBroadcastedEventPayload(): Buffer {
13
+ const path = getPathToFixture('PrivateFunctionBroadcastedEventData.hex');
14
+ return Buffer.from(readFileSync(path).toString(), 'hex');
15
+ }
16
+
17
+ // Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
18
+ export function getSampleUnconstrainedFunctionBroadcastedEventPayload(): Buffer {
19
+ const path = getPathToFixture('UnconstrainedFunctionBroadcastedEventData.hex');
20
+ return Buffer.from(readFileSync(path).toString(), 'hex');
21
+ }
22
+
23
+ // Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
24
+ export function getSampleContractInstanceDeployedEventPayload(): Buffer {
25
+ const path = getPathToFixture('ContractInstanceDeployedEventData.hex');
26
+ return Buffer.from(readFileSync(path).toString(), 'hex');
27
+ }
28
+
29
+ export function getPathToFixture(name: string) {
30
+ return resolve(dirname(fileURLToPath(import.meta.url)), `../../fixtures/${name}`);
31
+ }