@aztec/protocol-contracts 0.0.0-test.1 → 0.0.1-commit.5daedc8

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 (132) hide show
  1. package/README.md +2 -2
  2. package/artifacts/AuthRegistry.json +2095 -1241
  3. package/artifacts/ContractClassRegistry.json +6635 -0
  4. package/artifacts/ContractInstanceRegistry.json +3629 -0
  5. package/artifacts/FeeJuice.json +2848 -2146
  6. package/artifacts/MultiCallEntrypoint.json +1594 -855
  7. package/artifacts/Router.json +698 -3537
  8. package/dest/auth-registry/index.d.ts +3 -2
  9. package/dest/auth-registry/index.d.ts.map +1 -1
  10. package/dest/auth-registry/index.js +1 -1
  11. package/dest/auth-registry/lazy.d.ts +1 -1
  12. package/dest/auth-registry/lazy.js +4 -4
  13. package/dest/class-registry/contract_class_published_event.d.ts +17 -0
  14. package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
  15. package/dest/{class-registerer/contract_class_registered_event.js → class-registry/contract_class_published_event.js} +15 -20
  16. package/dest/class-registry/index.d.ts +8 -0
  17. package/dest/class-registry/index.d.ts.map +1 -0
  18. package/dest/class-registry/index.js +17 -0
  19. package/dest/class-registry/lazy.d.ts +9 -0
  20. package/dest/class-registry/lazy.d.ts.map +1 -0
  21. package/dest/class-registry/lazy.js +26 -0
  22. package/dest/class-registry/private_function_broadcasted_event.d.ts +40 -0
  23. package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -0
  24. package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.js +11 -11
  25. package/dest/class-registry/utility_function_broadcasted_event.d.ts +35 -0
  26. package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -0
  27. package/dest/{class-registerer/unconstrained_function_broadcasted_event.js → class-registry/utility_function_broadcasted_event.js} +19 -19
  28. package/dest/fee-juice/index.d.ts +1 -1
  29. package/dest/fee-juice/index.js +1 -1
  30. package/dest/fee-juice/lazy.d.ts +1 -1
  31. package/dest/fee-juice/lazy.js +4 -4
  32. package/dest/index.d.ts +1 -2
  33. package/dest/index.d.ts.map +1 -1
  34. package/dest/index.js +0 -1
  35. package/dest/instance-registry/contract_instance_published_event.d.ts +21 -0
  36. package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -0
  37. package/dest/{instance-deployer/contract_instance_deployed_event.js → instance-registry/contract_instance_published_event.js} +8 -5
  38. package/dest/instance-registry/contract_instance_updated_event.d.ts +17 -0
  39. package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -0
  40. package/dest/instance-registry/contract_instance_updated_event.js +35 -0
  41. package/dest/instance-registry/index.d.ts +7 -0
  42. package/dest/instance-registry/index.d.ts.map +1 -0
  43. package/dest/{instance-deployer → instance-registry}/index.js +5 -5
  44. package/dest/instance-registry/lazy.d.ts +8 -0
  45. package/dest/{instance-deployer → instance-registry}/lazy.d.ts.map +1 -1
  46. package/dest/instance-registry/lazy.js +25 -0
  47. package/dest/make_protocol_contract.d.ts +1 -1
  48. package/dest/make_protocol_contract.js +2 -2
  49. package/dest/multi-call-entrypoint/index.d.ts +1 -1
  50. package/dest/multi-call-entrypoint/index.js +1 -1
  51. package/dest/multi-call-entrypoint/lazy.d.ts +1 -1
  52. package/dest/multi-call-entrypoint/lazy.js +4 -4
  53. package/dest/protocol_contract.d.ts +1 -1
  54. package/dest/protocol_contract_data.d.ts +13 -15
  55. package/dest/protocol_contract_data.d.ts.map +1 -1
  56. package/dest/protocol_contract_data.js +29 -19
  57. package/dest/provider/bundle.d.ts +1 -1
  58. package/dest/provider/bundle.d.ts.map +1 -1
  59. package/dest/provider/bundle.js +4 -4
  60. package/dest/provider/lazy.d.ts +1 -1
  61. package/dest/provider/lazy.d.ts.map +1 -1
  62. package/dest/provider/lazy.js +6 -6
  63. package/dest/provider/protocol_contracts_provider.d.ts +1 -1
  64. package/dest/router/index.d.ts +1 -1
  65. package/dest/router/index.js +1 -1
  66. package/dest/router/lazy.d.ts +1 -1
  67. package/dest/router/lazy.js +4 -4
  68. package/dest/scripts/cleanup_artifacts.js +2 -2
  69. package/dest/scripts/generate_data.js +38 -45
  70. package/dest/tests/fixtures.d.ts +4 -6
  71. package/dest/tests/fixtures.d.ts.map +1 -1
  72. package/dest/tests/fixtures.js +6 -6
  73. package/package.json +23 -20
  74. package/src/auth-registry/index.ts +3 -3
  75. package/src/auth-registry/lazy.ts +4 -4
  76. package/src/class-registry/__snapshots__/README.md +9 -0
  77. package/src/{class-registerer/contract_class_registered_event.ts → class-registry/contract_class_published_event.ts} +22 -22
  78. package/src/{class-registerer → class-registry}/index.ts +7 -9
  79. package/src/class-registry/lazy.ts +33 -0
  80. package/src/{class-registerer → class-registry}/private_function_broadcasted_event.ts +12 -8
  81. package/src/{class-registerer/unconstrained_function_broadcasted_event.ts → class-registry/utility_function_broadcasted_event.ts} +25 -21
  82. package/src/fee-juice/index.ts +1 -1
  83. package/src/fee-juice/lazy.ts +4 -4
  84. package/src/index.ts +0 -1
  85. package/src/instance-registry/__snapshots__/README.md +9 -0
  86. package/src/{instance-deployer/contract_instance_deployed_event.ts → instance-registry/contract_instance_published_event.ts} +12 -6
  87. package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +14 -14
  88. package/src/{instance-deployer → instance-registry}/index.ts +6 -6
  89. package/src/{instance-deployer → instance-registry}/lazy.ts +11 -11
  90. package/src/make_protocol_contract.ts +2 -2
  91. package/src/multi-call-entrypoint/index.ts +1 -1
  92. package/src/multi-call-entrypoint/lazy.ts +4 -4
  93. package/src/protocol_contract_data.ts +30 -19
  94. package/src/provider/bundle.ts +4 -4
  95. package/src/provider/lazy.ts +6 -6
  96. package/src/router/index.ts +1 -1
  97. package/src/router/lazy.ts +4 -4
  98. package/src/tests/fixtures.ts +6 -6
  99. package/artifacts/ContractClassRegisterer.json +0 -7219
  100. package/artifacts/ContractInstanceDeployer.json +0 -2984
  101. package/dest/build_protocol_contract_tree.d.ts +0 -10
  102. package/dest/build_protocol_contract_tree.d.ts.map +0 -1
  103. package/dest/build_protocol_contract_tree.js +0 -20
  104. package/dest/class-registerer/contract_class_registered_event.d.ts +0 -18
  105. package/dest/class-registerer/contract_class_registered_event.d.ts.map +0 -1
  106. package/dest/class-registerer/index.d.ts +0 -8
  107. package/dest/class-registerer/index.d.ts.map +0 -1
  108. package/dest/class-registerer/index.js +0 -17
  109. package/dest/class-registerer/lazy.d.ts +0 -9
  110. package/dest/class-registerer/lazy.d.ts.map +0 -1
  111. package/dest/class-registerer/lazy.js +0 -26
  112. package/dest/class-registerer/private_function_broadcasted_event.d.ts +0 -46
  113. package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +0 -1
  114. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +0 -40
  115. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
  116. package/dest/instance-deployer/contract_instance_deployed_event.d.ts +0 -20
  117. package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
  118. package/dest/instance-deployer/contract_instance_updated_event.d.ts +0 -16
  119. package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +0 -1
  120. package/dest/instance-deployer/contract_instance_updated_event.js +0 -36
  121. package/dest/instance-deployer/index.d.ts +0 -7
  122. package/dest/instance-deployer/index.d.ts.map +0 -1
  123. package/dest/instance-deployer/lazy.d.ts +0 -8
  124. package/dest/instance-deployer/lazy.js +0 -25
  125. package/dest/protocol_contract_tree.d.ts +0 -7
  126. package/dest/protocol_contract_tree.d.ts.map +0 -1
  127. package/dest/protocol_contract_tree.js +0 -34
  128. package/src/build_protocol_contract_tree.ts +0 -29
  129. package/src/class-registerer/lazy.ts +0 -33
  130. package/src/protocol_contract_tree.ts +0 -44
  131. /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
  132. /package/artifacts/{ContractInstanceDeployer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
@@ -1,39 +1,43 @@
1
1
  import {
2
2
  ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
3
- MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS,
3
+ CONTRACT_CLASS_REGISTRY_UTILITY_FUNCTION_BROADCASTED_MAGIC_VALUE,
4
+ MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS,
4
5
  } from '@aztec/constants';
5
6
  import { removeArrayPaddingEnd } from '@aztec/foundation/collection';
6
7
  import { Fr } from '@aztec/foundation/fields';
7
8
  import type { Tuple } from '@aztec/foundation/serialize';
8
9
  import { FieldReader } from '@aztec/foundation/serialize';
9
10
  import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
10
- import type { UnconstrainedFunction, UnconstrainedFunctionWithMembershipProof } from '@aztec/stdlib/contract';
11
+ import type { UtilityFunction, UtilityFunctionWithMembershipProof } from '@aztec/stdlib/contract';
11
12
  import type { ContractClassLog } from '@aztec/stdlib/logs';
12
13
 
13
- import { REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG } from '../protocol_contract_data.js';
14
+ import { ProtocolContractAddress } from '../protocol_contract_data.js';
14
15
 
15
- /** Event emitted from the ContractClassRegisterer. */
16
- export class UnconstrainedFunctionBroadcastedEvent {
16
+ /** Event emitted from the ContractClassRegistry. */
17
+ export class UtilityFunctionBroadcastedEvent {
17
18
  constructor(
18
19
  public readonly contractClassId: Fr,
19
20
  public readonly artifactMetadataHash: Fr,
20
21
  public readonly privateFunctionsArtifactTreeRoot: Fr,
21
22
  public readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>,
22
23
  public readonly artifactFunctionTreeLeafIndex: number,
23
- public readonly unconstrainedFunction: BroadcastedUnconstrainedFunction,
24
+ public readonly utilityFunction: BroadcastedUtilityFunction,
24
25
  ) {}
25
26
 
26
- static isUnconstrainedFunctionBroadcastedEvent(log: ContractClassLog) {
27
- return log.fields[0].equals(REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG);
27
+ static isUtilityFunctionBroadcastedEvent(log: ContractClassLog) {
28
+ return (
29
+ log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) &&
30
+ log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_UTILITY_FUNCTION_BROADCASTED_MAGIC_VALUE
31
+ );
28
32
  }
29
33
 
30
34
  static fromLog(log: ContractClassLog) {
31
- const reader = new FieldReader(log.fields.slice(1));
32
- const event = UnconstrainedFunctionBroadcastedEvent.fromFields(reader);
35
+ const reader = new FieldReader(log.fields.fields.slice(1));
36
+ const event = UtilityFunctionBroadcastedEvent.fromFields(reader);
33
37
  while (!reader.isFinished()) {
34
38
  const field = reader.readField();
35
39
  if (!field.isZero()) {
36
- throw new Error(`Unexpected data after parsing UnconstrainedFunctionBroadcastedEvent: ${field.toString()}`);
40
+ throw new Error(`Unexpected data after parsing UtilityFunctionBroadcastedEvent: ${field.toString()}`);
37
41
  }
38
42
  }
39
43
 
@@ -47,28 +51,28 @@ export class UnconstrainedFunctionBroadcastedEvent {
47
51
  const privateFunctionsArtifactTreeRoot = reader.readField();
48
52
  const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
49
53
  const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
50
- const unconstrainedFunction = BroadcastedUnconstrainedFunction.fromFields(reader);
54
+ const utilityFunction = BroadcastedUtilityFunction.fromFields(reader);
51
55
 
52
- return new UnconstrainedFunctionBroadcastedEvent(
56
+ return new UtilityFunctionBroadcastedEvent(
53
57
  contractClassId,
54
58
  artifactMetadataHash,
55
59
  privateFunctionsArtifactTreeRoot,
56
60
  artifactFunctionTreeSiblingPath,
57
61
  artifactFunctionTreeLeafIndex,
58
- unconstrainedFunction,
62
+ utilityFunction,
59
63
  );
60
64
  }
61
65
 
62
- toFunctionWithMembershipProof(): UnconstrainedFunctionWithMembershipProof {
66
+ toFunctionWithMembershipProof(): UtilityFunctionWithMembershipProof {
63
67
  // We should be able to safely remove the zero elements that pad the variable-length sibling path,
64
68
  // since a sibling with value zero can only occur on the tree leaves, so the sibling path will never end
65
69
  // in a zero. The only exception is a tree with depth 2 with one non-zero leaf, where the sibling path would
66
70
  // be a single zero element, but in that case the artifact tree should be just the single leaf.
67
71
  const artifactTreeSiblingPath = removeArrayPaddingEnd(this.artifactFunctionTreeSiblingPath, Fr.isZero);
68
72
  return {
69
- ...this.unconstrainedFunction,
70
- bytecode: this.unconstrainedFunction.bytecode,
71
- functionMetadataHash: this.unconstrainedFunction.metadataHash,
73
+ ...this.utilityFunction,
74
+ bytecode: this.utilityFunction.bytecode,
75
+ functionMetadataHash: this.utilityFunction.metadataHash,
72
76
  artifactMetadataHash: this.artifactMetadataHash,
73
77
  privateFunctionsArtifactTreeRoot: this.privateFunctionsArtifactTreeRoot,
74
78
  artifactTreeSiblingPath,
@@ -77,7 +81,7 @@ export class UnconstrainedFunctionBroadcastedEvent {
77
81
  }
78
82
  }
79
83
 
80
- export class BroadcastedUnconstrainedFunction implements UnconstrainedFunction {
84
+ export class BroadcastedUtilityFunction implements UtilityFunction {
81
85
  constructor(
82
86
  /** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
83
87
  public readonly selector: FunctionSelector,
@@ -92,8 +96,8 @@ export class BroadcastedUnconstrainedFunction implements UnconstrainedFunction {
92
96
  const selector = FunctionSelector.fromField(reader.readField());
93
97
  const metadataHash = reader.readField();
94
98
  // The '* 1' removes the 'Type instantiation is excessively deep and possibly infinite. ts(2589)' err
95
- const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS * 1);
99
+ const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS * 1);
96
100
  const bytecode = bufferFromFields(encodedBytecode);
97
- return new BroadcastedUnconstrainedFunction(selector, metadataHash, bytecode);
101
+ return new BroadcastedUtilityFunction(selector, metadataHash, bytecode);
98
102
  }
99
103
  }
@@ -4,7 +4,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { computePublicDataTreeLeafSlot, deriveStorageSlotInMap } from '@aztec/stdlib/hash';
5
5
  import type { NoirCompiledContract } from '@aztec/stdlib/noir';
6
6
 
7
- import FeeJuiceJson from '../../artifacts/FeeJuice.json' assert { type: 'json' };
7
+ import FeeJuiceJson from '../../artifacts/FeeJuice.json' with { type: 'json' };
8
8
  import { makeProtocolContract } from '../make_protocol_contract.js';
9
9
  import type { ProtocolContract } from '../protocol_contract.js';
10
10
  import { ProtocolContractAddress } from '../protocol_contract_data.js';
@@ -8,10 +8,10 @@ let protocolContractArtifact: ContractArtifact;
8
8
 
9
9
  export async function getFeeJuiceArtifact(): Promise<ContractArtifact> {
10
10
  if (!protocolContractArtifact) {
11
- // Cannot assert this import as it's incompatible with browsers
12
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
13
- // Use the new "with" syntax once supported by firefox
14
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
11
+ // Cannot assert this import as it's incompatible with bundlers like vite
12
+ // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
13
+ // Even if now supported by al major browsers, the MIME type is replaced with
14
+ // "text/javascript"
15
15
  // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
16
16
  const { default: feeJuiceJson } = await import('../../artifacts/FeeJuice.json');
17
17
  protocolContractArtifact = loadContractArtifact(feeJuiceJson);
package/src/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './protocol_contract.js';
2
2
  export * from './protocol_contract_data.js';
3
- export * from './protocol_contract_tree.js';
@@ -0,0 +1,9 @@
1
+ # How to update these snapshots
2
+
3
+ (You probably need to have done a `./bootstrap.sh` at some point)
4
+
5
+ From the root:
6
+
7
+ `cd yarn-project/protocol-contracts`
8
+
9
+ `yarn test -u`
@@ -5,10 +5,10 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
5
  import { PublicKeys } from '@aztec/stdlib/keys';
6
6
  import type { PrivateLog } from '@aztec/stdlib/logs';
7
7
 
8
- import { DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG } from '../protocol_contract_data.js';
8
+ import { CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG } from '../protocol_contract_data.js';
9
9
 
10
- /** Event emitted from the ContractInstanceDeployer. */
11
- export class ContractInstanceDeployedEvent {
10
+ /** Event emitted from the ContractInstanceRegistry. */
11
+ export class ContractInstancePublishedEvent {
12
12
  constructor(
13
13
  public readonly address: AztecAddress,
14
14
  public readonly version: number,
@@ -19,8 +19,8 @@ export class ContractInstanceDeployedEvent {
19
19
  public readonly deployer: AztecAddress,
20
20
  ) {}
21
21
 
22
- static isContractInstanceDeployedEvent(log: PrivateLog) {
23
- return log.fields[0].equals(DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG);
22
+ static isContractInstancePublishedEvent(log: PrivateLog) {
23
+ return log.fields[0].equals(CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG);
24
24
  }
25
25
 
26
26
  static fromLog(log: PrivateLog) {
@@ -34,7 +34,7 @@ export class ContractInstanceDeployedEvent {
34
34
  const publicKeys = reader.readObject(PublicKeys);
35
35
  const deployer = reader.readObject(AztecAddress);
36
36
 
37
- return new ContractInstanceDeployedEvent(
37
+ return new ContractInstancePublishedEvent(
38
38
  address,
39
39
  version,
40
40
  salt,
@@ -61,4 +61,10 @@ export class ContractInstanceDeployedEvent {
61
61
  deployer: this.deployer,
62
62
  };
63
63
  }
64
+
65
+ public static extractContractInstanceEvents(logs: PrivateLog[]): ContractInstancePublishedEvent[] {
66
+ return logs
67
+ .filter(log => ContractInstancePublishedEvent.isContractInstancePublishedEvent(log))
68
+ .map(log => ContractInstancePublishedEvent.fromLog(log));
69
+ }
64
70
  }
@@ -1,36 +1,36 @@
1
+ import { CONTRACT_INSTANCE_UPDATED_MAGIC_VALUE } from '@aztec/constants';
1
2
  import { Fr } from '@aztec/foundation/fields';
2
- import { BufferReader } from '@aztec/foundation/serialize';
3
+ import { FieldReader } from '@aztec/foundation/serialize';
3
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
5
  import type { ContractInstanceUpdateWithAddress } from '@aztec/stdlib/contract';
5
6
  import type { PublicLog } from '@aztec/stdlib/logs';
7
+ import type { UInt64 } from '@aztec/stdlib/types';
6
8
 
7
- import { DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG, ProtocolContractAddress } from '../protocol_contract_data.js';
9
+ import { ProtocolContractAddress } from '../protocol_contract_data.js';
8
10
 
9
- /** Event emitted from the ContractInstanceDeployer. */
11
+ /** Event emitted from the ContractInstanceRegistry. */
10
12
  export class ContractInstanceUpdatedEvent {
11
13
  constructor(
12
14
  public readonly address: AztecAddress,
13
15
  public readonly prevContractClassId: Fr,
14
16
  public readonly newContractClassId: Fr,
15
- public readonly blockOfChange: number,
17
+ public readonly timestampOfChange: UInt64,
16
18
  ) {}
17
19
 
18
20
  static isContractInstanceUpdatedEvent(log: PublicLog) {
19
21
  return (
20
- log.contractAddress.equals(ProtocolContractAddress.ContractInstanceDeployer) &&
21
- log.log[0].equals(DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG)
22
+ log.contractAddress.equals(ProtocolContractAddress.ContractInstanceRegistry) &&
23
+ log.fields[0].toBigInt() === CONTRACT_INSTANCE_UPDATED_MAGIC_VALUE
22
24
  );
23
25
  }
24
26
 
25
27
  static fromLog(log: PublicLog) {
26
- const bufferWithoutAddressAndTag = log.toBuffer().subarray(64);
27
- const reader = new BufferReader(bufferWithoutAddressAndTag);
28
+ const reader = new FieldReader(log.fields.slice(1) /* remove tag */);
28
29
  const address = reader.readObject(AztecAddress);
29
- const prevContractClassId = reader.readObject(Fr);
30
- const newContractClassId = reader.readObject(Fr);
31
- const blockOfChange = reader.readObject(Fr).toNumber();
32
-
33
- return new ContractInstanceUpdatedEvent(address, prevContractClassId, newContractClassId, blockOfChange);
30
+ const prevContractClassId = reader.readField();
31
+ const newContractClassId = reader.readField();
32
+ const timestampOfChange = reader.readField().toBigInt();
33
+ return new ContractInstanceUpdatedEvent(address, prevContractClassId, newContractClassId, timestampOfChange);
34
34
  }
35
35
 
36
36
  toContractInstanceUpdate(): ContractInstanceUpdateWithAddress {
@@ -38,7 +38,7 @@ export class ContractInstanceUpdatedEvent {
38
38
  address: this.address,
39
39
  prevContractClassId: this.prevContractClassId,
40
40
  newContractClassId: this.newContractClassId,
41
- blockOfChange: this.blockOfChange,
41
+ timestampOfChange: this.timestampOfChange,
42
42
  };
43
43
  }
44
44
  }
@@ -1,23 +1,23 @@
1
1
  import { loadContractArtifact } from '@aztec/stdlib/abi';
2
2
  import type { NoirCompiledContract } from '@aztec/stdlib/noir';
3
3
 
4
- import ContractInstanceDeployerJson from '../../artifacts/ContractInstanceDeployer.json' assert { type: 'json' };
4
+ import ContractInstanceRegistryJson from '../../artifacts/ContractInstanceRegistry.json' with { type: 'json' };
5
5
  import { makeProtocolContract } from '../make_protocol_contract.js';
6
6
  import type { ProtocolContract } from '../protocol_contract.js';
7
7
 
8
- export * from './contract_instance_deployed_event.js';
8
+ export * from './contract_instance_published_event.js';
9
9
  export * from './contract_instance_updated_event.js';
10
10
 
11
- export const ContractInstanceDeployerArtifact = loadContractArtifact(
12
- ContractInstanceDeployerJson as NoirCompiledContract,
11
+ export const ContractInstanceRegistryArtifact = loadContractArtifact(
12
+ ContractInstanceRegistryJson as NoirCompiledContract,
13
13
  );
14
14
 
15
15
  let protocolContract: ProtocolContract;
16
16
 
17
17
  /** Returns the canonical deployment of the contract. */
18
- export async function getCanonicalInstanceDeployer(): Promise<ProtocolContract> {
18
+ export async function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
19
19
  if (!protocolContract) {
20
- protocolContract = await makeProtocolContract('ContractInstanceDeployer', ContractInstanceDeployerArtifact);
20
+ protocolContract = await makeProtocolContract('ContractInstanceRegistry', ContractInstanceRegistryArtifact);
21
21
  }
22
22
  return protocolContract;
23
23
  }
@@ -3,30 +3,30 @@ import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
3
3
  import { makeProtocolContract } from '../make_protocol_contract.js';
4
4
  import type { ProtocolContract } from '../protocol_contract.js';
5
5
 
6
- export * from './contract_instance_deployed_event.js';
6
+ export * from './contract_instance_published_event.js';
7
7
  export * from './contract_instance_updated_event.js';
8
8
 
9
9
  let protocolContract: ProtocolContract;
10
10
  let protocolContractArtifact: ContractArtifact;
11
11
 
12
- export async function getContractInstanceDeployerArtifact(): Promise<ContractArtifact> {
12
+ export async function getContractInstanceRegistryArtifact(): Promise<ContractArtifact> {
13
13
  if (!protocolContractArtifact) {
14
- // Cannot assert this import as it's incompatible with browsers
15
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
16
- // Use the new "with" syntax once supported by firefox
17
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
14
+ // Cannot assert this import as it's incompatible with bundlers like vite
15
+ // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
16
+ // Even if now supported by al major browsers, the MIME type is replaced with
17
+ // "text/javascript"
18
18
  // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
19
- const { default: contractInstanceDeployerJson } = await import('../../artifacts/ContractInstanceDeployer.json');
20
- protocolContractArtifact = loadContractArtifact(contractInstanceDeployerJson);
19
+ const { default: contractInstanceRegistryJson } = await import('../../artifacts/ContractInstanceRegistry.json');
20
+ protocolContractArtifact = loadContractArtifact(contractInstanceRegistryJson);
21
21
  }
22
22
  return protocolContractArtifact;
23
23
  }
24
24
 
25
25
  /** Returns the canonical deployment of the auth registry. */
26
- export async function getCanonicalInstanceDeployer(): Promise<ProtocolContract> {
26
+ export async function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
27
27
  if (!protocolContract) {
28
- const contractInstanceDeployerArtifact = await getContractInstanceDeployerArtifact();
29
- protocolContract = await makeProtocolContract('ContractInstanceDeployer', contractInstanceDeployerArtifact);
28
+ const contractInstanceRegistryArtifact = await getContractInstanceRegistryArtifact();
29
+ protocolContract = await makeProtocolContract('ContractInstanceRegistry', contractInstanceRegistryArtifact);
30
30
  }
31
31
  return protocolContract;
32
32
  }
@@ -1,5 +1,5 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
- import { getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
2
+ import { getContractClassFromArtifact, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
3
3
 
4
4
  import type { ProtocolContract } from './protocol_contract.js';
5
5
  import { ProtocolContractAddress, type ProtocolContractName, ProtocolContractSalt } from './protocol_contract_data.js';
@@ -16,7 +16,7 @@ export async function makeProtocolContract(
16
16
  const salt = ProtocolContractSalt[name];
17
17
  // TODO(@spalladino): This computes the contract class from the artifact twice.
18
18
  const contractClass = await getContractClassFromArtifact(artifact);
19
- const instance = await getContractInstanceFromDeployParams(artifact, { salt });
19
+ const instance = await getContractInstanceFromInstantiationParams(artifact, { salt });
20
20
  return {
21
21
  instance: { ...instance, address },
22
22
  contractClass,
@@ -1,7 +1,7 @@
1
1
  import { loadContractArtifact } from '@aztec/stdlib/abi';
2
2
  import type { NoirCompiledContract } from '@aztec/stdlib/noir';
3
3
 
4
- import MultiCallEntrypointJson from '../../artifacts/MultiCallEntrypoint.json' assert { type: 'json' };
4
+ import MultiCallEntrypointJson from '../../artifacts/MultiCallEntrypoint.json' with { type: 'json' };
5
5
  import { makeProtocolContract } from '../make_protocol_contract.js';
6
6
  import type { ProtocolContract } from '../protocol_contract.js';
7
7
 
@@ -8,10 +8,10 @@ let protocolContractArtifact: ContractArtifact;
8
8
 
9
9
  export async function getMultiCallEntrypointArtifact(): Promise<ContractArtifact> {
10
10
  if (!protocolContractArtifact) {
11
- // Cannot assert this import as it's incompatible with browsers
12
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
13
- // Use the new "with" syntax once supported by firefox
14
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
11
+ // Cannot assert this import as it's incompatible with bundlers like vite
12
+ // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
13
+ // Even if now supported by al major browsers, the MIME type is replaced with
14
+ // "text/javascript"
15
15
  // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
16
16
  const { default: multiCallEntrypointJson } = await import('../../artifacts/MultiCallEntrypoint.json');
17
17
  protocolContractArtifact = loadContractArtifact(multiCallEntrypointJson);
@@ -2,12 +2,13 @@
2
2
  // GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
3
3
  import { Fr } from '@aztec/foundation/fields';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import { ProtocolContracts } from '@aztec/stdlib/tx';
5
6
 
6
7
 
7
8
  export const protocolContractNames = [
8
9
  'AuthRegistry',
9
- 'ContractInstanceDeployer',
10
- 'ContractClassRegisterer',
10
+ 'ContractInstanceRegistry',
11
+ 'ContractClassRegistry',
11
12
  'MultiCallEntrypoint',
12
13
  'FeeJuice',
13
14
  'Router'
@@ -19,8 +20,8 @@
19
20
 
20
21
  export const ProtocolContractSalt: Record<ProtocolContractName, Fr> = {
21
22
  AuthRegistry: new Fr(1),
22
- ContractInstanceDeployer: new Fr(1),
23
- ContractClassRegisterer: new Fr(1),
23
+ ContractInstanceRegistry: new Fr(1),
24
+ ContractClassRegistry: new Fr(1),
24
25
  MultiCallEntrypoint: new Fr(1),
25
26
  FeeJuice: new Fr(1),
26
27
  Router: new Fr(1)
@@ -30,8 +31,8 @@ Router: new Fr(1)
30
31
 
31
32
  export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> = {
32
33
  AuthRegistry: AztecAddress.fromBigInt(1n),
33
- ContractInstanceDeployer: AztecAddress.fromBigInt(2n),
34
- ContractClassRegisterer: AztecAddress.fromBigInt(3n),
34
+ ContractInstanceRegistry: AztecAddress.fromBigInt(2n),
35
+ ContractClassRegistry: AztecAddress.fromBigInt(3n),
35
36
  MultiCallEntrypoint: AztecAddress.fromBigInt(4n),
36
37
  FeeJuice: AztecAddress.fromBigInt(5n),
37
38
  Router: AztecAddress.fromBigInt(6n)
@@ -39,25 +40,35 @@ Router: AztecAddress.fromBigInt(6n)
39
40
 
40
41
 
41
42
 
42
- export const ProtocolContractLeaves = {
43
- AuthRegistry: Fr.fromHexString('0x1dc70bdab08ce08aef9f6ddcc8fd54fb91fdb72a6433c2dd6b69b33cf1fb87a2'),
44
- ContractInstanceDeployer: Fr.fromHexString('0x005d6d6addbbda03dcad6fc9a3c3b7de457c30990ec2acaaf74f139a3a506e06'),
45
- ContractClassRegisterer: Fr.fromHexString('0x110ef3d93e27fd61a5a56e479a9f9cbdb099d2d968cdcc16c01d2bdfd6cb0ddd'),
46
- MultiCallEntrypoint: Fr.fromHexString('0x121f834b03a64d38463ae18ddebceeb4dce8192cc289052e175ad754a883a7fe'),
47
- FeeJuice: Fr.fromHexString('0x141a566ade0bef915526762c2c2fb19b2a756ad7c82e83fde6dbf86848ecc131'),
48
- Router: Fr.fromHexString('0x2c20bd328fbd33c01fbcda9e6299c31da5d5b29ea30e9c7b9d631618b839bca9')
43
+ export const ProtocolContractDerivedAddress = {
44
+ AuthRegistry: AztecAddress.fromString('0x1dc64374e96b37a36d94b737a049efb4686f45f628457f5d6d74f5d45817944b'),
45
+ ContractInstanceRegistry: AztecAddress.fromString('0x24b7c46308ae93c05e3bac8201935effd50b61504954eef96d7b0384f27ee80c'),
46
+ ContractClassRegistry: AztecAddress.fromString('0x2f6b4852b69e0381596da99b3aad9b8d493312f47e1c0e3523928e010e1f9df2'),
47
+ MultiCallEntrypoint: AztecAddress.fromString('0x1c93c2cb51b87faa1ee26b5f933a8136642cec5cdf95216bdd9aa4873d4b38ff'),
48
+ FeeJuice: AztecAddress.fromString('0x2223ff211abddd65cb27b3fd9ef6cbcdfed867b1b5c2421f87624c6fe86c39ff'),
49
+ Router: AztecAddress.fromString('0x090dc318c793abc5ee9a560dcf9f0ba54c73902086dd7258cd48da8c79ef201a')
49
50
  };
50
51
 
51
52
 
52
53
 
53
- export const protocolContractTreeRoot = Fr.fromHexString('0x093cc9324e5a7b44883f515ac490e7294ef8cb1e6d2d8c503255b1b3a9409262');
54
+ export const ProtocolContractsList = new ProtocolContracts([
55
+ AztecAddress.fromString('0x1dc64374e96b37a36d94b737a049efb4686f45f628457f5d6d74f5d45817944b'),
56
+ AztecAddress.fromString('0x24b7c46308ae93c05e3bac8201935effd50b61504954eef96d7b0384f27ee80c'),
57
+ AztecAddress.fromString('0x2f6b4852b69e0381596da99b3aad9b8d493312f47e1c0e3523928e010e1f9df2'),
58
+ AztecAddress.fromString('0x1c93c2cb51b87faa1ee26b5f933a8136642cec5cdf95216bdd9aa4873d4b38ff'),
59
+ AztecAddress.fromString('0x2223ff211abddd65cb27b3fd9ef6cbcdfed867b1b5c2421f87624c6fe86c39ff'),
60
+ AztecAddress.fromString('0x090dc318c793abc5ee9a560dcf9f0ba54c73902086dd7258cd48da8c79ef201a'),
61
+ AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
62
+ AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
63
+ AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
64
+ AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
65
+ AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
66
+ ]);
67
+
68
+ export const protocolContractsHash = Fr.fromString('0x12f22ad1b89f09c9a684cb5f36820a7d678527270547e489536c586d3c1756a4');
54
69
 
55
70
 
56
71
 
57
- export const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG = Fr.fromHexString('0x20cd27645f65c15a38720ca984aef936592f3938a705db706d068ad13fc58ae9');
58
- export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x0abf338154e355442d9916d630da0491036d5a7b23c42b477c1395ba3bf9b42d');
59
- export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x27774539896271d6dbe0c1de45ddc44709d1e8d9a9fb686ca3c105d87c417bb8');
60
- export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG = Fr.fromHexString('0x2ec28b91a5f838506d6042915005ff55cf7a0a5f889a83b11faed33a31b486f2');
61
- export const DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG = new Fr(1534834688047131268740281708431107902615560100979874281215533519862n);
72
+ export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('0x28da3fc471387d4e20b646b77abc8cdfc02a339a7507285a73d84f9b97b13486');
62
73
 
63
74
 
@@ -1,9 +1,9 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
2
 
3
3
  import { AuthRegistryArtifact } from '../auth-registry/index.js';
4
- import { ContractClassRegistererArtifact } from '../class-registerer/index.js';
4
+ import { ContractClassRegistryArtifact } from '../class-registry/index.js';
5
5
  import { FeeJuiceArtifact } from '../fee-juice/index.js';
6
- import { ContractInstanceDeployerArtifact } from '../instance-deployer/index.js';
6
+ import { ContractInstanceRegistryArtifact } from '../instance-registry/index.js';
7
7
  import { makeProtocolContract } from '../make_protocol_contract.js';
8
8
  import { MultiCallEntrypointArtifact } from '../multi-call-entrypoint/index.js';
9
9
  import type { ProtocolContract } from '../protocol_contract.js';
@@ -13,8 +13,8 @@ import type { ProtocolContractsProvider } from './protocol_contracts_provider.js
13
13
 
14
14
  export const ProtocolContractArtifact: Record<ProtocolContractName, ContractArtifact> = {
15
15
  AuthRegistry: AuthRegistryArtifact,
16
- ContractInstanceDeployer: ContractInstanceDeployerArtifact,
17
- ContractClassRegisterer: ContractClassRegistererArtifact,
16
+ ContractInstanceRegistry: ContractInstanceRegistryArtifact,
17
+ ContractClassRegistry: ContractClassRegistryArtifact,
18
18
  MultiCallEntrypoint: MultiCallEntrypointArtifact,
19
19
  FeeJuice: FeeJuiceArtifact,
20
20
  Router: RouterArtifact,
@@ -1,7 +1,7 @@
1
1
  import { getCanonicalAuthRegistry } from '../auth-registry/lazy.js';
2
- import { getCanonicalClassRegisterer } from '../class-registerer/lazy.js';
2
+ import { getCanonicalClassRegistry } from '../class-registry/lazy.js';
3
3
  import { getCanonicalFeeJuice } from '../fee-juice/lazy.js';
4
- import { getCanonicalInstanceDeployer } from '../instance-deployer/lazy.js';
4
+ import { getCanonicalInstanceRegistry } from '../instance-registry/lazy.js';
5
5
  import { getCanonicalMultiCallEntrypoint } from '../multi-call-entrypoint/lazy.js';
6
6
  import type { ProtocolContract } from '../protocol_contract.js';
7
7
  import type { ProtocolContractName } from '../protocol_contract_data.js';
@@ -13,10 +13,10 @@ export class LazyProtocolContractsProvider implements ProtocolContractsProvider
13
13
  switch (name) {
14
14
  case 'AuthRegistry':
15
15
  return getCanonicalAuthRegistry();
16
- case 'ContractInstanceDeployer':
17
- return getCanonicalInstanceDeployer();
18
- case 'ContractClassRegisterer':
19
- return getCanonicalClassRegisterer();
16
+ case 'ContractInstanceRegistry':
17
+ return getCanonicalInstanceRegistry();
18
+ case 'ContractClassRegistry':
19
+ return getCanonicalClassRegistry();
20
20
  case 'MultiCallEntrypoint':
21
21
  return getCanonicalMultiCallEntrypoint();
22
22
  case 'FeeJuice':
@@ -1,7 +1,7 @@
1
1
  import { loadContractArtifact } from '@aztec/stdlib/abi';
2
2
  import type { NoirCompiledContract } from '@aztec/stdlib/noir';
3
3
 
4
- import RouterJson from '../../artifacts/Router.json' assert { type: 'json' };
4
+ import RouterJson from '../../artifacts/Router.json' with { type: 'json' };
5
5
  import { makeProtocolContract } from '../make_protocol_contract.js';
6
6
  import type { ProtocolContract } from '../protocol_contract.js';
7
7
 
@@ -8,10 +8,10 @@ let protocolContractArtifact: ContractArtifact;
8
8
 
9
9
  export async function getRouterArtifact(): Promise<ContractArtifact> {
10
10
  if (!protocolContractArtifact) {
11
- // Cannot assert this import as it's incompatible with browsers
12
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
13
- // Use the new "with" syntax once supported by firefox
14
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
11
+ // Cannot assert this import as it's incompatible with bundlers like vite
12
+ // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
13
+ // Even if now supported by al major browsers, the MIME type is replaced with
14
+ // "text/javascript"
15
15
  // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
16
16
  const { default: routerJson } = await import('../../artifacts/Router.json');
17
17
  protocolContractArtifact = loadContractArtifact(routerJson);
@@ -3,8 +3,8 @@ import { dirname, resolve } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
 
5
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');
6
+ export function getSampleContractClassPublishedEventPayload(): Buffer {
7
+ const path = getPathToFixture('ContractClassPublishedEventData.hex');
8
8
  return Buffer.from(readFileSync(path).toString(), 'hex');
9
9
  }
10
10
 
@@ -15,14 +15,14 @@ export function getSamplePrivateFunctionBroadcastedEventPayload(): Buffer {
15
15
  }
16
16
 
17
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');
18
+ export function getSampleUtilityFunctionBroadcastedEventPayload(): Buffer {
19
+ const path = getPathToFixture('UtilityFunctionBroadcastedEventData.hex');
20
20
  return Buffer.from(readFileSync(path).toString(), 'hex');
21
21
  }
22
22
 
23
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');
24
+ export function getSampleContractInstancePublishedEventPayload(): Buffer {
25
+ const path = getPathToFixture('ContractInstancePublishedEventData.hex');
26
26
  return Buffer.from(readFileSync(path).toString(), 'hex');
27
27
  }
28
28