@aztec/protocol-contracts 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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.
Files changed (77) hide show
  1. package/artifacts/AuthRegistry.json +1526 -1612
  2. package/artifacts/ContractClassRegistry.json +3568 -5272
  3. package/artifacts/ContractInstanceRegistry.json +1509 -1484
  4. package/artifacts/FeeJuice.json +3157 -1202
  5. package/artifacts/MultiCallEntrypoint.json +1161 -1117
  6. package/artifacts/Router.json +347 -4001
  7. package/dest/auth-registry/index.d.ts +1 -1
  8. package/dest/auth-registry/lazy.d.ts +1 -1
  9. package/dest/auth-registry/lazy.js +4 -4
  10. package/dest/class-registry/contract_class_published_event.d.ts +3 -2
  11. package/dest/class-registry/contract_class_published_event.d.ts.map +1 -1
  12. package/dest/class-registry/contract_class_published_event.js +4 -0
  13. package/dest/class-registry/index.d.ts +1 -1
  14. package/dest/class-registry/lazy.d.ts +1 -1
  15. package/dest/class-registry/lazy.js +4 -4
  16. package/dest/class-registry/private_function_broadcasted_event.d.ts +2 -6
  17. package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -1
  18. package/dest/class-registry/utility_function_broadcasted_event.d.ts +2 -5
  19. package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -1
  20. package/dest/class-registry/utility_function_broadcasted_event.js +1 -1
  21. package/dest/fee-juice/index.d.ts +2 -2
  22. package/dest/fee-juice/index.d.ts.map +1 -1
  23. package/dest/fee-juice/lazy.d.ts +1 -1
  24. package/dest/fee-juice/lazy.js +4 -4
  25. package/dest/index.d.ts +1 -2
  26. package/dest/index.d.ts.map +1 -1
  27. package/dest/index.js +0 -1
  28. package/dest/instance-registry/contract_instance_published_event.d.ts +3 -2
  29. package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -1
  30. package/dest/instance-registry/contract_instance_published_event.js +4 -1
  31. package/dest/instance-registry/contract_instance_updated_event.d.ts +2 -2
  32. package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -1
  33. package/dest/instance-registry/contract_instance_updated_event.js +5 -7
  34. package/dest/instance-registry/index.d.ts +1 -1
  35. package/dest/instance-registry/lazy.d.ts +1 -1
  36. package/dest/instance-registry/lazy.js +4 -4
  37. package/dest/make_protocol_contract.d.ts +1 -1
  38. package/dest/multi-call-entrypoint/index.d.ts +1 -1
  39. package/dest/multi-call-entrypoint/lazy.d.ts +1 -1
  40. package/dest/multi-call-entrypoint/lazy.js +4 -4
  41. package/dest/protocol_contract.d.ts +1 -1
  42. package/dest/protocol_contract_data.d.ts +12 -10
  43. package/dest/protocol_contract_data.d.ts.map +1 -1
  44. package/dest/protocol_contract_data.js +23 -9
  45. package/dest/provider/bundle.d.ts +1 -1
  46. package/dest/provider/bundle.d.ts.map +1 -1
  47. package/dest/provider/lazy.d.ts +1 -1
  48. package/dest/provider/lazy.d.ts.map +1 -1
  49. package/dest/provider/protocol_contracts_provider.d.ts +1 -1
  50. package/dest/router/index.d.ts +1 -1
  51. package/dest/router/lazy.d.ts +1 -1
  52. package/dest/router/lazy.js +4 -4
  53. package/dest/scripts/generate_data.js +33 -76
  54. package/dest/tests/fixtures.d.ts +1 -1
  55. package/package.json +10 -9
  56. package/src/auth-registry/lazy.ts +4 -4
  57. package/src/class-registry/contract_class_published_event.ts +8 -1
  58. package/src/class-registry/lazy.ts +4 -4
  59. package/src/class-registry/private_function_broadcasted_event.ts +1 -1
  60. package/src/class-registry/utility_function_broadcasted_event.ts +1 -1
  61. package/src/fee-juice/index.ts +1 -1
  62. package/src/fee-juice/lazy.ts +4 -4
  63. package/src/index.ts +0 -1
  64. package/src/instance-registry/contract_instance_published_event.ts +7 -1
  65. package/src/instance-registry/contract_instance_updated_event.ts +6 -8
  66. package/src/instance-registry/lazy.ts +4 -4
  67. package/src/multi-call-entrypoint/lazy.ts +4 -4
  68. package/src/protocol_contract_data.ts +24 -9
  69. package/src/router/lazy.ts +4 -4
  70. package/dest/build_protocol_contract_tree.d.ts +0 -10
  71. package/dest/build_protocol_contract_tree.d.ts.map +0 -1
  72. package/dest/build_protocol_contract_tree.js +0 -20
  73. package/dest/protocol_contract_tree.d.ts +0 -7
  74. package/dest/protocol_contract_tree.d.ts.map +0 -1
  75. package/dest/protocol_contract_tree.js +0 -34
  76. package/src/build_protocol_contract_tree.ts +0 -29
  77. package/src/protocol_contract_tree.ts +0 -44
