@aztec/protocol-contracts 4.2.0-nightly.20260320 → 4.2.0-nightly.20260322

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.
@@ -1,5 +1,5 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
- import { type ContractClassPublic } from '@aztec/stdlib/contract';
2
+ import { type ContractClassPublic, type ContractClassPublicWithCommitment } from '@aztec/stdlib/contract';
3
3
  import type { ContractClassLog } from '@aztec/stdlib/logs';
4
4
  /** Event emitted from the ContractClassRegistry. */
5
5
  export declare class ContractClassPublishedEvent {
@@ -11,7 +11,10 @@ export declare class ContractClassPublishedEvent {
11
11
  constructor(contractClassId: Fr, version: number, artifactHash: Fr, privateFunctionsRoot: Fr, packedPublicBytecode: Buffer);
12
12
  static isContractClassPublishedEvent(log: ContractClassLog): boolean;
13
13
  static fromLog(log: ContractClassLog): ContractClassPublishedEvent;
14
- toContractClassPublic(): Promise<ContractClassPublic>;
14
+ /** Converts the event to a contract class, without computing or validating the bytecode commitment. */
15
+ toContractClassPublic(): ContractClassPublic;
16
+ /** Converts the event to a contract class with its bytecode commitment (expensive). */
17
+ toContractClassPublicWithBytecodeCommitment(): Promise<ContractClassPublicWithCommitment>;
15
18
  static extractContractClassEvents(logs: ContractClassLog[]): ContractClassPublishedEvent[];
16
19
  }
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfY2xhc3NfcHVibGlzaGVkX2V2ZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xhc3MtcmVnaXN0cnkvY29udHJhY3RfY2xhc3NfcHVibGlzaGVkX2V2ZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUdwRCxPQUFPLEVBQ0wsS0FBSy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BQUdwRCxPQUFPLEVBQ0wsS0FBSyxtQkFBbUIsRUFDeEIsS0FBSyxpQ0FBaUMsRUFFdkMsTUFBTSx3QkFBd0IsQ0FBQztBQUNoQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSTNELG9EQUFvRDtBQUNwRCxxQkFBYSwyQkFBMkI7YUFFcEIsZUFBZSxFQUFFLEVBQUU7YUFDbkIsT0FBTyxFQUFFLE1BQU07YUFDZixZQUFZLEVBQUUsRUFBRTthQUNoQixvQkFBb0IsRUFBRSxFQUFFO2FBQ3hCLG9CQUFvQixFQUFFLE1BQU07SUFMOUMsWUFDa0IsZUFBZSxFQUFFLEVBQUUsRUFDbkIsT0FBTyxFQUFFLE1BQU0sRUFDZixZQUFZLEVBQUUsRUFBRSxFQUNoQixvQkFBb0IsRUFBRSxFQUFFLEVBQ3hCLG9CQUFvQixFQUFFLE1BQU0sRUFDMUM7SUFFSixNQUFNLENBQUMsNkJBQTZCLENBQUMsR0FBRyxFQUFFLGdCQUFnQixXQUt6RDtJQUVELE1BQU0sQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLGdCQUFnQiwrQkFpQm5DO0lBRUQsdUdBQXVHO0lBQ3ZHLHFCQUFxQixJQUFJLG1CQUFtQixDQVUzQztJQUVELHVGQUF1RjtJQUNqRiwyQ0FBMkMsSUFBSSxPQUFPLENBQUMsaUNBQWlDLENBQUMsQ0FHOUY7SUFFRCxPQUFjLDBCQUEwQixDQUFDLElBQUksRUFBRSxnQkFBZ0IsRUFBRSxHQUFHLDJCQUEyQixFQUFFLENBSWhHO0NBQ0YifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"contract_class_published_event.d.ts","sourceRoot":"","sources":["../../src/class-registry/contract_class_published_event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,oDAAoD;AACpD,qBAAa,2BAA2B;aAEpB,eAAe,EAAE,EAAE;aACnB,OAAO,EAAE,MAAM;aACf,YAAY,EAAE,EAAE;aAChB,oBAAoB,EAAE,EAAE;aACxB,oBAAoB,EAAE,MAAM;IAL9C,YACkB,eAAe,EAAE,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,EAAE,EAChB,oBAAoB,EAAE,EAAE,EACxB,oBAAoB,EAAE,MAAM,EAC1C;IAEJ,MAAM,CAAC,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,WAKzD;IAED,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,+BAiBnC;IAEK,qBAAqB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CA0B1D;IAED,OAAc,0BAA0B,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,2BAA2B,EAAE,CAIhG;CACF"}
1
+ {"version":3,"file":"contract_class_published_event.d.ts","sourceRoot":"","sources":["../../src/class-registry/contract_class_published_event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iCAAiC,EAEvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,oDAAoD;AACpD,qBAAa,2BAA2B;aAEpB,eAAe,EAAE,EAAE;aACnB,OAAO,EAAE,MAAM;aACf,YAAY,EAAE,EAAE;aAChB,oBAAoB,EAAE,EAAE;aACxB,oBAAoB,EAAE,MAAM;IAL9C,YACkB,eAAe,EAAE,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,EAAE,EAChB,oBAAoB,EAAE,EAAE,EACxB,oBAAoB,EAAE,MAAM,EAC1C;IAEJ,MAAM,CAAC,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,WAKzD;IAED,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,+BAiBnC;IAED,uGAAuG;IACvG,qBAAqB,IAAI,mBAAmB,CAU3C;IAED,uFAAuF;IACjF,2CAA2C,IAAI,OAAO,CAAC,iCAAiC,CAAC,CAG9F;IAED,OAAc,0BAA0B,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,2BAA2B,EAAE,CAIhG;CACF"}
@@ -1,7 +1,7 @@
1
1
  import { CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE } from '@aztec/constants';
2
2
  import { FieldReader } from '@aztec/foundation/serialize';
3
3
  import { bufferFromFields } from '@aztec/stdlib/abi';
4
- import { computeContractClassId, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
4
+ import { computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
5
5
  import { ProtocolContractAddress } from '../protocol_contract_data.js';
6
6
  /** Event emitted from the ContractClassRegistry. */ export class ContractClassPublishedEvent {
7
7
  contractClassId;
@@ -30,18 +30,7 @@ import { ProtocolContractAddress } from '../protocol_contract_data.js';
30
30
  const packedPublicBytecode = bufferFromFields(reader.readFieldArray(fieldsWithoutTag.length - reader.cursor));
31
31
  return new ContractClassPublishedEvent(contractClassId, version, artifactHash, privateFunctionsRoot, packedPublicBytecode);
32
32
  }
33
- async toContractClassPublic() {
34
- const computedClassId = await computeContractClassId({
35
- artifactHash: this.artifactHash,
36
- privateFunctionsRoot: this.privateFunctionsRoot,
37
- publicBytecodeCommitment: await computePublicBytecodeCommitment(this.packedPublicBytecode)
38
- });
39
- if (!computedClassId.equals(this.contractClassId)) {
40
- throw new Error(`Invalid contract class id: computed ${computedClassId.toString()} but event broadcasted ${this.contractClassId.toString()}`);
41
- }
42
- if (this.version !== 1) {
43
- throw new Error(`Unexpected contract class version ${this.version}`);
44
- }
33
+ /** Converts the event to a contract class, without computing or validating the bytecode commitment. */ toContractClassPublic() {
45
34
  return {
46
35
  id: this.contractClassId,
47
36
  artifactHash: this.artifactHash,
@@ -52,6 +41,13 @@ import { ProtocolContractAddress } from '../protocol_contract_data.js';
52
41
  utilityFunctions: []
53
42
  };
54
43
  }
44
+ /** Converts the event to a contract class with its bytecode commitment (expensive). */ async toContractClassPublicWithBytecodeCommitment() {
45
+ const publicBytecodeCommitment = await computePublicBytecodeCommitment(this.packedPublicBytecode);
46
+ return {
47
+ ...this.toContractClassPublic(),
48
+ publicBytecodeCommitment
49
+ };
50
+ }
55
51
  static extractContractClassEvents(logs) {
56
52
  return logs.filter((log)=>ContractClassPublishedEvent.isContractClassPublishedEvent(log)).map((log)=>ContractClassPublishedEvent.fromLog(log));
57
53
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aztec/protocol-contracts",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/protocol-contracts",
4
4
  "description": "Canonical Noir contracts for the Aztec Network",
5
- "version": "4.2.0-nightly.20260320",
5
+ "version": "4.2.0-nightly.20260322",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": "./dest/index.js",
@@ -73,9 +73,9 @@
73
73
  ]
74
74
  },
75
75
  "dependencies": {
76
- "@aztec/constants": "4.2.0-nightly.20260320",
77
- "@aztec/foundation": "4.2.0-nightly.20260320",
78
- "@aztec/stdlib": "4.2.0-nightly.20260320",
76
+ "@aztec/constants": "4.2.0-nightly.20260322",
77
+ "@aztec/foundation": "4.2.0-nightly.20260322",
78
+ "@aztec/stdlib": "4.2.0-nightly.20260322",
79
79
  "lodash.chunk": "^4.2.0",
80
80
  "lodash.omit": "^4.5.0",
81
81
  "tslib": "^2.4.0"
@@ -4,7 +4,7 @@ import { FieldReader } from '@aztec/foundation/serialize';
4
4
  import { bufferFromFields } from '@aztec/stdlib/abi';
5
5
  import {
6
6
  type ContractClassPublic,
7
- computeContractClassId,
7
+ type ContractClassPublicWithCommitment,
8
8
  computePublicBytecodeCommitment,
9
9
  } from '@aztec/stdlib/contract';
10
10
  import type { ContractClassLog } from '@aztec/stdlib/logs';
@@ -47,34 +47,25 @@ export class ContractClassPublishedEvent {
47
47
  );
48
48
  }
49
49
 
50
- async toContractClassPublic(): Promise<ContractClassPublic> {
51
- const computedClassId = await computeContractClassId({
52
- artifactHash: this.artifactHash,
53
- privateFunctionsRoot: this.privateFunctionsRoot,
54
- publicBytecodeCommitment: await computePublicBytecodeCommitment(this.packedPublicBytecode),
55
- });
56
-
57
- if (!computedClassId.equals(this.contractClassId)) {
58
- throw new Error(
59
- `Invalid contract class id: computed ${computedClassId.toString()} but event broadcasted ${this.contractClassId.toString()}`,
60
- );
61
- }
62
-
63
- if (this.version !== 1) {
64
- throw new Error(`Unexpected contract class version ${this.version}`);
65
- }
66
-
50
+ /** Converts the event to a contract class, without computing or validating the bytecode commitment. */
51
+ toContractClassPublic(): ContractClassPublic {
67
52
  return {
68
53
  id: this.contractClassId,
69
54
  artifactHash: this.artifactHash,
70
55
  packedBytecode: this.packedPublicBytecode,
71
56
  privateFunctionsRoot: this.privateFunctionsRoot,
72
- version: this.version,
57
+ version: this.version as 1,
73
58
  privateFunctions: [],
74
59
  utilityFunctions: [],
75
60
  };
76
61
  }
77
62
 
63
+ /** Converts the event to a contract class with its bytecode commitment (expensive). */
64
+ async toContractClassPublicWithBytecodeCommitment(): Promise<ContractClassPublicWithCommitment> {
65
+ const publicBytecodeCommitment = await computePublicBytecodeCommitment(this.packedPublicBytecode);
66
+ return { ...this.toContractClassPublic(), publicBytecodeCommitment };
67
+ }
68
+
78
69
  public static extractContractClassEvents(logs: ContractClassLog[]): ContractClassPublishedEvent[] {
79
70
  return logs
80
71
  .filter((log: ContractClassLog) => ContractClassPublishedEvent.isContractClassPublishedEvent(log))