@aztec/protocol-contracts 4.0.0-rc.3 → 4.0.0-rc.5
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.
- package/dest/auth-registry/index.d.ts +1 -1
- package/dest/auth-registry/index.d.ts.map +1 -1
- package/dest/auth-registry/index.js +3 -3
- package/dest/auth-registry/lazy.js +1 -1
- package/dest/class-registry/index.d.ts +1 -1
- package/dest/class-registry/index.d.ts.map +1 -1
- package/dest/class-registry/index.js +3 -3
- package/dest/class-registry/lazy.js +1 -1
- package/dest/fee-juice/index.d.ts +1 -1
- package/dest/fee-juice/index.d.ts.map +1 -1
- package/dest/fee-juice/index.js +3 -3
- package/dest/fee-juice/lazy.js +1 -1
- package/dest/instance-registry/index.d.ts +1 -1
- package/dest/instance-registry/index.d.ts.map +1 -1
- package/dest/instance-registry/index.js +3 -3
- package/dest/instance-registry/lazy.js +1 -1
- package/dest/make_protocol_contract.d.ts +4 -4
- package/dest/make_protocol_contract.d.ts.map +1 -1
- package/dest/make_protocol_contract.js +27 -14
- package/dest/multi-call-entrypoint/index.d.ts +1 -1
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
- package/dest/multi-call-entrypoint/index.js +3 -3
- package/dest/multi-call-entrypoint/lazy.js +1 -1
- package/dest/protocol_contract_data.d.ts +13 -1
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +86 -0
- package/dest/provider/bundle.js +1 -1
- package/dest/public-checks/index.d.ts +1 -1
- package/dest/public-checks/index.d.ts.map +1 -1
- package/dest/public-checks/index.js +3 -3
- package/dest/public-checks/lazy.js +1 -1
- package/dest/scripts/generate_data.js +66 -15
- package/package.json +4 -4
- package/src/auth-registry/index.ts +3 -3
- package/src/auth-registry/lazy.ts +1 -1
- package/src/class-registry/index.ts +3 -3
- package/src/class-registry/lazy.ts +1 -1
- package/src/fee-juice/index.ts +3 -3
- package/src/fee-juice/lazy.ts +1 -1
- package/src/instance-registry/index.ts +3 -3
- package/src/instance-registry/lazy.ts +1 -1
- package/src/make_protocol_contract.ts +37 -15
- package/src/multi-call-entrypoint/index.ts +3 -3
- package/src/multi-call-entrypoint/lazy.ts +1 -1
- package/src/protocol_contract_data.ts +63 -0
- package/src/provider/bundle.ts +1 -1
- package/src/public-checks/index.ts +3 -3
- package/src/public-checks/lazy.ts +1 -1
|
@@ -3,4 +3,4 @@ import type { ProtocolContract } from '../protocol_contract.js';
|
|
|
3
3
|
export declare const AuthRegistryArtifact: ContractArtifact;
|
|
4
4
|
/** Returns the canonical deployment of the auth registry. */
|
|
5
5
|
export declare function getCanonicalAuthRegistry(): Promise<ProtocolContract>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hdXRoLXJlZ2lzdHJ5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUF3QixNQUFNLG1CQUFtQixDQUFDO0FBS2hGLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFJaEUsZUFBTyxNQUFNLG9CQUFvQixFQUFFLGdCQUFpRixDQUFDO0FBRXJILDZEQUE2RDtBQUM3RCx3QkFBZ0Isd0JBQXdCLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBS3BFIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth-registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAKhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,eAAO,MAAM,oBAAoB,EAAE,gBAAiF,CAAC;AAErH,6DAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth-registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAKhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,eAAO,MAAM,oBAAoB,EAAE,gBAAiF,CAAC;AAErH,6DAA6D;AAC7D,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKpE"}
|
|
@@ -5,9 +5,9 @@ import AuthRegistryJson from '../../artifacts/AuthRegistry.json' with {
|
|
|
5
5
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
6
|
let protocolContract;
|
|
7
7
|
export const AuthRegistryArtifact = loadContractArtifact(AuthRegistryJson);
|
|
8
|
-
/** Returns the canonical deployment of the auth registry. */ export
|
|
8
|
+
/** Returns the canonical deployment of the auth registry. */ export function getCanonicalAuthRegistry() {
|
|
9
9
|
if (!protocolContract) {
|
|
10
|
-
protocolContract =
|
|
10
|
+
protocolContract = makeProtocolContract('AuthRegistry', AuthRegistryArtifact);
|
|
11
11
|
}
|
|
12
|
-
return protocolContract;
|
|
12
|
+
return Promise.resolve(protocolContract);
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ export async function getAuthRegistryArtifact() {
|
|
|
17
17
|
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalAuthRegistry() {
|
|
18
18
|
if (!protocolContract) {
|
|
19
19
|
const authRegistryArtifact = await getAuthRegistryArtifact();
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
21
21
|
}
|
|
22
22
|
return protocolContract;
|
|
23
23
|
}
|
|
@@ -5,4 +5,4 @@ export * from './utility_function_broadcasted_event.js';
|
|
|
5
5
|
export declare const ContractClassRegistryArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
6
6
|
/** Returns the canonical deployment of the contract. */
|
|
7
7
|
export declare function getCanonicalClassRegistry(): Promise<ProtocolContract>;
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGFzcy1yZWdpc3RyeS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRWhFLGNBQWMscUNBQXFDLENBQUM7QUFDcEQsY0FBYyx5Q0FBeUMsQ0FBQztBQUN4RCxjQUFjLHlDQUF5QyxDQUFDO0FBRXhELGVBQU8sTUFBTSw2QkFBNkIsOENBQTBFLENBQUM7QUFJckgsd0RBQXdEO0FBQ3hELHdCQUFnQix5QkFBeUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FNckUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/class-registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AAExD,eAAO,MAAM,6BAA6B,8CAA0E,CAAC;AAIrH,wDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/class-registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AAExD,eAAO,MAAM,6BAA6B,8CAA0E,CAAC;AAIrH,wDAAwD;AACxD,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAMrE"}
|
|
@@ -8,10 +8,10 @@ export * from './private_function_broadcasted_event.js';
|
|
|
8
8
|
export * from './utility_function_broadcasted_event.js';
|
|
9
9
|
export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassRegistryJson);
|
|
10
10
|
let protocolContract;
|
|
11
|
-
/** Returns the canonical deployment of the contract. */ export
|
|
11
|
+
/** Returns the canonical deployment of the contract. */ export function getCanonicalClassRegistry() {
|
|
12
12
|
if (!protocolContract) {
|
|
13
13
|
const artifact = ContractClassRegistryArtifact;
|
|
14
|
-
protocolContract =
|
|
14
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', artifact);
|
|
15
15
|
}
|
|
16
|
-
return protocolContract;
|
|
16
|
+
return Promise.resolve(protocolContract);
|
|
17
17
|
}
|
|
@@ -20,7 +20,7 @@ export async function getContractClassRegistryArtifact() {
|
|
|
20
20
|
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalClassRegistry() {
|
|
21
21
|
if (!protocolContract) {
|
|
22
22
|
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
23
|
-
protocolContract =
|
|
23
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
24
24
|
}
|
|
25
25
|
return protocolContract;
|
|
26
26
|
}
|
|
@@ -12,4 +12,4 @@ export declare function computeFeePayerBalanceStorageSlot(feePayer: AztecAddress
|
|
|
12
12
|
* Computes the leaf slot in the public data tree for the balance of the fee payer in the Fee Juice.
|
|
13
13
|
*/
|
|
14
14
|
export declare function computeFeePayerBalanceLeafSlot(feePayer: AztecAddress): Promise<Fr>;
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mZWUtanVpY2UvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFNaEUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUdoRSxlQUFPLE1BQU0sZ0JBQWdCLDhDQUE2RCxDQUFDO0FBSTNGLHdEQUF3RDtBQUN4RCx3QkFBZ0Isb0JBQW9CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBS2hFO0FBRUQ7O0dBRUc7QUFDSCx3QkFBZ0IsaUNBQWlDLENBQUMsUUFBUSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDLENBRXJGO0FBRUQ7O0dBRUc7QUFDSCx3QkFBc0IsOEJBQThCLENBQUMsUUFBUSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDLENBR3hGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fee-juice/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,eAAO,MAAM,gBAAgB,8CAA6D,CAAC;AAI3F,wDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fee-juice/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,eAAO,MAAM,gBAAgB,8CAA6D,CAAC;AAI3F,wDAAwD;AACxD,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKhE;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC,CAErF;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC,CAGxF"}
|
package/dest/fee-juice/index.js
CHANGED
|
@@ -7,11 +7,11 @@ import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
|
7
7
|
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
8
8
|
export const FeeJuiceArtifact = loadContractArtifact(FeeJuiceJson);
|
|
9
9
|
let protocolContract;
|
|
10
|
-
/** Returns the canonical deployment of the contract. */ export
|
|
10
|
+
/** Returns the canonical deployment of the contract. */ export function getCanonicalFeeJuice() {
|
|
11
11
|
if (!protocolContract) {
|
|
12
|
-
protocolContract =
|
|
12
|
+
protocolContract = makeProtocolContract('FeeJuice', FeeJuiceArtifact);
|
|
13
13
|
}
|
|
14
|
-
return protocolContract;
|
|
14
|
+
return Promise.resolve(protocolContract);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Computes the storage slot within the Fee Juice contract for the balance of the fee payer.
|
package/dest/fee-juice/lazy.js
CHANGED
|
@@ -17,7 +17,7 @@ export async function getFeeJuiceArtifact() {
|
|
|
17
17
|
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalFeeJuice() {
|
|
18
18
|
if (!protocolContract) {
|
|
19
19
|
const feeJuiceArtifact = await getFeeJuiceArtifact();
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('FeeJuice', feeJuiceArtifact);
|
|
21
21
|
}
|
|
22
22
|
return protocolContract;
|
|
23
23
|
}
|
|
@@ -4,4 +4,4 @@ export * from './contract_instance_updated_event.js';
|
|
|
4
4
|
export declare const ContractInstanceRegistryArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
5
5
|
/** Returns the canonical deployment of the contract. */
|
|
6
6
|
export declare function getCanonicalInstanceRegistry(): Promise<ProtocolContract>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbnN0YW5jZS1yZWdpc3RyeS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRWhFLGNBQWMsd0NBQXdDLENBQUM7QUFDdkQsY0FBYyxzQ0FBc0MsQ0FBQztBQUVyRCxlQUFPLE1BQU0sZ0NBQWdDLDhDQUU1QyxDQUFDO0FBSUYsd0RBQXdEO0FBQ3hELHdCQUFnQiw0QkFBNEIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FLeEUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instance-registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AAErD,eAAO,MAAM,gCAAgC,8CAE5C,CAAC;AAIF,wDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instance-registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AAErD,eAAO,MAAM,gCAAgC,8CAE5C,CAAC;AAIF,wDAAwD;AACxD,wBAAgB,4BAA4B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKxE"}
|
|
@@ -7,9 +7,9 @@ export * from './contract_instance_published_event.js';
|
|
|
7
7
|
export * from './contract_instance_updated_event.js';
|
|
8
8
|
export const ContractInstanceRegistryArtifact = loadContractArtifact(ContractInstanceRegistryJson);
|
|
9
9
|
let protocolContract;
|
|
10
|
-
/** Returns the canonical deployment of the contract. */ export
|
|
10
|
+
/** Returns the canonical deployment of the contract. */ export function getCanonicalInstanceRegistry() {
|
|
11
11
|
if (!protocolContract) {
|
|
12
|
-
protocolContract =
|
|
12
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', ContractInstanceRegistryArtifact);
|
|
13
13
|
}
|
|
14
|
-
return protocolContract;
|
|
14
|
+
return Promise.resolve(protocolContract);
|
|
15
15
|
}
|
|
@@ -19,7 +19,7 @@ export async function getContractInstanceRegistryArtifact() {
|
|
|
19
19
|
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalInstanceRegistry() {
|
|
20
20
|
if (!protocolContract) {
|
|
21
21
|
const contractInstanceRegistryArtifact = await getContractInstanceRegistryArtifact();
|
|
22
|
-
protocolContract =
|
|
22
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', contractInstanceRegistryArtifact);
|
|
23
23
|
}
|
|
24
24
|
return protocolContract;
|
|
25
25
|
}
|
|
@@ -2,8 +2,8 @@ import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
|
2
2
|
import type { ProtocolContract } from './protocol_contract.js';
|
|
3
3
|
import { type ProtocolContractName } from './protocol_contract_data.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Reconstructs a ProtocolContract from precomputed data without performing any hash computations.
|
|
6
|
+
* Internal to the protocol-contracts package — not part of the public API.
|
|
7
7
|
*/
|
|
8
|
-
export declare function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact):
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
export declare function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact): ProtocolContract;
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFrZV9wcm90b2NvbF9jb250cmFjdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL21ha2VfcHJvdG9jb2xfY29udHJhY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUcxRCxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQy9ELE9BQU8sRUFLTCxLQUFLLG9CQUFvQixFQUcxQixNQUFNLDZCQUE2QixDQUFDO0FBRXJDOzs7R0FHRztBQUNILHdCQUFnQixvQkFBb0IsQ0FBQyxJQUFJLEVBQUUsb0JBQW9CLEVBQUUsUUFBUSxFQUFFLGdCQUFnQixHQUFHLGdCQUFnQixDQTZCN0cifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make_protocol_contract.d.ts","sourceRoot":"","sources":["../src/make_protocol_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"make_protocol_contract.d.ts","sourceRoot":"","sources":["../src/make_protocol_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAKL,KAAK,oBAAoB,EAG1B,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,gBAAgB,GAAG,gBAAgB,CA6B7G"}
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProtocolContractAddress, ProtocolContractSalt } from './protocol_contract_data.js';
|
|
1
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
2
|
+
import { ProtocolContractAddress, ProtocolContractClassId, ProtocolContractClassIdPreimage, ProtocolContractInitializationHash, ProtocolContractPrivateFunctions, ProtocolContractSalt } from './protocol_contract_data.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*/ export
|
|
4
|
+
* Reconstructs a ProtocolContract from precomputed data without performing any hash computations.
|
|
5
|
+
* Internal to the protocol-contracts package — not part of the public API.
|
|
6
|
+
*/ export function makeProtocolContract(name, artifact) {
|
|
7
7
|
const address = ProtocolContractAddress[name];
|
|
8
8
|
const salt = ProtocolContractSalt[name];
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const classId = ProtocolContractClassId[name];
|
|
10
|
+
const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment } = ProtocolContractClassIdPreimage[name];
|
|
11
|
+
const initializationHash = ProtocolContractInitializationHash[name];
|
|
12
|
+
const contractClass = {
|
|
13
|
+
id: classId,
|
|
14
|
+
version: 1,
|
|
15
|
+
artifactHash,
|
|
16
|
+
privateFunctionsRoot,
|
|
17
|
+
publicBytecodeCommitment,
|
|
18
|
+
packedBytecode: artifact.functions.find((f)=>f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0),
|
|
19
|
+
privateFunctions: ProtocolContractPrivateFunctions[name]
|
|
20
|
+
};
|
|
21
|
+
const instance = {
|
|
22
|
+
version: 1,
|
|
23
|
+
currentContractClassId: classId,
|
|
24
|
+
originalContractClassId: classId,
|
|
25
|
+
initializationHash,
|
|
26
|
+
publicKeys: PublicKeys.default(),
|
|
12
27
|
salt,
|
|
13
|
-
deployer: address
|
|
14
|
-
|
|
28
|
+
deployer: address,
|
|
29
|
+
address
|
|
30
|
+
};
|
|
15
31
|
return {
|
|
16
|
-
instance
|
|
17
|
-
...instance,
|
|
18
|
-
address
|
|
19
|
-
},
|
|
32
|
+
instance,
|
|
20
33
|
contractClass,
|
|
21
34
|
artifact,
|
|
22
35
|
address
|
|
@@ -2,4 +2,4 @@ import type { ProtocolContract } from '../protocol_contract.js';
|
|
|
2
2
|
export declare const MultiCallEntrypointArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
3
|
/** Returns the canonical deployment of the contract. */
|
|
4
4
|
export declare function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract>;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tdWx0aS1jYWxsLWVudHJ5cG9pbnQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUVoRSxlQUFPLE1BQU0sMkJBQTJCLDhDQUF3RSxDQUFDO0FBSWpILHdEQUF3RDtBQUN4RCx3QkFBZ0IsK0JBQStCLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBSzNFIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/multi-call-entrypoint/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,2BAA2B,8CAAwE,CAAC;AAIjH,wDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/multi-call-entrypoint/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,2BAA2B,8CAAwE,CAAC;AAIjH,wDAAwD;AACxD,wBAAgB,+BAA+B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAK3E"}
|
|
@@ -5,9 +5,9 @@ import MultiCallEntrypointJson from '../../artifacts/MultiCallEntrypoint.json' w
|
|
|
5
5
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
6
|
export const MultiCallEntrypointArtifact = loadContractArtifact(MultiCallEntrypointJson);
|
|
7
7
|
let protocolContract;
|
|
8
|
-
/** Returns the canonical deployment of the contract. */ export
|
|
8
|
+
/** Returns the canonical deployment of the contract. */ export function getCanonicalMultiCallEntrypoint() {
|
|
9
9
|
if (!protocolContract) {
|
|
10
|
-
protocolContract =
|
|
10
|
+
protocolContract = makeProtocolContract('MultiCallEntrypoint', MultiCallEntrypointArtifact);
|
|
11
11
|
}
|
|
12
|
-
return protocolContract;
|
|
12
|
+
return Promise.resolve(protocolContract);
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ export async function getMultiCallEntrypointArtifact() {
|
|
|
17
17
|
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalMultiCallEntrypoint() {
|
|
18
18
|
if (!protocolContract) {
|
|
19
19
|
const multiCallEntrypointArtifact = await getMultiCallEntrypointArtifact();
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('MultiCallEntrypoint', multiCallEntrypointArtifact);
|
|
21
21
|
}
|
|
22
22
|
return protocolContract;
|
|
23
23
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
4
5
|
export declare const protocolContractNames: readonly ["AuthRegistry", "ContractInstanceRegistry", "ContractClassRegistry", "MultiCallEntrypoint", "FeeJuice", "PublicChecks"];
|
|
@@ -13,7 +14,18 @@ export declare const ProtocolContractDerivedAddress: {
|
|
|
13
14
|
FeeJuice: AztecAddress;
|
|
14
15
|
PublicChecks: AztecAddress;
|
|
15
16
|
};
|
|
17
|
+
export declare const ProtocolContractClassId: Record<ProtocolContractName, Fr>;
|
|
18
|
+
export declare const ProtocolContractClassIdPreimage: Record<ProtocolContractName, {
|
|
19
|
+
artifactHash: Fr;
|
|
20
|
+
privateFunctionsRoot: Fr;
|
|
21
|
+
publicBytecodeCommitment: Fr;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr>;
|
|
24
|
+
export declare const ProtocolContractPrivateFunctions: Record<ProtocolContractName, {
|
|
25
|
+
selector: FunctionSelector;
|
|
26
|
+
vkHash: Fr;
|
|
27
|
+
}[]>;
|
|
16
28
|
export declare const ProtocolContractsList: ProtocolContracts;
|
|
17
29
|
export declare const protocolContractsHash: Fr;
|
|
18
30
|
export declare const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG: Fr;
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdG9jb2xfY29udHJhY3RfZGF0YS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Byb3RvY29sX2NvbnRyYWN0X2RhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUksT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUdyRCxlQUFPLE1BQU0scUJBQXFCLG1JQU94QixDQUFDO0FBRVgsTUFBTSxNQUFNLG9CQUFvQixHQUFHLE9BQU8scUJBQXFCLENBQUMsTUFBTSxDQUFDLENBQUM7QUFJeEUsZUFBTyxNQUFNLG9CQUFvQixFQUFFLE1BQU0sQ0FBQyxvQkFBb0IsRUFBRSxFQUFFLENBT2pFLENBQUM7QUFJRixlQUFPLE1BQU0sdUJBQXVCLEVBQUUsTUFBTSxDQUFDLG9CQUFvQixFQUFFLFlBQVksQ0FPOUUsQ0FBQztBQUlGLGVBQU8sTUFBTSw4QkFBOEI7Ozs7Ozs7Q0FPMUMsQ0FBQztBQUlGLGVBQU8sTUFBTSx1QkFBdUIsRUFBRSxNQUFNLENBQUMsb0JBQW9CLEVBQUUsRUFBRSxDQU9wRSxDQUFDO0FBRUYsZUFBTyxNQUFNLCtCQUErQixFQUFFLE1BQU0sQ0FBQyxvQkFBb0IsRUFBRTtJQUFFLFlBQVksRUFBRSxFQUFFLENBQUM7SUFBQyxvQkFBb0IsRUFBRSxFQUFFLENBQUM7SUFBQyx3QkFBd0IsRUFBRSxFQUFFLENBQUE7Q0FBRSxDQStCdEosQ0FBQztBQUVGLGVBQU8sTUFBTSxrQ0FBa0MsRUFBRSxNQUFNLENBQUMsb0JBQW9CLEVBQUUsRUFBRSxDQU8vRSxDQUFDO0FBRUYsZUFBTyxNQUFNLGdDQUFnQyxFQUFFLE1BQU0sQ0FBQyxvQkFBb0IsRUFBRTtJQUFFLFFBQVEsRUFBRSxnQkFBZ0IsQ0FBQztJQUFDLE1BQU0sRUFBRSxFQUFFLENBQUE7Q0FBRSxFQUFFLENBT3ZILENBQUM7QUFJRixlQUFPLE1BQU0scUJBQXFCLG1CQVloQyxDQUFDO0FBRUgsZUFBTyxNQUFNLHFCQUFxQixJQUFzRixDQUFDO0FBSTNILGVBQU8sTUFBTSxxQ0FBcUMsSUFBeUYsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol_contract_data.d.ts","sourceRoot":"","sources":["../src/protocol_contract_data.ts"],"names":[],"mappings":"AAEI,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,eAAO,MAAM,qBAAqB,mIAOxB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAIxE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAOjE,CAAC;AAIF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAO9E,CAAC;AAIF,eAAO,MAAM,8BAA8B;;;;;;;CAO1C,CAAC;AAIF,eAAO,MAAM,qBAAqB,mBAYhC,CAAC;AAEH,eAAO,MAAM,qBAAqB,IAAsF,CAAC;AAI3H,eAAO,MAAM,qCAAqC,IAAyF,CAAC"}
|
|
1
|
+
{"version":3,"file":"protocol_contract_data.d.ts","sourceRoot":"","sources":["../src/protocol_contract_data.ts"],"names":[],"mappings":"AAEI,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,eAAO,MAAM,qBAAqB,mIAOxB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAIxE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAOjE,CAAC;AAIF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAO9E,CAAC;AAIF,eAAO,MAAM,8BAA8B;;;;;;;CAO1C,CAAC;AAIF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAOpE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,oBAAoB,EAAE;IAAE,YAAY,EAAE,EAAE,CAAC;IAAC,oBAAoB,EAAE,EAAE,CAAC;IAAC,wBAAwB,EAAE,EAAE,CAAA;CAAE,CA+BtJ,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAO/E,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,oBAAoB,EAAE;IAAE,QAAQ,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,EAAE,CAAA;CAAE,EAAE,CAOvH,CAAC;AAIF,eAAO,MAAM,qBAAqB,mBAYhC,CAAC;AAEH,eAAO,MAAM,qBAAqB,IAAsF,CAAC;AAI3H,eAAO,MAAM,qCAAqC,IAAyF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
5
6
|
export const protocolContractNames = [
|
|
@@ -34,6 +35,91 @@ export const ProtocolContractDerivedAddress = {
|
|
|
34
35
|
FeeJuice: AztecAddress.fromString('0x204913186c0dd70015d05bf9100a12e31ccb7cc2527aacdfae0c19ad6439fcf4'),
|
|
35
36
|
PublicChecks: AztecAddress.fromString('0x1198142fd84a58c0ab22d5fde371ce527042db49487e05206a326ad154952ac8')
|
|
36
37
|
};
|
|
38
|
+
export const ProtocolContractClassId = {
|
|
39
|
+
AuthRegistry: Fr.fromString('0x17ad10e1b5dba2877b9a973449c03d5227f2c719c0eb1989427c10c1d83867a5'),
|
|
40
|
+
ContractInstanceRegistry: Fr.fromString('0x187c710b0d69b2da7a6f0663c15093a5d595c04e77762c249aa9b654bc12158c'),
|
|
41
|
+
ContractClassRegistry: Fr.fromString('0x013466b8a65dea98ad80c119cf236a0acf53acfede687769410cfd57876b8242'),
|
|
42
|
+
MultiCallEntrypoint: Fr.fromString('0x1acd7ab8bf186c16eafc9c4fe9049f35df27e172bb2d8319a2a22ddd0006966d'),
|
|
43
|
+
FeeJuice: Fr.fromString('0x16b2d5ef5044c11126a16ccdb3778082eb423375977da9458d493fdf84505e81'),
|
|
44
|
+
PublicChecks: Fr.fromString('0x03f2ebaef8d692422185e35d8fe35d0bb7289702cf023b525c022d77fc6b5ed5')
|
|
45
|
+
};
|
|
46
|
+
export const ProtocolContractClassIdPreimage = {
|
|
47
|
+
AuthRegistry: {
|
|
48
|
+
artifactHash: Fr.fromString('0x029f3b5582e9e2f9cddb4f887fa67c06d8dbe9aef604aa7de91a6f5328bf477c'),
|
|
49
|
+
privateFunctionsRoot: Fr.fromString('0x0826df9bf86cf460935b2bd024edcb5a58532fcf0392abbdb33f5f2150753756'),
|
|
50
|
+
publicBytecodeCommitment: Fr.fromString('0x22db1f0a70bfefaf90371c7728e558cf60507b718e99ed276ed3143bec615f6f')
|
|
51
|
+
},
|
|
52
|
+
ContractInstanceRegistry: {
|
|
53
|
+
artifactHash: Fr.fromString('0x18601566bacdca7a5a40528f221b04ee7b74f382e6cd34fbdf69d31c50d5ee88'),
|
|
54
|
+
privateFunctionsRoot: Fr.fromString('0x136a6705c7ad1d47f65cb881a56909d4c78d3fa8944f5b103734cd91e654ed63'),
|
|
55
|
+
publicBytecodeCommitment: Fr.fromString('0x01c573f470ba9a17d362c7dd5a28931c39432f9ce527555049c71432f895ad6c')
|
|
56
|
+
},
|
|
57
|
+
ContractClassRegistry: {
|
|
58
|
+
artifactHash: Fr.fromString('0x232d868db8a4d1e0f013efa4bfe5c39d96e11f16a62e3e73abbbafc3028fc410'),
|
|
59
|
+
privateFunctionsRoot: Fr.fromString('0x2ac3bf890a7d534a768079aa86889caa1a86373c8e6fc2db48215b11bbb79106'),
|
|
60
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e')
|
|
61
|
+
},
|
|
62
|
+
MultiCallEntrypoint: {
|
|
63
|
+
artifactHash: Fr.fromString('0x0d30526b6b786cf887d7e44ba59d2e9561d5791b0e3c78c681d0499ae45b225a'),
|
|
64
|
+
privateFunctionsRoot: Fr.fromString('0x266505ecb7c02ce6e227227c0b6bdb44713c8ecd43164ee7bb00b8fb340e8b03'),
|
|
65
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e')
|
|
66
|
+
},
|
|
67
|
+
FeeJuice: {
|
|
68
|
+
artifactHash: Fr.fromString('0x2eb476f12cce5207be118047fb7f603378b78aa619d6539a4d9eec4700ea2507'),
|
|
69
|
+
privateFunctionsRoot: Fr.fromString('0x0abef3cfc6ae314886c841b42dc33d3eed255ad3dee7773daabf05b229573759'),
|
|
70
|
+
publicBytecodeCommitment: Fr.fromString('0x2a144b28b36efa21b7488467aba7e06b33e016d00bfe083a7bfa06ad6ff5aa2f')
|
|
71
|
+
},
|
|
72
|
+
PublicChecks: {
|
|
73
|
+
artifactHash: Fr.fromString('0x228ea8af66ff150f40a4b01b64115d12777b2f7fd3a4bfc0d97d38a91f139ef6'),
|
|
74
|
+
privateFunctionsRoot: Fr.fromString('0x067243231eddf4222f3911defbba7705aff06ed45960b27f6f91319196ef97e1'),
|
|
75
|
+
publicBytecodeCommitment: Fr.fromString('0x2d0834fc9468fd2092091852543a2fbd7b6b313c7e5e4defe8730c8065366a03')
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
export const ProtocolContractInitializationHash = {
|
|
79
|
+
AuthRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
80
|
+
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
81
|
+
ContractClassRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
82
|
+
MultiCallEntrypoint: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
83
|
+
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
84
|
+
PublicChecks: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
85
|
+
};
|
|
86
|
+
export const ProtocolContractPrivateFunctions = {
|
|
87
|
+
AuthRegistry: [
|
|
88
|
+
{
|
|
89
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000079a3d418')),
|
|
90
|
+
vkHash: Fr.fromString('0x019c553854290b9b547841e45bf45e344d4a2d4f6702fee430ec5897ce7d3b78')
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
ContractInstanceRegistry: [
|
|
94
|
+
{
|
|
95
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000016ec12aa')),
|
|
96
|
+
vkHash: Fr.fromString('0x262f7a90ecf055779001b67dad01a3add1e549f6c27931f0e71e463ce2142b57')
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
ContractClassRegistry: [
|
|
100
|
+
{
|
|
101
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000006934ed0d')),
|
|
102
|
+
vkHash: Fr.fromString('0x1163f31e191528254c877fce0c7f62dd738f5552bbd2dda97512fe4777377f5b')
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
MultiCallEntrypoint: [
|
|
106
|
+
{
|
|
107
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f04908a9')),
|
|
108
|
+
vkHash: Fr.fromString('0x21732ab3cecf633e4c31a030df62c93e35a005b89941fdab568d2818c1355192')
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
FeeJuice: [
|
|
112
|
+
{
|
|
113
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000cbe67243')),
|
|
114
|
+
vkHash: Fr.fromString('0x2ad6083b4595f8076c014e5152191013167ab1b5a31ad0cbb06490054c7c59ae')
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000e8d374b6')),
|
|
118
|
+
vkHash: Fr.fromString('0x05aaffffdf797625ff24575d939339303775c5db77fb6bdcecbf955f726fd071')
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
PublicChecks: []
|
|
122
|
+
};
|
|
37
123
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
38
124
|
AztecAddress.fromString('0x139f8eb6d6e7e7a7c0322c3b7558687a7e24201f11bf2c4cb2fe56c18d363695'),
|
|
39
125
|
AztecAddress.fromString('0x1254246c88aca5a66fa66f3aa78c408a698ebca3b713120497c7555dfc718592'),
|
package/dest/provider/bundle.js
CHANGED
|
@@ -15,6 +15,6 @@ export const ProtocolContractArtifact = {
|
|
|
15
15
|
};
|
|
16
16
|
export class BundledProtocolContractsProvider {
|
|
17
17
|
getProtocolContractArtifact(name) {
|
|
18
|
-
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
18
|
+
return Promise.resolve(makeProtocolContract(name, ProtocolContractArtifact[name]));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -2,4 +2,4 @@ import type { ProtocolContract } from '../protocol_contract.js';
|
|
|
2
2
|
export declare const PublicChecksArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
3
|
/** Returns the canonical deployment of the contract. */
|
|
4
4
|
export declare function getCanonicalPublicChecks(): Promise<ProtocolContract>;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMtY2hlY2tzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFaEUsZUFBTyxNQUFNLG9CQUFvQiw4Q0FBaUUsQ0FBQztBQUluRyx3REFBd0Q7QUFDeEQsd0JBQWdCLHdCQUF3QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUtwRSJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public-checks/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,oBAAoB,8CAAiE,CAAC;AAInG,wDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public-checks/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,oBAAoB,8CAAiE,CAAC;AAInG,wDAAwD;AACxD,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKpE"}
|
|
@@ -5,9 +5,9 @@ import PublicChecksJson from '../../artifacts/PublicChecks.json' with {
|
|
|
5
5
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
6
|
export const PublicChecksArtifact = loadContractArtifact(PublicChecksJson);
|
|
7
7
|
let protocolContract;
|
|
8
|
-
/** Returns the canonical deployment of the contract. */ export
|
|
8
|
+
/** Returns the canonical deployment of the contract. */ export function getCanonicalPublicChecks() {
|
|
9
9
|
if (!protocolContract) {
|
|
10
|
-
protocolContract =
|
|
10
|
+
protocolContract = makeProtocolContract('PublicChecks', PublicChecksArtifact);
|
|
11
11
|
}
|
|
12
|
-
return protocolContract;
|
|
12
|
+
return Promise.resolve(protocolContract);
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ export async function getPublicChecksArtifact() {
|
|
|
17
17
|
/** Returns the canonical deployment of the public checks contract. */ export async function getCanonicalPublicChecks() {
|
|
18
18
|
if (!protocolContract) {
|
|
19
19
|
const publicChecksArtifact = await getPublicChecksArtifact();
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('PublicChecks', publicChecksArtifact);
|
|
21
21
|
}
|
|
22
22
|
return protocolContract;
|
|
23
23
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
// Reads compiled Noir artifacts for each protocol contract and derives their addresses, class IDs,
|
|
2
|
+
// bytecode commitments, and other deployment data, emitting everything as precomputed constants into
|
|
3
|
+
// `protocol_contract_data.ts`. This avoids clients repeating the expensive hashing at runtime and
|
|
4
|
+
// ensures a single source of truth for the protocol contracts hash enforced by circuits, P2P, and L1.
|
|
1
5
|
import { CANONICAL_AUTH_REGISTRY_ADDRESS, CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS, CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, FEE_JUICE_ADDRESS, MAX_PROTOCOL_CONTRACTS, MULTI_CALL_ENTRYPOINT_ADDRESS, PUBLIC_CHECKS_ADDRESS } from '@aztec/constants';
|
|
2
6
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
7
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
8
|
import { createConsoleLogger } from '@aztec/foundation/log';
|
|
5
9
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
6
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import {
|
|
11
|
+
import { computeContractAddressFromInstance, computeInitializationHash, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
8
12
|
import { computeSiloedPrivateLogFirstField } from '@aztec/stdlib/hash';
|
|
13
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
9
14
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
10
15
|
import { promises as fs } from 'fs';
|
|
11
16
|
import path from 'path';
|
|
@@ -50,12 +55,32 @@ async function copyArtifact(srcName, destName) {
|
|
|
50
55
|
await fs.copyFile(src, dest);
|
|
51
56
|
return artifact;
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
// Precompute all the expensive contract data that can be obtained from the artifact, to avoid redundant computations in clients.
|
|
59
|
+
// Protocol contracts come from a trusted source, so no class verifications are needed.
|
|
60
|
+
async function computeContractData(artifact, deployer) {
|
|
61
|
+
const loaded = loadContractArtifact(artifact);
|
|
62
|
+
const contractClass = await getContractClassFromArtifact(loaded);
|
|
63
|
+
const constructorArtifact = loaded.functions.find((f)=>f.name === 'constructor');
|
|
64
|
+
const initializationHash = await computeInitializationHash(constructorArtifact, []);
|
|
65
|
+
const instance = {
|
|
66
|
+
version: 1,
|
|
67
|
+
currentContractClassId: contractClass.id,
|
|
68
|
+
originalContractClassId: contractClass.id,
|
|
69
|
+
initializationHash,
|
|
70
|
+
publicKeys: PublicKeys.default(),
|
|
55
71
|
salt,
|
|
56
72
|
deployer
|
|
57
|
-
}
|
|
58
|
-
|
|
73
|
+
};
|
|
74
|
+
const address = await computeContractAddressFromInstance(instance);
|
|
75
|
+
return {
|
|
76
|
+
address,
|
|
77
|
+
classId: contractClass.id,
|
|
78
|
+
artifactHash: contractClass.artifactHash,
|
|
79
|
+
privateFunctionsRoot: contractClass.privateFunctionsRoot,
|
|
80
|
+
publicBytecodeCommitment: contractClass.publicBytecodeCommitment,
|
|
81
|
+
initializationHash,
|
|
82
|
+
privateFunctions: contractClass.privateFunctions
|
|
83
|
+
};
|
|
59
84
|
}
|
|
60
85
|
async function generateDeclarationFile(destName) {
|
|
61
86
|
const content = `
|
|
@@ -89,14 +114,37 @@ function generateContractAddresses(names) {
|
|
|
89
114
|
};
|
|
90
115
|
`;
|
|
91
116
|
}
|
|
92
|
-
function generateDerivedAddresses(names,
|
|
117
|
+
function generateDerivedAddresses(names, contractData) {
|
|
93
118
|
return `
|
|
94
119
|
export const ProtocolContractDerivedAddress = {
|
|
95
|
-
${
|
|
120
|
+
${contractData.map((d, i)=>`${names[i]}: AztecAddress.fromString('${d.address.toString()}')`).join(',\n')}
|
|
121
|
+
};
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
function generateClassIdPreimages(names, contractData) {
|
|
125
|
+
return `
|
|
126
|
+
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
127
|
+
${contractData.map((d, i)=>`${names[i]}: Fr.fromString('${d.classId.toString()}')`).join(',\n')}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
131
|
+
${contractData.map((d, i)=>`${names[i]}: {
|
|
132
|
+
artifactHash: Fr.fromString('${d.artifactHash.toString()}'),
|
|
133
|
+
privateFunctionsRoot: Fr.fromString('${d.privateFunctionsRoot.toString()}'),
|
|
134
|
+
publicBytecodeCommitment: Fr.fromString('${d.publicBytecodeCommitment.toString()}'),
|
|
135
|
+
}`).join(',\n')}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
139
|
+
${contractData.map((d, i)=>`${names[i]}: Fr.fromString('${d.initializationHash.toString()}')`).join(',\n')}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
143
|
+
${contractData.map((d, i)=>`${names[i]}: [${d.privateFunctions.map((fn)=>`{ selector: FunctionSelector.fromField(Fr.fromString('${fn.selector.toField().toString()}')), vkHash: Fr.fromString('${fn.vkHash.toString()}') }`).join(', ')}]`).join(',\n')}
|
|
96
144
|
};
|
|
97
145
|
`;
|
|
98
146
|
}
|
|
99
|
-
async function generateProtocolContractsList(names,
|
|
147
|
+
async function generateProtocolContractsList(names, contractData) {
|
|
100
148
|
const list = makeTuple(MAX_PROTOCOL_CONTRACTS, ()=>AztecAddress.zero());
|
|
101
149
|
for(let i = 0; i < names.length; i++){
|
|
102
150
|
const name = names[i];
|
|
@@ -105,7 +153,7 @@ async function generateProtocolContractsList(names, derivedAddresses) {
|
|
|
105
153
|
if (!list[derivedAddressIndex].equals(AztecAddress.zero())) {
|
|
106
154
|
throw new Error(`Duplicate protocol contract address: ${address.toString()}`);
|
|
107
155
|
}
|
|
108
|
-
list[derivedAddressIndex] =
|
|
156
|
+
list[derivedAddressIndex] = contractData[i].address;
|
|
109
157
|
}
|
|
110
158
|
return `
|
|
111
159
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
@@ -121,10 +169,11 @@ async function generateLogTags() {
|
|
|
121
169
|
export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('${await computeSiloedPrivateLogFirstField(new AztecAddress(new Fr(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS)), new Fr(CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE))}');
|
|
122
170
|
`;
|
|
123
171
|
}
|
|
124
|
-
async function generateOutputFile(names,
|
|
172
|
+
async function generateOutputFile(names, contractData) {
|
|
125
173
|
const content = `
|
|
126
174
|
// GENERATED FILE - DO NOT EDIT. RUN \`yarn generate\` or \`yarn generate:data\`
|
|
127
175
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
176
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
128
177
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
129
178
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
130
179
|
|
|
@@ -134,9 +183,11 @@ async function generateOutputFile(names, derivedAddresses) {
|
|
|
134
183
|
|
|
135
184
|
${generateContractAddresses(names)}
|
|
136
185
|
|
|
137
|
-
${generateDerivedAddresses(names,
|
|
186
|
+
${generateDerivedAddresses(names, contractData)}
|
|
187
|
+
|
|
188
|
+
${generateClassIdPreimages(names, contractData)}
|
|
138
189
|
|
|
139
|
-
${await generateProtocolContractsList(names,
|
|
190
|
+
${await generateProtocolContractsList(names, contractData)}
|
|
140
191
|
|
|
141
192
|
${await generateLogTags()}
|
|
142
193
|
`;
|
|
@@ -145,16 +196,16 @@ async function generateOutputFile(names, derivedAddresses) {
|
|
|
145
196
|
async function main() {
|
|
146
197
|
await clearDestDir();
|
|
147
198
|
const srcNames = JSON.parse(await fs.readFile(path.join(noirContractsRoot, 'protocol_contracts.json'), 'utf8'));
|
|
148
|
-
const
|
|
199
|
+
const contractDataList = [];
|
|
149
200
|
const destNames = srcNames.map((n)=>n.split('-')[1]);
|
|
150
201
|
for(let i = 0; i < srcNames.length; i++){
|
|
151
202
|
const srcName = srcNames[i];
|
|
152
203
|
const destName = destNames[i];
|
|
153
204
|
const artifact = await copyArtifact(srcName, destName);
|
|
154
205
|
await generateDeclarationFile(destName);
|
|
155
|
-
|
|
206
|
+
contractDataList.push(await computeContractData(artifact, AztecAddress.fromBigInt(BigInt(contractAddressMapping[destName]))));
|
|
156
207
|
}
|
|
157
|
-
await generateOutputFile(destNames,
|
|
208
|
+
await generateOutputFile(destNames, contractDataList);
|
|
158
209
|
}
|
|
159
210
|
try {
|
|
160
211
|
await main();
|
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.0.0-rc.
|
|
5
|
+
"version": "4.0.0-rc.5",
|
|
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.0.0-rc.
|
|
77
|
-
"@aztec/foundation": "4.0.0-rc.
|
|
78
|
-
"@aztec/stdlib": "4.0.0-rc.
|
|
76
|
+
"@aztec/constants": "4.0.0-rc.5",
|
|
77
|
+
"@aztec/foundation": "4.0.0-rc.5",
|
|
78
|
+
"@aztec/stdlib": "4.0.0-rc.5",
|
|
79
79
|
"lodash.chunk": "^4.2.0",
|
|
80
80
|
"lodash.omit": "^4.5.0",
|
|
81
81
|
"tslib": "^2.4.0"
|
|
@@ -10,9 +10,9 @@ let protocolContract: ProtocolContract;
|
|
|
10
10
|
export const AuthRegistryArtifact: ContractArtifact = loadContractArtifact(AuthRegistryJson as NoirCompiledContract);
|
|
11
11
|
|
|
12
12
|
/** Returns the canonical deployment of the auth registry. */
|
|
13
|
-
export
|
|
13
|
+
export function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
14
14
|
if (!protocolContract) {
|
|
15
|
-
protocolContract =
|
|
15
|
+
protocolContract = makeProtocolContract('AuthRegistry', AuthRegistryArtifact);
|
|
16
16
|
}
|
|
17
|
-
return protocolContract;
|
|
17
|
+
return Promise.resolve(protocolContract);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export async function getAuthRegistryArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const authRegistryArtifact = await getAuthRegistryArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|
|
@@ -14,10 +14,10 @@ export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassR
|
|
|
14
14
|
let protocolContract: ProtocolContract;
|
|
15
15
|
|
|
16
16
|
/** Returns the canonical deployment of the contract. */
|
|
17
|
-
export
|
|
17
|
+
export function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
18
18
|
if (!protocolContract) {
|
|
19
19
|
const artifact = ContractClassRegistryArtifact;
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', artifact);
|
|
21
21
|
}
|
|
22
|
-
return protocolContract;
|
|
22
|
+
return Promise.resolve(protocolContract);
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ export async function getContractClassRegistryArtifact(): Promise<ContractArtifa
|
|
|
27
27
|
export async function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
28
28
|
if (!protocolContract) {
|
|
29
29
|
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
30
|
-
protocolContract =
|
|
30
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
31
31
|
}
|
|
32
32
|
return protocolContract;
|
|
33
33
|
}
|
package/src/fee-juice/index.ts
CHANGED
|
@@ -14,11 +14,11 @@ export const FeeJuiceArtifact = loadContractArtifact(FeeJuiceJson as NoirCompile
|
|
|
14
14
|
let protocolContract: ProtocolContract;
|
|
15
15
|
|
|
16
16
|
/** Returns the canonical deployment of the contract. */
|
|
17
|
-
export
|
|
17
|
+
export function getCanonicalFeeJuice(): Promise<ProtocolContract> {
|
|
18
18
|
if (!protocolContract) {
|
|
19
|
-
protocolContract =
|
|
19
|
+
protocolContract = makeProtocolContract('FeeJuice', FeeJuiceArtifact);
|
|
20
20
|
}
|
|
21
|
-
return protocolContract;
|
|
21
|
+
return Promise.resolve(protocolContract);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
package/src/fee-juice/lazy.ts
CHANGED
|
@@ -23,7 +23,7 @@ export async function getFeeJuiceArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalFeeJuice(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const feeJuiceArtifact = await getFeeJuiceArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('FeeJuice', feeJuiceArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|
|
@@ -15,9 +15,9 @@ export const ContractInstanceRegistryArtifact = loadContractArtifact(
|
|
|
15
15
|
let protocolContract: ProtocolContract;
|
|
16
16
|
|
|
17
17
|
/** Returns the canonical deployment of the contract. */
|
|
18
|
-
export
|
|
18
|
+
export function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
|
|
19
19
|
if (!protocolContract) {
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', ContractInstanceRegistryArtifact);
|
|
21
21
|
}
|
|
22
|
-
return protocolContract;
|
|
22
|
+
return Promise.resolve(protocolContract);
|
|
23
23
|
}
|
|
@@ -26,7 +26,7 @@ export async function getContractInstanceRegistryArtifact(): Promise<ContractArt
|
|
|
26
26
|
export async function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
|
|
27
27
|
if (!protocolContract) {
|
|
28
28
|
const contractInstanceRegistryArtifact = await getContractInstanceRegistryArtifact();
|
|
29
|
-
protocolContract =
|
|
29
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', contractInstanceRegistryArtifact);
|
|
30
30
|
}
|
|
31
31
|
return protocolContract;
|
|
32
32
|
}
|
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import {
|
|
2
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
3
|
|
|
4
4
|
import type { ProtocolContract } from './protocol_contract.js';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ProtocolContractAddress,
|
|
7
|
+
ProtocolContractClassId,
|
|
8
|
+
ProtocolContractClassIdPreimage,
|
|
9
|
+
ProtocolContractInitializationHash,
|
|
10
|
+
type ProtocolContractName,
|
|
11
|
+
ProtocolContractPrivateFunctions,
|
|
12
|
+
ProtocolContractSalt,
|
|
13
|
+
} from './protocol_contract_data.js';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
16
|
+
* Reconstructs a ProtocolContract from precomputed data without performing any hash computations.
|
|
17
|
+
* Internal to the protocol-contracts package — not part of the public API.
|
|
10
18
|
*/
|
|
11
|
-
export
|
|
12
|
-
name: ProtocolContractName,
|
|
13
|
-
artifact: ContractArtifact,
|
|
14
|
-
): Promise<ProtocolContract> {
|
|
19
|
+
export function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact): ProtocolContract {
|
|
15
20
|
const address = ProtocolContractAddress[name];
|
|
16
21
|
const salt = ProtocolContractSalt[name];
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const classId = ProtocolContractClassId[name];
|
|
23
|
+
const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment } = ProtocolContractClassIdPreimage[name];
|
|
24
|
+
const initializationHash = ProtocolContractInitializationHash[name];
|
|
25
|
+
|
|
26
|
+
const contractClass = {
|
|
27
|
+
id: classId,
|
|
28
|
+
version: 1 as const,
|
|
29
|
+
artifactHash,
|
|
30
|
+
privateFunctionsRoot,
|
|
31
|
+
publicBytecodeCommitment,
|
|
32
|
+
packedBytecode: artifact.functions.find(f => f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0),
|
|
33
|
+
privateFunctions: ProtocolContractPrivateFunctions[name],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const instance = {
|
|
37
|
+
version: 1 as const,
|
|
38
|
+
currentContractClassId: classId,
|
|
39
|
+
originalContractClassId: classId,
|
|
40
|
+
initializationHash,
|
|
41
|
+
publicKeys: PublicKeys.default(),
|
|
42
|
+
salt,
|
|
43
|
+
deployer: address,
|
|
24
44
|
address,
|
|
25
45
|
};
|
|
46
|
+
|
|
47
|
+
return { instance, contractClass, artifact, address };
|
|
26
48
|
}
|
|
@@ -10,9 +10,9 @@ export const MultiCallEntrypointArtifact = loadContractArtifact(MultiCallEntrypo
|
|
|
10
10
|
let protocolContract: ProtocolContract;
|
|
11
11
|
|
|
12
12
|
/** Returns the canonical deployment of the contract. */
|
|
13
|
-
export
|
|
13
|
+
export function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract> {
|
|
14
14
|
if (!protocolContract) {
|
|
15
|
-
protocolContract =
|
|
15
|
+
protocolContract = makeProtocolContract('MultiCallEntrypoint', MultiCallEntrypointArtifact);
|
|
16
16
|
}
|
|
17
|
-
return protocolContract;
|
|
17
|
+
return Promise.resolve(protocolContract);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export async function getMultiCallEntrypointArtifact(): Promise<ContractArtifact
|
|
|
23
23
|
export async function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const multiCallEntrypointArtifact = await getMultiCallEntrypointArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('MultiCallEntrypoint', multiCallEntrypointArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
6
7
|
|
|
@@ -51,6 +52,68 @@ PublicChecks: AztecAddress.fromString('0x1198142fd84a58c0ab22d5fde371ce527042db4
|
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
|
|
55
|
+
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
56
|
+
AuthRegistry: Fr.fromString('0x17ad10e1b5dba2877b9a973449c03d5227f2c719c0eb1989427c10c1d83867a5'),
|
|
57
|
+
ContractInstanceRegistry: Fr.fromString('0x187c710b0d69b2da7a6f0663c15093a5d595c04e77762c249aa9b654bc12158c'),
|
|
58
|
+
ContractClassRegistry: Fr.fromString('0x013466b8a65dea98ad80c119cf236a0acf53acfede687769410cfd57876b8242'),
|
|
59
|
+
MultiCallEntrypoint: Fr.fromString('0x1acd7ab8bf186c16eafc9c4fe9049f35df27e172bb2d8319a2a22ddd0006966d'),
|
|
60
|
+
FeeJuice: Fr.fromString('0x16b2d5ef5044c11126a16ccdb3778082eb423375977da9458d493fdf84505e81'),
|
|
61
|
+
PublicChecks: Fr.fromString('0x03f2ebaef8d692422185e35d8fe35d0bb7289702cf023b525c022d77fc6b5ed5')
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
65
|
+
AuthRegistry: {
|
|
66
|
+
artifactHash: Fr.fromString('0x029f3b5582e9e2f9cddb4f887fa67c06d8dbe9aef604aa7de91a6f5328bf477c'),
|
|
67
|
+
privateFunctionsRoot: Fr.fromString('0x0826df9bf86cf460935b2bd024edcb5a58532fcf0392abbdb33f5f2150753756'),
|
|
68
|
+
publicBytecodeCommitment: Fr.fromString('0x22db1f0a70bfefaf90371c7728e558cf60507b718e99ed276ed3143bec615f6f'),
|
|
69
|
+
},
|
|
70
|
+
ContractInstanceRegistry: {
|
|
71
|
+
artifactHash: Fr.fromString('0x18601566bacdca7a5a40528f221b04ee7b74f382e6cd34fbdf69d31c50d5ee88'),
|
|
72
|
+
privateFunctionsRoot: Fr.fromString('0x136a6705c7ad1d47f65cb881a56909d4c78d3fa8944f5b103734cd91e654ed63'),
|
|
73
|
+
publicBytecodeCommitment: Fr.fromString('0x01c573f470ba9a17d362c7dd5a28931c39432f9ce527555049c71432f895ad6c'),
|
|
74
|
+
},
|
|
75
|
+
ContractClassRegistry: {
|
|
76
|
+
artifactHash: Fr.fromString('0x232d868db8a4d1e0f013efa4bfe5c39d96e11f16a62e3e73abbbafc3028fc410'),
|
|
77
|
+
privateFunctionsRoot: Fr.fromString('0x2ac3bf890a7d534a768079aa86889caa1a86373c8e6fc2db48215b11bbb79106'),
|
|
78
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
79
|
+
},
|
|
80
|
+
MultiCallEntrypoint: {
|
|
81
|
+
artifactHash: Fr.fromString('0x0d30526b6b786cf887d7e44ba59d2e9561d5791b0e3c78c681d0499ae45b225a'),
|
|
82
|
+
privateFunctionsRoot: Fr.fromString('0x266505ecb7c02ce6e227227c0b6bdb44713c8ecd43164ee7bb00b8fb340e8b03'),
|
|
83
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
84
|
+
},
|
|
85
|
+
FeeJuice: {
|
|
86
|
+
artifactHash: Fr.fromString('0x2eb476f12cce5207be118047fb7f603378b78aa619d6539a4d9eec4700ea2507'),
|
|
87
|
+
privateFunctionsRoot: Fr.fromString('0x0abef3cfc6ae314886c841b42dc33d3eed255ad3dee7773daabf05b229573759'),
|
|
88
|
+
publicBytecodeCommitment: Fr.fromString('0x2a144b28b36efa21b7488467aba7e06b33e016d00bfe083a7bfa06ad6ff5aa2f'),
|
|
89
|
+
},
|
|
90
|
+
PublicChecks: {
|
|
91
|
+
artifactHash: Fr.fromString('0x228ea8af66ff150f40a4b01b64115d12777b2f7fd3a4bfc0d97d38a91f139ef6'),
|
|
92
|
+
privateFunctionsRoot: Fr.fromString('0x067243231eddf4222f3911defbba7705aff06ed45960b27f6f91319196ef97e1'),
|
|
93
|
+
publicBytecodeCommitment: Fr.fromString('0x2d0834fc9468fd2092091852543a2fbd7b6b313c7e5e4defe8730c8065366a03'),
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
98
|
+
AuthRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
99
|
+
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
100
|
+
ContractClassRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
101
|
+
MultiCallEntrypoint: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
102
|
+
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
103
|
+
PublicChecks: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
107
|
+
AuthRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000079a3d418')), vkHash: Fr.fromString('0x019c553854290b9b547841e45bf45e344d4a2d4f6702fee430ec5897ce7d3b78') }],
|
|
108
|
+
ContractInstanceRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000016ec12aa')), vkHash: Fr.fromString('0x262f7a90ecf055779001b67dad01a3add1e549f6c27931f0e71e463ce2142b57') }],
|
|
109
|
+
ContractClassRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000006934ed0d')), vkHash: Fr.fromString('0x1163f31e191528254c877fce0c7f62dd738f5552bbd2dda97512fe4777377f5b') }],
|
|
110
|
+
MultiCallEntrypoint: [{ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f04908a9')), vkHash: Fr.fromString('0x21732ab3cecf633e4c31a030df62c93e35a005b89941fdab568d2818c1355192') }],
|
|
111
|
+
FeeJuice: [{ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000cbe67243')), vkHash: Fr.fromString('0x2ad6083b4595f8076c014e5152191013167ab1b5a31ad0cbb06490054c7c59ae') }, { selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000e8d374b6')), vkHash: Fr.fromString('0x05aaffffdf797625ff24575d939339303775c5db77fb6bdcecbf955f726fd071') }],
|
|
112
|
+
PublicChecks: []
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
54
117
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
55
118
|
AztecAddress.fromString('0x139f8eb6d6e7e7a7c0322c3b7558687a7e24201f11bf2c4cb2fe56c18d363695'),
|
|
56
119
|
AztecAddress.fromString('0x1254246c88aca5a66fa66f3aa78c408a698ebca3b713120497c7555dfc718592'),
|
package/src/provider/bundle.ts
CHANGED
|
@@ -22,6 +22,6 @@ export const ProtocolContractArtifact: Record<ProtocolContractName, ContractArti
|
|
|
22
22
|
|
|
23
23
|
export class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
|
24
24
|
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract> {
|
|
25
|
-
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
25
|
+
return Promise.resolve(makeProtocolContract(name, ProtocolContractArtifact[name]));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -10,9 +10,9 @@ export const PublicChecksArtifact = loadContractArtifact(PublicChecksJson as Noi
|
|
|
10
10
|
let protocolContract: ProtocolContract;
|
|
11
11
|
|
|
12
12
|
/** Returns the canonical deployment of the contract. */
|
|
13
|
-
export
|
|
13
|
+
export function getCanonicalPublicChecks(): Promise<ProtocolContract> {
|
|
14
14
|
if (!protocolContract) {
|
|
15
|
-
protocolContract =
|
|
15
|
+
protocolContract = makeProtocolContract('PublicChecks', PublicChecksArtifact);
|
|
16
16
|
}
|
|
17
|
-
return protocolContract;
|
|
17
|
+
return Promise.resolve(protocolContract);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export async function getPublicChecksArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalPublicChecks(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const publicChecksArtifact = await getPublicChecksArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('PublicChecks', publicChecksArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|