@aztec/protocol-contracts 4.0.0-devnet.1-patch.1 → 4.0.0-devnet.2-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/AuthRegistry.json +26 -26
- package/artifacts/ContractClassRegistry.json +52 -32
- package/artifacts/ContractInstanceRegistry.json +32 -32
- package/artifacts/FeeJuice.json +29 -29
- package/artifacts/MultiCallEntrypoint.json +29 -29
- package/artifacts/PublicChecks.json +19 -19
- package/dest/auth-registry/index.d.ts +1 -1
- package/dest/auth-registry/index.d.ts.map +1 -1
- package/dest/auth-registry/index.js +3 -3
- package/dest/auth-registry/lazy.js +1 -1
- package/dest/class-registry/index.d.ts +1 -1
- package/dest/class-registry/index.d.ts.map +1 -1
- package/dest/class-registry/index.js +3 -3
- package/dest/class-registry/lazy.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +28 -14
- package/dest/multi-call-entrypoint/index.d.ts +1 -1
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
- package/dest/multi-call-entrypoint/index.js +3 -3
- package/dest/multi-call-entrypoint/lazy.js +1 -1
- package/dest/protocol_contract_data.d.ts +13 -1
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +99 -13
- package/dest/provider/bundle.js +1 -1
- package/dest/public-checks/index.d.ts +1 -1
- package/dest/public-checks/index.d.ts.map +1 -1
- package/dest/public-checks/index.js +3 -3
- package/dest/public-checks/lazy.js +1 -1
- package/dest/scripts/generate_data.js +67 -22
- package/package.json +4 -4
- package/src/auth-registry/index.ts +3 -3
- package/src/auth-registry/lazy.ts +1 -1
- package/src/class-registry/index.ts +3 -3
- package/src/class-registry/lazy.ts +1 -1
- package/src/fee-juice/index.ts +3 -3
- package/src/fee-juice/lazy.ts +1 -1
- package/src/instance-registry/index.ts +3 -3
- package/src/instance-registry/lazy.ts +1 -1
- package/src/make_protocol_contract.ts +37 -15
- package/src/multi-call-entrypoint/index.ts +3 -3
- package/src/multi-call-entrypoint/lazy.ts +1 -1
- package/src/protocol_contract_data.ts +76 -13
- package/src/provider/bundle.ts +1 -1
- package/src/public-checks/index.ts +3 -3
- package/src/public-checks/lazy.ts +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { CANONICAL_AUTH_REGISTRY_ADDRESS, CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS, CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, FEE_JUICE_ADDRESS,
|
|
1
|
+
import { CANONICAL_AUTH_REGISTRY_ADDRESS, CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS, CONTRACT_INSTANCE_PUBLISHED_MAGIC_VALUE, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, FEE_JUICE_ADDRESS, MAX_PROTOCOL_CONTRACTS, MULTI_CALL_ENTRYPOINT_ADDRESS, PUBLIC_CHECKS_ADDRESS } from '@aztec/constants';
|
|
2
2
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
-
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
4
|
import { createConsoleLogger } from '@aztec/foundation/log';
|
|
6
5
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
7
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import {
|
|
7
|
+
import { computeContractAddressFromInstance, computeInitializationHash, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
8
|
+
import { computeSiloedPrivateLogFirstField } from '@aztec/stdlib/hash';
|
|
9
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
9
10
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
10
11
|
import { promises as fs } from 'fs';
|
|
11
12
|
import path from 'path';
|
|
@@ -50,11 +51,32 @@ async function copyArtifact(srcName, destName) {
|
|
|
50
51
|
await fs.copyFile(src, dest);
|
|
51
52
|
return artifact;
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
// Precompute all the expensive contract data that can be obtained from the artifact, to avoid redundant computations in clients.
|
|
55
|
+
// Protocol contracts come from a trusted source, so no class verifications are needed.
|
|
56
|
+
async function computeContractData(artifact, deployer) {
|
|
57
|
+
const loaded = loadContractArtifact(artifact);
|
|
58
|
+
const contractClass = await getContractClassFromArtifact(loaded);
|
|
59
|
+
const constructorArtifact = loaded.functions.find((f)=>f.name === 'constructor');
|
|
60
|
+
const initializationHash = await computeInitializationHash(constructorArtifact, []);
|
|
61
|
+
const instance = {
|
|
62
|
+
version: 1,
|
|
63
|
+
currentContractClassId: contractClass.id,
|
|
64
|
+
originalContractClassId: contractClass.id,
|
|
65
|
+
initializationHash,
|
|
66
|
+
publicKeys: PublicKeys.default(),
|
|
67
|
+
salt,
|
|
68
|
+
deployer
|
|
69
|
+
};
|
|
70
|
+
const address = await computeContractAddressFromInstance(instance);
|
|
71
|
+
return {
|
|
72
|
+
address,
|
|
73
|
+
classId: contractClass.id,
|
|
74
|
+
artifactHash: contractClass.artifactHash,
|
|
75
|
+
privateFunctionsRoot: contractClass.privateFunctionsRoot,
|
|
76
|
+
publicBytecodeCommitment: contractClass.publicBytecodeCommitment,
|
|
77
|
+
initializationHash,
|
|
78
|
+
privateFunctions: contractClass.privateFunctions
|
|
79
|
+
};
|
|
58
80
|
}
|
|
59
81
|
async function generateDeclarationFile(destName) {
|
|
60
82
|
const content = `
|
|
@@ -88,14 +110,37 @@ function generateContractAddresses(names) {
|
|
|
88
110
|
};
|
|
89
111
|
`;
|
|
90
112
|
}
|
|
91
|
-
function generateDerivedAddresses(names,
|
|
113
|
+
function generateDerivedAddresses(names, contractData) {
|
|
92
114
|
return `
|
|
93
115
|
export const ProtocolContractDerivedAddress = {
|
|
94
|
-
${
|
|
116
|
+
${contractData.map((d, i)=>`${names[i]}: AztecAddress.fromString('${d.address.toString()}')`).join(',\n')}
|
|
117
|
+
};
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
function generateClassIdPreimages(names, contractData) {
|
|
121
|
+
return `
|
|
122
|
+
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
123
|
+
${contractData.map((d, i)=>`${names[i]}: Fr.fromString('${d.classId.toString()}')`).join(',\n')}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
127
|
+
${contractData.map((d, i)=>`${names[i]}: {
|
|
128
|
+
artifactHash: Fr.fromString('${d.artifactHash.toString()}'),
|
|
129
|
+
privateFunctionsRoot: Fr.fromString('${d.privateFunctionsRoot.toString()}'),
|
|
130
|
+
publicBytecodeCommitment: Fr.fromString('${d.publicBytecodeCommitment.toString()}'),
|
|
131
|
+
}`).join(',\n')}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
135
|
+
${contractData.map((d, i)=>`${names[i]}: Fr.fromString('${d.initializationHash.toString()}')`).join(',\n')}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
139
|
+
${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
140
|
};
|
|
96
141
|
`;
|
|
97
142
|
}
|
|
98
|
-
async function generateProtocolContractsList(names,
|
|
143
|
+
async function generateProtocolContractsList(names, contractData) {
|
|
99
144
|
const list = makeTuple(MAX_PROTOCOL_CONTRACTS, ()=>AztecAddress.zero());
|
|
100
145
|
for(let i = 0; i < names.length; i++){
|
|
101
146
|
const name = names[i];
|
|
@@ -104,7 +149,7 @@ async function generateProtocolContractsList(names, derivedAddresses) {
|
|
|
104
149
|
if (!list[derivedAddressIndex].equals(AztecAddress.zero())) {
|
|
105
150
|
throw new Error(`Duplicate protocol contract address: ${address.toString()}`);
|
|
106
151
|
}
|
|
107
|
-
list[derivedAddressIndex] =
|
|
152
|
+
list[derivedAddressIndex] = contractData[i].address;
|
|
108
153
|
}
|
|
109
154
|
return `
|
|
110
155
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
@@ -117,16 +162,14 @@ async function generateProtocolContractsList(names, derivedAddresses) {
|
|
|
117
162
|
// Generate the siloed log tags for events emitted via private logs.
|
|
118
163
|
async function generateLogTags() {
|
|
119
164
|
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)}');
|
|
165
|
+
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
166
|
`;
|
|
125
167
|
}
|
|
126
|
-
async function generateOutputFile(names,
|
|
168
|
+
async function generateOutputFile(names, contractData) {
|
|
127
169
|
const content = `
|
|
128
170
|
// GENERATED FILE - DO NOT EDIT. RUN \`yarn generate\` or \`yarn generate:data\`
|
|
129
171
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
172
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
130
173
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
131
174
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
132
175
|
|
|
@@ -136,9 +179,11 @@ async function generateOutputFile(names, derivedAddresses) {
|
|
|
136
179
|
|
|
137
180
|
${generateContractAddresses(names)}
|
|
138
181
|
|
|
139
|
-
${generateDerivedAddresses(names,
|
|
182
|
+
${generateDerivedAddresses(names, contractData)}
|
|
183
|
+
|
|
184
|
+
${generateClassIdPreimages(names, contractData)}
|
|
140
185
|
|
|
141
|
-
${await generateProtocolContractsList(names,
|
|
186
|
+
${await generateProtocolContractsList(names, contractData)}
|
|
142
187
|
|
|
143
188
|
${await generateLogTags()}
|
|
144
189
|
`;
|
|
@@ -147,16 +192,16 @@ async function generateOutputFile(names, derivedAddresses) {
|
|
|
147
192
|
async function main() {
|
|
148
193
|
await clearDestDir();
|
|
149
194
|
const srcNames = JSON.parse(await fs.readFile(path.join(noirContractsRoot, 'protocol_contracts.json'), 'utf8'));
|
|
150
|
-
const
|
|
195
|
+
const contractDataList = [];
|
|
151
196
|
const destNames = srcNames.map((n)=>n.split('-')[1]);
|
|
152
197
|
for(let i = 0; i < srcNames.length; i++){
|
|
153
198
|
const srcName = srcNames[i];
|
|
154
199
|
const destName = destNames[i];
|
|
155
200
|
const artifact = await copyArtifact(srcName, destName);
|
|
156
201
|
await generateDeclarationFile(destName);
|
|
157
|
-
|
|
202
|
+
contractDataList.push(await computeContractData(artifact, AztecAddress.fromBigInt(BigInt(contractAddressMapping[destName]))));
|
|
158
203
|
}
|
|
159
|
-
await generateOutputFile(destNames,
|
|
204
|
+
await generateOutputFile(destNames, contractDataList);
|
|
160
205
|
}
|
|
161
206
|
try {
|
|
162
207
|
await main();
|
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": "4.0.0-devnet.
|
|
5
|
+
"version": "4.0.0-devnet.2-patch.1",
|
|
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": "4.0.0-devnet.
|
|
77
|
-
"@aztec/foundation": "4.0.0-devnet.
|
|
78
|
-
"@aztec/stdlib": "4.0.0-devnet.
|
|
76
|
+
"@aztec/constants": "4.0.0-devnet.2-patch.1",
|
|
77
|
+
"@aztec/foundation": "4.0.0-devnet.2-patch.1",
|
|
78
|
+
"@aztec/stdlib": "4.0.0-devnet.2-patch.1",
|
|
79
79
|
"lodash.chunk": "^4.2.0",
|
|
80
80
|
"lodash.omit": "^4.5.0",
|
|
81
81
|
"tslib": "^2.4.0"
|
|
@@ -10,9 +10,9 @@ let protocolContract: ProtocolContract;
|
|
|
10
10
|
export const AuthRegistryArtifact: ContractArtifact = loadContractArtifact(AuthRegistryJson as NoirCompiledContract);
|
|
11
11
|
|
|
12
12
|
/** Returns the canonical deployment of the auth registry. */
|
|
13
|
-
export
|
|
13
|
+
export function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
14
14
|
if (!protocolContract) {
|
|
15
|
-
protocolContract =
|
|
15
|
+
protocolContract = makeProtocolContract('AuthRegistry', AuthRegistryArtifact);
|
|
16
16
|
}
|
|
17
|
-
return protocolContract;
|
|
17
|
+
return Promise.resolve(protocolContract);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export async function getAuthRegistryArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const authRegistryArtifact = await getAuthRegistryArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|
|
@@ -14,10 +14,10 @@ export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassR
|
|
|
14
14
|
let protocolContract: ProtocolContract;
|
|
15
15
|
|
|
16
16
|
/** Returns the canonical deployment of the contract. */
|
|
17
|
-
export
|
|
17
|
+
export function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
18
18
|
if (!protocolContract) {
|
|
19
19
|
const artifact = ContractClassRegistryArtifact;
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', artifact);
|
|
21
21
|
}
|
|
22
|
-
return protocolContract;
|
|
22
|
+
return Promise.resolve(protocolContract);
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ export async function getContractClassRegistryArtifact(): Promise<ContractArtifa
|
|
|
27
27
|
export async function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
28
28
|
if (!protocolContract) {
|
|
29
29
|
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
30
|
-
protocolContract =
|
|
30
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
31
31
|
}
|
|
32
32
|
return protocolContract;
|
|
33
33
|
}
|
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
|
@@ -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
|
}
|
|
@@ -15,9 +15,9 @@ export const ContractInstanceRegistryArtifact = loadContractArtifact(
|
|
|
15
15
|
let protocolContract: ProtocolContract;
|
|
16
16
|
|
|
17
17
|
/** Returns the canonical deployment of the contract. */
|
|
18
|
-
export
|
|
18
|
+
export function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
|
|
19
19
|
if (!protocolContract) {
|
|
20
|
-
protocolContract =
|
|
20
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', ContractInstanceRegistryArtifact);
|
|
21
21
|
}
|
|
22
|
-
return protocolContract;
|
|
22
|
+
return Promise.resolve(protocolContract);
|
|
23
23
|
}
|
|
@@ -26,7 +26,7 @@ export async function getContractInstanceRegistryArtifact(): Promise<ContractArt
|
|
|
26
26
|
export async function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
|
|
27
27
|
if (!protocolContract) {
|
|
28
28
|
const contractInstanceRegistryArtifact = await getContractInstanceRegistryArtifact();
|
|
29
|
-
protocolContract =
|
|
29
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', contractInstanceRegistryArtifact);
|
|
30
30
|
}
|
|
31
31
|
return protocolContract;
|
|
32
32
|
}
|
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import {
|
|
2
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
3
|
|
|
4
4
|
import type { ProtocolContract } from './protocol_contract.js';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ProtocolContractAddress,
|
|
7
|
+
ProtocolContractClassId,
|
|
8
|
+
ProtocolContractClassIdPreimage,
|
|
9
|
+
ProtocolContractInitializationHash,
|
|
10
|
+
type ProtocolContractName,
|
|
11
|
+
ProtocolContractPrivateFunctions,
|
|
12
|
+
ProtocolContractSalt,
|
|
13
|
+
} from './protocol_contract_data.js';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
16
|
+
* Reconstructs a ProtocolContract from precomputed data without performing any hash computations.
|
|
17
|
+
* Internal to the protocol-contracts package — not part of the public API.
|
|
10
18
|
*/
|
|
11
|
-
export
|
|
12
|
-
name: ProtocolContractName,
|
|
13
|
-
artifact: ContractArtifact,
|
|
14
|
-
): Promise<ProtocolContract> {
|
|
19
|
+
export function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact): ProtocolContract {
|
|
15
20
|
const address = ProtocolContractAddress[name];
|
|
16
21
|
const salt = ProtocolContractSalt[name];
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const classId = ProtocolContractClassId[name];
|
|
23
|
+
const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment } = ProtocolContractClassIdPreimage[name];
|
|
24
|
+
const initializationHash = ProtocolContractInitializationHash[name];
|
|
25
|
+
|
|
26
|
+
const contractClass = {
|
|
27
|
+
id: classId,
|
|
28
|
+
version: 1 as const,
|
|
29
|
+
artifactHash,
|
|
30
|
+
privateFunctionsRoot,
|
|
31
|
+
publicBytecodeCommitment,
|
|
32
|
+
packedBytecode: artifact.functions.find(f => f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0),
|
|
33
|
+
privateFunctions: ProtocolContractPrivateFunctions[name],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const instance = {
|
|
37
|
+
version: 1 as const,
|
|
38
|
+
currentContractClassId: classId,
|
|
39
|
+
originalContractClassId: classId,
|
|
40
|
+
initializationHash,
|
|
41
|
+
publicKeys: PublicKeys.default(),
|
|
42
|
+
salt,
|
|
43
|
+
deployer: address,
|
|
24
44
|
address,
|
|
25
45
|
};
|
|
46
|
+
|
|
47
|
+
return { instance, contractClass, artifact, address };
|
|
26
48
|
}
|
|
@@ -10,9 +10,9 @@ export const MultiCallEntrypointArtifact = loadContractArtifact(MultiCallEntrypo
|
|
|
10
10
|
let protocolContract: ProtocolContract;
|
|
11
11
|
|
|
12
12
|
/** Returns the canonical deployment of the contract. */
|
|
13
|
-
export
|
|
13
|
+
export function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract> {
|
|
14
14
|
if (!protocolContract) {
|
|
15
|
-
protocolContract =
|
|
15
|
+
protocolContract = makeProtocolContract('MultiCallEntrypoint', MultiCallEntrypointArtifact);
|
|
16
16
|
}
|
|
17
|
-
return protocolContract;
|
|
17
|
+
return Promise.resolve(protocolContract);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export async function getMultiCallEntrypointArtifact(): Promise<ContractArtifact
|
|
|
23
23
|
export async function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const multiCallEntrypointArtifact = await getMultiCallEntrypointArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('MultiCallEntrypoint', multiCallEntrypointArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
6
7
|
|
|
@@ -41,23 +42,85 @@ PublicChecks: AztecAddress.fromBigInt(6n)
|
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
export const ProtocolContractDerivedAddress = {
|
|
44
|
-
AuthRegistry: AztecAddress.fromString('
|
|
45
|
-
ContractInstanceRegistry: AztecAddress.fromString('
|
|
46
|
-
ContractClassRegistry: AztecAddress.fromString('
|
|
47
|
-
MultiCallEntrypoint: AztecAddress.fromString('
|
|
48
|
-
FeeJuice: AztecAddress.fromString('
|
|
49
|
-
PublicChecks: AztecAddress.fromString('
|
|
45
|
+
AuthRegistry: AztecAddress.fromString('0x139f8eb6d6e7e7a7c0322c3b7558687a7e24201f11bf2c4cb2fe56c18d363695'),
|
|
46
|
+
ContractInstanceRegistry: AztecAddress.fromString('0x1254246c88aca5a66fa66f3aa78c408a698ebca3b713120497c7555dfc718592'),
|
|
47
|
+
ContractClassRegistry: AztecAddress.fromString('0x14d670efa326a07b99777b01fb706427ca776095246569150f2a3f17a7d4dc66'),
|
|
48
|
+
MultiCallEntrypoint: AztecAddress.fromString('0x230d0b47ba6d5ed99afb89d584f32ff33438b64f51000f252a140cf995781628'),
|
|
49
|
+
FeeJuice: AztecAddress.fromString('0x204913186c0dd70015d05bf9100a12e31ccb7cc2527aacdfae0c19ad6439fcf4'),
|
|
50
|
+
PublicChecks: AztecAddress.fromString('0x1198142fd84a58c0ab22d5fde371ce527042db49487e05206a326ad154952ac8')
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
56
|
+
AuthRegistry: Fr.fromString('0x17ad10e1b5dba2877b9a973449c03d5227f2c719c0eb1989427c10c1d83867a5'),
|
|
57
|
+
ContractInstanceRegistry: Fr.fromString('0x187c710b0d69b2da7a6f0663c15093a5d595c04e77762c249aa9b654bc12158c'),
|
|
58
|
+
ContractClassRegistry: Fr.fromString('0x013466b8a65dea98ad80c119cf236a0acf53acfede687769410cfd57876b8242'),
|
|
59
|
+
MultiCallEntrypoint: Fr.fromString('0x1acd7ab8bf186c16eafc9c4fe9049f35df27e172bb2d8319a2a22ddd0006966d'),
|
|
60
|
+
FeeJuice: Fr.fromString('0x16b2d5ef5044c11126a16ccdb3778082eb423375977da9458d493fdf84505e81'),
|
|
61
|
+
PublicChecks: Fr.fromString('0x03f2ebaef8d692422185e35d8fe35d0bb7289702cf023b525c022d77fc6b5ed5')
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
65
|
+
AuthRegistry: {
|
|
66
|
+
artifactHash: Fr.fromString('0x029f3b5582e9e2f9cddb4f887fa67c06d8dbe9aef604aa7de91a6f5328bf477c'),
|
|
67
|
+
privateFunctionsRoot: Fr.fromString('0x0826df9bf86cf460935b2bd024edcb5a58532fcf0392abbdb33f5f2150753756'),
|
|
68
|
+
publicBytecodeCommitment: Fr.fromString('0x22db1f0a70bfefaf90371c7728e558cf60507b718e99ed276ed3143bec615f6f'),
|
|
69
|
+
},
|
|
70
|
+
ContractInstanceRegistry: {
|
|
71
|
+
artifactHash: Fr.fromString('0x18601566bacdca7a5a40528f221b04ee7b74f382e6cd34fbdf69d31c50d5ee88'),
|
|
72
|
+
privateFunctionsRoot: Fr.fromString('0x136a6705c7ad1d47f65cb881a56909d4c78d3fa8944f5b103734cd91e654ed63'),
|
|
73
|
+
publicBytecodeCommitment: Fr.fromString('0x01c573f470ba9a17d362c7dd5a28931c39432f9ce527555049c71432f895ad6c'),
|
|
74
|
+
},
|
|
75
|
+
ContractClassRegistry: {
|
|
76
|
+
artifactHash: Fr.fromString('0x232d868db8a4d1e0f013efa4bfe5c39d96e11f16a62e3e73abbbafc3028fc410'),
|
|
77
|
+
privateFunctionsRoot: Fr.fromString('0x2ac3bf890a7d534a768079aa86889caa1a86373c8e6fc2db48215b11bbb79106'),
|
|
78
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
79
|
+
},
|
|
80
|
+
MultiCallEntrypoint: {
|
|
81
|
+
artifactHash: Fr.fromString('0x0d30526b6b786cf887d7e44ba59d2e9561d5791b0e3c78c681d0499ae45b225a'),
|
|
82
|
+
privateFunctionsRoot: Fr.fromString('0x266505ecb7c02ce6e227227c0b6bdb44713c8ecd43164ee7bb00b8fb340e8b03'),
|
|
83
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
84
|
+
},
|
|
85
|
+
FeeJuice: {
|
|
86
|
+
artifactHash: Fr.fromString('0x2eb476f12cce5207be118047fb7f603378b78aa619d6539a4d9eec4700ea2507'),
|
|
87
|
+
privateFunctionsRoot: Fr.fromString('0x0abef3cfc6ae314886c841b42dc33d3eed255ad3dee7773daabf05b229573759'),
|
|
88
|
+
publicBytecodeCommitment: Fr.fromString('0x2a144b28b36efa21b7488467aba7e06b33e016d00bfe083a7bfa06ad6ff5aa2f'),
|
|
89
|
+
},
|
|
90
|
+
PublicChecks: {
|
|
91
|
+
artifactHash: Fr.fromString('0x228ea8af66ff150f40a4b01b64115d12777b2f7fd3a4bfc0d97d38a91f139ef6'),
|
|
92
|
+
privateFunctionsRoot: Fr.fromString('0x067243231eddf4222f3911defbba7705aff06ed45960b27f6f91319196ef97e1'),
|
|
93
|
+
publicBytecodeCommitment: Fr.fromString('0x2d0834fc9468fd2092091852543a2fbd7b6b313c7e5e4defe8730c8065366a03'),
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
98
|
+
AuthRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
99
|
+
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
100
|
+
ContractClassRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
101
|
+
MultiCallEntrypoint: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
102
|
+
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
103
|
+
PublicChecks: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
107
|
+
AuthRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000079a3d418')), vkHash: Fr.fromString('0x019c553854290b9b547841e45bf45e344d4a2d4f6702fee430ec5897ce7d3b78') }],
|
|
108
|
+
ContractInstanceRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000016ec12aa')), vkHash: Fr.fromString('0x262f7a90ecf055779001b67dad01a3add1e549f6c27931f0e71e463ce2142b57') }],
|
|
109
|
+
ContractClassRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000006934ed0d')), vkHash: Fr.fromString('0x1163f31e191528254c877fce0c7f62dd738f5552bbd2dda97512fe4777377f5b') }],
|
|
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: []
|
|
50
113
|
};
|
|
51
114
|
|
|
52
115
|
|
|
53
116
|
|
|
54
117
|
export const ProtocolContractsList = new ProtocolContracts([
|
|
55
|
-
AztecAddress.fromString('
|
|
56
|
-
AztecAddress.fromString('
|
|
57
|
-
AztecAddress.fromString('
|
|
58
|
-
AztecAddress.fromString('
|
|
59
|
-
AztecAddress.fromString('
|
|
60
|
-
AztecAddress.fromString('
|
|
118
|
+
AztecAddress.fromString('0x139f8eb6d6e7e7a7c0322c3b7558687a7e24201f11bf2c4cb2fe56c18d363695'),
|
|
119
|
+
AztecAddress.fromString('0x1254246c88aca5a66fa66f3aa78c408a698ebca3b713120497c7555dfc718592'),
|
|
120
|
+
AztecAddress.fromString('0x14d670efa326a07b99777b01fb706427ca776095246569150f2a3f17a7d4dc66'),
|
|
121
|
+
AztecAddress.fromString('0x230d0b47ba6d5ed99afb89d584f32ff33438b64f51000f252a140cf995781628'),
|
|
122
|
+
AztecAddress.fromString('0x204913186c0dd70015d05bf9100a12e31ccb7cc2527aacdfae0c19ad6439fcf4'),
|
|
123
|
+
AztecAddress.fromString('0x1198142fd84a58c0ab22d5fde371ce527042db49487e05206a326ad154952ac8'),
|
|
61
124
|
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
62
125
|
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
63
126
|
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
@@ -65,7 +128,7 @@ AztecAddress.fromString('0x00000000000000000000000000000000000000000000000000000
|
|
|
65
128
|
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
66
129
|
]);
|
|
67
130
|
|
|
68
|
-
export const protocolContractsHash = Fr.fromString('
|
|
131
|
+
export const protocolContractsHash = Fr.fromString('0x2672340d9a0107a7b81e6d10d25b854debe613f3272e8738e8df0ca2ff297141');
|
|
69
132
|
|
|
70
133
|
|
|
71
134
|
|
package/src/provider/bundle.ts
CHANGED
|
@@ -22,6 +22,6 @@ export const ProtocolContractArtifact: Record<ProtocolContractName, ContractArti
|
|
|
22
22
|
|
|
23
23
|
export class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
|
24
24
|
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract> {
|
|
25
|
-
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
25
|
+
return Promise.resolve(makeProtocolContract(name, ProtocolContractArtifact[name]));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -10,9 +10,9 @@ export const PublicChecksArtifact = loadContractArtifact(PublicChecksJson as Noi
|
|
|
10
10
|
let protocolContract: ProtocolContract;
|
|
11
11
|
|
|
12
12
|
/** Returns the canonical deployment of the contract. */
|
|
13
|
-
export
|
|
13
|
+
export function getCanonicalPublicChecks(): Promise<ProtocolContract> {
|
|
14
14
|
if (!protocolContract) {
|
|
15
|
-
protocolContract =
|
|
15
|
+
protocolContract = makeProtocolContract('PublicChecks', PublicChecksArtifact);
|
|
16
16
|
}
|
|
17
|
-
return protocolContract;
|
|
17
|
+
return Promise.resolve(protocolContract);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export async function getPublicChecksArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalPublicChecks(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const publicChecksArtifact = await getPublicChecksArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('PublicChecks', publicChecksArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|