@aztec/protocol-contracts 3.0.0-nightly.20250906 → 4.0.0-nightly.20250907

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.
@@ -13,6 +13,7 @@ const noirContractsRoot = '../../noir-projects/noir-contracts';
13
13
  const srcPath = path.join(noirContractsRoot, './target');
14
14
  const destArtifactsDir = './artifacts';
15
15
  const outputFilePath = './src/protocol_contract_data.ts';
16
+ const cppOutputFilePath = '../../barretenberg/cpp/src/barretenberg/vm2/common/protocol_contract_data.hpp';
16
17
  const salt = new Fr(1);
17
18
  const contractAddressMapping = {
18
19
  AuthRegistry: CANONICAL_AUTH_REGISTRY_ADDRESS,
@@ -22,6 +23,14 @@ const contractAddressMapping = {
22
23
  FeeJuice: FEE_JUICE_ADDRESS,
23
24
  Router: ROUTER_ADDRESS
24
25
  };
26
+ const contractAddressNameMapping = {
27
+ AuthRegistry: 'CANONICAL_AUTH_REGISTRY_ADDRESS',
28
+ ContractInstanceRegistry: 'CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS',
29
+ ContractClassRegistry: 'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
30
+ MultiCallEntrypoint: 'MULTI_CALL_ENTRYPOINT_ADDRESS',
31
+ FeeJuice: 'FEE_JUICE_ADDRESS',
32
+ Router: 'ROUTER_ADDRESS'
33
+ };
25
34
  async function clearDestDir() {
26
35
  try {
27
36
  await fs.access(destArtifactsDir);
@@ -137,6 +146,45 @@ async function generateOutputFile(names, leaves) {
137
146
  `;
138
147
  await fs.writeFile(outputFilePath, content);
139
148
  }
149
+ async function generateHppOutputFile() {
150
+ const content = `// GENERATED FILE - DO NOT EDIT, RUN yarn generate in yarn-project/protocol-contracts
151
+ #pragma once
152
+
153
+ #include "barretenberg/vm2/common/aztec_constants.hpp"
154
+ #include "barretenberg/vm2/common/aztec_types.hpp"
155
+
156
+ #include <unordered_map>
157
+
158
+ namespace bb::avm2 {
159
+
160
+ using CanonicalAddress = AztecAddress;
161
+ using DerivedAddress = AztecAddress;
162
+
163
+ extern const std::unordered_map<CanonicalAddress, DerivedAddress> derived_addresses;
164
+
165
+ } // namespace bb::avm2
166
+ `;
167
+ await fs.writeFile(cppOutputFilePath, content);
168
+ }
169
+ async function generateCppOutputFile(names, leaves) {
170
+ await generateHppOutputFile();
171
+ const data = names.map((name, i)=>({
172
+ name: contractAddressNameMapping[name],
173
+ addr: leaves[i].toString()
174
+ }));
175
+ const content = `// GENERATED FILE - DO NOT EDIT, RUN yarn generate in yarn-project/protocol-contracts
176
+ #include "protocol_contract_data.hpp"
177
+
178
+ namespace bb::avm2 {
179
+
180
+ const std::unordered_map<CanonicalAddress, DerivedAddress> derived_addresses = {
181
+ ${data.map(({ name, addr })=>`{ ${name}, AztecAddress("${addr}") }`).join(',\n\t')}
182
+ };
183
+
184
+ } // namespace bb::avm2
185
+ `;
186
+ await fs.writeFile(cppOutputFilePath.replace('.hpp', '.cpp'), content);
187
+ }
140
188
  async function main() {
141
189
  await clearDestDir();
142
190
  const srcNames = JSON.parse(await fs.readFile(path.join(noirContractsRoot, 'protocol_contracts.json'), 'utf8'));
@@ -150,6 +198,7 @@ async function main() {
150
198
  const contractLeaf = await computeContractLeaf(artifact);
151
199
  leaves.push(contractLeaf.toField());
152
200
  }
201
+ await generateCppOutputFile(destNames, leaves);
153
202
  await generateOutputFile(destNames, leaves);
154
203
  }
155
204
  try {
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": "3.0.0-nightly.20250906",
5
+ "version": "4.0.0-nightly.20250907",
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": "3.0.0-nightly.20250906",
77
- "@aztec/foundation": "3.0.0-nightly.20250906",
78
- "@aztec/stdlib": "3.0.0-nightly.20250906",
76
+ "@aztec/constants": "4.0.0-nightly.20250907",
77
+ "@aztec/foundation": "4.0.0-nightly.20250907",
78
+ "@aztec/stdlib": "4.0.0-nightly.20250907",
79
79
  "lodash.chunk": "^4.2.0",
80
80
  "lodash.omit": "^4.5.0",
81
81
  "tslib": "^2.4.0"