@aztec/protocol-contracts 0.0.0-test.1 → 0.0.1-commit.017a351
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/README.md +2 -2
- package/artifacts/ContractClassRegistry.json +3950 -0
- package/artifacts/ContractInstanceRegistry.json +5132 -0
- package/artifacts/FeeJuice.json +5171 -2507
- package/dest/class-registry/contract_class_published_event.d.ts +20 -0
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
- package/dest/class-registry/contract_class_published_event.js +52 -0
- package/dest/class-registry/index.d.ts +6 -0
- package/dest/class-registry/index.d.ts.map +1 -0
- package/dest/class-registry/index.js +15 -0
- package/dest/class-registry/lazy.d.ts +7 -0
- package/dest/class-registry/lazy.d.ts.map +1 -0
- package/dest/class-registry/lazy.js +24 -0
- package/dest/fee-juice/index.d.ts +2 -2
- package/dest/fee-juice/index.d.ts.map +1 -1
- package/dest/fee-juice/index.js +4 -4
- package/dest/fee-juice/lazy.d.ts +1 -1
- package/dest/fee-juice/lazy.js +5 -5
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/instance-registry/contract_instance_published_event.d.ts +22 -0
- package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -0
- package/dest/{instance-deployer/contract_instance_deployed_event.js → instance-registry/contract_instance_published_event.js} +15 -8
- package/dest/instance-registry/contract_instance_updated_event.d.ts +17 -0
- package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -0
- package/dest/instance-registry/contract_instance_updated_event.js +35 -0
- package/dest/instance-registry/index.d.ts +7 -0
- package/dest/instance-registry/index.d.ts.map +1 -0
- package/dest/instance-registry/index.js +15 -0
- package/dest/instance-registry/lazy.d.ts +8 -0
- package/dest/{instance-deployer → instance-registry}/lazy.d.ts.map +1 -1
- package/dest/instance-registry/lazy.js +25 -0
- 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 +30 -14
- package/dest/protocol_contract.d.ts +1 -1
- package/dest/protocol_contract_data.d.ts +23 -16
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +82 -32
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +6 -12
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +6 -15
- package/dest/provider/protocol_contracts_provider.d.ts +1 -1
- package/dest/scripts/cleanup_artifacts.js +2 -2
- package/dest/scripts/generate_data.js +96 -56
- package/dest/tests/fixtures.d.ts +3 -7
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +4 -14
- package/package.json +23 -20
- package/src/class-registry/__snapshots__/README.md +9 -0
- package/src/class-registry/contract_class_published_event.ts +72 -0
- package/src/class-registry/index.ts +21 -0
- package/src/class-registry/lazy.ts +31 -0
- package/src/fee-juice/index.ts +5 -5
- package/src/fee-juice/lazy.ts +5 -5
- package/src/index.ts +0 -1
- package/src/instance-registry/__snapshots__/README.md +9 -0
- package/src/{instance-deployer/contract_instance_deployed_event.ts → instance-registry/contract_instance_published_event.ts} +18 -8
- package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +15 -15
- package/src/instance-registry/index.ts +23 -0
- package/src/instance-registry/lazy.ts +32 -0
- package/src/make_protocol_contract.ts +39 -15
- package/src/protocol_contract_data.ts +70 -32
- package/src/provider/bundle.ts +5 -11
- package/src/provider/lazy.ts +6 -15
- package/src/tests/fixtures.ts +4 -16
- package/artifacts/AuthRegistry.json +0 -2725
- package/artifacts/ContractClassRegisterer.json +0 -7219
- package/artifacts/ContractInstanceDeployer.d.json.ts +0 -5
- package/artifacts/ContractInstanceDeployer.json +0 -2984
- package/artifacts/MultiCallEntrypoint.d.json.ts +0 -5
- package/artifacts/MultiCallEntrypoint.json +0 -2005
- package/artifacts/Router.d.json.ts +0 -5
- package/artifacts/Router.json +0 -3798
- package/dest/auth-registry/index.d.ts +0 -5
- 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/build_protocol_contract_tree.d.ts +0 -10
- package/dest/build_protocol_contract_tree.d.ts.map +0 -1
- package/dest/build_protocol_contract_tree.js +0 -20
- package/dest/class-registerer/contract_class_registered_event.d.ts +0 -18
- package/dest/class-registerer/contract_class_registered_event.d.ts.map +0 -1
- package/dest/class-registerer/contract_class_registered_event.js +0 -63
- package/dest/class-registerer/index.d.ts +0 -8
- package/dest/class-registerer/index.d.ts.map +0 -1
- package/dest/class-registerer/index.js +0 -17
- package/dest/class-registerer/lazy.d.ts +0 -9
- package/dest/class-registerer/lazy.d.ts.map +0 -1
- package/dest/class-registerer/lazy.js +0 -26
- package/dest/class-registerer/private_function_broadcasted_event.d.ts +0 -46
- package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registerer/private_function_broadcasted_event.js +0 -85
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +0 -40
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registerer/unconstrained_function_broadcasted_event.js +0 -81
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts +0 -20
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_updated_event.d.ts +0 -16
- package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_updated_event.js +0 -36
- package/dest/instance-deployer/index.d.ts +0 -7
- package/dest/instance-deployer/index.d.ts.map +0 -1
- package/dest/instance-deployer/index.js +0 -15
- package/dest/instance-deployer/lazy.d.ts +0 -8
- package/dest/instance-deployer/lazy.js +0 -25
- 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/protocol_contract_tree.d.ts +0 -7
- package/dest/protocol_contract_tree.d.ts.map +0 -1
- package/dest/protocol_contract_tree.js +0 -34
- package/dest/router/index.d.ts +0 -5
- package/dest/router/index.d.ts.map +0 -1
- package/dest/router/index.js +0 -13
- package/dest/router/lazy.d.ts +0 -6
- package/dest/router/lazy.d.ts.map +0 -1
- package/dest/router/lazy.js +0 -23
- package/src/auth-registry/index.ts +0 -18
- package/src/auth-registry/lazy.ts +0 -29
- package/src/build_protocol_contract_tree.ts +0 -29
- package/src/class-registerer/contract_class_registered_event.ts +0 -83
- package/src/class-registerer/index.ts +0 -25
- package/src/class-registerer/lazy.ts +0 -33
- package/src/class-registerer/private_function_broadcasted_event.ts +0 -105
- package/src/class-registerer/unconstrained_function_broadcasted_event.ts +0 -99
- package/src/instance-deployer/index.ts +0 -23
- package/src/instance-deployer/lazy.ts +0 -32
- package/src/multi-call-entrypoint/index.ts +0 -18
- package/src/multi-call-entrypoint/lazy.ts +0 -29
- package/src/protocol_contract_tree.ts +0 -44
- package/src/router/index.ts +0 -18
- package/src/router/lazy.ts +0 -29
- /package/artifacts/{AuthRegistry.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
- /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
-
export declare const AuthRegistryArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
4
|
-
export declare function getCanonicalAuthRegistry(): Promise<ProtocolContract>;
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth-registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,eAAO,MAAM,oBAAoB,8CAAiE,CAAC;AAEnG,6DAA6D;AAC7D,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAK1E"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import AuthRegistryJson from '../../artifacts/AuthRegistry.json' assert {
|
|
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 async function getCanonicalAuthRegistry() {
|
|
9
|
-
if (!protocolContract) {
|
|
10
|
-
protocolContract = await makeProtocolContract('AuthRegistry', AuthRegistryArtifact);
|
|
11
|
-
}
|
|
12
|
-
return 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=lazy.d.ts.map
|
|
@@ -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 browsers
|
|
8
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
|
|
9
|
-
// Use the new "with" syntax once supported by firefox
|
|
10
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
|
|
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 = await makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
21
|
-
}
|
|
22
|
-
return protocolContract;
|
|
23
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { type IndexedMerkleTree } from '@aztec/foundation/trees';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
|
|
6
|
-
export declare function buildProtocolContractTree(contracts: {
|
|
7
|
-
address: AztecAddress;
|
|
8
|
-
leaf: Fr;
|
|
9
|
-
}[]): Promise<IndexedMerkleTree<ProtocolContractLeafPreimage, typeof PROTOCOL_CONTRACT_TREE_HEIGHT>>;
|
|
10
|
-
//# sourceMappingURL=build_protocol_contract_tree.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_protocol_contract_tree.d.ts","sourceRoot":"","sources":["../src/build_protocol_contract_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEzF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,iBAAiB,EAA+B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,EAAE,GAC/C,OAAO,CAAC,iBAAiB,CAAC,4BAA4B,EAAE,OAAO,6BAA6B,CAAC,CAAC,CAmBhG"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MAX_PROTOCOL_CONTRACTS, PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
3
|
-
import { IndexedMerkleTreeCalculator } from '@aztec/foundation/trees';
|
|
4
|
-
import { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
|
|
5
|
-
export async function buildProtocolContractTree(contracts) {
|
|
6
|
-
const hasher = {
|
|
7
|
-
hash: async (l, r)=>(await poseidon2Hash([
|
|
8
|
-
l,
|
|
9
|
-
r
|
|
10
|
-
])).toBuffer(),
|
|
11
|
-
hashInputs: async (i)=>(await poseidon2Hash(i)).toBuffer()
|
|
12
|
-
};
|
|
13
|
-
const calculator = await IndexedMerkleTreeCalculator.create(PROTOCOL_CONTRACT_TREE_HEIGHT, hasher, ProtocolContractLeafPreimage);
|
|
14
|
-
const leaves = new Array(MAX_PROTOCOL_CONTRACTS).fill(Buffer.alloc(32));
|
|
15
|
-
for (const contract of contracts){
|
|
16
|
-
const index = contract.address.toField().toNumber();
|
|
17
|
-
leaves[index] = contract.leaf.toBuffer();
|
|
18
|
-
}
|
|
19
|
-
return calculator.computeTree(leaves);
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { type ContractClassPublic } from '@aztec/stdlib/contract';
|
|
5
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
6
|
-
/** Event emitted from the ContractClassRegisterer. */
|
|
7
|
-
export declare class ContractClassRegisteredEvent {
|
|
8
|
-
readonly contractClassId: Fr;
|
|
9
|
-
readonly version: number;
|
|
10
|
-
readonly artifactHash: Fr;
|
|
11
|
-
readonly privateFunctionsRoot: Fr;
|
|
12
|
-
readonly packedPublicBytecode: Buffer;
|
|
13
|
-
constructor(contractClassId: Fr, version: number, artifactHash: Fr, privateFunctionsRoot: Fr, packedPublicBytecode: Buffer);
|
|
14
|
-
static isContractClassRegisteredEvent(log: ContractClassLog): boolean;
|
|
15
|
-
static fromLog(log: ContractClassLog): ContractClassRegisteredEvent;
|
|
16
|
-
toContractClassPublic(): Promise<ContractClassPublic>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=contract_class_registered_event.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract_class_registered_event.d.ts","sourceRoot":"","sources":["../../src/class-registerer/contract_class_registered_event.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,sDAAsD;AACtD,qBAAa,4BAA4B;aAErB,eAAe,EAAE,EAAE;aACnB,OAAO,EAAE,MAAM;aACf,YAAY,EAAE,EAAE;aAChB,oBAAoB,EAAE,EAAE;aACxB,oBAAoB,EAAE,MAAM;gBAJ5B,eAAe,EAAE,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,EAAE,EAChB,oBAAoB,EAAE,EAAE,EACxB,oBAAoB,EAAE,MAAM;IAG9C,MAAM,CAAC,8BAA8B,CAAC,GAAG,EAAE,gBAAgB;IAI3D,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAiB9B,qBAAqB,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAqC5D"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { PUBLIC_DISPATCH_SELECTOR } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
4
|
-
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
5
|
-
import { computeContractClassId, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
6
|
-
import { REGISTERER_CONTRACT_CLASS_REGISTERED_TAG } from '../protocol_contract_data.js';
|
|
7
|
-
/** Event emitted from the ContractClassRegisterer. */ export class ContractClassRegisteredEvent {
|
|
8
|
-
contractClassId;
|
|
9
|
-
version;
|
|
10
|
-
artifactHash;
|
|
11
|
-
privateFunctionsRoot;
|
|
12
|
-
packedPublicBytecode;
|
|
13
|
-
constructor(contractClassId, version, artifactHash, privateFunctionsRoot, packedPublicBytecode){
|
|
14
|
-
this.contractClassId = contractClassId;
|
|
15
|
-
this.version = version;
|
|
16
|
-
this.artifactHash = artifactHash;
|
|
17
|
-
this.privateFunctionsRoot = privateFunctionsRoot;
|
|
18
|
-
this.packedPublicBytecode = packedPublicBytecode;
|
|
19
|
-
}
|
|
20
|
-
static isContractClassRegisteredEvent(log) {
|
|
21
|
-
return log.fields[0].equals(REGISTERER_CONTRACT_CLASS_REGISTERED_TAG);
|
|
22
|
-
}
|
|
23
|
-
static fromLog(log) {
|
|
24
|
-
const reader = new FieldReader(log.fields.slice(1));
|
|
25
|
-
const contractClassId = reader.readField();
|
|
26
|
-
const version = reader.readField().toNumber();
|
|
27
|
-
const artifactHash = reader.readField();
|
|
28
|
-
const privateFunctionsRoot = reader.readField();
|
|
29
|
-
const packedPublicBytecode = bufferFromFields(reader.readFieldArray(log.fields.slice(1).length - reader.cursor));
|
|
30
|
-
return new ContractClassRegisteredEvent(contractClassId, version, artifactHash, privateFunctionsRoot, packedPublicBytecode);
|
|
31
|
-
}
|
|
32
|
-
async toContractClassPublic() {
|
|
33
|
-
const computedClassId = await computeContractClassId({
|
|
34
|
-
artifactHash: this.artifactHash,
|
|
35
|
-
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
36
|
-
publicBytecodeCommitment: await computePublicBytecodeCommitment(this.packedPublicBytecode)
|
|
37
|
-
});
|
|
38
|
-
if (!computedClassId.equals(this.contractClassId)) {
|
|
39
|
-
throw new Error(`Invalid contract class id: computed ${computedClassId.toString()} but event broadcasted ${this.contractClassId.toString()}`);
|
|
40
|
-
}
|
|
41
|
-
if (this.version !== 1) {
|
|
42
|
-
throw new Error(`Unexpected contract class version ${this.version}`);
|
|
43
|
-
}
|
|
44
|
-
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Remove public functions.
|
|
45
|
-
const publicFunctions = [];
|
|
46
|
-
if (this.packedPublicBytecode.length > 0) {
|
|
47
|
-
publicFunctions.push({
|
|
48
|
-
selector: FunctionSelector.fromField(new Fr(PUBLIC_DISPATCH_SELECTOR)),
|
|
49
|
-
bytecode: this.packedPublicBytecode
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
id: this.contractClassId,
|
|
54
|
-
artifactHash: this.artifactHash,
|
|
55
|
-
packedBytecode: this.packedPublicBytecode,
|
|
56
|
-
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
57
|
-
publicFunctions: publicFunctions,
|
|
58
|
-
version: this.version,
|
|
59
|
-
privateFunctions: [],
|
|
60
|
-
unconstrainedFunctions: []
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
-
export * from './contract_class_registered_event.js';
|
|
3
|
-
export * from './private_function_broadcasted_event.js';
|
|
4
|
-
export * from './unconstrained_function_broadcasted_event.js';
|
|
5
|
-
export declare const ContractClassRegistererArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
6
|
-
/** Returns the canonical deployment of the contract. */
|
|
7
|
-
export declare function getCanonicalClassRegisterer(): Promise<ProtocolContract>;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/class-registerer/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAE9D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAIF,wDAAwD;AACxD,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM7E"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import ContractClassRegistererJson from '../../artifacts/ContractClassRegisterer.json' assert {
|
|
3
|
-
type: 'json'
|
|
4
|
-
};
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
export * from './contract_class_registered_event.js';
|
|
7
|
-
export * from './private_function_broadcasted_event.js';
|
|
8
|
-
export * from './unconstrained_function_broadcasted_event.js';
|
|
9
|
-
export const ContractClassRegistererArtifact = loadContractArtifact(ContractClassRegistererJson);
|
|
10
|
-
let protocolContract;
|
|
11
|
-
/** Returns the canonical deployment of the contract. */ export async function getCanonicalClassRegisterer() {
|
|
12
|
-
if (!protocolContract) {
|
|
13
|
-
const artifact = ContractClassRegistererArtifact;
|
|
14
|
-
protocolContract = await makeProtocolContract('ContractClassRegisterer', artifact);
|
|
15
|
-
}
|
|
16
|
-
return protocolContract;
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
-
export * from './contract_class_registered_event.js';
|
|
4
|
-
export * from './private_function_broadcasted_event.js';
|
|
5
|
-
export * from './unconstrained_function_broadcasted_event.js';
|
|
6
|
-
export declare function getContractClassRegistererArtifact(): Promise<ContractArtifact>;
|
|
7
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
8
|
-
export declare function getCanonicalClassRegisterer(): Promise<ProtocolContract>;
|
|
9
|
-
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/class-registerer/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAK9D,wBAAsB,kCAAkC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWpF;AAED,6DAA6D;AAC7D,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM7E"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
3
|
-
export * from './contract_class_registered_event.js';
|
|
4
|
-
export * from './private_function_broadcasted_event.js';
|
|
5
|
-
export * from './unconstrained_function_broadcasted_event.js';
|
|
6
|
-
let protocolContract;
|
|
7
|
-
let protocolContractArtifact;
|
|
8
|
-
export async function getContractClassRegistererArtifact() {
|
|
9
|
-
if (!protocolContractArtifact) {
|
|
10
|
-
// Cannot assert this import as it's incompatible with browsers
|
|
11
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
|
|
12
|
-
// Use the new "with" syntax once supported by firefox
|
|
13
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
|
|
14
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
15
|
-
const { default: contractClassRegistererJson } = await import('../../artifacts/ContractClassRegisterer.json');
|
|
16
|
-
protocolContractArtifact = loadContractArtifact(contractClassRegistererJson);
|
|
17
|
-
}
|
|
18
|
-
return protocolContractArtifact;
|
|
19
|
-
}
|
|
20
|
-
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalClassRegisterer() {
|
|
21
|
-
if (!protocolContract) {
|
|
22
|
-
const contractClassRegistererArtifact = await getContractClassRegistererArtifact();
|
|
23
|
-
protocolContract = await makeProtocolContract('ContractClassRegisterer', contractClassRegistererArtifact);
|
|
24
|
-
}
|
|
25
|
-
return protocolContract;
|
|
26
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
6
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
7
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
|
-
import type { ExecutablePrivateFunctionWithMembershipProof, PrivateFunction } from '@aztec/stdlib/contract';
|
|
9
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
10
|
-
/** Event emitted from the ContractClassRegisterer. */
|
|
11
|
-
export declare class PrivateFunctionBroadcastedEvent {
|
|
12
|
-
readonly contractClassId: Fr;
|
|
13
|
-
readonly artifactMetadataHash: Fr;
|
|
14
|
-
readonly unconstrainedFunctionsArtifactTreeRoot: Fr;
|
|
15
|
-
readonly privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>;
|
|
16
|
-
readonly privateFunctionTreeLeafIndex: number;
|
|
17
|
-
readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>;
|
|
18
|
-
readonly artifactFunctionTreeLeafIndex: number;
|
|
19
|
-
readonly privateFunction: BroadcastedPrivateFunction;
|
|
20
|
-
constructor(contractClassId: Fr, artifactMetadataHash: Fr, unconstrainedFunctionsArtifactTreeRoot: Fr, privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>, privateFunctionTreeLeafIndex: number, artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>, artifactFunctionTreeLeafIndex: number, privateFunction: BroadcastedPrivateFunction);
|
|
21
|
-
static isPrivateFunctionBroadcastedEvent(log: ContractClassLog): boolean;
|
|
22
|
-
static fromLog(log: ContractClassLog): PrivateFunctionBroadcastedEvent;
|
|
23
|
-
static fromFields(fields: Fr[] | FieldReader): PrivateFunctionBroadcastedEvent;
|
|
24
|
-
toFunctionWithMembershipProof(): ExecutablePrivateFunctionWithMembershipProof;
|
|
25
|
-
}
|
|
26
|
-
export declare class BroadcastedPrivateFunction implements PrivateFunction {
|
|
27
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
28
|
-
readonly selector: FunctionSelector;
|
|
29
|
-
/** Artifact metadata hash */
|
|
30
|
-
readonly metadataHash: Fr;
|
|
31
|
-
/** Hash of the verification key associated to this private function. */
|
|
32
|
-
readonly vkHash: Fr;
|
|
33
|
-
/** ACIR and Brillig bytecode */
|
|
34
|
-
readonly bytecode: Buffer;
|
|
35
|
-
constructor(
|
|
36
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
37
|
-
selector: FunctionSelector,
|
|
38
|
-
/** Artifact metadata hash */
|
|
39
|
-
metadataHash: Fr,
|
|
40
|
-
/** Hash of the verification key associated to this private function. */
|
|
41
|
-
vkHash: Fr,
|
|
42
|
-
/** ACIR and Brillig bytecode */
|
|
43
|
-
bytecode: Buffer);
|
|
44
|
-
static fromFields(fields: Fr[] | FieldReader): BroadcastedPrivateFunction;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=private_function_broadcasted_event.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"private_function_broadcasted_event.d.ts","sourceRoot":"","sources":["../../src/class-registerer/private_function_broadcasted_event.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,iCAAiC,EACjC,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,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,4CAA4C,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,sDAAsD;AACtD,qBAAa,+BAA+B;aAExB,eAAe,EAAE,EAAE;aACnB,oBAAoB,EAAE,EAAE;aACxB,sCAAsC,EAAE,EAAE;aAC1C,8BAA8B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,oBAAoB,CAAC;aACtE,4BAA4B,EAAE,MAAM;aACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC;aACpF,6BAA6B,EAAE,MAAM;aACrC,eAAe,EAAE,0BAA0B;gBAP3C,eAAe,EAAE,EAAE,EACnB,oBAAoB,EAAE,EAAE,EACxB,sCAAsC,EAAE,EAAE,EAC1C,8BAA8B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,oBAAoB,CAAC,EACtE,4BAA4B,EAAE,MAAM,EACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC,EACpF,6BAA6B,EAAE,MAAM,EACrC,eAAe,EAAE,0BAA0B;IAG7D,MAAM,CAAC,iCAAiC,CAAC,GAAG,EAAE,gBAAgB;IAI9D,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAapC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAuB5C,6BAA6B,IAAI,4CAA4C;CAa9E;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;;IAPhC,qJAAqJ;IACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;IACb,YAAY,EAAE,EAAE;IAChC,wEAAwE;IACxD,MAAM,EAAE,EAAE;IAC1B,gCAAgC;IAChB,QAAQ,EAAE,MAAM;IAGlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;CAU7C"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, 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 { REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG } from '../protocol_contract_data.js';
|
|
5
|
-
/** Event emitted from the ContractClassRegisterer. */ export class PrivateFunctionBroadcastedEvent {
|
|
6
|
-
contractClassId;
|
|
7
|
-
artifactMetadataHash;
|
|
8
|
-
unconstrainedFunctionsArtifactTreeRoot;
|
|
9
|
-
privateFunctionTreeSiblingPath;
|
|
10
|
-
privateFunctionTreeLeafIndex;
|
|
11
|
-
artifactFunctionTreeSiblingPath;
|
|
12
|
-
artifactFunctionTreeLeafIndex;
|
|
13
|
-
privateFunction;
|
|
14
|
-
constructor(contractClassId, artifactMetadataHash, unconstrainedFunctionsArtifactTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, privateFunction){
|
|
15
|
-
this.contractClassId = contractClassId;
|
|
16
|
-
this.artifactMetadataHash = artifactMetadataHash;
|
|
17
|
-
this.unconstrainedFunctionsArtifactTreeRoot = unconstrainedFunctionsArtifactTreeRoot;
|
|
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.fields[0].equals(REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG);
|
|
26
|
-
}
|
|
27
|
-
static fromLog(log) {
|
|
28
|
-
const reader = new FieldReader(log.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 unconstrainedFunctionsArtifactTreeRoot = 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, unconstrainedFunctionsArtifactTreeRoot, 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
|
-
unconstrainedFunctionsArtifactTreeRoot: this.unconstrainedFunctionsArtifactTreeRoot,
|
|
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,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT } from '@aztec/constants';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
6
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
7
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
|
-
import type { UnconstrainedFunction, UnconstrainedFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
9
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
10
|
-
/** Event emitted from the ContractClassRegisterer. */
|
|
11
|
-
export declare class UnconstrainedFunctionBroadcastedEvent {
|
|
12
|
-
readonly contractClassId: Fr;
|
|
13
|
-
readonly artifactMetadataHash: Fr;
|
|
14
|
-
readonly privateFunctionsArtifactTreeRoot: Fr;
|
|
15
|
-
readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>;
|
|
16
|
-
readonly artifactFunctionTreeLeafIndex: number;
|
|
17
|
-
readonly unconstrainedFunction: BroadcastedUnconstrainedFunction;
|
|
18
|
-
constructor(contractClassId: Fr, artifactMetadataHash: Fr, privateFunctionsArtifactTreeRoot: Fr, artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>, artifactFunctionTreeLeafIndex: number, unconstrainedFunction: BroadcastedUnconstrainedFunction);
|
|
19
|
-
static isUnconstrainedFunctionBroadcastedEvent(log: ContractClassLog): boolean;
|
|
20
|
-
static fromLog(log: ContractClassLog): UnconstrainedFunctionBroadcastedEvent;
|
|
21
|
-
static fromFields(fields: Fr[] | FieldReader): UnconstrainedFunctionBroadcastedEvent;
|
|
22
|
-
toFunctionWithMembershipProof(): UnconstrainedFunctionWithMembershipProof;
|
|
23
|
-
}
|
|
24
|
-
export declare class BroadcastedUnconstrainedFunction implements UnconstrainedFunction {
|
|
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
|
-
/** Brillig bytecode */
|
|
30
|
-
readonly bytecode: Buffer;
|
|
31
|
-
constructor(
|
|
32
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
33
|
-
selector: FunctionSelector,
|
|
34
|
-
/** Artifact metadata hash */
|
|
35
|
-
metadataHash: Fr,
|
|
36
|
-
/** Brillig bytecode */
|
|
37
|
-
bytecode: Buffer);
|
|
38
|
-
static fromFields(fields: Fr[] | FieldReader): BroadcastedUnconstrainedFunction;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=unconstrained_function_broadcasted_event.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unconstrained_function_broadcasted_event.d.ts","sourceRoot":"","sources":["../../src/class-registerer/unconstrained_function_broadcasted_event.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,iCAAiC,EAElC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,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,qBAAqB,EAAE,wCAAwC,EAAE,MAAM,wBAAwB,CAAC;AAC9G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,sDAAsD;AACtD,qBAAa,qCAAqC;aAE9B,eAAe,EAAE,EAAE;aACnB,oBAAoB,EAAE,EAAE;aACxB,gCAAgC,EAAE,EAAE;aACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC;aACpF,6BAA6B,EAAE,MAAM;aACrC,qBAAqB,EAAE,gCAAgC;gBALvD,eAAe,EAAE,EAAE,EACnB,oBAAoB,EAAE,EAAE,EACxB,gCAAgC,EAAE,EAAE,EACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC,EACpF,6BAA6B,EAAE,MAAM,EACrC,qBAAqB,EAAE,gCAAgC;IAGzE,MAAM,CAAC,uCAAuC,CAAC,GAAG,EAAE,gBAAgB;IAIpE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAapC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAmB5C,6BAA6B,IAAI,wCAAwC;CAgB1E;AAED,qBAAa,gCAAiC,YAAW,qBAAqB;IAE1E,qJAAqJ;aACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;aACb,YAAY,EAAE,EAAE;IAChC,uBAAuB;aACP,QAAQ,EAAE,MAAM;;IALhC,qJAAqJ;IACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;IACb,YAAY,EAAE,EAAE;IAChC,uBAAuB;IACP,QAAQ,EAAE,MAAM;IAGlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;CAS7C"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS } from '@aztec/constants';
|
|
2
|
-
import { removeArrayPaddingEnd } from '@aztec/foundation/collection';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { FieldReader } from '@aztec/foundation/serialize';
|
|
5
|
-
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
6
|
-
import { REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG } from '../protocol_contract_data.js';
|
|
7
|
-
/** Event emitted from the ContractClassRegisterer. */ export class UnconstrainedFunctionBroadcastedEvent {
|
|
8
|
-
contractClassId;
|
|
9
|
-
artifactMetadataHash;
|
|
10
|
-
privateFunctionsArtifactTreeRoot;
|
|
11
|
-
artifactFunctionTreeSiblingPath;
|
|
12
|
-
artifactFunctionTreeLeafIndex;
|
|
13
|
-
unconstrainedFunction;
|
|
14
|
-
constructor(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, unconstrainedFunction){
|
|
15
|
-
this.contractClassId = contractClassId;
|
|
16
|
-
this.artifactMetadataHash = artifactMetadataHash;
|
|
17
|
-
this.privateFunctionsArtifactTreeRoot = privateFunctionsArtifactTreeRoot;
|
|
18
|
-
this.artifactFunctionTreeSiblingPath = artifactFunctionTreeSiblingPath;
|
|
19
|
-
this.artifactFunctionTreeLeafIndex = artifactFunctionTreeLeafIndex;
|
|
20
|
-
this.unconstrainedFunction = unconstrainedFunction;
|
|
21
|
-
}
|
|
22
|
-
static isUnconstrainedFunctionBroadcastedEvent(log) {
|
|
23
|
-
return log.fields[0].equals(REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG);
|
|
24
|
-
}
|
|
25
|
-
static fromLog(log) {
|
|
26
|
-
const reader = new FieldReader(log.fields.slice(1));
|
|
27
|
-
const event = UnconstrainedFunctionBroadcastedEvent.fromFields(reader);
|
|
28
|
-
while(!reader.isFinished()){
|
|
29
|
-
const field = reader.readField();
|
|
30
|
-
if (!field.isZero()) {
|
|
31
|
-
throw new Error(`Unexpected data after parsing UnconstrainedFunctionBroadcastedEvent: ${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 unconstrainedFunction = BroadcastedUnconstrainedFunction.fromFields(reader);
|
|
44
|
-
return new UnconstrainedFunctionBroadcastedEvent(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, unconstrainedFunction);
|
|
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.unconstrainedFunction,
|
|
54
|
-
bytecode: this.unconstrainedFunction.bytecode,
|
|
55
|
-
functionMetadataHash: this.unconstrainedFunction.metadataHash,
|
|
56
|
-
artifactMetadataHash: this.artifactMetadataHash,
|
|
57
|
-
privateFunctionsArtifactTreeRoot: this.privateFunctionsArtifactTreeRoot,
|
|
58
|
-
artifactTreeSiblingPath,
|
|
59
|
-
artifactTreeLeafIndex: this.artifactFunctionTreeLeafIndex
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export class BroadcastedUnconstrainedFunction {
|
|
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_UNCONSTRAINED_FUNCTION_IN_FIELDS * 1);
|
|
78
|
-
const bytecode = bufferFromFields(encodedBytecode);
|
|
79
|
-
return new BroadcastedUnconstrainedFunction(selector, metadataHash, bytecode);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
-
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
-
import type { PrivateLog } from '@aztec/stdlib/logs';
|
|
6
|
-
/** Event emitted from the ContractInstanceDeployer. */
|
|
7
|
-
export declare class ContractInstanceDeployedEvent {
|
|
8
|
-
readonly address: AztecAddress;
|
|
9
|
-
readonly version: number;
|
|
10
|
-
readonly salt: Fr;
|
|
11
|
-
readonly contractClassId: Fr;
|
|
12
|
-
readonly initializationHash: Fr;
|
|
13
|
-
readonly publicKeys: PublicKeys;
|
|
14
|
-
readonly deployer: AztecAddress;
|
|
15
|
-
constructor(address: AztecAddress, version: number, salt: Fr, contractClassId: Fr, initializationHash: Fr, publicKeys: PublicKeys, deployer: AztecAddress);
|
|
16
|
-
static isContractInstanceDeployedEvent(log: PrivateLog): boolean;
|
|
17
|
-
static fromLog(log: PrivateLog): ContractInstanceDeployedEvent;
|
|
18
|
-
toContractInstance(): ContractInstanceWithAddress;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=contract_instance_deployed_event.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract_instance_deployed_event.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/contract_instance_deployed_event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,uDAAuD;AACvD,qBAAa,6BAA6B;aAEtB,OAAO,EAAE,YAAY;aACrB,OAAO,EAAE,MAAM;aACf,IAAI,EAAE,EAAE;aACR,eAAe,EAAE,EAAE;aACnB,kBAAkB,EAAE,EAAE;aACtB,UAAU,EAAE,UAAU;aACtB,QAAQ,EAAE,YAAY;gBANtB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,EAAE,EACR,eAAe,EAAE,EAAE,EACnB,kBAAkB,EAAE,EAAE,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,YAAY;IAGxC,MAAM,CAAC,+BAA+B,CAAC,GAAG,EAAE,UAAU;IAItD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU;IAsB9B,kBAAkB,IAAI,2BAA2B;CAgBlD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { ContractInstanceUpdateWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
-
import type { PublicLog } from '@aztec/stdlib/logs';
|
|
5
|
-
/** Event emitted from the ContractInstanceDeployer. */
|
|
6
|
-
export declare class ContractInstanceUpdatedEvent {
|
|
7
|
-
readonly address: AztecAddress;
|
|
8
|
-
readonly prevContractClassId: Fr;
|
|
9
|
-
readonly newContractClassId: Fr;
|
|
10
|
-
readonly blockOfChange: number;
|
|
11
|
-
constructor(address: AztecAddress, prevContractClassId: Fr, newContractClassId: Fr, blockOfChange: number);
|
|
12
|
-
static isContractInstanceUpdatedEvent(log: PublicLog): boolean;
|
|
13
|
-
static fromLog(log: PublicLog): ContractInstanceUpdatedEvent;
|
|
14
|
-
toContractInstanceUpdate(): ContractInstanceUpdateWithAddress;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=contract_instance_updated_event.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract_instance_updated_event.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/contract_instance_updated_event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD,uDAAuD;AACvD,qBAAa,4BAA4B;aAErB,OAAO,EAAE,YAAY;aACrB,mBAAmB,EAAE,EAAE;aACvB,kBAAkB,EAAE,EAAE;aACtB,aAAa,EAAE,MAAM;gBAHrB,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,EAAE,EACvB,kBAAkB,EAAE,EAAE,EACtB,aAAa,EAAE,MAAM;IAGvC,MAAM,CAAC,8BAA8B,CAAC,GAAG,EAAE,SAAS;IAOpD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS;IAW7B,wBAAwB,IAAI,iCAAiC;CAQ9D"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG, ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
5
|
-
/** Event emitted from the ContractInstanceDeployer. */ export class ContractInstanceUpdatedEvent {
|
|
6
|
-
address;
|
|
7
|
-
prevContractClassId;
|
|
8
|
-
newContractClassId;
|
|
9
|
-
blockOfChange;
|
|
10
|
-
constructor(address, prevContractClassId, newContractClassId, blockOfChange){
|
|
11
|
-
this.address = address;
|
|
12
|
-
this.prevContractClassId = prevContractClassId;
|
|
13
|
-
this.newContractClassId = newContractClassId;
|
|
14
|
-
this.blockOfChange = blockOfChange;
|
|
15
|
-
}
|
|
16
|
-
static isContractInstanceUpdatedEvent(log) {
|
|
17
|
-
return log.contractAddress.equals(ProtocolContractAddress.ContractInstanceDeployer) && log.log[0].equals(DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG);
|
|
18
|
-
}
|
|
19
|
-
static fromLog(log) {
|
|
20
|
-
const bufferWithoutAddressAndTag = log.toBuffer().subarray(64);
|
|
21
|
-
const reader = new BufferReader(bufferWithoutAddressAndTag);
|
|
22
|
-
const address = reader.readObject(AztecAddress);
|
|
23
|
-
const prevContractClassId = reader.readObject(Fr);
|
|
24
|
-
const newContractClassId = reader.readObject(Fr);
|
|
25
|
-
const blockOfChange = reader.readObject(Fr).toNumber();
|
|
26
|
-
return new ContractInstanceUpdatedEvent(address, prevContractClassId, newContractClassId, blockOfChange);
|
|
27
|
-
}
|
|
28
|
-
toContractInstanceUpdate() {
|
|
29
|
-
return {
|
|
30
|
-
address: this.address,
|
|
31
|
-
prevContractClassId: this.prevContractClassId,
|
|
32
|
-
newContractClassId: this.newContractClassId,
|
|
33
|
-
blockOfChange: this.blockOfChange
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
-
export * from './contract_instance_deployed_event.js';
|
|
3
|
-
export * from './contract_instance_updated_event.js';
|
|
4
|
-
export declare const ContractInstanceDeployerArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
5
|
-
/** Returns the canonical deployment of the contract. */
|
|
6
|
-
export declare function getCanonicalInstanceDeployer(): Promise<ProtocolContract>;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AAErD,eAAO,MAAM,gCAAgC,8CAE5C,CAAC;AAIF,wDAAwD;AACxD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAK9E"}
|