@@ -1,29 +0,0 @@
1
- import { MAX_PROTOCOL_CONTRACTS, PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
2
- import { poseidon2Hash } from '@aztec/foundation/crypto';
3
- import type { Fr } from '@aztec/foundation/fields';
4
- import { type IndexedMerkleTree, IndexedMerkleTreeCalculator } from '@aztec/foundation/trees';
5
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
- import { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
7
-
8
- export async function buildProtocolContractTree(
9
- contracts: { address: AztecAddress; leaf: Fr }[],
10
- ): Promise<IndexedMerkleTree<ProtocolContractLeafPreimage, typeof PROTOCOL_CONTRACT_TREE_HEIGHT>> {
11
- const hasher = {
12
- hash: async (l: Buffer, r: Buffer) => (await poseidon2Hash([l, r])).toBuffer() as Buffer<ArrayBuffer>,
13
- hashInputs: async (i: Buffer[]) => (await poseidon2Hash(i)).toBuffer() as Buffer<ArrayBuffer>,
14
- };
15
- const calculator = await IndexedMerkleTreeCalculator.create(
16
- PROTOCOL_CONTRACT_TREE_HEIGHT,
17
- hasher,
18
- ProtocolContractLeafPreimage,
19
- );
20
-
21
- const leaves = new Array(MAX_PROTOCOL_CONTRACTS).fill(Buffer.alloc(32));
22
-
23
- for (const contract of contracts) {
24
- const index = contract.address.toField().toNumber();
25
- leaves[index] = contract.leaf.toBuffer();
26
- }
27
-
28
- return calculator.computeTree(leaves);
29
- }
@@ -1,44 +0,0 @@
1
- import type { PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
2
- import { poseidon2Hash } from '@aztec/foundation/crypto';
3
- import type { IndexedMerkleTree } from '@aztec/foundation/trees';
4
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import type { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
6
-
7
- import { buildProtocolContractTree } from './build_protocol_contract_tree.js';
8
- import { isProtocolContract } from './protocol_contract.js';
9
- import { ProtocolContractAddress, ProtocolContractLeaves, protocolContractNames } from './protocol_contract_data.js';
10
-
11
- let protocolContractTree:
12
- | IndexedMerkleTree<ProtocolContractLeafPreimage, typeof PROTOCOL_CONTRACT_TREE_HEIGHT>
13
- | undefined;
14
-
15
- async function getTree() {
16
- if (!protocolContractTree) {
17
- const leaves = protocolContractNames.map(name => ({
18
- address: ProtocolContractAddress[name],
19
- leaf: ProtocolContractLeaves[name],
20
- }));
21
- protocolContractTree = await buildProtocolContractTree(leaves);
22
- }
23
- return protocolContractTree;
24
- }
25
-
26
- // Computed address can be different from contract address due to upgrades
27
- export async function getProtocolContractLeafAndMembershipWitness(
28
- contractAddress: AztecAddress,
29
- computedAddress: AztecAddress,
30
- ) {
31
- const tree = await getTree();
32
- let lowLeaf;
33
- let witness;
34
- if (isProtocolContract(contractAddress)) {
35
- const index = contractAddress.toField().toNumber();
36
- lowLeaf = tree.leafPreimages[index];
37
- witness = tree.getMembershipWitness(index);
38
- } else {
39
- lowLeaf = tree.getLowLeaf(computedAddress.toBigInt());
40
- const hashed = (await poseidon2Hash(lowLeaf.toHashInputs())).toBuffer();
41
- witness = tree.getMembershipWitness(hashed);
42
- }
43
- return { lowLeaf, witness };
44
- }