@aztec/protocol-contracts 5.0.0-private.20260318 → 5.0.0-rc.1
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/artifacts/ContractClassRegistry.json +2592 -460
- package/artifacts/ContractInstanceRegistry.json +3492 -937
- package/artifacts/FeeJuice.json +3799 -944
- package/dest/class-registry/contract_class_published_event.d.ts +6 -3
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -1
- package/dest/class-registry/contract_class_published_event.js +10 -16
- package/dest/class-registry/index.d.ts +1 -3
- package/dest/class-registry/index.d.ts.map +1 -1
- package/dest/class-registry/index.js +0 -2
- package/dest/class-registry/lazy.d.ts +1 -3
- package/dest/class-registry/lazy.d.ts.map +1 -1
- package/dest/class-registry/lazy.js +1 -3
- package/dest/fee-juice/lazy.js +1 -1
- package/dest/instance-registry/contract_instance_published_event.d.ts +3 -2
- package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -1
- package/dest/instance-registry/contract_instance_published_event.js +7 -3
- package/dest/instance-registry/lazy.js +1 -1
- package/dest/make_protocol_contract.d.ts +1 -1
- package/dest/make_protocol_contract.d.ts.map +1 -1
- package/dest/make_protocol_contract.js +3 -1
- package/dest/protocol_contract_data.d.ts +2 -5
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +32 -78
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +1 -7
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +0 -9
- package/dest/scripts/generate_data.js +4 -6
- package/dest/tests/fixtures.d.ts +1 -3
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +0 -10
- package/package.json +4 -4
- package/src/class-registry/contract_class_published_event.ts +10 -21
- package/src/class-registry/index.ts +0 -2
- package/src/class-registry/lazy.ts +1 -3
- package/src/fee-juice/lazy.ts +1 -1
- package/src/instance-registry/contract_instance_published_event.ts +5 -1
- package/src/instance-registry/lazy.ts +1 -1
- package/src/make_protocol_contract.ts +3 -1
- package/src/protocol_contract_data.ts +34 -70
- package/src/provider/bundle.ts +0 -6
- package/src/provider/lazy.ts +0 -9
- package/src/tests/fixtures.ts +0 -12
- package/artifacts/AuthRegistry.d.json.ts +0 -5
- package/artifacts/AuthRegistry.json +0 -3721
- package/artifacts/MultiCallEntrypoint.d.json.ts +0 -5
- package/artifacts/MultiCallEntrypoint.json +0 -2969
- package/artifacts/PublicChecks.d.json.ts +0 -5
- package/artifacts/PublicChecks.json +0 -1180
- package/dest/auth-registry/index.d.ts +0 -6
- package/dest/auth-registry/index.d.ts.map +0 -1
- package/dest/auth-registry/index.js +0 -13
- package/dest/auth-registry/lazy.d.ts +0 -6
- package/dest/auth-registry/lazy.d.ts.map +0 -1
- package/dest/auth-registry/lazy.js +0 -23
- package/dest/class-registry/private_function_broadcasted_event.d.ts +0 -44
- package/dest/class-registry/private_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registry/private_function_broadcasted_event.js +0 -85
- package/dest/class-registry/utility_function_broadcasted_event.d.ts +0 -38
- package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registry/utility_function_broadcasted_event.js +0 -81
- package/dest/multi-call-entrypoint/index.d.ts +0 -5
- package/dest/multi-call-entrypoint/index.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/index.js +0 -13
- package/dest/multi-call-entrypoint/lazy.d.ts +0 -6
- package/dest/multi-call-entrypoint/lazy.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/lazy.js +0 -23
- package/dest/public-checks/index.d.ts +0 -5
- package/dest/public-checks/index.d.ts.map +0 -1
- package/dest/public-checks/index.js +0 -13
- package/dest/public-checks/lazy.d.ts +0 -6
- package/dest/public-checks/lazy.d.ts.map +0 -1
- package/dest/public-checks/lazy.js +0 -23
- package/src/auth-registry/index.ts +0 -18
- package/src/auth-registry/lazy.ts +0 -29
- package/src/class-registry/private_function_broadcasted_event.ts +0 -109
- package/src/class-registry/utility_function_broadcasted_event.ts +0 -103
- package/src/multi-call-entrypoint/index.ts +0 -18
- package/src/multi-call-entrypoint/lazy.ts +0 -29
- package/src/public-checks/index.ts +0 -18
- package/src/public-checks/lazy.ts +0 -29
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
-
export declare const AuthRegistryArtifact: ContractArtifact;
|
|
4
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
5
|
-
export declare function getCanonicalAuthRegistry(): Promise<ProtocolContract>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hdXRoLXJlZ2lzdHJ5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUF3QixNQUFNLG1CQUFtQixDQUFDO0FBS2hGLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFJaEUsZUFBTyxNQUFNLG9CQUFvQixFQUFFLGdCQUFpRixDQUFDO0FBRXJILDZEQUE2RDtBQUM3RCx3QkFBZ0Isd0JBQXdCLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBS3BFIn0=
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import AuthRegistryJson from '../../artifacts/AuthRegistry.json' with {
|
|
3
|
-
type: 'json'
|
|
4
|
-
};
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
let protocolContract;
|
|
7
|
-
export const AuthRegistryArtifact = loadContractArtifact(AuthRegistryJson);
|
|
8
|
-
/** Returns the canonical deployment of the auth registry. */ export function getCanonicalAuthRegistry() {
|
|
9
|
-
if (!protocolContract) {
|
|
10
|
-
protocolContract = makeProtocolContract('AuthRegistry', AuthRegistryArtifact);
|
|
11
|
-
}
|
|
12
|
-
return Promise.resolve(protocolContract);
|
|
13
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
-
export declare function getAuthRegistryArtifact(): Promise<ContractArtifact>;
|
|
4
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
5
|
-
export declare function getCanonicalAuthRegistry(): Promise<ProtocolContract>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F1dGgtcmVnaXN0cnkvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBd0IsTUFBTSxtQkFBbUIsQ0FBQztBQUdoRixPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFLHdCQUFzQix1QkFBdUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FXekU7QUFFRCw2REFBNkQ7QUFDN0Qsd0JBQXNCLHdCQUF3QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQU0xRSJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/auth-registry/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWzE;AAED,6DAA6D;AAC7D,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM1E"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
3
|
-
let protocolContract;
|
|
4
|
-
let protocolContractArtifact;
|
|
5
|
-
export async function getAuthRegistryArtifact() {
|
|
6
|
-
if (!protocolContractArtifact) {
|
|
7
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
8
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
9
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
10
|
-
// "text/javascript"
|
|
11
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
12
|
-
const { default: authRegistryJson } = await import('../../artifacts/AuthRegistry.json');
|
|
13
|
-
protocolContractArtifact = loadContractArtifact(authRegistryJson);
|
|
14
|
-
}
|
|
15
|
-
return protocolContractArtifact;
|
|
16
|
-
}
|
|
17
|
-
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalAuthRegistry() {
|
|
18
|
-
if (!protocolContract) {
|
|
19
|
-
const authRegistryArtifact = await getAuthRegistryArtifact();
|
|
20
|
-
protocolContract = makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
21
|
-
}
|
|
22
|
-
return protocolContract;
|
|
23
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
4
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
5
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
|
-
import type { ExecutablePrivateFunctionWithMembershipProof, PrivateFunction } from '@aztec/stdlib/contract';
|
|
7
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
8
|
-
/** Event emitted from the ContractClassRegistry. */
|
|
9
|
-
export declare class PrivateFunctionBroadcastedEvent {
|
|
10
|
-
readonly contractClassId: Fr;
|
|
11
|
-
readonly artifactMetadataHash: Fr;
|
|
12
|
-
readonly utilityFunctionsTreeRoot: Fr;
|
|
13
|
-
readonly privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>;
|
|
14
|
-
readonly privateFunctionTreeLeafIndex: number;
|
|
15
|
-
readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>;
|
|
16
|
-
readonly artifactFunctionTreeLeafIndex: number;
|
|
17
|
-
readonly privateFunction: BroadcastedPrivateFunction;
|
|
18
|
-
constructor(contractClassId: Fr, artifactMetadataHash: Fr, utilityFunctionsTreeRoot: Fr, privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>, privateFunctionTreeLeafIndex: number, artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>, artifactFunctionTreeLeafIndex: number, privateFunction: BroadcastedPrivateFunction);
|
|
19
|
-
static isPrivateFunctionBroadcastedEvent(log: ContractClassLog): boolean;
|
|
20
|
-
static fromLog(log: ContractClassLog): PrivateFunctionBroadcastedEvent;
|
|
21
|
-
static fromFields(fields: Fr[] | FieldReader): PrivateFunctionBroadcastedEvent;
|
|
22
|
-
toFunctionWithMembershipProof(): ExecutablePrivateFunctionWithMembershipProof;
|
|
23
|
-
}
|
|
24
|
-
export declare class BroadcastedPrivateFunction implements PrivateFunction {
|
|
25
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
26
|
-
readonly selector: FunctionSelector;
|
|
27
|
-
/** Artifact metadata hash */
|
|
28
|
-
readonly metadataHash: Fr;
|
|
29
|
-
/** Hash of the verification key associated to this private function. */
|
|
30
|
-
readonly vkHash: Fr;
|
|
31
|
-
/** ACIR and Brillig bytecode */
|
|
32
|
-
readonly bytecode: Buffer;
|
|
33
|
-
constructor(
|
|
34
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
35
|
-
selector: FunctionSelector,
|
|
36
|
-
/** Artifact metadata hash */
|
|
37
|
-
metadataHash: Fr,
|
|
38
|
-
/** Hash of the verification key associated to this private function. */
|
|
39
|
-
vkHash: Fr,
|
|
40
|
-
/** ACIR and Brillig bytecode */
|
|
41
|
-
bytecode: Buffer);
|
|
42
|
-
static fromFields(fields: Fr[] | FieldReader): BroadcastedPrivateFunction;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbl9icm9hZGNhc3RlZF9ldmVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsYXNzLXJlZ2lzdHJ5L3ByaXZhdGVfZnVuY3Rpb25fYnJvYWRjYXN0ZWRfZXZlbnQudHMiXSwibmFt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E,GAAG,WAAW,mCAqB3C;IAED,6BAA6B,IAAI,4CAA4C,CAY5E;CACF;AAED,qBAAa,0BAA2B,YAAW,eAAe;IAE9D,qJAAqJ;aACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;aACb,YAAY,EAAE,EAAE;IAChC,wEAAwE;aACxD,MAAM,EAAE,EAAE;IAC1B,gCAAgC;aAChB,QAAQ,EAAE,MAAM;IARlC;IACE,qJAAqJ;IACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;IACb,YAAY,EAAE,EAAE;IAChC,wEAAwE;IACxD,MAAM,EAAE,EAAE;IAC1B,gCAAgC;IAChB,QAAQ,EAAE,MAAM,EAC9B;IAEJ,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,8BAS3C;CACF"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE, FUNCTION_TREE_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS } from '@aztec/constants';
|
|
2
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
4
|
-
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
5
|
-
/** Event emitted from the ContractClassRegistry. */ export class PrivateFunctionBroadcastedEvent {
|
|
6
|
-
contractClassId;
|
|
7
|
-
artifactMetadataHash;
|
|
8
|
-
utilityFunctionsTreeRoot;
|
|
9
|
-
privateFunctionTreeSiblingPath;
|
|
10
|
-
privateFunctionTreeLeafIndex;
|
|
11
|
-
artifactFunctionTreeSiblingPath;
|
|
12
|
-
artifactFunctionTreeLeafIndex;
|
|
13
|
-
privateFunction;
|
|
14
|
-
constructor(contractClassId, artifactMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, privateFunction){
|
|
15
|
-
this.contractClassId = contractClassId;
|
|
16
|
-
this.artifactMetadataHash = artifactMetadataHash;
|
|
17
|
-
this.utilityFunctionsTreeRoot = utilityFunctionsTreeRoot;
|
|
18
|
-
this.privateFunctionTreeSiblingPath = privateFunctionTreeSiblingPath;
|
|
19
|
-
this.privateFunctionTreeLeafIndex = privateFunctionTreeLeafIndex;
|
|
20
|
-
this.artifactFunctionTreeSiblingPath = artifactFunctionTreeSiblingPath;
|
|
21
|
-
this.artifactFunctionTreeLeafIndex = artifactFunctionTreeLeafIndex;
|
|
22
|
-
this.privateFunction = privateFunction;
|
|
23
|
-
}
|
|
24
|
-
static isPrivateFunctionBroadcastedEvent(log) {
|
|
25
|
-
return log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) && log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE;
|
|
26
|
-
}
|
|
27
|
-
static fromLog(log) {
|
|
28
|
-
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
29
|
-
const event = PrivateFunctionBroadcastedEvent.fromFields(reader);
|
|
30
|
-
while(!reader.isFinished()){
|
|
31
|
-
const field = reader.readField();
|
|
32
|
-
if (!field.isZero()) {
|
|
33
|
-
throw new Error(`Unexpected data after parsing PrivateFunctionBroadcastedEvent: ${field.toString()}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return event;
|
|
37
|
-
}
|
|
38
|
-
static fromFields(fields) {
|
|
39
|
-
const reader = FieldReader.asReader(fields);
|
|
40
|
-
const contractClassId = reader.readField();
|
|
41
|
-
const artifactMetadataHash = reader.readField();
|
|
42
|
-
const utilityFunctionsTreeRoot = reader.readField();
|
|
43
|
-
const privateFunctionTreeSiblingPath = reader.readFieldArray(FUNCTION_TREE_HEIGHT);
|
|
44
|
-
const privateFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
45
|
-
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
46
|
-
const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
47
|
-
const privateFunction = BroadcastedPrivateFunction.fromFields(reader);
|
|
48
|
-
return new PrivateFunctionBroadcastedEvent(contractClassId, artifactMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, privateFunction);
|
|
49
|
-
}
|
|
50
|
-
toFunctionWithMembershipProof() {
|
|
51
|
-
return {
|
|
52
|
-
...this.privateFunction,
|
|
53
|
-
bytecode: this.privateFunction.bytecode,
|
|
54
|
-
functionMetadataHash: this.privateFunction.metadataHash,
|
|
55
|
-
artifactMetadataHash: this.artifactMetadataHash,
|
|
56
|
-
utilityFunctionsTreeRoot: this.utilityFunctionsTreeRoot,
|
|
57
|
-
privateFunctionTreeSiblingPath: this.privateFunctionTreeSiblingPath,
|
|
58
|
-
privateFunctionTreeLeafIndex: this.privateFunctionTreeLeafIndex,
|
|
59
|
-
artifactTreeSiblingPath: this.artifactFunctionTreeSiblingPath.filter((fr)=>!fr.isZero()),
|
|
60
|
-
artifactTreeLeafIndex: this.artifactFunctionTreeLeafIndex
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export class BroadcastedPrivateFunction {
|
|
65
|
-
selector;
|
|
66
|
-
metadataHash;
|
|
67
|
-
vkHash;
|
|
68
|
-
bytecode;
|
|
69
|
-
constructor(/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */ selector, /** Artifact metadata hash */ metadataHash, /** Hash of the verification key associated to this private function. */ vkHash, /** ACIR and Brillig bytecode */ bytecode){
|
|
70
|
-
this.selector = selector;
|
|
71
|
-
this.metadataHash = metadataHash;
|
|
72
|
-
this.vkHash = vkHash;
|
|
73
|
-
this.bytecode = bytecode;
|
|
74
|
-
}
|
|
75
|
-
static fromFields(fields) {
|
|
76
|
-
const reader = FieldReader.asReader(fields);
|
|
77
|
-
const selector = FunctionSelector.fromField(reader.readField());
|
|
78
|
-
const metadataHash = reader.readField();
|
|
79
|
-
const vkHash = reader.readField();
|
|
80
|
-
// The '* 1' removes the 'Type instantiation is excessively deep and possibly infinite. ts(2589)' err
|
|
81
|
-
const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS * 1);
|
|
82
|
-
const bytecode = bufferFromFields(encodedBytecode);
|
|
83
|
-
return new BroadcastedPrivateFunction(selector, metadataHash, vkHash, bytecode);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
4
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
5
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
|
-
import type { UtilityFunction, UtilityFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
7
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
8
|
-
/** Event emitted from the ContractClassRegistry. */
|
|
9
|
-
export declare class UtilityFunctionBroadcastedEvent {
|
|
10
|
-
readonly contractClassId: Fr;
|
|
11
|
-
readonly artifactMetadataHash: Fr;
|
|
12
|
-
readonly privateFunctionsArtifactTreeRoot: Fr;
|
|
13
|
-
readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>;
|
|
14
|
-
readonly artifactFunctionTreeLeafIndex: number;
|
|
15
|
-
readonly utilityFunction: BroadcastedUtilityFunction;
|
|
16
|
-
constructor(contractClassId: Fr, artifactMetadataHash: Fr, privateFunctionsArtifactTreeRoot: Fr, artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>, artifactFunctionTreeLeafIndex: number, utilityFunction: BroadcastedUtilityFunction);
|
|
17
|
-
static isUtilityFunctionBroadcastedEvent(log: ContractClassLog): boolean;
|
|
18
|
-
static fromLog(log: ContractClassLog): UtilityFunctionBroadcastedEvent;
|
|
19
|
-
static fromFields(fields: Fr[] | FieldReader): UtilityFunctionBroadcastedEvent;
|
|
20
|
-
toFunctionWithMembershipProof(): UtilityFunctionWithMembershipProof;
|
|
21
|
-
}
|
|
22
|
-
export declare class BroadcastedUtilityFunction implements UtilityFunction {
|
|
23
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
24
|
-
readonly selector: FunctionSelector;
|
|
25
|
-
/** Artifact metadata hash */
|
|
26
|
-
readonly metadataHash: Fr;
|
|
27
|
-
/** Brillig bytecode */
|
|
28
|
-
readonly bytecode: Buffer;
|
|
29
|
-
constructor(
|
|
30
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
31
|
-
selector: FunctionSelector,
|
|
32
|
-
/** Artifact metadata hash */
|
|
33
|
-
metadataHash: Fr,
|
|
34
|
-
/** Brillig bytecode */
|
|
35
|
-
bytecode: Buffer);
|
|
36
|
-
static fromFields(fields: Fr[] | FieldReader): BroadcastedUtilityFunction;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbGl0eV9mdW5jdGlvbl9icm9hZGNhc3RlZF9ldmVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsYXNzLXJlZ2lzdHJ5L3V0aWxpdHlfZnVuY3Rpb25fYnJvYWRjYXN0ZWRfZXZlbnQudHMiXSwibmFtZXMiO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SzdEO0lBRUQsTUFBTSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsZ0JBQWdCLG1DQVduQztJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLEVBQUUsRUFBRSxHQUFHLFdBQVcsbUNBaUIzQztJQUVELDZCQUE2QixJQUFJLGtDQUFrQyxDQWVsRTtDQUNGO0FBRUQscUJBQWEsMEJBQTJCLFlBQVcsZUFBZTtJQUU5RCxxSkFBcUo7YUFDckksUUFBUSxFQUFFLGdCQUFnQjtJQUMxQyw2QkFBNkI7YUFDYixZQUFZLEVBQUUsRUFBRTtJQUNoQyx1QkFBdUI7YUFDUCxRQUFRLEVBQUUsTUFBTTtJQU5sQztJQUNFLHFKQUFxSjtJQUNySSxRQUFRLEVBQUUsZ0JBQWdCO0lBQzFDLDZCQUE2QjtJQUNiLFlBQVksRUFBRSxFQUFFO0lBQ2hDLHVCQUF1QjtJQUNQLFFBQVEsRUFBRSxNQUFNLEVBQzlCO0lBRUosTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLEVBQUUsRUFBRSxFQUFFLEdBQUcsV0FBVyw4QkFRM0M7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utility_function_broadcasted_event.d.ts","sourceRoot":"","sources":["../../src/class-registry/utility_function_broadcasted_event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAGlC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAg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ZE_PER_UTILITY_FUNCTION_IN_FIELDS } from '@aztec/constants';
|
|
2
|
-
import { removeArrayPaddingEnd } from '@aztec/foundation/collection';
|
|
3
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
5
|
-
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
6
|
-
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
7
|
-
/** Event emitted from the ContractClassRegistry. */ export class UtilityFunctionBroadcastedEvent {
|
|
8
|
-
contractClassId;
|
|
9
|
-
artifactMetadataHash;
|
|
10
|
-
privateFunctionsArtifactTreeRoot;
|
|
11
|
-
artifactFunctionTreeSiblingPath;
|
|
12
|
-
artifactFunctionTreeLeafIndex;
|
|
13
|
-
utilityFunction;
|
|
14
|
-
constructor(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, utilityFunction){
|
|
15
|
-
this.contractClassId = contractClassId;
|
|
16
|
-
this.artifactMetadataHash = artifactMetadataHash;
|
|
17
|
-
this.privateFunctionsArtifactTreeRoot = privateFunctionsArtifactTreeRoot;
|
|
18
|
-
this.artifactFunctionTreeSiblingPath = artifactFunctionTreeSiblingPath;
|
|
19
|
-
this.artifactFunctionTreeLeafIndex = artifactFunctionTreeLeafIndex;
|
|
20
|
-
this.utilityFunction = utilityFunction;
|
|
21
|
-
}
|
|
22
|
-
static isUtilityFunctionBroadcastedEvent(log) {
|
|
23
|
-
return log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) && log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_UTILITY_FUNCTION_BROADCASTED_MAGIC_VALUE;
|
|
24
|
-
}
|
|
25
|
-
static fromLog(log) {
|
|
26
|
-
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
27
|
-
const event = UtilityFunctionBroadcastedEvent.fromFields(reader);
|
|
28
|
-
while(!reader.isFinished()){
|
|
29
|
-
const field = reader.readField();
|
|
30
|
-
if (!field.isZero()) {
|
|
31
|
-
throw new Error(`Unexpected data after parsing UtilityFunctionBroadcastedEvent: ${field.toString()}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return event;
|
|
35
|
-
}
|
|
36
|
-
static fromFields(fields) {
|
|
37
|
-
const reader = FieldReader.asReader(fields);
|
|
38
|
-
const contractClassId = reader.readField();
|
|
39
|
-
const artifactMetadataHash = reader.readField();
|
|
40
|
-
const privateFunctionsArtifactTreeRoot = reader.readField();
|
|
41
|
-
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
42
|
-
const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
43
|
-
const utilityFunction = BroadcastedUtilityFunction.fromFields(reader);
|
|
44
|
-
return new UtilityFunctionBroadcastedEvent(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, utilityFunction);
|
|
45
|
-
}
|
|
46
|
-
toFunctionWithMembershipProof() {
|
|
47
|
-
// We should be able to safely remove the zero elements that pad the variable-length sibling path,
|
|
48
|
-
// since a sibling with value zero can only occur on the tree leaves, so the sibling path will never end
|
|
49
|
-
// in a zero. The only exception is a tree with depth 2 with one non-zero leaf, where the sibling path would
|
|
50
|
-
// be a single zero element, but in that case the artifact tree should be just the single leaf.
|
|
51
|
-
const artifactTreeSiblingPath = removeArrayPaddingEnd(this.artifactFunctionTreeSiblingPath, Fr.isZero);
|
|
52
|
-
return {
|
|
53
|
-
...this.utilityFunction,
|
|
54
|
-
bytecode: this.utilityFunction.bytecode,
|
|
55
|
-
functionMetadataHash: this.utilityFunction.metadataHash,
|
|
56
|
-
artifactMetadataHash: this.artifactMetadataHash,
|
|
57
|
-
privateFunctionsArtifactTreeRoot: this.privateFunctionsArtifactTreeRoot,
|
|
58
|
-
artifactTreeSiblingPath,
|
|
59
|
-
artifactTreeLeafIndex: this.artifactFunctionTreeLeafIndex
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export class BroadcastedUtilityFunction {
|
|
64
|
-
selector;
|
|
65
|
-
metadataHash;
|
|
66
|
-
bytecode;
|
|
67
|
-
constructor(/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */ selector, /** Artifact metadata hash */ metadataHash, /** Brillig bytecode */ bytecode){
|
|
68
|
-
this.selector = selector;
|
|
69
|
-
this.metadataHash = metadataHash;
|
|
70
|
-
this.bytecode = bytecode;
|
|
71
|
-
}
|
|
72
|
-
static fromFields(fields) {
|
|
73
|
-
const reader = FieldReader.asReader(fields);
|
|
74
|
-
const selector = FunctionSelector.fromField(reader.readField());
|
|
75
|
-
const metadataHash = reader.readField();
|
|
76
|
-
// The '* 1' removes the 'Type instantiation is excessively deep and possibly infinite. ts(2589)' err
|
|
77
|
-
const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS * 1);
|
|
78
|
-
const bytecode = bufferFromFields(encodedBytecode);
|
|
79
|
-
return new BroadcastedUtilityFunction(selector, metadataHash, bytecode);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
-
export declare const MultiCallEntrypointArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
|
-
/** Returns the canonical deployment of the contract. */
|
|
4
|
-
export declare function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract>;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tdWx0aS1jYWxsLWVudHJ5cG9pbnQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUVoRSxlQUFPLE1BQU0sMkJBQTJCLDhDQUF3RSxDQUFDO0FBSWpILHdEQUF3RDtBQUN4RCx3QkFBZ0IsK0JBQStCLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBSzNFIn0=
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import MultiCallEntrypointJson from '../../artifacts/MultiCallEntrypoint.json' with {
|
|
3
|
-
type: 'json'
|
|
4
|
-
};
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
export const MultiCallEntrypointArtifact = loadContractArtifact(MultiCallEntrypointJson);
|
|
7
|
-
let protocolContract;
|
|
8
|
-
/** Returns the canonical deployment of the contract. */ export function getCanonicalMultiCallEntrypoint() {
|
|
9
|
-
if (!protocolContract) {
|
|
10
|
-
protocolContract = makeProtocolContract('MultiCallEntrypoint', MultiCallEntrypointArtifact);
|
|
11
|
-
}
|
|
12
|
-
return Promise.resolve(protocolContract);
|
|
13
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
-
export declare function getMultiCallEntrypointArtifact(): Promise<ContractArtifact>;
|
|
4
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
5
|
-
export declare function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL211bHRpLWNhbGwtZW50cnlwb2ludC9sYXp5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUF3QixNQUFNLG1CQUFtQixDQUFDO0FBR2hGLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFLaEUsd0JBQXNCLDhCQUE4QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQVdoRjtBQUVELDZEQUE2RDtBQUM3RCx3QkFBc0IsK0JBQStCLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBTWpGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/multi-call-entrypoint/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWhF;AAED,6DAA6D;AAC7D,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAMjF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
3
|
-
let protocolContract;
|
|
4
|
-
let protocolContractArtifact;
|
|
5
|
-
export async function getMultiCallEntrypointArtifact() {
|
|
6
|
-
if (!protocolContractArtifact) {
|
|
7
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
8
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
9
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
10
|
-
// "text/javascript"
|
|
11
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
12
|
-
const { default: multiCallEntrypointJson } = await import('../../artifacts/MultiCallEntrypoint.json');
|
|
13
|
-
protocolContractArtifact = loadContractArtifact(multiCallEntrypointJson);
|
|
14
|
-
}
|
|
15
|
-
return protocolContractArtifact;
|
|
16
|
-
}
|
|
17
|
-
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalMultiCallEntrypoint() {
|
|
18
|
-
if (!protocolContract) {
|
|
19
|
-
const multiCallEntrypointArtifact = await getMultiCallEntrypointArtifact();
|
|
20
|
-
protocolContract = makeProtocolContract('MultiCallEntrypoint', multiCallEntrypointArtifact);
|
|
21
|
-
}
|
|
22
|
-
return protocolContract;
|
|
23
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
-
export declare const PublicChecksArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
|
-
/** Returns the canonical deployment of the contract. */
|
|
4
|
-
export declare function getCanonicalPublicChecks(): Promise<ProtocolContract>;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMtY2hlY2tzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFaEUsZUFBTyxNQUFNLG9CQUFvQiw4Q0FBaUUsQ0FBQztBQUluRyx3REFBd0Q7QUFDeEQsd0JBQWdCLHdCQUF3QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUtwRSJ9
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import PublicChecksJson from '../../artifacts/PublicChecks.json' with {
|
|
3
|
-
type: 'json'
|
|
4
|
-
};
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
export const PublicChecksArtifact = loadContractArtifact(PublicChecksJson);
|
|
7
|
-
let protocolContract;
|
|
8
|
-
/** Returns the canonical deployment of the contract. */ export function getCanonicalPublicChecks() {
|
|
9
|
-
if (!protocolContract) {
|
|
10
|
-
protocolContract = makeProtocolContract('PublicChecks', PublicChecksArtifact);
|
|
11
|
-
}
|
|
12
|
-
return Promise.resolve(protocolContract);
|
|
13
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
-
export declare function getPublicChecksArtifact(): Promise<ContractArtifact>;
|
|
4
|
-
/** Returns the canonical deployment of the public checks contract. */
|
|
5
|
-
export declare function getCanonicalPublicChecks(): Promise<ProtocolContract>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1YmxpYy1jaGVja3MvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBd0IsTUFBTSxtQkFBbUIsQ0FBQztBQUdoRixPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFLHdCQUFzQix1QkFBdUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FXekU7QUFFRCxzRUFBc0U7QUFDdEUsd0JBQXNCLHdCQUF3QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQU0xRSJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/public-checks/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWzE;AAED,sEAAsE;AACtE,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM1E"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
3
|
-
let protocolContract;
|
|
4
|
-
let protocolContractArtifact;
|
|
5
|
-
export async function getPublicChecksArtifact() {
|
|
6
|
-
if (!protocolContractArtifact) {
|
|
7
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
8
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
9
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
10
|
-
// "text/javascript"
|
|
11
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
12
|
-
const { default: publicChecksJson } = await import('../../artifacts/PublicChecks.json');
|
|
13
|
-
protocolContractArtifact = loadContractArtifact(publicChecksJson);
|
|
14
|
-
}
|
|
15
|
-
return protocolContractArtifact;
|
|
16
|
-
}
|
|
17
|
-
/** Returns the canonical deployment of the public checks contract. */ export async function getCanonicalPublicChecks() {
|
|
18
|
-
if (!protocolContract) {
|
|
19
|
-
const publicChecksArtifact = await getPublicChecksArtifact();
|
|
20
|
-
protocolContract = makeProtocolContract('PublicChecks', publicChecksArtifact);
|
|
21
|
-
}
|
|
22
|
-
return protocolContract;
|
|
23
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
-
|
|
4
|
-
import AuthRegistryJson from '../../artifacts/AuthRegistry.json' with { type: 'json' };
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
|
-
|
|
8
|
-
let protocolContract: ProtocolContract;
|
|
9
|
-
|
|
10
|
-
export const AuthRegistryArtifact: ContractArtifact = loadContractArtifact(AuthRegistryJson as NoirCompiledContract);
|
|
11
|
-
|
|
12
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
13
|
-
export function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
14
|
-
if (!protocolContract) {
|
|
15
|
-
protocolContract = makeProtocolContract('AuthRegistry', AuthRegistryArtifact);
|
|
16
|
-
}
|
|
17
|
-
return Promise.resolve(protocolContract);
|
|
18
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
|
|
3
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
4
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
5
|
-
|
|
6
|
-
let protocolContract: ProtocolContract;
|
|
7
|
-
let protocolContractArtifact: ContractArtifact;
|
|
8
|
-
|
|
9
|
-
export async function getAuthRegistryArtifact(): Promise<ContractArtifact> {
|
|
10
|
-
if (!protocolContractArtifact) {
|
|
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
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
16
|
-
const { default: authRegistryJson } = await import('../../artifacts/AuthRegistry.json');
|
|
17
|
-
protocolContractArtifact = loadContractArtifact(authRegistryJson);
|
|
18
|
-
}
|
|
19
|
-
return protocolContractArtifact;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
23
|
-
export async function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
24
|
-
if (!protocolContract) {
|
|
25
|
-
const authRegistryArtifact = await getAuthRegistryArtifact();
|
|
26
|
-
protocolContract = makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
27
|
-
}
|
|
28
|
-
return protocolContract;
|
|
29
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
|
|
3
|
-
CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE,
|
|
4
|
-
FUNCTION_TREE_HEIGHT,
|
|
5
|
-
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
|
|
6
|
-
} from '@aztec/constants';
|
|
7
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
9
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
10
|
-
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
11
|
-
import type { ExecutablePrivateFunctionWithMembershipProof, PrivateFunction } from '@aztec/stdlib/contract';
|
|
12
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
13
|
-
|
|
14
|
-
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
15
|
-
|
|
16
|
-
/** Event emitted from the ContractClassRegistry. */
|
|
17
|
-
export class PrivateFunctionBroadcastedEvent {
|
|
18
|
-
constructor(
|
|
19
|
-
public readonly contractClassId: Fr,
|
|
20
|
-
public readonly artifactMetadataHash: Fr,
|
|
21
|
-
public readonly utilityFunctionsTreeRoot: Fr,
|
|
22
|
-
public readonly privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>,
|
|
23
|
-
public readonly privateFunctionTreeLeafIndex: number,
|
|
24
|
-
public readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>,
|
|
25
|
-
public readonly artifactFunctionTreeLeafIndex: number,
|
|
26
|
-
public readonly privateFunction: BroadcastedPrivateFunction,
|
|
27
|
-
) {}
|
|
28
|
-
|
|
29
|
-
static isPrivateFunctionBroadcastedEvent(log: ContractClassLog) {
|
|
30
|
-
return (
|
|
31
|
-
log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) &&
|
|
32
|
-
log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static fromLog(log: ContractClassLog) {
|
|
37
|
-
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
38
|
-
const event = PrivateFunctionBroadcastedEvent.fromFields(reader);
|
|
39
|
-
while (!reader.isFinished()) {
|
|
40
|
-
const field = reader.readField();
|
|
41
|
-
if (!field.isZero()) {
|
|
42
|
-
throw new Error(`Unexpected data after parsing PrivateFunctionBroadcastedEvent: ${field.toString()}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return event;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static fromFields(fields: Fr[] | FieldReader) {
|
|
50
|
-
const reader = FieldReader.asReader(fields);
|
|
51
|
-
const contractClassId = reader.readField();
|
|
52
|
-
const artifactMetadataHash = reader.readField();
|
|
53
|
-
const utilityFunctionsTreeRoot = reader.readField();
|
|
54
|
-
const privateFunctionTreeSiblingPath = reader.readFieldArray(FUNCTION_TREE_HEIGHT);
|
|
55
|
-
const privateFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
56
|
-
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
57
|
-
const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
58
|
-
const privateFunction = BroadcastedPrivateFunction.fromFields(reader);
|
|
59
|
-
|
|
60
|
-
return new PrivateFunctionBroadcastedEvent(
|
|
61
|
-
contractClassId,
|
|
62
|
-
artifactMetadataHash,
|
|
63
|
-
utilityFunctionsTreeRoot,
|
|
64
|
-
privateFunctionTreeSiblingPath,
|
|
65
|
-
privateFunctionTreeLeafIndex,
|
|
66
|
-
artifactFunctionTreeSiblingPath,
|
|
67
|
-
artifactFunctionTreeLeafIndex,
|
|
68
|
-
privateFunction,
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
toFunctionWithMembershipProof(): ExecutablePrivateFunctionWithMembershipProof {
|
|
73
|
-
return {
|
|
74
|
-
...this.privateFunction,
|
|
75
|
-
bytecode: this.privateFunction.bytecode,
|
|
76
|
-
functionMetadataHash: this.privateFunction.metadataHash,
|
|
77
|
-
artifactMetadataHash: this.artifactMetadataHash,
|
|
78
|
-
utilityFunctionsTreeRoot: this.utilityFunctionsTreeRoot,
|
|
79
|
-
privateFunctionTreeSiblingPath: this.privateFunctionTreeSiblingPath,
|
|
80
|
-
privateFunctionTreeLeafIndex: this.privateFunctionTreeLeafIndex,
|
|
81
|
-
artifactTreeSiblingPath: this.artifactFunctionTreeSiblingPath.filter(fr => !fr.isZero()),
|
|
82
|
-
artifactTreeLeafIndex: this.artifactFunctionTreeLeafIndex,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export class BroadcastedPrivateFunction implements PrivateFunction {
|
|
88
|
-
constructor(
|
|
89
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
90
|
-
public readonly selector: FunctionSelector,
|
|
91
|
-
/** Artifact metadata hash */
|
|
92
|
-
public readonly metadataHash: Fr,
|
|
93
|
-
/** Hash of the verification key associated to this private function. */
|
|
94
|
-
public readonly vkHash: Fr,
|
|
95
|
-
/** ACIR and Brillig bytecode */
|
|
96
|
-
public readonly bytecode: Buffer,
|
|
97
|
-
) {}
|
|
98
|
-
|
|
99
|
-
static fromFields(fields: Fr[] | FieldReader) {
|
|
100
|
-
const reader = FieldReader.asReader(fields);
|
|
101
|
-
const selector = FunctionSelector.fromField(reader.readField());
|
|
102
|
-
const metadataHash = reader.readField();
|
|
103
|
-
const vkHash = reader.readField();
|
|
104
|
-
// The '* 1' removes the 'Type instantiation is excessively deep and possibly infinite. ts(2589)' err
|
|
105
|
-
const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS * 1);
|
|
106
|
-
const bytecode = bufferFromFields(encodedBytecode);
|
|
107
|
-
return new BroadcastedPrivateFunction(selector, metadataHash, vkHash, bytecode);
|
|
108
|
-
}
|
|
109
|
-
}
|