@aztec/protocol-contracts 0.0.0-test.1 → 0.0.1-commit.24de95ac
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/AuthRegistry.json +1979 -1183
- package/artifacts/ContractClassRegistry.json +8205 -0
- package/artifacts/ContractInstanceRegistry.json +3587 -0
- package/artifacts/FeeJuice.json +2499 -1930
- package/artifacts/MultiCallEntrypoint.json +1527 -841
- package/artifacts/Router.json +709 -3531
- package/dest/auth-registry/index.d.ts +2 -1
- package/dest/auth-registry/index.d.ts.map +1 -1
- package/dest/auth-registry/index.js +1 -1
- package/dest/auth-registry/lazy.js +4 -4
- package/dest/{class-registerer/contract_class_registered_event.d.ts → class-registry/contract_class_published_event.d.ts} +5 -7
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
- package/dest/{class-registerer/contract_class_registered_event.js → class-registry/contract_class_published_event.js} +12 -20
- package/dest/class-registry/index.d.ts +8 -0
- package/dest/class-registry/index.d.ts.map +1 -0
- package/dest/class-registry/index.js +17 -0
- package/dest/class-registry/lazy.d.ts +9 -0
- package/dest/class-registry/lazy.d.ts.map +1 -0
- package/dest/class-registry/lazy.js +26 -0
- package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.d.ts +3 -5
- package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -0
- package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.js +11 -11
- package/dest/{class-registerer/unconstrained_function_broadcasted_event.d.ts → class-registry/utility_function_broadcasted_event.d.ts} +12 -14
- package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -0
- package/dest/{class-registerer/unconstrained_function_broadcasted_event.js → class-registry/utility_function_broadcasted_event.js} +19 -19
- package/dest/fee-juice/index.js +1 -1
- package/dest/fee-juice/lazy.js +4 -4
- package/dest/index.d.ts +0 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/{instance-deployer/contract_instance_deployed_event.d.ts → instance-registry/contract_instance_published_event.d.ts} +5 -5
- 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} +5 -5
- package/dest/{instance-deployer → instance-registry}/contract_instance_updated_event.d.ts +4 -3
- 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-deployer → instance-registry}/index.d.ts +3 -3
- package/dest/instance-registry/index.d.ts.map +1 -0
- package/dest/{instance-deployer → instance-registry}/index.js +5 -5
- package/dest/{instance-deployer → instance-registry}/lazy.d.ts +3 -3
- 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.js +2 -2
- package/dest/multi-call-entrypoint/index.js +1 -1
- package/dest/multi-call-entrypoint/lazy.js +4 -4
- package/dest/protocol_contract_data.d.ts +12 -14
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +29 -19
- package/dest/provider/bundle.js +4 -4
- package/dest/provider/lazy.js +6 -6
- package/dest/router/index.js +1 -1
- package/dest/router/lazy.js +4 -4
- package/dest/scripts/cleanup_artifacts.js +2 -2
- package/dest/scripts/generate_data.js +38 -45
- package/dest/tests/fixtures.d.ts +3 -5
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +6 -6
- package/package.json +18 -16
- package/src/auth-registry/index.ts +3 -3
- package/src/auth-registry/lazy.ts +4 -4
- package/src/class-registry/__snapshots__/README.md +9 -0
- package/src/{class-registerer/contract_class_registered_event.ts → class-registry/contract_class_published_event.ts} +16 -22
- package/src/{class-registerer → class-registry}/index.ts +7 -9
- package/src/class-registry/lazy.ts +33 -0
- package/src/{class-registerer → class-registry}/private_function_broadcasted_event.ts +12 -8
- package/src/{class-registerer/unconstrained_function_broadcasted_event.ts → class-registry/utility_function_broadcasted_event.ts} +25 -21
- package/src/fee-juice/index.ts +1 -1
- package/src/fee-juice/lazy.ts +4 -4
- 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} +6 -6
- package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +14 -14
- package/src/{instance-deployer → instance-registry}/index.ts +6 -6
- package/src/{instance-deployer → instance-registry}/lazy.ts +11 -11
- package/src/make_protocol_contract.ts +2 -2
- package/src/multi-call-entrypoint/index.ts +1 -1
- package/src/multi-call-entrypoint/lazy.ts +4 -4
- package/src/protocol_contract_data.ts +30 -19
- package/src/provider/bundle.ts +4 -4
- package/src/provider/lazy.ts +6 -6
- package/src/router/index.ts +1 -1
- package/src/router/lazy.ts +4 -4
- package/src/tests/fixtures.ts +6 -6
- package/artifacts/ContractClassRegisterer.json +0 -7219
- package/artifacts/ContractInstanceDeployer.json +0 -2984
- 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.map +0 -1
- 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.map +0 -1
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
- 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.map +0 -1
- package/dest/instance-deployer/lazy.js +0 -25
- 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/src/build_protocol_contract_tree.ts +0 -29
- package/src/class-registerer/lazy.ts +0 -33
- package/src/protocol_contract_tree.ts +0 -44
- /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
- /package/artifacts/{ContractInstanceDeployer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
1
2
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
-
export declare const AuthRegistryArtifact:
|
|
3
|
+
export declare const AuthRegistryArtifact: ContractArtifact;
|
|
3
4
|
/** Returns the canonical deployment of the auth registry. */
|
|
4
5
|
export declare function getCanonicalAuthRegistry(): Promise<ProtocolContract>;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth-registry/index.ts"],"names":[],"mappings":"
|
|
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,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAK1E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import AuthRegistryJson from '../../artifacts/AuthRegistry.json'
|
|
2
|
+
import AuthRegistryJson from '../../artifacts/AuthRegistry.json' with {
|
|
3
3
|
type: 'json'
|
|
4
4
|
};
|
|
5
5
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
@@ -4,10 +4,10 @@ let protocolContract;
|
|
|
4
4
|
let protocolContractArtifact;
|
|
5
5
|
export async function getAuthRegistryArtifact() {
|
|
6
6
|
if (!protocolContractArtifact) {
|
|
7
|
-
// Cannot assert this import as it's incompatible with
|
|
8
|
-
// https://
|
|
9
|
-
//
|
|
10
|
-
//
|
|
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
11
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
12
12
|
const { default: authRegistryJson } = await import('../../artifacts/AuthRegistry.json');
|
|
13
13
|
protocolContractArtifact = loadContractArtifact(authRegistryJson);
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
2
|
import { type ContractClassPublic } from '@aztec/stdlib/contract';
|
|
5
3
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
6
|
-
/** Event emitted from the
|
|
7
|
-
export declare class
|
|
4
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
5
|
+
export declare class ContractClassPublishedEvent {
|
|
8
6
|
readonly contractClassId: Fr;
|
|
9
7
|
readonly version: number;
|
|
10
8
|
readonly artifactHash: Fr;
|
|
11
9
|
readonly privateFunctionsRoot: Fr;
|
|
12
10
|
readonly packedPublicBytecode: Buffer;
|
|
13
11
|
constructor(contractClassId: Fr, version: number, artifactHash: Fr, privateFunctionsRoot: Fr, packedPublicBytecode: Buffer);
|
|
14
|
-
static
|
|
15
|
-
static fromLog(log: ContractClassLog):
|
|
12
|
+
static isContractClassPublishedEvent(log: ContractClassLog): boolean;
|
|
13
|
+
static fromLog(log: ContractClassLog): ContractClassPublishedEvent;
|
|
16
14
|
toContractClassPublic(): Promise<ContractClassPublic>;
|
|
17
15
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=contract_class_published_event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract_class_published_event.d.ts","sourceRoot":"","sources":["../../src/class-registry/contract_class_published_event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,oDAAoD;AACpD,qBAAa,2BAA2B;aAEpB,eAAe,EAAE,EAAE;aACnB,OAAO,EAAE,MAAM;aACf,YAAY,EAAE,EAAE;aAChB,oBAAoB,EAAE,EAAE;aACxB,oBAAoB,EAAE,MAAM;gBAJ5B,eAAe,EAAE,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,EAAE,EAChB,oBAAoB,EAAE,EAAE,EACxB,oBAAoB,EAAE,MAAM;IAG9C,MAAM,CAAC,6BAA6B,CAAC,GAAG,EAAE,gBAAgB;IAO1D,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAmB9B,qBAAqB,IAAI,OAAO,CAAC,mBAAmB,CAAC;CA2B5D"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
1
|
+
import { CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE } from '@aztec/constants';
|
|
3
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
4
|
-
import {
|
|
3
|
+
import { bufferFromFields } from '@aztec/stdlib/abi';
|
|
5
4
|
import { computeContractClassId, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
6
|
-
import {
|
|
7
|
-
/** Event emitted from the
|
|
5
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
6
|
+
/** Event emitted from the ContractClassRegistry. */ export class ContractClassPublishedEvent {
|
|
8
7
|
contractClassId;
|
|
9
8
|
version;
|
|
10
9
|
artifactHash;
|
|
@@ -17,17 +16,19 @@ import { REGISTERER_CONTRACT_CLASS_REGISTERED_TAG } from '../protocol_contract_d
|
|
|
17
16
|
this.privateFunctionsRoot = privateFunctionsRoot;
|
|
18
17
|
this.packedPublicBytecode = packedPublicBytecode;
|
|
19
18
|
}
|
|
20
|
-
static
|
|
21
|
-
return log.fields[0].
|
|
19
|
+
static isContractClassPublishedEvent(log) {
|
|
20
|
+
return log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) && log.fields.fields[0].toBigInt() === CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE;
|
|
22
21
|
}
|
|
23
22
|
static fromLog(log) {
|
|
24
|
-
|
|
23
|
+
// See how the log is serialized in `noir-projects/noir-contracts/contracts/protocol/contract_class_registry/src/events/class_published.nr`.
|
|
24
|
+
const fieldsWithoutTag = log.fields.fields.slice(1);
|
|
25
|
+
const reader = new FieldReader(fieldsWithoutTag);
|
|
25
26
|
const contractClassId = reader.readField();
|
|
26
27
|
const version = reader.readField().toNumber();
|
|
27
28
|
const artifactHash = reader.readField();
|
|
28
29
|
const privateFunctionsRoot = reader.readField();
|
|
29
|
-
const packedPublicBytecode = bufferFromFields(reader.readFieldArray(
|
|
30
|
-
return new
|
|
30
|
+
const packedPublicBytecode = bufferFromFields(reader.readFieldArray(fieldsWithoutTag.length - reader.cursor));
|
|
31
|
+
return new ContractClassPublishedEvent(contractClassId, version, artifactHash, privateFunctionsRoot, packedPublicBytecode);
|
|
31
32
|
}
|
|
32
33
|
async toContractClassPublic() {
|
|
33
34
|
const computedClassId = await computeContractClassId({
|
|
@@ -41,23 +42,14 @@ import { REGISTERER_CONTRACT_CLASS_REGISTERED_TAG } from '../protocol_contract_d
|
|
|
41
42
|
if (this.version !== 1) {
|
|
42
43
|
throw new Error(`Unexpected contract class version ${this.version}`);
|
|
43
44
|
}
|
|
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
45
|
return {
|
|
53
46
|
id: this.contractClassId,
|
|
54
47
|
artifactHash: this.artifactHash,
|
|
55
48
|
packedBytecode: this.packedPublicBytecode,
|
|
56
49
|
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
57
|
-
publicFunctions: publicFunctions,
|
|
58
50
|
version: this.version,
|
|
59
51
|
privateFunctions: [],
|
|
60
|
-
|
|
52
|
+
utilityFunctions: []
|
|
61
53
|
};
|
|
62
54
|
}
|
|
63
55
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
export * from './contract_class_published_event.js';
|
|
3
|
+
export * from './private_function_broadcasted_event.js';
|
|
4
|
+
export * from './utility_function_broadcasted_event.js';
|
|
5
|
+
export declare const ContractClassRegistryArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
6
|
+
/** Returns the canonical deployment of the contract. */
|
|
7
|
+
export declare function getCanonicalClassRegistry(): Promise<ProtocolContract>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/class-registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AAExD,eAAO,MAAM,6BAA6B,8CAA0E,CAAC;AAIrH,wDAAwD;AACxD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM3E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import ContractClassRegistryJson from '../../artifacts/ContractClassRegistry.json' with {
|
|
3
|
+
type: 'json'
|
|
4
|
+
};
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
export * from './contract_class_published_event.js';
|
|
7
|
+
export * from './private_function_broadcasted_event.js';
|
|
8
|
+
export * from './utility_function_broadcasted_event.js';
|
|
9
|
+
export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassRegistryJson);
|
|
10
|
+
let protocolContract;
|
|
11
|
+
/** Returns the canonical deployment of the contract. */ export async function getCanonicalClassRegistry() {
|
|
12
|
+
if (!protocolContract) {
|
|
13
|
+
const artifact = ContractClassRegistryArtifact;
|
|
14
|
+
protocolContract = await makeProtocolContract('ContractClassRegistry', artifact);
|
|
15
|
+
}
|
|
16
|
+
return protocolContract;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
+
export * from './contract_class_published_event.js';
|
|
4
|
+
export * from './private_function_broadcasted_event.js';
|
|
5
|
+
export * from './utility_function_broadcasted_event.js';
|
|
6
|
+
export declare function getContractClassRegistryArtifact(): Promise<ContractArtifact>;
|
|
7
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
8
|
+
export declare function getCanonicalClassRegistry(): Promise<ProtocolContract>;
|
|
9
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/class-registry/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AAKxD,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWlF;AAED,6DAA6D;AAC7D,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM3E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
3
|
+
export * from './contract_class_published_event.js';
|
|
4
|
+
export * from './private_function_broadcasted_event.js';
|
|
5
|
+
export * from './utility_function_broadcasted_event.js';
|
|
6
|
+
let protocolContract;
|
|
7
|
+
let protocolContractArtifact;
|
|
8
|
+
export async function getContractClassRegistryArtifact() {
|
|
9
|
+
if (!protocolContractArtifact) {
|
|
10
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
11
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
12
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
13
|
+
// "text/javascript"
|
|
14
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
15
|
+
const { default: contractClassRegistryJson } = await import('../../artifacts/ContractClassRegistry.json');
|
|
16
|
+
protocolContractArtifact = loadContractArtifact(contractClassRegistryJson);
|
|
17
|
+
}
|
|
18
|
+
return protocolContractArtifact;
|
|
19
|
+
}
|
|
20
|
+
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalClassRegistry() {
|
|
21
|
+
if (!protocolContract) {
|
|
22
|
+
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
23
|
+
protocolContract = await makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
24
|
+
}
|
|
25
|
+
return protocolContract;
|
|
26
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
4
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
3
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
@@ -7,17 +5,17 @@ import { FieldReader } from '@aztec/foundation/serialize';
|
|
|
7
5
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
6
|
import type { ExecutablePrivateFunctionWithMembershipProof, PrivateFunction } from '@aztec/stdlib/contract';
|
|
9
7
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
10
|
-
/** Event emitted from the
|
|
8
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
11
9
|
export declare class PrivateFunctionBroadcastedEvent {
|
|
12
10
|
readonly contractClassId: Fr;
|
|
13
11
|
readonly artifactMetadataHash: Fr;
|
|
14
|
-
readonly
|
|
12
|
+
readonly utilityFunctionsTreeRoot: Fr;
|
|
15
13
|
readonly privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>;
|
|
16
14
|
readonly privateFunctionTreeLeafIndex: number;
|
|
17
15
|
readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>;
|
|
18
16
|
readonly artifactFunctionTreeLeafIndex: number;
|
|
19
17
|
readonly privateFunction: BroadcastedPrivateFunction;
|
|
20
|
-
constructor(contractClassId: Fr, artifactMetadataHash: Fr,
|
|
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);
|
|
21
19
|
static isPrivateFunctionBroadcastedEvent(log: ContractClassLog): boolean;
|
|
22
20
|
static fromLog(log: ContractClassLog): PrivateFunctionBroadcastedEvent;
|
|
23
21
|
static fromFields(fields: Fr[] | FieldReader): PrivateFunctionBroadcastedEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_function_broadcasted_event.d.ts","sourceRoot":"","sources":["../../src/class-registry/private_function_broadcasted_event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAEjC,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,oDAAoD;AACpD,qBAAa,+BAA+B;aAExB,eAAe,EAAE,EAAE;aACnB,oBAAoB,EAAE,EAAE;aACxB,wBAAwB,EAAE,EAAE;aAC5B,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,wBAAwB,EAAE,EAAE,EAC5B,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;IAO9D,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,20 +1,20 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS } from '@aztec/constants';
|
|
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
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
4
|
-
import {
|
|
5
|
-
/** Event emitted from the
|
|
4
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
5
|
+
/** Event emitted from the ContractClassRegistry. */ export class PrivateFunctionBroadcastedEvent {
|
|
6
6
|
contractClassId;
|
|
7
7
|
artifactMetadataHash;
|
|
8
|
-
|
|
8
|
+
utilityFunctionsTreeRoot;
|
|
9
9
|
privateFunctionTreeSiblingPath;
|
|
10
10
|
privateFunctionTreeLeafIndex;
|
|
11
11
|
artifactFunctionTreeSiblingPath;
|
|
12
12
|
artifactFunctionTreeLeafIndex;
|
|
13
13
|
privateFunction;
|
|
14
|
-
constructor(contractClassId, artifactMetadataHash,
|
|
14
|
+
constructor(contractClassId, artifactMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, privateFunction){
|
|
15
15
|
this.contractClassId = contractClassId;
|
|
16
16
|
this.artifactMetadataHash = artifactMetadataHash;
|
|
17
|
-
this.
|
|
17
|
+
this.utilityFunctionsTreeRoot = utilityFunctionsTreeRoot;
|
|
18
18
|
this.privateFunctionTreeSiblingPath = privateFunctionTreeSiblingPath;
|
|
19
19
|
this.privateFunctionTreeLeafIndex = privateFunctionTreeLeafIndex;
|
|
20
20
|
this.artifactFunctionTreeSiblingPath = artifactFunctionTreeSiblingPath;
|
|
@@ -22,10 +22,10 @@ import { REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG } from '../protocol_contrac
|
|
|
22
22
|
this.privateFunction = privateFunction;
|
|
23
23
|
}
|
|
24
24
|
static isPrivateFunctionBroadcastedEvent(log) {
|
|
25
|
-
return log.fields[0].
|
|
25
|
+
return log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) && log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE;
|
|
26
26
|
}
|
|
27
27
|
static fromLog(log) {
|
|
28
|
-
const reader = new FieldReader(log.fields.slice(1));
|
|
28
|
+
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
29
29
|
const event = PrivateFunctionBroadcastedEvent.fromFields(reader);
|
|
30
30
|
while(!reader.isFinished()){
|
|
31
31
|
const field = reader.readField();
|
|
@@ -39,13 +39,13 @@ import { REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG } from '../protocol_contrac
|
|
|
39
39
|
const reader = FieldReader.asReader(fields);
|
|
40
40
|
const contractClassId = reader.readField();
|
|
41
41
|
const artifactMetadataHash = reader.readField();
|
|
42
|
-
const
|
|
42
|
+
const utilityFunctionsTreeRoot = reader.readField();
|
|
43
43
|
const privateFunctionTreeSiblingPath = reader.readFieldArray(FUNCTION_TREE_HEIGHT);
|
|
44
44
|
const privateFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
45
45
|
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
46
46
|
const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
47
47
|
const privateFunction = BroadcastedPrivateFunction.fromFields(reader);
|
|
48
|
-
return new PrivateFunctionBroadcastedEvent(contractClassId, artifactMetadataHash,
|
|
48
|
+
return new PrivateFunctionBroadcastedEvent(contractClassId, artifactMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, privateFunction);
|
|
49
49
|
}
|
|
50
50
|
toFunctionWithMembershipProof() {
|
|
51
51
|
return {
|
|
@@ -53,7 +53,7 @@ import { REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG } from '../protocol_contrac
|
|
|
53
53
|
bytecode: this.privateFunction.bytecode,
|
|
54
54
|
functionMetadataHash: this.privateFunction.metadataHash,
|
|
55
55
|
artifactMetadataHash: this.artifactMetadataHash,
|
|
56
|
-
|
|
56
|
+
utilityFunctionsTreeRoot: this.utilityFunctionsTreeRoot,
|
|
57
57
|
privateFunctionTreeSiblingPath: this.privateFunctionTreeSiblingPath,
|
|
58
58
|
privateFunctionTreeLeafIndex: this.privateFunctionTreeLeafIndex,
|
|
59
59
|
artifactTreeSiblingPath: this.artifactFunctionTreeSiblingPath.filter((fr)=>!fr.isZero()),
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT } from '@aztec/constants';
|
|
4
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
3
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
6
4
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
7
5
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
|
-
import type {
|
|
6
|
+
import type { UtilityFunction, UtilityFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
9
7
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
10
|
-
/** Event emitted from the
|
|
11
|
-
export declare class
|
|
8
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
9
|
+
export declare class UtilityFunctionBroadcastedEvent {
|
|
12
10
|
readonly contractClassId: Fr;
|
|
13
11
|
readonly artifactMetadataHash: Fr;
|
|
14
12
|
readonly privateFunctionsArtifactTreeRoot: Fr;
|
|
15
13
|
readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>;
|
|
16
14
|
readonly artifactFunctionTreeLeafIndex: number;
|
|
17
|
-
readonly
|
|
18
|
-
constructor(contractClassId: Fr, artifactMetadataHash: Fr, privateFunctionsArtifactTreeRoot: Fr, artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>, artifactFunctionTreeLeafIndex: number,
|
|
19
|
-
static
|
|
20
|
-
static fromLog(log: ContractClassLog):
|
|
21
|
-
static fromFields(fields: Fr[] | FieldReader):
|
|
22
|
-
toFunctionWithMembershipProof():
|
|
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;
|
|
23
21
|
}
|
|
24
|
-
export declare class
|
|
22
|
+
export declare class BroadcastedUtilityFunction implements UtilityFunction {
|
|
25
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. */
|
|
26
24
|
readonly selector: FunctionSelector;
|
|
27
25
|
/** Artifact metadata hash */
|
|
@@ -35,6 +33,6 @@ export declare class BroadcastedUnconstrainedFunction implements UnconstrainedFu
|
|
|
35
33
|
metadataHash: Fr,
|
|
36
34
|
/** Brillig bytecode */
|
|
37
35
|
bytecode: Buffer);
|
|
38
|
-
static fromFields(fields: Fr[] | FieldReader):
|
|
36
|
+
static fromFields(fields: Fr[] | FieldReader): BroadcastedUtilityFunction;
|
|
39
37
|
}
|
|
40
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=utility_function_broadcasted_event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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,eAAe,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,oDAAoD;AACpD,qBAAa,+BAA+B;aAExB,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,eAAe,EAAE,0BAA0B;gBAL3C,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,eAAe,EAAE,0BAA0B;IAG7D,MAAM,CAAC,iCAAiC,CAAC,GAAG,EAAE,gBAAgB;IAO9D,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAapC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAmB5C,6BAA6B,IAAI,kCAAkC;CAgBpE;AAED,qBAAa,0BAA2B,YAAW,eAAe;IAE9D,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,34 +1,34 @@
|
|
|
1
|
-
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
|
|
1
|
+
import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, CONTRACT_CLASS_REGISTRY_UTILITY_FUNCTION_BROADCASTED_MAGIC_VALUE, MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS } from '@aztec/constants';
|
|
2
2
|
import { removeArrayPaddingEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
5
5
|
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
6
|
-
import {
|
|
7
|
-
/** Event emitted from the
|
|
6
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
7
|
+
/** Event emitted from the ContractClassRegistry. */ export class UtilityFunctionBroadcastedEvent {
|
|
8
8
|
contractClassId;
|
|
9
9
|
artifactMetadataHash;
|
|
10
10
|
privateFunctionsArtifactTreeRoot;
|
|
11
11
|
artifactFunctionTreeSiblingPath;
|
|
12
12
|
artifactFunctionTreeLeafIndex;
|
|
13
|
-
|
|
14
|
-
constructor(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex,
|
|
13
|
+
utilityFunction;
|
|
14
|
+
constructor(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, utilityFunction){
|
|
15
15
|
this.contractClassId = contractClassId;
|
|
16
16
|
this.artifactMetadataHash = artifactMetadataHash;
|
|
17
17
|
this.privateFunctionsArtifactTreeRoot = privateFunctionsArtifactTreeRoot;
|
|
18
18
|
this.artifactFunctionTreeSiblingPath = artifactFunctionTreeSiblingPath;
|
|
19
19
|
this.artifactFunctionTreeLeafIndex = artifactFunctionTreeLeafIndex;
|
|
20
|
-
this.
|
|
20
|
+
this.utilityFunction = utilityFunction;
|
|
21
21
|
}
|
|
22
|
-
static
|
|
23
|
-
return log.fields[0].
|
|
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
24
|
}
|
|
25
25
|
static fromLog(log) {
|
|
26
|
-
const reader = new FieldReader(log.fields.slice(1));
|
|
27
|
-
const event =
|
|
26
|
+
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
27
|
+
const event = UtilityFunctionBroadcastedEvent.fromFields(reader);
|
|
28
28
|
while(!reader.isFinished()){
|
|
29
29
|
const field = reader.readField();
|
|
30
30
|
if (!field.isZero()) {
|
|
31
|
-
throw new Error(`Unexpected data after parsing
|
|
31
|
+
throw new Error(`Unexpected data after parsing UtilityFunctionBroadcastedEvent: ${field.toString()}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return event;
|
|
@@ -40,8 +40,8 @@ import { REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG } from '../protocol_c
|
|
|
40
40
|
const privateFunctionsArtifactTreeRoot = reader.readField();
|
|
41
41
|
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
42
42
|
const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
43
|
-
const
|
|
44
|
-
return new
|
|
43
|
+
const utilityFunction = BroadcastedUtilityFunction.fromFields(reader);
|
|
44
|
+
return new UtilityFunctionBroadcastedEvent(contractClassId, artifactMetadataHash, privateFunctionsArtifactTreeRoot, artifactFunctionTreeSiblingPath, artifactFunctionTreeLeafIndex, utilityFunction);
|
|
45
45
|
}
|
|
46
46
|
toFunctionWithMembershipProof() {
|
|
47
47
|
// We should be able to safely remove the zero elements that pad the variable-length sibling path,
|
|
@@ -50,9 +50,9 @@ import { REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG } from '../protocol_c
|
|
|
50
50
|
// be a single zero element, but in that case the artifact tree should be just the single leaf.
|
|
51
51
|
const artifactTreeSiblingPath = removeArrayPaddingEnd(this.artifactFunctionTreeSiblingPath, Fr.isZero);
|
|
52
52
|
return {
|
|
53
|
-
...this.
|
|
54
|
-
bytecode: this.
|
|
55
|
-
functionMetadataHash: this.
|
|
53
|
+
...this.utilityFunction,
|
|
54
|
+
bytecode: this.utilityFunction.bytecode,
|
|
55
|
+
functionMetadataHash: this.utilityFunction.metadataHash,
|
|
56
56
|
artifactMetadataHash: this.artifactMetadataHash,
|
|
57
57
|
privateFunctionsArtifactTreeRoot: this.privateFunctionsArtifactTreeRoot,
|
|
58
58
|
artifactTreeSiblingPath,
|
|
@@ -60,7 +60,7 @@ import { REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG } from '../protocol_c
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
export class
|
|
63
|
+
export class BroadcastedUtilityFunction {
|
|
64
64
|
selector;
|
|
65
65
|
metadataHash;
|
|
66
66
|
bytecode;
|
|
@@ -74,8 +74,8 @@ export class BroadcastedUnconstrainedFunction {
|
|
|
74
74
|
const selector = FunctionSelector.fromField(reader.readField());
|
|
75
75
|
const metadataHash = reader.readField();
|
|
76
76
|
// The '* 1' removes the 'Type instantiation is excessively deep and possibly infinite. ts(2589)' err
|
|
77
|
-
const encodedBytecode = reader.readFieldArray(
|
|
77
|
+
const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS * 1);
|
|
78
78
|
const bytecode = bufferFromFields(encodedBytecode);
|
|
79
|
-
return new
|
|
79
|
+
return new BroadcastedUtilityFunction(selector, metadataHash, bytecode);
|
|
80
80
|
}
|
|
81
81
|
}
|
package/dest/fee-juice/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
import { computePublicDataTreeLeafSlot, deriveStorageSlotInMap } from '@aztec/stdlib/hash';
|
|
3
|
-
import FeeJuiceJson from '../../artifacts/FeeJuice.json'
|
|
3
|
+
import FeeJuiceJson from '../../artifacts/FeeJuice.json' with {
|
|
4
4
|
type: 'json'
|
|
5
5
|
};
|
|
6
6
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
package/dest/fee-juice/lazy.js
CHANGED
|
@@ -4,10 +4,10 @@ let protocolContract;
|
|
|
4
4
|
let protocolContractArtifact;
|
|
5
5
|
export async function getFeeJuiceArtifact() {
|
|
6
6
|
if (!protocolContractArtifact) {
|
|
7
|
-
// Cannot assert this import as it's incompatible with
|
|
8
|
-
// https://
|
|
9
|
-
//
|
|
10
|
-
//
|
|
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
11
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
12
12
|
const { default: feeJuiceJson } = await import('../../artifacts/FeeJuice.json');
|
|
13
13
|
protocolContractArtifact = loadContractArtifact(feeJuiceJson);
|
package/dest/index.d.ts
CHANGED
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
3
3
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
4
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
5
|
import type { PrivateLog } from '@aztec/stdlib/logs';
|
|
6
|
-
/** Event emitted from the
|
|
7
|
-
export declare class
|
|
6
|
+
/** Event emitted from the ContractInstanceRegistry. */
|
|
7
|
+
export declare class ContractInstancePublishedEvent {
|
|
8
8
|
readonly address: AztecAddress;
|
|
9
9
|
readonly version: number;
|
|
10
10
|
readonly salt: Fr;
|
|
@@ -13,8 +13,8 @@ export declare class ContractInstanceDeployedEvent {
|
|
|
13
13
|
readonly publicKeys: PublicKeys;
|
|
14
14
|
readonly deployer: AztecAddress;
|
|
15
15
|
constructor(address: AztecAddress, version: number, salt: Fr, contractClassId: Fr, initializationHash: Fr, publicKeys: PublicKeys, deployer: AztecAddress);
|
|
16
|
-
static
|
|
17
|
-
static fromLog(log: PrivateLog):
|
|
16
|
+
static isContractInstancePublishedEvent(log: PrivateLog): boolean;
|
|
17
|
+
static fromLog(log: PrivateLog): ContractInstancePublishedEvent;
|
|
18
18
|
toContractInstance(): ContractInstanceWithAddress;
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=contract_instance_published_event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract_instance_published_event.d.ts","sourceRoot":"","sources":["../../src/instance-registry/contract_instance_published_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,8BAA8B;aAEvB,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,gCAAgC,CAAC,GAAG,EAAE,UAAU;IAIvD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU;IAsB9B,kBAAkB,IAAI,2BAA2B;CAgBlD"}
|
|
@@ -2,8 +2,8 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
2
2
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
-
import {
|
|
6
|
-
/** Event emitted from the
|
|
5
|
+
import { CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG } from '../protocol_contract_data.js';
|
|
6
|
+
/** Event emitted from the ContractInstanceRegistry. */ export class ContractInstancePublishedEvent {
|
|
7
7
|
address;
|
|
8
8
|
version;
|
|
9
9
|
salt;
|
|
@@ -20,8 +20,8 @@ import { DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG } from '../protocol_contract_da
|
|
|
20
20
|
this.publicKeys = publicKeys;
|
|
21
21
|
this.deployer = deployer;
|
|
22
22
|
}
|
|
23
|
-
static
|
|
24
|
-
return log.fields[0].equals(
|
|
23
|
+
static isContractInstancePublishedEvent(log) {
|
|
24
|
+
return log.fields[0].equals(CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG);
|
|
25
25
|
}
|
|
26
26
|
static fromLog(log) {
|
|
27
27
|
const bufferWithoutTag = log.toBuffer().subarray(32);
|
|
@@ -33,7 +33,7 @@ import { DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG } from '../protocol_contract_da
|
|
|
33
33
|
const initializationHash = reader.readObject(Fr);
|
|
34
34
|
const publicKeys = reader.readObject(PublicKeys);
|
|
35
35
|
const deployer = reader.readObject(AztecAddress);
|
|
36
|
-
return new
|
|
36
|
+
return new ContractInstancePublishedEvent(address, version, salt, contractClassId, initializationHash, publicKeys, deployer);
|
|
37
37
|
}
|
|
38
38
|
toContractInstance() {
|
|
39
39
|
if (this.version !== 1) {
|
|
@@ -2,13 +2,14 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { ContractInstanceUpdateWithAddress } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { PublicLog } from '@aztec/stdlib/logs';
|
|
5
|
-
|
|
5
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
6
|
+
/** Event emitted from the ContractInstanceRegistry. */
|
|
6
7
|
export declare class ContractInstanceUpdatedEvent {
|
|
7
8
|
readonly address: AztecAddress;
|
|
8
9
|
readonly prevContractClassId: Fr;
|
|
9
10
|
readonly newContractClassId: Fr;
|
|
10
|
-
readonly
|
|
11
|
-
constructor(address: AztecAddress, prevContractClassId: Fr, newContractClassId: Fr,
|
|
11
|
+
readonly timestampOfChange: UInt64;
|
|
12
|
+
constructor(address: AztecAddress, prevContractClassId: Fr, newContractClassId: Fr, timestampOfChange: UInt64);
|
|
12
13
|
static isContractInstanceUpdatedEvent(log: PublicLog): boolean;
|
|
13
14
|
static fromLog(log: PublicLog): ContractInstanceUpdatedEvent;
|
|
14
15
|
toContractInstanceUpdate(): ContractInstanceUpdateWithAddress;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract_instance_updated_event.d.ts","sourceRoot":"","sources":["../../src/instance-registry/contract_instance_updated_event.ts"],"names":[],"mappings":"AACA,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;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,uDAAuD;AACvD,qBAAa,4BAA4B;aAErB,OAAO,EAAE,YAAY;aACrB,mBAAmB,EAAE,EAAE;aACvB,kBAAkB,EAAE,EAAE;aACtB,iBAAiB,EAAE,MAAM;gBAHzB,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,EAAE,EACvB,kBAAkB,EAAE,EAAE,EACtB,iBAAiB,EAAE,MAAM;IAG3C,MAAM,CAAC,8BAA8B,CAAC,GAAG,EAAE,SAAS;IAOpD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS;IAS7B,wBAAwB,IAAI,iCAAiC;CAQ9D"}
|