@aztec/protocol-contracts 0.0.1-commit.a072138 → 0.0.1-commit.a4600f49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/ContractClassRegistry.json +2608 -4410
- package/artifacts/ContractInstanceRegistry.json +3511 -936
- package/artifacts/FeeJuice.json +3868 -941
- package/dest/class-registry/contract_class_published_event.d.ts +6 -3
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -1
- package/dest/class-registry/contract_class_published_event.js +17 -17
- package/dest/class-registry/index.d.ts +1 -3
- package/dest/class-registry/index.d.ts.map +1 -1
- package/dest/class-registry/index.js +3 -5
- package/dest/class-registry/lazy.d.ts +1 -3
- package/dest/class-registry/lazy.d.ts.map +1 -1
- package/dest/class-registry/lazy.js +2 -4
- package/dest/fee-juice/index.d.ts +1 -1
- package/dest/fee-juice/index.d.ts.map +1 -1
- package/dest/fee-juice/index.js +3 -3
- package/dest/fee-juice/lazy.js +2 -2
- package/dest/instance-registry/contract_instance_published_event.d.ts +3 -2
- package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -1
- package/dest/instance-registry/contract_instance_published_event.js +7 -3
- package/dest/instance-registry/index.d.ts +1 -1
- package/dest/instance-registry/index.d.ts.map +1 -1
- package/dest/instance-registry/index.js +3 -3
- package/dest/instance-registry/lazy.js +2 -2
- 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 +4 -1
- package/dest/protocol_contract.d.ts.map +1 -1
- package/dest/protocol_contract.js +5 -1
- package/dest/protocol_contract_data.d.ts +14 -5
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +73 -33
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +2 -8
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +0 -9
- package/dest/scripts/generate_data.js +75 -28
- package/dest/tests/fixtures.d.ts +1 -3
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +2 -12
- package/package.json +4 -4
- package/src/class-registry/contract_class_published_event.ts +16 -22
- package/src/class-registry/index.ts +3 -5
- package/src/class-registry/lazy.ts +2 -4
- package/src/fee-juice/index.ts +3 -3
- package/src/fee-juice/lazy.ts +2 -2
- package/src/instance-registry/contract_instance_published_event.ts +5 -1
- package/src/instance-registry/index.ts +3 -3
- package/src/instance-registry/lazy.ts +2 -2
- package/src/make_protocol_contract.ts +39 -15
- package/src/protocol_contract.ts +9 -1
- package/src/protocol_contract_data.ts +62 -35
- package/src/provider/bundle.ts +1 -7
- package/src/provider/lazy.ts +0 -9
- package/src/tests/fixtures.ts +2 -14
- package/artifacts/AuthRegistry.d.json.ts +0 -5
- package/artifacts/AuthRegistry.json +0 -2764
- package/artifacts/MultiCallEntrypoint.d.json.ts +0 -5
- package/artifacts/MultiCallEntrypoint.json +0 -2759
- package/artifacts/PublicChecks.d.json.ts +0 -5
- package/artifacts/PublicChecks.json +0 -970
- package/dest/auth-registry/index.d.ts +0 -6
- package/dest/auth-registry/index.d.ts.map +0 -1
- package/dest/auth-registry/index.js +0 -13
- package/dest/auth-registry/lazy.d.ts +0 -6
- package/dest/auth-registry/lazy.d.ts.map +0 -1
- package/dest/auth-registry/lazy.js +0 -23
- package/dest/class-registry/private_function_broadcasted_event.d.ts +0 -44
- package/dest/class-registry/private_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registry/private_function_broadcasted_event.js +0 -85
- package/dest/class-registry/utility_function_broadcasted_event.d.ts +0 -38
- package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registry/utility_function_broadcasted_event.js +0 -81
- package/dest/multi-call-entrypoint/index.d.ts +0 -5
- package/dest/multi-call-entrypoint/index.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/index.js +0 -13
- package/dest/multi-call-entrypoint/lazy.d.ts +0 -6
- package/dest/multi-call-entrypoint/lazy.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/lazy.js +0 -23
- package/dest/public-checks/index.d.ts +0 -5
- package/dest/public-checks/index.d.ts.map +0 -1
- package/dest/public-checks/index.js +0 -13
- package/dest/public-checks/lazy.d.ts +0 -6
- package/dest/public-checks/lazy.d.ts.map +0 -1
- package/dest/public-checks/lazy.js +0 -23
- package/src/auth-registry/index.ts +0 -18
- package/src/auth-registry/lazy.ts +0 -29
- package/src/class-registry/private_function_broadcasted_event.ts +0 -109
- package/src/class-registry/utility_function_broadcasted_event.ts +0 -103
- package/src/multi-call-entrypoint/index.ts +0 -18
- package/src/multi-call-entrypoint/lazy.ts +0 -29
- package/src/public-checks/index.ts +0 -18
- package/src/public-checks/lazy.ts +0 -29
|
@@ -1,51 +1,91 @@
|
|
|
1
1
|
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
5
6
|
export const protocolContractNames = [
|
|
6
|
-
'AuthRegistry',
|
|
7
7
|
'ContractInstanceRegistry',
|
|
8
8
|
'ContractClassRegistry',
|
|
9
|
-
'
|
|
10
|
-
'FeeJuice',
|
|
11
|
-
'PublicChecks'
|
|
9
|
+
'FeeJuice'
|
|
12
10
|
];
|
|
13
11
|
export const ProtocolContractSalt = {
|
|
14
|
-
AuthRegistry: new Fr(1),
|
|
15
12
|
ContractInstanceRegistry: new Fr(1),
|
|
16
13
|
ContractClassRegistry: new Fr(1),
|
|
17
|
-
|
|
18
|
-
FeeJuice: new Fr(1),
|
|
19
|
-
PublicChecks: new Fr(1)
|
|
14
|
+
FeeJuice: new Fr(1)
|
|
20
15
|
};
|
|
21
16
|
export const ProtocolContractAddress = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
MultiCallEntrypoint: AztecAddress.fromBigInt(4n),
|
|
26
|
-
FeeJuice: AztecAddress.fromBigInt(5n),
|
|
27
|
-
PublicChecks: AztecAddress.fromBigInt(6n)
|
|
17
|
+
ContractInstanceRegistry: AztecAddress.fromBigIntUnsafe(2n),
|
|
18
|
+
ContractClassRegistry: AztecAddress.fromBigIntUnsafe(1n),
|
|
19
|
+
FeeJuice: AztecAddress.fromBigIntUnsafe(3n)
|
|
28
20
|
};
|
|
29
21
|
export const ProtocolContractDerivedAddress = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
ContractInstanceRegistry: AztecAddress.fromStringUnsafe('0x262381bdb818ed44505e217b6b02ecc37a1046edc6785b3caef6a86513d71058'),
|
|
23
|
+
ContractClassRegistry: AztecAddress.fromStringUnsafe('0x0f75f6277a8850d5f77139ea643de697009a1ab4666673553b908b247d514f0f'),
|
|
24
|
+
FeeJuice: AztecAddress.fromStringUnsafe('0x0aee027cb94b86007afb04f4378f4a2c1649e4642c72056896ba54819fbf5430')
|
|
25
|
+
};
|
|
26
|
+
export const ProtocolContractClassId = {
|
|
27
|
+
ContractInstanceRegistry: Fr.fromString('0x06900ee6077e08bc0bcf1be064f3dad67b58d46ca59a00c99e1ad1db425525c7'),
|
|
28
|
+
ContractClassRegistry: Fr.fromString('0x2cce985fc14d6fff65d3eed0435e037ed27039a6a86d3aab6a5bd2569b83ec70'),
|
|
29
|
+
FeeJuice: Fr.fromString('0x17c33630396638ccf890042352185bedae92c69d7db3ec4aece71b70bcb8a7a4')
|
|
30
|
+
};
|
|
31
|
+
export const ProtocolContractClassIdPreimage = {
|
|
32
|
+
ContractInstanceRegistry: {
|
|
33
|
+
artifactHash: Fr.fromString('0x1a45ee8878136dff02e310c2c62b875be7480494673f5dc2d4f963746b0dbd8d'),
|
|
34
|
+
privateFunctionsRoot: Fr.fromString('0x05bb912d9d2871492d76c610472544d8219df70aa874768f9667e99861d7971f'),
|
|
35
|
+
publicBytecodeCommitment: Fr.fromString('0x232a10bc23611d07c57c32110e6ad7accd088e861c4e167a17bd7433fec2f020')
|
|
36
|
+
},
|
|
37
|
+
ContractClassRegistry: {
|
|
38
|
+
artifactHash: Fr.fromString('0x2cbc206eed84dbb5fc5b5d34e223c8c26def6bf0eb4ef93a54936ef1d6be6bbb'),
|
|
39
|
+
privateFunctionsRoot: Fr.fromString('0x1226036210d1d3d19245a2fe913bd14c7d3922be9e551aa481189d9561ca23a2'),
|
|
40
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e')
|
|
41
|
+
},
|
|
42
|
+
FeeJuice: {
|
|
43
|
+
artifactHash: Fr.fromString('0x1a57ff2a8e653094229bd15c028683e08b2086dfeadecac4c6b950c383b3ae1d'),
|
|
44
|
+
privateFunctionsRoot: Fr.fromString('0x1c4bf54a4a33e3b9eae6f816dfc81e128d76d2646807a5443598c8adbd47f81f'),
|
|
45
|
+
publicBytecodeCommitment: Fr.fromString('0x1d4b1a8f71b8250d4fb65f8e16a4604e9165648279f47d80e024ce2684c4bdfb')
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export const ProtocolContractInitializationHash = {
|
|
49
|
+
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
50
|
+
ContractClassRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
51
|
+
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
52
|
+
};
|
|
53
|
+
export const ProtocolContractPrivateFunctions = {
|
|
54
|
+
ContractInstanceRegistry: [
|
|
55
|
+
{
|
|
56
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000077cff62f')),
|
|
57
|
+
vkHash: Fr.fromString('0x19172c0acecd517dd8995c2e36178ca2aa16cbe001c3606d8cd848776ab80d23')
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
ContractClassRegistry: [
|
|
61
|
+
{
|
|
62
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000006934ed0d')),
|
|
63
|
+
vkHash: Fr.fromString('0x0609c8195389d9ff372c9788d314c1387c31a9a4b73dacad95b01f5e03956056')
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
FeeJuice: [
|
|
67
|
+
{
|
|
68
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000cbe67243')),
|
|
69
|
+
vkHash: Fr.fromString('0x0bdf2e5c4467f295f8defb436546a7f2e642e7fe75786d0d54aef497b76527a1')
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000e8d374b6')),
|
|
73
|
+
vkHash: Fr.fromString('0x2616a94d2d2981737c31ed7d74b9fd32ddc8376bf436dd60fb2507662b47c6dd')
|
|
74
|
+
}
|
|
75
|
+
]
|
|
36
76
|
};
|
|
37
77
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
38
|
-
AztecAddress.
|
|
39
|
-
AztecAddress.
|
|
40
|
-
AztecAddress.
|
|
41
|
-
AztecAddress.
|
|
42
|
-
AztecAddress.
|
|
43
|
-
AztecAddress.
|
|
44
|
-
AztecAddress.
|
|
45
|
-
AztecAddress.
|
|
46
|
-
AztecAddress.
|
|
47
|
-
AztecAddress.
|
|
48
|
-
AztecAddress.
|
|
78
|
+
AztecAddress.fromStringUnsafe('0x0f75f6277a8850d5f77139ea643de697009a1ab4666673553b908b247d514f0f'),
|
|
79
|
+
AztecAddress.fromStringUnsafe('0x262381bdb818ed44505e217b6b02ecc37a1046edc6785b3caef6a86513d71058'),
|
|
80
|
+
AztecAddress.fromStringUnsafe('0x0aee027cb94b86007afb04f4378f4a2c1649e4642c72056896ba54819fbf5430'),
|
|
81
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
82
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
83
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
84
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
85
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
86
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
87
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
88
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
49
89
|
]);
|
|
50
|
-
export const protocolContractsHash = Fr.fromString('
|
|
51
|
-
export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('
|
|
90
|
+
export const protocolContractsHash = Fr.fromString('0x0727efc9473643b7abbe3c57df72d68e86b244b99cae71b17553c0f937ea433b');
|
|
91
|
+
export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('0x1a7e1badb79abdd38c684b3c8306ffe7ecb33c69e3380d9855730aaaa83a21a8');
|
|
@@ -6,4 +6,4 @@ export declare const ProtocolContractArtifact: Record<ProtocolContractName, Cont
|
|
|
6
6
|
export declare class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
|
7
7
|
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmlkZXIvYnVuZGxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFNMUQsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ3pFLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFbEYsZUFBTyxNQUFNLHdCQUF3QixFQUFFLE1BQU0sQ0FBQyxvQkFBb0IsRUFBRSxnQkFBZ0IsQ0FJbkYsQ0FBQztBQUVGLHFCQUFhLGdDQUFpQyxZQUFXLHlCQUF5QjtJQUNoRiwyQkFBMkIsQ0FBQyxJQUFJLEVBQUUsb0JBQW9CLEdBQUcsT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBRWpGO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/provider/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/provider/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,EAAE,gBAAgB,CAInF,CAAC;AAEF,qBAAa,gCAAiC,YAAW,yBAAyB;IAChF,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEjF;CACF"}
|
package/dest/provider/bundle.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { AuthRegistryArtifact } from '../auth-registry/index.js';
|
|
2
1
|
import { ContractClassRegistryArtifact } from '../class-registry/index.js';
|
|
3
2
|
import { FeeJuiceArtifact } from '../fee-juice/index.js';
|
|
4
3
|
import { ContractInstanceRegistryArtifact } from '../instance-registry/index.js';
|
|
5
4
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
import { MultiCallEntrypointArtifact } from '../multi-call-entrypoint/index.js';
|
|
7
|
-
import { PublicChecksArtifact } from '../public-checks/index.js';
|
|
8
5
|
export const ProtocolContractArtifact = {
|
|
9
|
-
AuthRegistry: AuthRegistryArtifact,
|
|
10
6
|
ContractInstanceRegistry: ContractInstanceRegistryArtifact,
|
|
11
7
|
ContractClassRegistry: ContractClassRegistryArtifact,
|
|
12
|
-
|
|
13
|
-
FeeJuice: FeeJuiceArtifact,
|
|
14
|
-
PublicChecks: PublicChecksArtifact
|
|
8
|
+
FeeJuice: FeeJuiceArtifact
|
|
15
9
|
};
|
|
16
10
|
export class BundledProtocolContractsProvider {
|
|
17
11
|
getProtocolContractArtifact(name) {
|
|
18
|
-
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
12
|
+
return Promise.resolve(makeProtocolContract(name, ProtocolContractArtifact[name]));
|
|
19
13
|
}
|
|
20
14
|
}
|
package/dest/provider/lazy.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import type { ProtocolContractsProvider } from './protocol_contracts_provider.js
|
|
|
4
4
|
export declare class LazyProtocolContractsProvider implements ProtocolContractsProvider {
|
|
5
5
|
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Byb3ZpZGVyL2xhenkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ3pFLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFbEYscUJBQWEsNkJBQThCLFlBQVcseUJBQXlCO0lBQzdFLDJCQUEyQixDQUFDLElBQUksRUFBRSxvQkFBb0IsR0FBRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FXakY7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/provider/lazy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/provider/lazy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,qBAAa,6BAA8B,YAAW,yBAAyB;IAC7E,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWjF;CACF"}
|
package/dest/provider/lazy.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import { getCanonicalAuthRegistry } from '../auth-registry/lazy.js';
|
|
2
1
|
import { getCanonicalClassRegistry } from '../class-registry/lazy.js';
|
|
3
2
|
import { getCanonicalFeeJuice } from '../fee-juice/lazy.js';
|
|
4
3
|
import { getCanonicalInstanceRegistry } from '../instance-registry/lazy.js';
|
|
5
|
-
import { getCanonicalMultiCallEntrypoint } from '../multi-call-entrypoint/lazy.js';
|
|
6
|
-
import { getCanonicalPublicChecks } from '../public-checks/lazy.js';
|
|
7
4
|
export class LazyProtocolContractsProvider {
|
|
8
5
|
getProtocolContractArtifact(name) {
|
|
9
6
|
switch(name){
|
|
10
|
-
case 'AuthRegistry':
|
|
11
|
-
return getCanonicalAuthRegistry();
|
|
12
7
|
case 'ContractInstanceRegistry':
|
|
13
8
|
return getCanonicalInstanceRegistry();
|
|
14
9
|
case 'ContractClassRegistry':
|
|
15
10
|
return getCanonicalClassRegistry();
|
|
16
|
-
case 'MultiCallEntrypoint':
|
|
17
|
-
return getCanonicalMultiCallEntrypoint();
|
|
18
11
|
case 'FeeJuice':
|
|
19
12
|
return getCanonicalFeeJuice();
|
|
20
|
-
case 'PublicChecks':
|
|
21
|
-
return getCanonicalPublicChecks();
|
|
22
13
|
default:
|
|
23
14
|
throw new Error(`Unknown protocol contract name: ${name}`);
|
|
24
15
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
// Reads compiled Noir artifacts for each protocol contract and derives their addresses, class IDs,
|
|
2
|
+
// bytecode commitments, and other deployment data, emitting everything as precomputed constants into
|
|
3
|
+
// `protocol_contract_data.ts`. This avoids clients repeating the expensive hashing at runtime and
|
|
4
|
+
// ensures a single source of truth for the protocol contracts hash enforced by circuits, P2P, and L1.
|
|
5
|
+
import { CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS, CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, FEE_JUICE_ADDRESS, MAX_PROTOCOL_CONTRACTS } from '@aztec/constants';
|
|
2
6
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
-
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
7
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
8
|
import { createConsoleLogger } from '@aztec/foundation/log';
|
|
6
9
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
7
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import {
|
|
11
|
+
import { computeContractAddressFromInstance, computeInitializationHash, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
12
|
+
import { computeSiloedPrivateLogFirstField } from '@aztec/stdlib/hash';
|
|
13
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
9
14
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
10
15
|
import { promises as fs } from 'fs';
|
|
11
16
|
import path from 'path';
|
|
@@ -16,12 +21,9 @@ const destArtifactsDir = './artifacts';
|
|
|
16
21
|
const outputFilePath = './src/protocol_contract_data.ts';
|
|
17
22
|
const salt = new Fr(1);
|
|
18
23
|
const contractAddressMapping = {
|
|
19
|
-
AuthRegistry: CANONICAL_AUTH_REGISTRY_ADDRESS,
|
|
20
24
|
ContractInstanceRegistry: CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS,
|
|
21
25
|
ContractClassRegistry: CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS,
|
|
22
|
-
|
|
23
|
-
FeeJuice: FEE_JUICE_ADDRESS,
|
|
24
|
-
PublicChecks: PUBLIC_CHECKS_ADDRESS
|
|
26
|
+
FeeJuice: FEE_JUICE_ADDRESS
|
|
25
27
|
};
|
|
26
28
|
async function clearDestDir() {
|
|
27
29
|
try {
|
|
@@ -50,11 +52,33 @@ async function copyArtifact(srcName, destName) {
|
|
|
50
52
|
await fs.copyFile(src, dest);
|
|
51
53
|
return artifact;
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
// Precompute all the expensive contract data that can be obtained from the artifact, to avoid redundant computations in clients.
|
|
56
|
+
// Protocol contracts come from a trusted source, so no class verifications are needed.
|
|
57
|
+
async function computeContractData(artifact, deployer) {
|
|
58
|
+
const loaded = loadContractArtifact(artifact);
|
|
59
|
+
const contractClass = await getContractClassFromArtifact(loaded);
|
|
60
|
+
const constructorArtifact = loaded.functions.find((f)=>f.name === 'constructor');
|
|
61
|
+
const initializationHash = await computeInitializationHash(constructorArtifact, []);
|
|
62
|
+
const instance = {
|
|
63
|
+
version: 2,
|
|
64
|
+
currentContractClassId: contractClass.id,
|
|
65
|
+
originalContractClassId: contractClass.id,
|
|
66
|
+
initializationHash,
|
|
67
|
+
immutablesHash: Fr.ZERO,
|
|
68
|
+
publicKeys: PublicKeys.default(),
|
|
69
|
+
salt,
|
|
70
|
+
deployer
|
|
71
|
+
};
|
|
72
|
+
const address = await computeContractAddressFromInstance(instance);
|
|
73
|
+
return {
|
|
74
|
+
address,
|
|
75
|
+
classId: contractClass.id,
|
|
76
|
+
artifactHash: contractClass.artifactHash,
|
|
77
|
+
privateFunctionsRoot: contractClass.privateFunctionsRoot,
|
|
78
|
+
publicBytecodeCommitment: contractClass.publicBytecodeCommitment,
|
|
79
|
+
initializationHash,
|
|
80
|
+
privateFunctions: contractClass.privateFunctions
|
|
81
|
+
};
|
|
58
82
|
}
|
|
59
83
|
async function generateDeclarationFile(destName) {
|
|
60
84
|
const content = `
|
|
@@ -81,21 +105,44 @@ function generateSalts(names) {
|
|
|
81
105
|
`;
|
|
82
106
|
}
|
|
83
107
|
function generateContractAddresses(names) {
|
|
84
|
-
const addresses = names.map((name)=>`${name}: AztecAddress.
|
|
108
|
+
const addresses = names.map((name)=>`${name}: AztecAddress.fromBigIntUnsafe(${contractAddressMapping[name]}n)`).join(',\n');
|
|
85
109
|
return `
|
|
86
110
|
export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> = {
|
|
87
111
|
${addresses}
|
|
88
112
|
};
|
|
89
113
|
`;
|
|
90
114
|
}
|
|
91
|
-
function generateDerivedAddresses(names,
|
|
115
|
+
function generateDerivedAddresses(names, contractData) {
|
|
92
116
|
return `
|
|
93
117
|
export const ProtocolContractDerivedAddress = {
|
|
94
|
-
${
|
|
118
|
+
${contractData.map((d, i)=>`${names[i]}: AztecAddress.fromStringUnsafe('${d.address.toString()}')`).join(',\n')}
|
|
119
|
+
};
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
function generateClassIdPreimages(names, contractData) {
|
|
123
|
+
return `
|
|
124
|
+
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
125
|
+
${contractData.map((d, i)=>`${names[i]}: Fr.fromString('${d.classId.toString()}')`).join(',\n')}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
129
|
+
${contractData.map((d, i)=>`${names[i]}: {
|
|
130
|
+
artifactHash: Fr.fromString('${d.artifactHash.toString()}'),
|
|
131
|
+
privateFunctionsRoot: Fr.fromString('${d.privateFunctionsRoot.toString()}'),
|
|
132
|
+
publicBytecodeCommitment: Fr.fromString('${d.publicBytecodeCommitment.toString()}'),
|
|
133
|
+
}`).join(',\n')}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
137
|
+
${contractData.map((d, i)=>`${names[i]}: Fr.fromString('${d.initializationHash.toString()}')`).join(',\n')}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
141
|
+
${contractData.map((d, i)=>`${names[i]}: [${d.privateFunctions.map((fn)=>`{ selector: FunctionSelector.fromField(Fr.fromString('${fn.selector.toField().toString()}')), vkHash: Fr.fromString('${fn.vkHash.toString()}') }`).join(', ')}]`).join(',\n')}
|
|
95
142
|
};
|
|
96
143
|
`;
|
|
97
144
|
}
|
|
98
|
-
async function generateProtocolContractsList(names,
|
|
145
|
+
async function generateProtocolContractsList(names, contractData) {
|
|
99
146
|
const list = makeTuple(MAX_PROTOCOL_CONTRACTS, ()=>AztecAddress.zero());
|
|
100
147
|
for(let i = 0; i < names.length; i++){
|
|
101
148
|
const name = names[i];
|
|
@@ -104,11 +151,11 @@ async function generateProtocolContractsList(names, derivedAddresses) {
|
|
|
104
151
|
if (!list[derivedAddressIndex].equals(AztecAddress.zero())) {
|
|
105
152
|
throw new Error(`Duplicate protocol contract address: ${address.toString()}`);
|
|
106
153
|
}
|
|
107
|
-
list[derivedAddressIndex] =
|
|
154
|
+
list[derivedAddressIndex] = contractData[i].address;
|
|
108
155
|
}
|
|
109
156
|
return `
|
|
110
157
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
111
|
-
${list.map((address)=>`AztecAddress.
|
|
158
|
+
${list.map((address)=>`AztecAddress.fromStringUnsafe('${address.toString()}')`).join(',\n')}
|
|
112
159
|
]);
|
|
113
160
|
|
|
114
161
|
export const protocolContractsHash = Fr.fromString('${(await new ProtocolContracts(list).hash()).toString()}');
|
|
@@ -117,16 +164,14 @@ async function generateProtocolContractsList(names, derivedAddresses) {
|
|
|
117
164
|
// Generate the siloed log tags for events emitted via private logs.
|
|
118
165
|
async function generateLogTags() {
|
|
119
166
|
return `
|
|
120
|
-
export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('${await
|
|
121
|
-
CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS,
|
|
122
|
-
CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE
|
|
123
|
-
], GeneratorIndex.PRIVATE_LOG_FIRST_FIELD)}');
|
|
167
|
+
export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('${await computeSiloedPrivateLogFirstField(new AztecAddress(new Fr(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS)), new Fr(CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE))}');
|
|
124
168
|
`;
|
|
125
169
|
}
|
|
126
|
-
async function generateOutputFile(names,
|
|
170
|
+
async function generateOutputFile(names, contractData) {
|
|
127
171
|
const content = `
|
|
128
172
|
// GENERATED FILE - DO NOT EDIT. RUN \`yarn generate\` or \`yarn generate:data\`
|
|
129
173
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
174
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
130
175
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
131
176
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
132
177
|
|
|
@@ -136,9 +181,11 @@ async function generateOutputFile(names, derivedAddresses) {
|
|
|
136
181
|
|
|
137
182
|
${generateContractAddresses(names)}
|
|
138
183
|
|
|
139
|
-
${generateDerivedAddresses(names,
|
|
184
|
+
${generateDerivedAddresses(names, contractData)}
|
|
185
|
+
|
|
186
|
+
${generateClassIdPreimages(names, contractData)}
|
|
140
187
|
|
|
141
|
-
${await generateProtocolContractsList(names,
|
|
188
|
+
${await generateProtocolContractsList(names, contractData)}
|
|
142
189
|
|
|
143
190
|
${await generateLogTags()}
|
|
144
191
|
`;
|
|
@@ -147,16 +194,16 @@ async function generateOutputFile(names, derivedAddresses) {
|
|
|
147
194
|
async function main() {
|
|
148
195
|
await clearDestDir();
|
|
149
196
|
const srcNames = JSON.parse(await fs.readFile(path.join(noirContractsRoot, 'protocol_contracts.json'), 'utf8'));
|
|
150
|
-
const
|
|
197
|
+
const contractDataList = [];
|
|
151
198
|
const destNames = srcNames.map((n)=>n.split('-')[1]);
|
|
152
199
|
for(let i = 0; i < srcNames.length; i++){
|
|
153
200
|
const srcName = srcNames[i];
|
|
154
201
|
const destName = destNames[i];
|
|
155
202
|
const artifact = await copyArtifact(srcName, destName);
|
|
156
203
|
await generateDeclarationFile(destName);
|
|
157
|
-
|
|
204
|
+
contractDataList.push(await computeContractData(artifact, AztecAddress.fromBigIntUnsafe(BigInt(contractAddressMapping[destName]))));
|
|
158
205
|
}
|
|
159
|
-
await generateOutputFile(destNames,
|
|
206
|
+
await generateOutputFile(destNames, contractDataList);
|
|
160
207
|
}
|
|
161
208
|
try {
|
|
162
209
|
await main();
|
package/dest/tests/fixtures.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export declare function getSampleContractClassPublishedEventPayload(): Buffer;
|
|
2
|
-
export declare function getSamplePrivateFunctionBroadcastedEventPayload(): Buffer;
|
|
3
|
-
export declare function getSampleUtilityFunctionBroadcastedEventPayload(): Buffer;
|
|
4
2
|
export declare function getSampleContractInstancePublishedEventPayload(): Buffer;
|
|
5
3
|
export declare function getPathToFixture(name: string): string;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZml4dHVyZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0cy9maXh0dXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSx3QkFBZ0IsMkNBQTJDLElBQUksTUFBTSxDQUdwRTtBQUdELHdCQUFnQiw4Q0FBOEMsSUFBSSxNQUFNLENBR3ZFO0FBRUQsd0JBQWdCLGdCQUFnQixDQUFDLElBQUksRUFBRSxNQUFNLFVBRTVDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/tests/fixtures.ts"],"names":[],"mappings":"AAKA,wBAAgB,2CAA2C,IAAI,MAAM,CAGpE;AAGD,wBAAgB
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/tests/fixtures.ts"],"names":[],"mappings":"AAKA,wBAAgB,2CAA2C,IAAI,MAAM,CAGpE;AAGD,wBAAgB,8CAA8C,IAAI,MAAM,CAGvE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,UAE5C"}
|
package/dest/tests/fixtures.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
2
|
import { dirname, resolve } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
-
// Generated from end-to-end/src/
|
|
4
|
+
// Generated from end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
|
|
5
5
|
export function getSampleContractClassPublishedEventPayload() {
|
|
6
6
|
const path = getPathToFixture('ContractClassPublishedEventData.hex');
|
|
7
7
|
return Buffer.from(readFileSync(path).toString(), 'hex');
|
|
8
8
|
}
|
|
9
|
-
// Generated from end-to-end/src/
|
|
10
|
-
export function getSamplePrivateFunctionBroadcastedEventPayload() {
|
|
11
|
-
const path = getPathToFixture('PrivateFunctionBroadcastedEventData.hex');
|
|
12
|
-
return Buffer.from(readFileSync(path).toString(), 'hex');
|
|
13
|
-
}
|
|
14
|
-
// Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
|
|
15
|
-
export function getSampleUtilityFunctionBroadcastedEventPayload() {
|
|
16
|
-
const path = getPathToFixture('UtilityFunctionBroadcastedEventData.hex');
|
|
17
|
-
return Buffer.from(readFileSync(path).toString(), 'hex');
|
|
18
|
-
}
|
|
19
|
-
// Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
|
|
9
|
+
// Generated from end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1
|
|
20
10
|
export function getSampleContractInstancePublishedEventPayload() {
|
|
21
11
|
const path = getPathToFixture('ContractInstancePublishedEventData.hex');
|
|
22
12
|
return Buffer.from(readFileSync(path).toString(), 'hex');
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aztec/protocol-contracts",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/protocol-contracts",
|
|
4
4
|
"description": "Canonical Noir contracts for the Aztec Network",
|
|
5
|
-
"version": "0.0.1-commit.
|
|
5
|
+
"version": "0.0.1-commit.a4600f49",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dest/index.js",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@aztec/constants": "0.0.1-commit.
|
|
77
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
78
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
76
|
+
"@aztec/constants": "0.0.1-commit.a4600f49",
|
|
77
|
+
"@aztec/foundation": "0.0.1-commit.a4600f49",
|
|
78
|
+
"@aztec/stdlib": "0.0.1-commit.a4600f49",
|
|
79
79
|
"lodash.chunk": "^4.2.0",
|
|
80
80
|
"lodash.omit": "^4.5.0",
|
|
81
81
|
"tslib": "^2.4.0"
|
|
@@ -4,7 +4,7 @@ import { FieldReader } from '@aztec/foundation/serialize';
|
|
|
4
4
|
import { bufferFromFields } from '@aztec/stdlib/abi';
|
|
5
5
|
import {
|
|
6
6
|
type ContractClassPublic,
|
|
7
|
-
|
|
7
|
+
type ContractClassPublicWithCommitment,
|
|
8
8
|
computePublicBytecodeCommitment,
|
|
9
9
|
} from '@aztec/stdlib/contract';
|
|
10
10
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
@@ -36,7 +36,12 @@ export class ContractClassPublishedEvent {
|
|
|
36
36
|
const version = reader.readField().toNumber();
|
|
37
37
|
const artifactHash = reader.readField();
|
|
38
38
|
const privateFunctionsRoot = reader.readField();
|
|
39
|
-
const
|
|
39
|
+
const bytecodeFields = reader.readFieldArray(fieldsWithoutTag.length - reader.cursor);
|
|
40
|
+
// The fixed-size class log can hold at most this many packed-bytecode bytes (every payload field
|
|
41
|
+
// carries 31 bytes). Bound the declared length to it so a malformed log can't declare a multi-MiB
|
|
42
|
+
// length backed by a tiny payload and force a large allocation during early (pre-proof) validation.
|
|
43
|
+
const maxByteLength = (bytecodeFields.length - 1) * (Fr.SIZE_IN_BYTES - 1);
|
|
44
|
+
const packedPublicBytecode = bufferFromFields(bytecodeFields, maxByteLength);
|
|
40
45
|
|
|
41
46
|
return new ContractClassPublishedEvent(
|
|
42
47
|
contractClassId,
|
|
@@ -47,34 +52,23 @@ export class ContractClassPublishedEvent {
|
|
|
47
52
|
);
|
|
48
53
|
}
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
artifactHash: this.artifactHash,
|
|
53
|
-
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
54
|
-
publicBytecodeCommitment: await computePublicBytecodeCommitment(this.packedPublicBytecode),
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
if (!computedClassId.equals(this.contractClassId)) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
`Invalid contract class id: computed ${computedClassId.toString()} but event broadcasted ${this.contractClassId.toString()}`,
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (this.version !== 1) {
|
|
64
|
-
throw new Error(`Unexpected contract class version ${this.version}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
55
|
+
/** Converts the event to a contract class, without computing or validating the bytecode commitment. */
|
|
56
|
+
toContractClassPublic(): ContractClassPublic {
|
|
67
57
|
return {
|
|
68
58
|
id: this.contractClassId,
|
|
69
59
|
artifactHash: this.artifactHash,
|
|
70
60
|
packedBytecode: this.packedPublicBytecode,
|
|
71
61
|
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
72
|
-
version: this.version,
|
|
73
|
-
privateFunctions: [],
|
|
74
|
-
utilityFunctions: [],
|
|
62
|
+
version: this.version as 1,
|
|
75
63
|
};
|
|
76
64
|
}
|
|
77
65
|
|
|
66
|
+
/** Converts the event to a contract class with its bytecode commitment (expensive). */
|
|
67
|
+
async toContractClassPublicWithBytecodeCommitment(): Promise<ContractClassPublicWithCommitment> {
|
|
68
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(this.packedPublicBytecode);
|
|
69
|
+
return { ...this.toContractClassPublic(), publicBytecodeCommitment };
|
|
70
|
+
}
|
|
71
|
+
|
|
78
72
|
public static extractContractClassEvents(logs: ContractClassLog[]): ContractClassPublishedEvent[] {
|
|
79
73
|
return logs
|
|
80
74
|
.filter((log: ContractClassLog) => ContractClassPublishedEvent.isContractClassPublishedEvent(log))
|
|
@@ -6,18 +6,16 @@ import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
|
6
6
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
7
|
|
|
8
8
|
export * from './contract_class_published_event.js';
|
|
9
|
-
export * from './private_function_broadcasted_event.js';
|
|
10
|
-
export * from './utility_function_broadcasted_event.js';
|
|
11
9
|
|
|
12
10
|
export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassRegistryJson as NoirCompiledContract);
|
|
13
11
|
|
|
14
12
|
let protocolContract: ProtocolContract;
|
|
15
13
|
|
|
16
14
|
/** Returns the canonical deployment of the contract. */
|
|
17
|
-
export
|
|
15
|
+
export function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
18
16
|
if (!protocolContract) {
|
|
19
17
|
const artifact = ContractClassRegistryArtifact;
|
|
20
|
-
protocolContract =
|
|
18
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', artifact);
|
|
21
19
|
}
|
|
22
|
-
return protocolContract;
|
|
20
|
+
return Promise.resolve(protocolContract);
|
|
23
21
|
}
|
|
@@ -4,8 +4,6 @@ import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
|
4
4
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
5
5
|
|
|
6
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
7
|
|
|
10
8
|
let protocolContract: ProtocolContract;
|
|
11
9
|
let protocolContractArtifact: ContractArtifact;
|
|
@@ -14,7 +12,7 @@ export async function getContractClassRegistryArtifact(): Promise<ContractArtifa
|
|
|
14
12
|
if (!protocolContractArtifact) {
|
|
15
13
|
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
16
14
|
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
17
|
-
// Even if now supported by
|
|
15
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
18
16
|
// "text/javascript"
|
|
19
17
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
20
18
|
const { default: contractClassRegistryJson } = await import('../../artifacts/ContractClassRegistry.json');
|
|
@@ -27,7 +25,7 @@ export async function getContractClassRegistryArtifact(): Promise<ContractArtifa
|
|
|
27
25
|
export async function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
28
26
|
if (!protocolContract) {
|
|
29
27
|
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
30
|
-
protocolContract =
|
|
28
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
31
29
|
}
|
|
32
30
|
return protocolContract;
|
|
33
31
|
}
|
package/src/fee-juice/index.ts
CHANGED
|
@@ -14,11 +14,11 @@ export const FeeJuiceArtifact = loadContractArtifact(FeeJuiceJson as NoirCompile
|
|
|
14
14
|
let protocolContract: ProtocolContract;
|
|
15
15
|
|
|
16
16
|
/** Returns the canonical deployment of the contract. */
|
|
17
|
-
export
|
|
17
|
+
export function getCanonicalFeeJuice(): Promise<ProtocolContract> {
|
|
18
18
|
if (!protocolContract) {
|
|
19
|
-
protocolContract =
|
|
19
|
+
protocolContract = makeProtocolContract('FeeJuice', FeeJuiceArtifact);
|
|
20
20
|
}
|
|
21
|
-
return protocolContract;
|
|
21
|
+
return Promise.resolve(protocolContract);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
package/src/fee-juice/lazy.ts
CHANGED
|
@@ -10,7 +10,7 @@ export async function getFeeJuiceArtifact(): Promise<ContractArtifact> {
|
|
|
10
10
|
if (!protocolContractArtifact) {
|
|
11
11
|
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
12
12
|
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
13
|
-
// Even if now supported by
|
|
13
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
14
14
|
// "text/javascript"
|
|
15
15
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
16
16
|
const { default: feeJuiceJson } = await import('../../artifacts/FeeJuice.json');
|
|
@@ -23,7 +23,7 @@ export async function getFeeJuiceArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalFeeJuice(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const feeJuiceArtifact = await getFeeJuiceArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('FeeJuice', feeJuiceArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|