@aztec/protocol-contracts 0.0.1-commit.993d52e → 0.0.1-commit.9a89641
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 +2640 -460
- package/artifacts/ContractInstanceRegistry.json +3507 -920
- package/artifacts/FeeJuice.json +3990 -960
- 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 +18 -18
- package/dest/class-registry/index.d.ts +1 -3
- package/dest/class-registry/index.d.ts.map +1 -1
- package/dest/class-registry/index.js +0 -2
- package/dest/class-registry/lazy.d.ts +1 -3
- package/dest/class-registry/lazy.d.ts.map +1 -1
- package/dest/class-registry/lazy.js +1 -3
- package/dest/fee-juice/lazy.js +1 -1
- package/dest/instance-registry/contract_instance_published_event.d.ts +3 -2
- package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -1
- package/dest/instance-registry/contract_instance_published_event.js +7 -3
- package/dest/instance-registry/lazy.js +1 -1
- package/dest/make_protocol_contract.d.ts +1 -1
- package/dest/make_protocol_contract.d.ts.map +1 -1
- package/dest/make_protocol_contract.js +3 -1
- package/dest/protocol_contract.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 +2 -5
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +38 -84
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +1 -7
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +0 -9
- package/dest/scripts/generate_data.js +12 -13
- 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 +5 -4
- package/src/class-registry/contract_class_published_event.ts +17 -23
- package/src/class-registry/index.ts +0 -2
- package/src/class-registry/lazy.ts +1 -3
- package/src/fee-juice/lazy.ts +1 -1
- package/src/instance-registry/contract_instance_published_event.ts +5 -1
- package/src/instance-registry/lazy.ts +1 -1
- package/src/make_protocol_contract.ts +3 -1
- package/src/protocol_contract.ts +9 -1
- package/src/protocol_contract_data.ts +39 -75
- package/src/provider/bundle.ts +0 -6
- 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 -2769
- package/artifacts/PublicChecks.d.json.ts +0 -5
- package/artifacts/PublicChecks.json +0 -980
- 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
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
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// bytecode commitments, and other deployment data, emitting everything as precomputed constants into
|
|
3
3
|
// `protocol_contract_data.ts`. This avoids clients repeating the expensive hashing at runtime and
|
|
4
4
|
// ensures a single source of truth for the protocol contracts hash enforced by circuits, P2P, and L1.
|
|
5
|
-
import {
|
|
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';
|
|
6
6
|
import { makeTuple } from '@aztec/foundation/array';
|
|
7
7
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
8
|
import { createConsoleLogger } from '@aztec/foundation/log';
|
|
9
|
+
import { fileURLToPath } from '@aztec/foundation/url';
|
|
9
10
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
10
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
12
|
import { computeContractAddressFromInstance, computeInitializationHash, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
@@ -15,18 +16,15 @@ import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
|
15
16
|
import { promises as fs } from 'fs';
|
|
16
17
|
import path from 'path';
|
|
17
18
|
const log = createConsoleLogger('autogenerate');
|
|
18
|
-
const
|
|
19
|
-
const srcPath = path.join(
|
|
19
|
+
const artifactsPkgRoot = path.dirname(fileURLToPath(import.meta.resolve('@aztec/protocol-contracts-artifacts/package.json')));
|
|
20
|
+
const srcPath = path.join(artifactsPkgRoot, 'artifacts');
|
|
20
21
|
const destArtifactsDir = './artifacts';
|
|
21
22
|
const outputFilePath = './src/protocol_contract_data.ts';
|
|
22
23
|
const salt = new Fr(1);
|
|
23
24
|
const contractAddressMapping = {
|
|
24
|
-
AuthRegistry: CANONICAL_AUTH_REGISTRY_ADDRESS,
|
|
25
25
|
ContractInstanceRegistry: CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS,
|
|
26
26
|
ContractClassRegistry: CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS,
|
|
27
|
-
|
|
28
|
-
FeeJuice: FEE_JUICE_ADDRESS,
|
|
29
|
-
PublicChecks: PUBLIC_CHECKS_ADDRESS
|
|
27
|
+
FeeJuice: FEE_JUICE_ADDRESS
|
|
30
28
|
};
|
|
31
29
|
async function clearDestDir() {
|
|
32
30
|
try {
|
|
@@ -63,10 +61,11 @@ async function computeContractData(artifact, deployer) {
|
|
|
63
61
|
const constructorArtifact = loaded.functions.find((f)=>f.name === 'constructor');
|
|
64
62
|
const initializationHash = await computeInitializationHash(constructorArtifact, []);
|
|
65
63
|
const instance = {
|
|
66
|
-
version:
|
|
64
|
+
version: 2,
|
|
67
65
|
currentContractClassId: contractClass.id,
|
|
68
66
|
originalContractClassId: contractClass.id,
|
|
69
67
|
initializationHash,
|
|
68
|
+
immutablesHash: Fr.ZERO,
|
|
70
69
|
publicKeys: PublicKeys.default(),
|
|
71
70
|
salt,
|
|
72
71
|
deployer
|
|
@@ -107,7 +106,7 @@ function generateSalts(names) {
|
|
|
107
106
|
`;
|
|
108
107
|
}
|
|
109
108
|
function generateContractAddresses(names) {
|
|
110
|
-
const addresses = names.map((name)=>`${name}: AztecAddress.
|
|
109
|
+
const addresses = names.map((name)=>`${name}: AztecAddress.fromBigIntUnsafe(${contractAddressMapping[name]}n)`).join(',\n');
|
|
111
110
|
return `
|
|
112
111
|
export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> = {
|
|
113
112
|
${addresses}
|
|
@@ -117,7 +116,7 @@ function generateContractAddresses(names) {
|
|
|
117
116
|
function generateDerivedAddresses(names, contractData) {
|
|
118
117
|
return `
|
|
119
118
|
export const ProtocolContractDerivedAddress = {
|
|
120
|
-
${contractData.map((d, i)=>`${names[i]}: AztecAddress.
|
|
119
|
+
${contractData.map((d, i)=>`${names[i]}: AztecAddress.fromStringUnsafe('${d.address.toString()}')`).join(',\n')}
|
|
121
120
|
};
|
|
122
121
|
`;
|
|
123
122
|
}
|
|
@@ -157,7 +156,7 @@ async function generateProtocolContractsList(names, contractData) {
|
|
|
157
156
|
}
|
|
158
157
|
return `
|
|
159
158
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
160
|
-
${list.map((address)=>`AztecAddress.
|
|
159
|
+
${list.map((address)=>`AztecAddress.fromStringUnsafe('${address.toString()}')`).join(',\n')}
|
|
161
160
|
]);
|
|
162
161
|
|
|
163
162
|
export const protocolContractsHash = Fr.fromString('${(await new ProtocolContracts(list).hash()).toString()}');
|
|
@@ -195,7 +194,7 @@ async function generateOutputFile(names, contractData) {
|
|
|
195
194
|
}
|
|
196
195
|
async function main() {
|
|
197
196
|
await clearDestDir();
|
|
198
|
-
const srcNames = JSON.parse(await fs.readFile(path.join(
|
|
197
|
+
const srcNames = JSON.parse(await fs.readFile(path.join(artifactsPkgRoot, 'protocol_contracts.json'), 'utf8'));
|
|
199
198
|
const contractDataList = [];
|
|
200
199
|
const destNames = srcNames.map((n)=>n.split('-')[1]);
|
|
201
200
|
for(let i = 0; i < srcNames.length; i++){
|
|
@@ -203,7 +202,7 @@ async function main() {
|
|
|
203
202
|
const destName = destNames[i];
|
|
204
203
|
const artifact = await copyArtifact(srcName, destName);
|
|
205
204
|
await generateDeclarationFile(destName);
|
|
206
|
-
contractDataList.push(await computeContractData(artifact, AztecAddress.
|
|
205
|
+
contractDataList.push(await computeContractData(artifact, AztecAddress.fromBigIntUnsafe(BigInt(contractAddressMapping[destName]))));
|
|
207
206
|
}
|
|
208
207
|
await generateOutputFile(destNames, contractDataList);
|
|
209
208
|
}
|
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.9a89641",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dest/index.js",
|
|
@@ -73,14 +73,15 @@
|
|
|
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.9a89641",
|
|
77
|
+
"@aztec/foundation": "0.0.1-commit.9a89641",
|
|
78
|
+
"@aztec/stdlib": "0.0.1-commit.9a89641",
|
|
79
79
|
"lodash.chunk": "^4.2.0",
|
|
80
80
|
"lodash.omit": "^4.5.0",
|
|
81
81
|
"tslib": "^2.4.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
+
"@aztec/protocol-contracts-artifacts": "6.0.0-nightly.20260807",
|
|
84
85
|
"@jest/globals": "^30.0.0",
|
|
85
86
|
"@types/jest": "^30.0.0",
|
|
86
87
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -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';
|
|
@@ -29,14 +29,19 @@ export class ContractClassPublishedEvent {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
static fromLog(log: ContractClassLog) {
|
|
32
|
-
// See how the log is serialized in `noir-projects/noir-contracts/contracts/protocol/contract_class_registry_contract/src/events/class_published.nr`.
|
|
32
|
+
// See how the log is serialized in `noir-projects/fnd/noir-contracts/contracts/protocol/contract_class_registry_contract/src/events/class_published.nr`.
|
|
33
33
|
const fieldsWithoutTag = log.fields.fields.slice(1);
|
|
34
34
|
const reader = new FieldReader(fieldsWithoutTag);
|
|
35
35
|
const contractClassId = reader.readField();
|
|
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,8 +6,6 @@ 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
|
|
|
@@ -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');
|
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');
|
|
@@ -15,6 +15,7 @@ export class ContractInstancePublishedEvent {
|
|
|
15
15
|
public readonly salt: Fr,
|
|
16
16
|
public readonly contractClassId: Fr,
|
|
17
17
|
public readonly initializationHash: Fr,
|
|
18
|
+
public readonly immutablesHash: Fr,
|
|
18
19
|
public readonly publicKeys: PublicKeys,
|
|
19
20
|
public readonly deployer: AztecAddress,
|
|
20
21
|
) {}
|
|
@@ -31,6 +32,7 @@ export class ContractInstancePublishedEvent {
|
|
|
31
32
|
const salt = reader.readObject(Fr);
|
|
32
33
|
const contractClassId = reader.readObject(Fr);
|
|
33
34
|
const initializationHash = reader.readObject(Fr);
|
|
35
|
+
const immutablesHash = reader.readObject(Fr);
|
|
34
36
|
const publicKeys = reader.readObject(PublicKeys);
|
|
35
37
|
const deployer = reader.readObject(AztecAddress);
|
|
36
38
|
|
|
@@ -40,13 +42,14 @@ export class ContractInstancePublishedEvent {
|
|
|
40
42
|
salt,
|
|
41
43
|
contractClassId,
|
|
42
44
|
initializationHash,
|
|
45
|
+
immutablesHash,
|
|
43
46
|
publicKeys,
|
|
44
47
|
deployer,
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
toContractInstance(): ContractInstanceWithAddress {
|
|
49
|
-
if (this.version !==
|
|
52
|
+
if (this.version !== 2) {
|
|
50
53
|
throw new Error(`Unexpected contract instance version ${this.version}`);
|
|
51
54
|
}
|
|
52
55
|
|
|
@@ -56,6 +59,7 @@ export class ContractInstancePublishedEvent {
|
|
|
56
59
|
currentContractClassId: this.contractClassId,
|
|
57
60
|
originalContractClassId: this.contractClassId,
|
|
58
61
|
initializationHash: this.initializationHash,
|
|
62
|
+
immutablesHash: this.immutablesHash,
|
|
59
63
|
publicKeys: this.publicKeys,
|
|
60
64
|
salt: this.salt,
|
|
61
65
|
deployer: this.deployer,
|
|
@@ -13,7 +13,7 @@ export async function getContractInstanceRegistryArtifact(): Promise<ContractArt
|
|
|
13
13
|
if (!protocolContractArtifact) {
|
|
14
14
|
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
15
15
|
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
16
|
-
// Even if now supported by
|
|
16
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
17
17
|
// "text/javascript"
|
|
18
18
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
19
19
|
const { default: contractInstanceRegistryJson } = await import('../../artifacts/ContractInstanceRegistry.json');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
1
2
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
3
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
4
|
|
|
@@ -34,10 +35,11 @@ export function makeProtocolContract(name: ProtocolContractName, artifact: Contr
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
const instance = {
|
|
37
|
-
version:
|
|
38
|
+
version: 2 as const,
|
|
38
39
|
currentContractClassId: classId,
|
|
39
40
|
originalContractClassId: classId,
|
|
40
41
|
initializationHash,
|
|
42
|
+
immutablesHash: Fr.ZERO, // Protocol Contracts Have No Immutables
|
|
41
43
|
publicKeys: PublicKeys.default(),
|
|
42
44
|
salt,
|
|
43
45
|
deployer: address,
|
package/src/protocol_contract.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
1
2
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
import type { ContractClassIdPreimage, ContractClassWithId, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
5
|
|
|
5
|
-
import { ProtocolContractAddress } from './protocol_contract_data.js';
|
|
6
|
+
import { ProtocolContractAddress, ProtocolContractClassId } from './protocol_contract_data.js';
|
|
6
7
|
|
|
7
8
|
/** Represents a canonical contract in the protocol. */
|
|
8
9
|
export interface ProtocolContract {
|
|
@@ -20,4 +21,11 @@ export function isProtocolContract(address: AztecAddress) {
|
|
|
20
21
|
return Object.values(ProtocolContractAddress).some(a => a.equals(address));
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
const protocolContractClassIds = new Set(Object.values(ProtocolContractClassId).map(id => id.toString()));
|
|
25
|
+
|
|
26
|
+
/** Returns whether the given contract class id belongs to a bundled protocol contract. */
|
|
27
|
+
export function isProtocolContractClass(classId: Fr): boolean {
|
|
28
|
+
return protocolContractClassIds.has(classId.toString());
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
export { type ProtocolContractsProvider } from './provider/protocol_contracts_provider.js';
|
|
@@ -7,12 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export const protocolContractNames = [
|
|
10
|
-
'
|
|
11
|
-
'ContractInstanceRegistry',
|
|
10
|
+
'ContractInstanceRegistry',
|
|
12
11
|
'ContractClassRegistry',
|
|
13
|
-
'
|
|
14
|
-
'FeeJuice',
|
|
15
|
-
'PublicChecks'
|
|
12
|
+
'FeeJuice'
|
|
16
13
|
] as const;
|
|
17
14
|
|
|
18
15
|
export type ProtocolContractName = typeof protocolContractNames[number];
|
|
@@ -20,115 +17,82 @@
|
|
|
20
17
|
|
|
21
18
|
|
|
22
19
|
export const ProtocolContractSalt: Record<ProtocolContractName, Fr> = {
|
|
23
|
-
|
|
24
|
-
ContractInstanceRegistry: new Fr(1),
|
|
20
|
+
ContractInstanceRegistry: new Fr(1),
|
|
25
21
|
ContractClassRegistry: new Fr(1),
|
|
26
|
-
|
|
27
|
-
FeeJuice: new Fr(1),
|
|
28
|
-
PublicChecks: new Fr(1)
|
|
22
|
+
FeeJuice: new Fr(1)
|
|
29
23
|
};
|
|
30
24
|
|
|
31
25
|
|
|
32
26
|
|
|
33
27
|
export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
MultiCallEntrypoint: AztecAddress.fromBigInt(4n),
|
|
38
|
-
FeeJuice: AztecAddress.fromBigInt(5n),
|
|
39
|
-
PublicChecks: AztecAddress.fromBigInt(6n)
|
|
28
|
+
ContractInstanceRegistry: AztecAddress.fromBigIntUnsafe(2n),
|
|
29
|
+
ContractClassRegistry: AztecAddress.fromBigIntUnsafe(1n),
|
|
30
|
+
FeeJuice: AztecAddress.fromBigIntUnsafe(3n)
|
|
40
31
|
};
|
|
41
32
|
|
|
42
33
|
|
|
43
34
|
|
|
44
35
|
export const ProtocolContractDerivedAddress = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
MultiCallEntrypoint: AztecAddress.fromString('0x230d0b47ba6d5ed99afb89d584f32ff33438b64f51000f252a140cf995781628'),
|
|
49
|
-
FeeJuice: AztecAddress.fromString('0x204913186c0dd70015d05bf9100a12e31ccb7cc2527aacdfae0c19ad6439fcf4'),
|
|
50
|
-
PublicChecks: AztecAddress.fromString('0x1198142fd84a58c0ab22d5fde371ce527042db49487e05206a326ad154952ac8')
|
|
36
|
+
ContractInstanceRegistry: AztecAddress.fromStringUnsafe('0x2ce1dfe11c45332d557e8302d624b011eb471f0dfa40d2fae64d9fb21590321b'),
|
|
37
|
+
ContractClassRegistry: AztecAddress.fromStringUnsafe('0x1bbb52d2b4ac8c634f4b5026f2228580627c918895c369495f71caae13d996fe'),
|
|
38
|
+
FeeJuice: AztecAddress.fromStringUnsafe('0x258a4892dd83d064f6f250601711a82a7b2aaa20f39dbab216237af3ae0c63f2')
|
|
51
39
|
};
|
|
52
40
|
|
|
53
41
|
|
|
54
42
|
|
|
55
43
|
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
MultiCallEntrypoint: Fr.fromString('0x1acd7ab8bf186c16eafc9c4fe9049f35df27e172bb2d8319a2a22ddd0006966d'),
|
|
60
|
-
FeeJuice: Fr.fromString('0x16b2d5ef5044c11126a16ccdb3778082eb423375977da9458d493fdf84505e81'),
|
|
61
|
-
PublicChecks: Fr.fromString('0x03f2ebaef8d692422185e35d8fe35d0bb7289702cf023b525c022d77fc6b5ed5')
|
|
44
|
+
ContractInstanceRegistry: Fr.fromString('0x265816820ef83a476c1725199f5b25fefffcf30d564b31ae95fa8eeee579aa30'),
|
|
45
|
+
ContractClassRegistry: Fr.fromString('0x0026d0944a8b8204b840c37cf238b145bdd6b1af9daf59eeb5e689022a708e5e'),
|
|
46
|
+
FeeJuice: Fr.fromString('0x2a58e1588a3ee6ef0d4c951051959789ec8a3680c551f74148f4b4dab7a3df9d')
|
|
62
47
|
};
|
|
63
48
|
|
|
64
49
|
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
65
|
-
|
|
66
|
-
artifactHash: Fr.fromString('
|
|
67
|
-
privateFunctionsRoot: Fr.fromString('
|
|
68
|
-
publicBytecodeCommitment: Fr.fromString('
|
|
69
|
-
},
|
|
70
|
-
ContractInstanceRegistry: {
|
|
71
|
-
artifactHash: Fr.fromString('0x18601566bacdca7a5a40528f221b04ee7b74f382e6cd34fbdf69d31c50d5ee88'),
|
|
72
|
-
privateFunctionsRoot: Fr.fromString('0x136a6705c7ad1d47f65cb881a56909d4c78d3fa8944f5b103734cd91e654ed63'),
|
|
73
|
-
publicBytecodeCommitment: Fr.fromString('0x01c573f470ba9a17d362c7dd5a28931c39432f9ce527555049c71432f895ad6c'),
|
|
50
|
+
ContractInstanceRegistry: {
|
|
51
|
+
artifactHash: Fr.fromString('0x19835337f0aee2e9042f3a0ae0d334bdb39ecb22794b40d2670d26b2ca72b98f'),
|
|
52
|
+
privateFunctionsRoot: Fr.fromString('0x05bb912d9d2871492d76c610472544d8219df70aa874768f9667e99861d7971f'),
|
|
53
|
+
publicBytecodeCommitment: Fr.fromString('0x1a226919cd754b17c3c32ad430ecb2ce41117aa6bab5d52f070d3ab4c103c45f'),
|
|
74
54
|
},
|
|
75
55
|
ContractClassRegistry: {
|
|
76
|
-
artifactHash: Fr.fromString('
|
|
77
|
-
privateFunctionsRoot: Fr.fromString('
|
|
78
|
-
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
79
|
-
},
|
|
80
|
-
MultiCallEntrypoint: {
|
|
81
|
-
artifactHash: Fr.fromString('0x0d30526b6b786cf887d7e44ba59d2e9561d5791b0e3c78c681d0499ae45b225a'),
|
|
82
|
-
privateFunctionsRoot: Fr.fromString('0x266505ecb7c02ce6e227227c0b6bdb44713c8ecd43164ee7bb00b8fb340e8b03'),
|
|
56
|
+
artifactHash: Fr.fromString('0x0d0ef0a61d9c829c306eee702aa7914299d58e7d3fc9f11d5aebd38c838fa1d0'),
|
|
57
|
+
privateFunctionsRoot: Fr.fromString('0x119c77be6d76c221642b63a337d94bf7b6ed8f872927ef3645c7e6b5002baa34'),
|
|
83
58
|
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
84
59
|
},
|
|
85
60
|
FeeJuice: {
|
|
86
|
-
artifactHash: Fr.fromString('
|
|
87
|
-
privateFunctionsRoot: Fr.fromString('
|
|
88
|
-
publicBytecodeCommitment: Fr.fromString('
|
|
89
|
-
},
|
|
90
|
-
PublicChecks: {
|
|
91
|
-
artifactHash: Fr.fromString('0x228ea8af66ff150f40a4b01b64115d12777b2f7fd3a4bfc0d97d38a91f139ef6'),
|
|
92
|
-
privateFunctionsRoot: Fr.fromString('0x067243231eddf4222f3911defbba7705aff06ed45960b27f6f91319196ef97e1'),
|
|
93
|
-
publicBytecodeCommitment: Fr.fromString('0x2d0834fc9468fd2092091852543a2fbd7b6b313c7e5e4defe8730c8065366a03'),
|
|
61
|
+
artifactHash: Fr.fromString('0x2686d931d674aa3a340ad779b9464901ea46b645570f62ddf6beeafcab989e5b'),
|
|
62
|
+
privateFunctionsRoot: Fr.fromString('0x1c4bf54a4a33e3b9eae6f816dfc81e128d76d2646807a5443598c8adbd47f81f'),
|
|
63
|
+
publicBytecodeCommitment: Fr.fromString('0x1d4b1a8f71b8250d4fb65f8e16a4604e9165648279f47d80e024ce2684c4bdfb'),
|
|
94
64
|
}
|
|
95
65
|
};
|
|
96
66
|
|
|
97
67
|
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
98
|
-
|
|
99
|
-
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
68
|
+
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
100
69
|
ContractClassRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
101
|
-
|
|
102
|
-
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
103
|
-
PublicChecks: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
70
|
+
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
104
71
|
};
|
|
105
72
|
|
|
106
73
|
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
MultiCallEntrypoint: [{ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f04908a9')), vkHash: Fr.fromString('0x21732ab3cecf633e4c31a030df62c93e35a005b89941fdab568d2818c1355192') }],
|
|
111
|
-
FeeJuice: [{ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000cbe67243')), vkHash: Fr.fromString('0x2ad6083b4595f8076c014e5152191013167ab1b5a31ad0cbb06490054c7c59ae') }, { selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000e8d374b6')), vkHash: Fr.fromString('0x05aaffffdf797625ff24575d939339303775c5db77fb6bdcecbf955f726fd071') }],
|
|
112
|
-
PublicChecks: []
|
|
74
|
+
ContractInstanceRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000077cff62f')), vkHash: Fr.fromString('0x19172c0acecd517dd8995c2e36178ca2aa16cbe001c3606d8cd848776ab80d23') }],
|
|
75
|
+
ContractClassRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000006934ed0d')), vkHash: Fr.fromString('0x1241fdbf61631c59b977bb6a520cafe3169604036705b8680dea59f05fb71251') }],
|
|
76
|
+
FeeJuice: [{ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000cbe67243')), vkHash: Fr.fromString('0x0bdf2e5c4467f295f8defb436546a7f2e642e7fe75786d0d54aef497b76527a1') }, { selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000e8d374b6')), vkHash: Fr.fromString('0x2616a94d2d2981737c31ed7d74b9fd32ddc8376bf436dd60fb2507662b47c6dd') }]
|
|
113
77
|
};
|
|
114
78
|
|
|
115
79
|
|
|
116
80
|
|
|
117
81
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
118
|
-
AztecAddress.
|
|
119
|
-
AztecAddress.
|
|
120
|
-
AztecAddress.
|
|
121
|
-
AztecAddress.
|
|
122
|
-
AztecAddress.
|
|
123
|
-
AztecAddress.
|
|
124
|
-
AztecAddress.
|
|
125
|
-
AztecAddress.
|
|
126
|
-
AztecAddress.
|
|
127
|
-
AztecAddress.
|
|
128
|
-
AztecAddress.
|
|
82
|
+
AztecAddress.fromStringUnsafe('0x1bbb52d2b4ac8c634f4b5026f2228580627c918895c369495f71caae13d996fe'),
|
|
83
|
+
AztecAddress.fromStringUnsafe('0x2ce1dfe11c45332d557e8302d624b011eb471f0dfa40d2fae64d9fb21590321b'),
|
|
84
|
+
AztecAddress.fromStringUnsafe('0x258a4892dd83d064f6f250601711a82a7b2aaa20f39dbab216237af3ae0c63f2'),
|
|
85
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
86
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
87
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
88
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
89
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
90
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
91
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
92
|
+
AztecAddress.fromStringUnsafe('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
129
93
|
]);
|
|
130
94
|
|
|
131
|
-
export const protocolContractsHash = Fr.fromString('
|
|
95
|
+
export const protocolContractsHash = Fr.fromString('0x08d0026a4983c49638d0910859942c6648d5ea0a3a152c8a376e4983d0a003d9');
|
|
132
96
|
|
|
133
97
|
|
|
134
98
|
|
package/src/provider/bundle.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
|
|
3
|
-
import { AuthRegistryArtifact } from '../auth-registry/index.js';
|
|
4
3
|
import { ContractClassRegistryArtifact } from '../class-registry/index.js';
|
|
5
4
|
import { FeeJuiceArtifact } from '../fee-juice/index.js';
|
|
6
5
|
import { ContractInstanceRegistryArtifact } from '../instance-registry/index.js';
|
|
7
6
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
8
|
-
import { MultiCallEntrypointArtifact } from '../multi-call-entrypoint/index.js';
|
|
9
7
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
10
8
|
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
11
|
-
import { PublicChecksArtifact } from '../public-checks/index.js';
|
|
12
9
|
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
13
10
|
|
|
14
11
|
export const ProtocolContractArtifact: Record<ProtocolContractName, ContractArtifact> = {
|
|
15
|
-
AuthRegistry: AuthRegistryArtifact,
|
|
16
12
|
ContractInstanceRegistry: ContractInstanceRegistryArtifact,
|
|
17
13
|
ContractClassRegistry: ContractClassRegistryArtifact,
|
|
18
|
-
MultiCallEntrypoint: MultiCallEntrypointArtifact,
|
|
19
14
|
FeeJuice: FeeJuiceArtifact,
|
|
20
|
-
PublicChecks: PublicChecksArtifact,
|
|
21
15
|
};
|
|
22
16
|
|
|
23
17
|
export class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
package/src/provider/lazy.ts
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
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
4
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
5
|
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
8
|
-
import { getCanonicalPublicChecks } from '../public-checks/lazy.js';
|
|
9
6
|
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
10
7
|
|
|
11
8
|
export class LazyProtocolContractsProvider implements ProtocolContractsProvider {
|
|
12
9
|
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract> {
|
|
13
10
|
switch (name) {
|
|
14
|
-
case 'AuthRegistry':
|
|
15
|
-
return getCanonicalAuthRegistry();
|
|
16
11
|
case 'ContractInstanceRegistry':
|
|
17
12
|
return getCanonicalInstanceRegistry();
|
|
18
13
|
case 'ContractClassRegistry':
|
|
19
14
|
return getCanonicalClassRegistry();
|
|
20
|
-
case 'MultiCallEntrypoint':
|
|
21
|
-
return getCanonicalMultiCallEntrypoint();
|
|
22
15
|
case 'FeeJuice':
|
|
23
16
|
return getCanonicalFeeJuice();
|
|
24
|
-
case 'PublicChecks':
|
|
25
|
-
return getCanonicalPublicChecks();
|
|
26
17
|
default:
|
|
27
18
|
throw new Error(`Unknown protocol contract name: ${name}`);
|
|
28
19
|
}
|