@aztec/cli 0.0.0-test.1 → 0.0.1-fake-ceab37513c

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 (146) hide show
  1. package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
  2. package/dest/cmds/contracts/inspect_contract.js +9 -5
  3. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  4. package/dest/cmds/infrastructure/index.js +3 -3
  5. package/dest/cmds/infrastructure/sequencers.d.ts +2 -1
  6. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  7. package/dest/cmds/infrastructure/sequencers.js +27 -15
  8. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  9. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  10. package/dest/cmds/infrastructure/setup_l2_contract.js +14 -12
  11. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
  12. package/dest/cmds/l1/advance_epoch.js +3 -2
  13. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  14. package/dest/cmds/l1/assume_proven_through.js +3 -3
  15. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  16. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  17. package/dest/cmds/l1/bridge_erc20.js +4 -4
  18. package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
  19. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
  20. package/dest/cmds/l1/deploy_l1_contracts.js +22 -5
  21. package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -1
  22. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  23. package/dest/cmds/l1/deploy_new_rollup.js +16 -7
  24. package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
  25. package/dest/cmds/l1/governance_utils.js +17 -17
  26. package/dest/cmds/l1/index.d.ts +1 -0
  27. package/dest/cmds/l1/index.d.ts.map +1 -1
  28. package/dest/cmds/l1/index.js +29 -39
  29. package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
  30. package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
  31. package/dest/cmds/l1/trigger_seed_snapshot.js +19 -0
  32. package/dest/cmds/l1/update_l1_validators.d.ts +17 -2
  33. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  34. package/dest/cmds/l1/update_l1_validators.js +156 -101
  35. package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
  36. package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
  37. package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
  38. package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
  39. package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
  40. package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
  41. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
  42. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
  43. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
  44. package/dest/cmds/misc/index.d.ts.map +1 -1
  45. package/dest/cmds/misc/index.js +7 -3
  46. package/dest/cmds/misc/update/github.d.ts +0 -1
  47. package/dest/cmds/misc/update/github.d.ts.map +1 -1
  48. package/dest/cmds/misc/update/github.js +0 -1
  49. package/dest/cmds/misc/update.d.ts.map +1 -1
  50. package/dest/cmds/misc/update.js +2 -3
  51. package/dest/cmds/pxe/get_contract_data.js +1 -1
  52. package/dest/cmds/pxe/get_node_info.d.ts.map +1 -1
  53. package/dest/cmds/pxe/get_node_info.js +11 -7
  54. package/dest/cmds/pxe/get_pxe_info.js +2 -2
  55. package/dest/config/cached_fetch.d.ts +18 -0
  56. package/dest/config/cached_fetch.d.ts.map +1 -0
  57. package/dest/config/cached_fetch.js +54 -0
  58. package/dest/config/chain_l2_config.d.ts +38 -0
  59. package/dest/config/chain_l2_config.d.ts.map +1 -0
  60. package/dest/config/chain_l2_config.js +376 -0
  61. package/dest/config/enrich_env.d.ts +4 -0
  62. package/dest/config/enrich_env.d.ts.map +1 -0
  63. package/dest/config/enrich_env.js +12 -0
  64. package/dest/config/get_l1_config.d.ts +8 -0
  65. package/dest/config/get_l1_config.d.ts.map +1 -0
  66. package/dest/config/get_l1_config.js +22 -0
  67. package/dest/config/index.d.ts +5 -0
  68. package/dest/config/index.d.ts.map +1 -0
  69. package/dest/config/index.js +4 -0
  70. package/dest/config/network_config.d.ts +19 -0
  71. package/dest/config/network_config.d.ts.map +1 -0
  72. package/dest/config/network_config.js +79 -0
  73. package/dest/utils/aztec.d.ts +12 -11
  74. package/dest/utils/aztec.d.ts.map +1 -1
  75. package/dest/utils/aztec.js +52 -22
  76. package/dest/utils/commands.d.ts +1 -1
  77. package/dest/utils/commands.d.ts.map +1 -1
  78. package/dest/utils/commands.js +5 -5
  79. package/dest/utils/encoding.js +1 -1
  80. package/dest/utils/github.d.ts +0 -1
  81. package/dest/utils/github.d.ts.map +1 -1
  82. package/dest/utils/github.js +0 -1
  83. package/dest/utils/index.d.ts +1 -0
  84. package/dest/utils/index.d.ts.map +1 -1
  85. package/dest/utils/index.js +1 -0
  86. package/dest/utils/inspect.d.ts.map +1 -1
  87. package/dest/utils/inspect.js +18 -26
  88. package/dest/utils/setup_contracts.d.ts +5 -0
  89. package/dest/utils/setup_contracts.d.ts.map +1 -0
  90. package/dest/utils/setup_contracts.js +36 -0
  91. package/package.json +38 -32
  92. package/src/cmds/contracts/inspect_contract.ts +16 -6
  93. package/src/cmds/infrastructure/index.ts +10 -2
  94. package/src/cmds/infrastructure/sequencers.ts +32 -15
  95. package/src/cmds/infrastructure/setup_l2_contract.ts +16 -11
  96. package/src/cmds/l1/advance_epoch.ts +3 -2
  97. package/src/cmds/l1/assume_proven_through.ts +3 -3
  98. package/src/cmds/l1/bridge_erc20.ts +4 -3
  99. package/src/cmds/l1/deploy_l1_contracts.ts +30 -6
  100. package/src/cmds/l1/deploy_new_rollup.ts +22 -8
  101. package/src/cmds/l1/governance_utils.ts +18 -17
  102. package/src/cmds/l1/index.ts +69 -96
  103. package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
  104. package/src/cmds/l1/update_l1_validators.ts +191 -92
  105. package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
  106. package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
  107. package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
  108. package/src/cmds/misc/index.ts +13 -4
  109. package/src/cmds/misc/update/github.ts +0 -1
  110. package/src/cmds/misc/update.ts +1 -7
  111. package/src/cmds/pxe/get_contract_data.ts +1 -1
  112. package/src/cmds/pxe/get_node_info.ts +10 -7
  113. package/src/cmds/pxe/get_pxe_info.ts +2 -2
  114. package/src/config/cached_fetch.ts +67 -0
  115. package/src/config/chain_l2_config.ts +493 -0
  116. package/src/config/enrich_env.ts +15 -0
  117. package/src/config/get_l1_config.ts +28 -0
  118. package/src/config/index.ts +4 -0
  119. package/src/config/network_config.ts +102 -0
  120. package/src/utils/aztec.ts +76 -27
  121. package/src/utils/commands.ts +5 -5
  122. package/src/utils/encoding.ts +1 -1
  123. package/src/utils/github.ts +0 -1
  124. package/src/utils/index.ts +1 -0
  125. package/src/utils/inspect.ts +18 -25
  126. package/src/utils/setup_contracts.ts +58 -0
  127. package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
  128. package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
  129. package/dest/cmds/devnet/bootstrap_network.js +0 -196
  130. package/dest/cmds/devnet/faucet.d.ts +0 -4
  131. package/dest/cmds/devnet/faucet.d.ts.map +0 -1
  132. package/dest/cmds/devnet/faucet.js +0 -26
  133. package/dest/cmds/devnet/index.d.ts +0 -4
  134. package/dest/cmds/devnet/index.d.ts.map +0 -1
  135. package/dest/cmds/devnet/index.js +0 -14
  136. package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
  137. package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
  138. package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
  139. package/dest/cmds/misc/setup_contracts.d.ts +0 -7
  140. package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
  141. package/dest/cmds/misc/setup_contracts.js +0 -27
  142. package/src/cmds/devnet/bootstrap_network.ts +0 -318
  143. package/src/cmds/devnet/faucet.ts +0 -33
  144. package/src/cmds/devnet/index.ts +0 -60
  145. package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
  146. package/src/cmds/misc/setup_contracts.ts +0 -40
@@ -0,0 +1,36 @@
1
+ import { AztecAddress, DefaultWaitOpts, Fr, SignerlessWallet, SponsoredFeePaymentMethod, getContractInstanceFromInstantiationParams, waitForProven } from '@aztec/aztec.js';
2
+ import { SPONSORED_FPC_SALT } from '@aztec/constants';
3
+ import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
4
+ async function getSponsoredFPCContract() {
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
7
+ const { SponsoredFPCContract } = await import('@aztec/noir-contracts.js/SponsoredFPC');
8
+ return SponsoredFPCContract;
9
+ }
10
+ export async function getSponsoredFPCAddress() {
11
+ const SponsoredFPCContract = await getSponsoredFPCContract();
12
+ const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
13
+ salt: new Fr(SPONSORED_FPC_SALT)
14
+ });
15
+ return sponsoredFPCInstance.address;
16
+ }
17
+ export async function setupSponsoredFPC(pxe, log, waitOpts = DefaultWaitOpts, waitForProvenOptions) {
18
+ const SponsoredFPCContract = await getSponsoredFPCContract();
19
+ const address = await getSponsoredFPCAddress();
20
+ const paymentMethod = new SponsoredFeePaymentMethod(address);
21
+ const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
22
+ const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
23
+ const deployTx = SponsoredFPCContract.deploy(deployer).send({
24
+ from: AztecAddress.ZERO,
25
+ contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
26
+ universalDeploy: true,
27
+ fee: {
28
+ paymentMethod
29
+ }
30
+ });
31
+ const deployed = await deployTx.deployed(waitOpts);
32
+ if (waitForProvenOptions !== undefined) {
33
+ await waitForProven(pxe, await deployTx.getReceipt(), waitForProvenOptions);
34
+ }
35
+ log(`SponsoredFPC: ${deployed.address}`);
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli",
3
- "version": "0.0.0-test.1",
3
+ "version": "0.0.1-fake-ceab37513c",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./contracts": "./dest/cmds/contracts/index.js",
@@ -12,7 +12,8 @@
12
12
  "./misc": "./dest/cmds/misc/index.js",
13
13
  "./setup-contracts": "./dest/cmds/misc/setup_contracts.js",
14
14
  "./utils": "./dest/utils/index.js",
15
- "./inspect": "./dest/utils/inspect.js"
15
+ "./inspect": "./dest/utils/inspect.js",
16
+ "./config": "./dest/config/index.js"
16
17
  },
17
18
  "typedocOptions": {
18
19
  "entryPoints": [
@@ -25,8 +26,6 @@
25
26
  "build": "yarn clean && tsc -b",
26
27
  "build:dev": "tsc -b --watch",
27
28
  "clean": "rm -rf ./dest .tsbuildinfo",
28
- "formatting": "run -T prettier --check ./src && run -T eslint ./src",
29
- "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
30
29
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
31
30
  },
32
31
  "inherits": [
@@ -64,17 +63,24 @@
64
63
  "testTimeout": 120000,
65
64
  "setupFiles": [
66
65
  "../../foundation/src/jest/setup.mjs"
66
+ ],
67
+ "testEnvironment": "../../foundation/src/jest/env.mjs",
68
+ "setupFilesAfterEnv": [
69
+ "../../foundation/src/jest/setupAfterEnv.mjs"
67
70
  ]
68
71
  },
69
72
  "dependencies": {
70
- "@aztec/archiver": "0.0.0-test.1",
71
- "@aztec/aztec.js": "0.0.0-test.1",
72
- "@aztec/constants": "0.0.0-test.1",
73
- "@aztec/foundation": "0.0.0-test.1",
74
- "@aztec/l1-artifacts": "0.0.0-test.1",
75
- "@aztec/p2p": "0.0.0-test.1",
76
- "@aztec/stdlib": "0.0.0-test.1",
77
- "@aztec/world-state": "0.0.0-test.1",
73
+ "@aztec/archiver": "0.0.1-fake-ceab37513c",
74
+ "@aztec/aztec.js": "0.0.1-fake-ceab37513c",
75
+ "@aztec/constants": "0.0.1-fake-ceab37513c",
76
+ "@aztec/entrypoints": "0.0.1-fake-ceab37513c",
77
+ "@aztec/ethereum": "0.0.1-fake-ceab37513c",
78
+ "@aztec/foundation": "0.0.1-fake-ceab37513c",
79
+ "@aztec/l1-artifacts": "0.0.1-fake-ceab37513c",
80
+ "@aztec/node-lib": "0.0.1-fake-ceab37513c",
81
+ "@aztec/p2p": "0.0.1-fake-ceab37513c",
82
+ "@aztec/stdlib": "0.0.1-fake-ceab37513c",
83
+ "@aztec/world-state": "0.0.1-fake-ceab37513c",
78
84
  "@iarna/toml": "^2.2.5",
79
85
  "@libp2p/peer-id-factory": "^3.0.4",
80
86
  "commander": "^12.1.0",
@@ -83,35 +89,35 @@
83
89
  "semver": "^7.5.4",
84
90
  "source-map-support": "^0.5.21",
85
91
  "tslib": "^2.4.0",
86
- "viem": "2.22.8"
92
+ "viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
87
93
  },
88
94
  "devDependencies": {
89
- "@aztec/accounts": "0.0.0-test.1",
90
- "@aztec/ethereum": "0.0.0-test.1",
91
- "@aztec/protocol-contracts": "0.0.0-test.1",
92
- "@jest/globals": "^29.5.0",
93
- "@types/jest": "^29.5.0",
95
+ "@aztec/accounts": "0.0.1-fake-ceab37513c",
96
+ "@aztec/protocol-contracts": "0.0.1-fake-ceab37513c",
97
+ "@jest/globals": "^30.0.0",
98
+ "@types/jest": "^30.0.0",
94
99
  "@types/lodash.chunk": "^4.2.9",
95
100
  "@types/lodash.groupby": "^4.6.9",
96
101
  "@types/lodash.startcase": "^4.4.7",
97
- "@types/node": "^18.7.23",
102
+ "@types/node": "^22.15.17",
98
103
  "@types/semver": "^7.5.2",
99
104
  "@types/source-map-support": "^0.5.10",
100
- "jest": "^29.5.0",
101
- "jest-mock-extended": "^3.0.5",
102
- "ts-jest": "^29.1.0",
105
+ "jest": "^30.0.0",
106
+ "jest-mock-extended": "^4.0.0",
107
+ "ts-jest": "^29.4.0",
103
108
  "ts-node": "^10.9.1",
104
- "typescript": "^5.0.4"
109
+ "typescript": "^5.3.3"
105
110
  },
106
111
  "peerDependencies": {
107
- "@aztec/accounts": "0.0.0-test.1",
108
- "@aztec/bb-prover": "0.0.0-test.1",
109
- "@aztec/ethereum": "0.0.0-test.1",
110
- "@aztec/l1-artifacts": "0.0.0-test.1",
111
- "@aztec/noir-contracts.js": "0.0.0-test.1",
112
- "@aztec/noir-protocol-circuits-types": "0.0.0-test.1",
113
- "@aztec/protocol-contracts": "0.0.0-test.1",
114
- "@aztec/stdlib": "0.0.0-test.1"
112
+ "@aztec/accounts": "0.0.1-fake-ceab37513c",
113
+ "@aztec/bb-prover": "0.0.1-fake-ceab37513c",
114
+ "@aztec/ethereum": "0.0.1-fake-ceab37513c",
115
+ "@aztec/l1-artifacts": "0.0.1-fake-ceab37513c",
116
+ "@aztec/noir-contracts.js": "0.0.1-fake-ceab37513c",
117
+ "@aztec/noir-protocol-circuits-types": "0.0.1-fake-ceab37513c",
118
+ "@aztec/noir-test-contracts.js": "0.0.1-fake-ceab37513c",
119
+ "@aztec/protocol-contracts": "0.0.1-fake-ceab37513c",
120
+ "@aztec/stdlib": "0.0.1-fake-ceab37513c"
115
121
  },
116
122
  "files": [
117
123
  "dest",
@@ -120,6 +126,6 @@
120
126
  ],
121
127
  "types": "./dest/index.d.ts",
122
128
  "engines": {
123
- "node": ">=18"
129
+ "node": ">=20.10"
124
130
  }
125
131
  }
@@ -5,6 +5,7 @@ import {
5
5
  FunctionSelector,
6
6
  decodeFunctionSignature,
7
7
  decodeFunctionSignatureWithParameterNames,
8
+ retainBytecode,
8
9
  } from '@aztec/stdlib/abi';
9
10
  import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
10
11
 
@@ -12,7 +13,9 @@ import { getContractArtifact } from '../../utils/aztec.js';
12
13
 
13
14
  export async function inspectContract(contractArtifactFile: string, debugLogger: Logger, log: LogFn) {
14
15
  const contractArtifact = await getContractArtifact(contractArtifactFile, log);
15
- const contractFns = contractArtifact.functions;
16
+ const contractFns = contractArtifact.functions.concat(
17
+ contractArtifact.nonDispatchPublicFunctions.map(f => f as FunctionArtifact),
18
+ );
16
19
  if (contractFns.length === 0) {
17
20
  log(`No functions found for contract ${contractArtifact.name}`);
18
21
  }
@@ -43,9 +46,16 @@ async function logFunction(fn: FunctionArtifact, log: LogFn) {
43
46
  const signatureWithParameterNames = decodeFunctionSignatureWithParameterNames(fn.name, fn.parameters);
44
47
  const signature = decodeFunctionSignature(fn.name, fn.parameters);
45
48
  const selector = await FunctionSelector.fromSignature(signature);
46
- const bytecodeSize = fn.bytecode.length;
47
- const bytecodeHash = sha256(fn.bytecode).toString('hex');
48
- log(
49
- `${fn.functionType} ${signatureWithParameterNames} \n\tfunction signature: ${signature}\n\tselector: ${selector}\n\tbytecode: ${bytecodeSize} bytes (sha256 ${bytecodeHash})`,
50
- );
49
+
50
+ if (retainBytecode(fn)) {
51
+ const bytecodeSize = fn.bytecode.length;
52
+ const bytecodeHash = sha256(fn.bytecode).toString('hex');
53
+ log(
54
+ `${fn.functionType} ${signatureWithParameterNames} \n\tfunction signature: ${signature}\n\tselector: ${selector}\n\tbytecode: ${bytecodeSize} bytes (sha256 ${bytecodeHash})`,
55
+ );
56
+ } else {
57
+ log(
58
+ `${fn.functionType} ${signatureWithParameterNames} \n\tfunction signature: ${signature}\n\tselector: ${selector}`,
59
+ );
60
+ }
51
61
  }
@@ -10,11 +10,19 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
10
10
  .description('Bootstrap the blockchain by initializing all the protocol contracts')
11
11
  .addOption(pxeOption)
12
12
  .option('--testAccounts', 'Deploy funded test accounts.')
13
+ .option('--sponsoredFPC', 'Deploy a sponsored FPC.')
13
14
  .option('--json', 'Output the contract addresses in JSON format')
14
15
  .option('--skipProofWait', "Don't wait for proofs to land.")
15
16
  .action(async options => {
16
17
  const { setupL2Contracts } = await import('./setup_l2_contract.js');
17
- await setupL2Contracts(options.rpcUrl, options.testAccounts, options.json, options.skipProofWait, log);
18
+ await setupL2Contracts(
19
+ options.rpcUrl,
20
+ options.testAccounts,
21
+ options.sponsoredFPC,
22
+ options.json,
23
+ options.skipProofWait,
24
+ log,
25
+ );
18
26
  });
19
27
 
20
28
  program
@@ -43,7 +51,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
43
51
  who,
44
52
  mnemonic: options.mnemonic,
45
53
  rpcUrl: options.rpcUrl,
46
- l1RpcUrls: options.l1RpcUrls.split(','),
54
+ l1RpcUrls: options.l1RpcUrls,
47
55
  chainId: options.l1ChainId,
48
56
  blockNumber: options.blockNumber,
49
57
  log,
@@ -1,5 +1,5 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- import { createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
1
+ import { Fr, createCompatibleClient } from '@aztec/aztec.js';
2
+ import { GSEContract, RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
3
  import type { LogFn, Logger } from '@aztec/foundation/log';
4
4
  import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
5
5
 
@@ -7,9 +7,10 @@ import { createPublicClient, createWalletClient, fallback, getContract, http } f
7
7
  import { mnemonicToAccount } from 'viem/accounts';
8
8
 
9
9
  export async function sequencers(opts: {
10
- command: 'list' | 'add' | 'remove' | 'who-next';
10
+ command: 'list' | 'add' | 'remove' | 'who-next' | 'flush';
11
11
  who?: string;
12
12
  mnemonic?: string;
13
+ bn254SecretKey?: bigint;
13
14
  rpcUrl: string;
14
15
  l1RpcUrls: string[];
15
16
  chainId: number;
@@ -17,7 +18,7 @@ export async function sequencers(opts: {
17
18
  log: LogFn;
18
19
  debugLogger: Logger;
19
20
  }) {
20
- const { command, who: maybeWho, mnemonic, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
21
+ const { command, who: maybeWho, mnemonic, bn254SecretKey, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
21
22
  const client = await createCompatibleClient(rpcUrl, debugLogger);
22
23
  const { l1ContractAddresses } = await client.getNodeInfo();
23
24
 
@@ -35,11 +36,7 @@ export async function sequencers(opts: {
35
36
  })
36
37
  : undefined;
37
38
 
38
- const rollup = getContract({
39
- address: l1ContractAddresses.rollupAddress.toString(),
40
- abi: RollupAbi,
41
- client: publicClient,
42
- });
39
+ const rollup = new RollupContract(publicClient, l1ContractAddresses.rollupAddress);
43
40
 
44
41
  const writeableRollup = walletClient
45
42
  ? getContract({
@@ -52,7 +49,7 @@ export async function sequencers(opts: {
52
49
  const who = (maybeWho as `0x{string}`) ?? walletClient?.account.address.toString();
53
50
 
54
51
  if (command === 'list') {
55
- const sequencers = await rollup.read.getAttesters();
52
+ const sequencers = await rollup.getAttesters();
56
53
  if (sequencers.length === 0) {
57
54
  log(`No sequencers registered on rollup`);
58
55
  } else {
@@ -69,23 +66,43 @@ export async function sequencers(opts: {
69
66
  log(`Adding ${who} as sequencer`);
70
67
 
71
68
  const stakingAsset = getContract({
72
- address: await rollup.read.getStakingAsset(),
69
+ address: await rollup.getStakingAsset(),
73
70
  abi: TestERC20Abi,
74
71
  client: walletClient,
75
72
  });
76
73
 
77
74
  const config = getL1ContractsConfigEnvVars();
78
75
 
76
+ const bn254SecretKeyFieldElement = bn254SecretKey ? new Fr(bn254SecretKey) : Fr.random();
77
+ const gseAddress = await rollup.getGSE();
78
+ const gseContract = new GSEContract(publicClient, gseAddress);
79
+ const registrationTuple = await gseContract.makeRegistrationTuple(bn254SecretKeyFieldElement.toBigInt());
80
+
79
81
  await Promise.all(
80
82
  [
81
- await stakingAsset.write.mint([walletClient.account.address, config.minimumStake], {} as any),
82
- await stakingAsset.write.approve([rollup.address, config.minimumStake], {} as any),
83
+ await stakingAsset.write.mint([walletClient.account.address, config.activationThreshold], {} as any),
84
+ await stakingAsset.write.approve([rollup.address, config.activationThreshold], {} as any),
83
85
  ].map(txHash => publicClient.waitForTransactionReceipt({ hash: txHash })),
84
86
  );
85
87
 
86
- const hash = await writeableRollup.write.deposit([who, who, who, config.minimumStake]);
88
+ const hash = await writeableRollup.write.deposit([
89
+ who,
90
+ who,
91
+ registrationTuple.publicKeyInG1,
92
+ registrationTuple.publicKeyInG2,
93
+ registrationTuple.proofOfPossession,
94
+ true,
95
+ ]);
87
96
  await publicClient.waitForTransactionReceipt({ hash });
88
97
  log(`Added in tx ${hash}`);
98
+ } else if (command === 'flush') {
99
+ if (!writeableRollup) {
100
+ throw new Error(`Missing sequencer address`);
101
+ }
102
+ log(`Flushing staking entry queue`);
103
+ const hash = await writeableRollup.write.flushEntryQueue();
104
+ await publicClient.waitForTransactionReceipt({ hash });
105
+ log(`Flushed staking entry queue in tx ${hash}`);
89
106
  } else if (command === 'remove') {
90
107
  if (!who || !writeableRollup) {
91
108
  throw new Error(`Missing sequencer address`);
@@ -95,7 +112,7 @@ export async function sequencers(opts: {
95
112
  await publicClient.waitForTransactionReceipt({ hash });
96
113
  log(`Removed in tx ${hash}`);
97
114
  } else if (command === 'who-next') {
98
- const next = await rollup.read.getCurrentProposer();
115
+ const next = await rollup.getCurrentProposer();
99
116
  log(`Sequencer expected to build is ${next}`);
100
117
  } else {
101
118
  throw new Error(`Unknown command ${command}`);
@@ -1,14 +1,15 @@
1
1
  import { type InitialAccountData, deployFundedSchnorrAccounts, getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { type AztecAddress, SignerlessWallet, type WaitOpts, createPXEClient, makeFetch } from '@aztec/aztec.js';
2
+ import { type AztecAddress, type WaitForProvenOpts, type WaitOpts, createPXEClient, makeFetch } from '@aztec/aztec.js';
3
3
  import { jsonStringify } from '@aztec/foundation/json-rpc';
4
4
  import type { LogFn } from '@aztec/foundation/log';
5
5
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
6
6
 
7
- import { setupCanonicalL2FeeJuice } from '../misc/setup_contracts.js';
7
+ import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
8
8
 
9
9
  export async function setupL2Contracts(
10
10
  rpcUrl: string,
11
11
  testAccounts: boolean,
12
+ sponsoredFPC: boolean,
12
13
  json: boolean,
13
14
  skipProofWait: boolean,
14
15
  log: LogFn,
@@ -16,19 +17,18 @@ export async function setupL2Contracts(
16
17
  const waitOpts: WaitOpts = {
17
18
  timeout: 180,
18
19
  interval: 1,
19
- proven: !skipProofWait,
20
- provenTimeout: 600,
21
20
  };
21
+ const waitForProvenOptions: WaitForProvenOpts | undefined = !skipProofWait
22
+ ? {
23
+ provenTimeout: 600,
24
+ }
25
+ : undefined;
22
26
  log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
27
+ if (waitForProvenOptions) {
28
+ log('setupL2Contracts: Wait for proven options' + jsonStringify(waitForProvenOptions));
29
+ }
23
30
  log('setupL2Contracts: Creating PXE client...');
24
31
  const pxe = createPXEClient(rpcUrl, {}, makeFetch([1, 1, 1, 1, 1], false));
25
- const wallet = new SignerlessWallet(pxe);
26
-
27
- log('setupL2Contracts: Getting fee juice portal address...');
28
- // Deploy Fee Juice
29
- const feeJuicePortalAddress = (await wallet.getNodeInfo()).l1ContractAddresses.feeJuicePortalAddress;
30
- log('setupL2Contracts: Setting up fee juice portal...');
31
- await setupCanonicalL2FeeJuice(wallet, feeJuicePortalAddress, waitOpts, log);
32
32
 
33
33
  let deployedAccounts: InitialAccountData[] = [];
34
34
  if (testAccounts) {
@@ -37,6 +37,11 @@ export async function setupL2Contracts(
37
37
  await deployFundedSchnorrAccounts(pxe, deployedAccounts, waitOpts);
38
38
  }
39
39
 
40
+ if (sponsoredFPC) {
41
+ log('setupL2Contracts: Setting up sponsored FPC...');
42
+ await setupSponsoredFPC(pxe, log, waitOpts, waitForProvenOptions);
43
+ }
44
+
40
45
  if (json) {
41
46
  const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
42
47
  deployedAccounts.forEach((a, i) => {
@@ -1,11 +1,12 @@
1
- import { CheatCodes, createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { createPXEClient, makeFetch } from '@aztec/aztec.js';
2
+ import { RollupCheatCodes } from '@aztec/ethereum/test';
2
3
  import type { LogFn } from '@aztec/foundation/log';
3
4
 
4
5
  export async function advanceEpoch(l1RpcUrls: string[], rpcUrl: string, log: LogFn) {
5
6
  const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
6
7
  const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
7
8
 
8
- const cheat = CheatCodes.createRollup(l1RpcUrls, { rollupAddress });
9
+ const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
9
10
 
10
11
  await cheat.advanceToNextEpoch();
11
12
  log(`Warped time to advance to next epoch`);
@@ -1,4 +1,5 @@
1
- import { EthCheatCodes, RollupCheatCodes, createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { createPXEClient, makeFetch } from '@aztec/aztec.js';
2
+ import { RollupCheatCodes } from '@aztec/ethereum/test';
2
3
  import type { LogFn } from '@aztec/foundation/log';
3
4
 
4
5
  export async function assumeProvenThrough(
@@ -11,8 +12,7 @@ export async function assumeProvenThrough(
11
12
  const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
12
13
  const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber());
13
14
 
14
- const ethCheatCode = new EthCheatCodes(l1RpcUrls);
15
- const rollupCheatCodes = new RollupCheatCodes(ethCheatCode, { rollupAddress });
15
+ const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
16
16
 
17
17
  await rollupCheatCodes.markAsProven(blockNumber);
18
18
  log(`Assumed proven through block ${blockNumber}`);
@@ -1,5 +1,5 @@
1
1
  import { type AztecAddress, type EthAddress, type Fr, L1ToL2TokenPortalManager } from '@aztec/aztec.js';
2
- import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
2
+ import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
3
3
  import type { LogFn, Logger } from '@aztec/foundation/log';
4
4
 
5
5
  import { prettyPrintJSON } from '../../utils/commands.js';
@@ -12,6 +12,7 @@ export async function bridgeERC20(
12
12
  privateKey: string | undefined,
13
13
  mnemonic: string,
14
14
  tokenAddress: EthAddress,
15
+ handlerAddress: EthAddress | undefined,
15
16
  portalAddress: EthAddress,
16
17
  privateTransfer: boolean,
17
18
  mint: boolean,
@@ -21,10 +22,10 @@ export async function bridgeERC20(
21
22
  ) {
22
23
  // Prepare L1 client
23
24
  const chain = createEthereumChain(l1RpcUrls, chainId);
24
- const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
25
+ const l1Client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
25
26
 
26
27
  // Setup portal manager
27
- const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, publicClient, walletClient, debugLogger);
28
+ const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress, l1Client, debugLogger);
28
29
  let claimSecret: Fr;
29
30
  let messageHash: `0x${string}`;
30
31
  if (privateTransfer) {
@@ -1,10 +1,12 @@
1
1
  import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
+ import { type EthAddress, Fr } from '@aztec/aztec.js';
2
3
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
- import type { EthAddress } from '@aztec/foundation/eth-address';
4
+ import { SecretValue } from '@aztec/foundation/config';
4
5
  import type { LogFn, Logger } from '@aztec/foundation/log';
5
6
  import { getGenesisValues } from '@aztec/world-state/testing';
6
7
 
7
8
  import { deployAztecContracts } from '../../utils/aztec.js';
9
+ import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
8
10
 
9
11
  export async function deployL1Contracts(
10
12
  rpcUrls: string[],
@@ -14,16 +16,28 @@ export async function deployL1Contracts(
14
16
  mnemonicIndex: number,
15
17
  salt: number | undefined,
16
18
  testAccounts: boolean,
19
+ sponsoredFPC: boolean,
17
20
  acceleratedTestDeployments: boolean,
18
21
  json: boolean,
22
+ createVerificationJson: string | false,
19
23
  initialValidators: EthAddress[],
24
+ realVerifier: boolean,
25
+ existingToken: EthAddress | undefined,
20
26
  log: LogFn,
21
27
  debugLogger: Logger,
22
28
  ) {
23
29
  const config = getL1ContractsConfigEnvVars();
24
30
 
25
- const initialFundedAccounts = testAccounts ? await getInitialTestAccounts() : [];
26
- const { genesisBlockHash, genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
31
+ const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
32
+ const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
33
+ const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
34
+ const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
35
+
36
+ const initialValidatorOperators = initialValidators.map(a => ({
37
+ attester: a,
38
+ withdrawer: a,
39
+ bn254SecretKey: new SecretValue(Fr.random().toBigInt()),
40
+ }));
27
41
 
28
42
  const { l1ContractAddresses } = await deployAztecContracts(
29
43
  rpcUrls,
@@ -32,18 +46,21 @@ export async function deployL1Contracts(
32
46
  mnemonic,
33
47
  mnemonicIndex,
34
48
  salt,
35
- initialValidators,
49
+ initialValidatorOperators,
36
50
  genesisArchiveRoot,
37
- genesisBlockHash,
51
+ fundingNeeded,
38
52
  acceleratedTestDeployments,
39
53
  config,
54
+ existingToken,
55
+ realVerifier,
56
+ createVerificationJson,
40
57
  debugLogger,
41
58
  );
42
59
 
43
60
  if (json) {
44
61
  log(
45
62
  JSON.stringify(
46
- Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v]) => [k, v.toString()])),
63
+ Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v]) => [k, v?.toString() ?? 'Not deployed'])),
47
64
  null,
48
65
  2,
49
66
  ),
@@ -51,6 +68,7 @@ export async function deployL1Contracts(
51
68
  } else {
52
69
  log(`Rollup Address: ${l1ContractAddresses.rollupAddress.toString()}`);
53
70
  log(`Registry Address: ${l1ContractAddresses.registryAddress.toString()}`);
71
+ log(`GSE Address: ${l1ContractAddresses.gseAddress?.toString()}`);
54
72
  log(`L1 -> L2 Inbox Address: ${l1ContractAddresses.inboxAddress.toString()}`);
55
73
  log(`L2 -> L1 Outbox Address: ${l1ContractAddresses.outboxAddress.toString()}`);
56
74
  log(`Fee Juice Address: ${l1ContractAddresses.feeJuiceAddress.toString()}`);
@@ -61,5 +79,11 @@ export async function deployL1Contracts(
61
79
  log(`GovernanceProposer Address: ${l1ContractAddresses.governanceProposerAddress.toString()}`);
62
80
  log(`Governance Address: ${l1ContractAddresses.governanceAddress.toString()}`);
63
81
  log(`SlashFactory Address: ${l1ContractAddresses.slashFactoryAddress?.toString()}`);
82
+ log(`FeeAssetHandler Address: ${l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
83
+ log(`StakingAssetHandler Address: ${l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
84
+ log(`ZK Passport Verifier Address: ${l1ContractAddresses.zkPassportVerifierAddress?.toString()}`);
85
+ log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
86
+ log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
87
+ log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
64
88
  }
65
89
  }
@@ -1,10 +1,11 @@
1
1
  import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
2
+ import { type Operator, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
3
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { LogFn, Logger } from '@aztec/foundation/log';
5
5
  import { getGenesisValues } from '@aztec/world-state/testing';
6
6
 
7
7
  import { deployNewRollupContracts } from '../../utils/aztec.js';
8
+ import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
8
9
 
9
10
  export async function deployNewRollup(
10
11
  registryAddress: EthAddress,
@@ -15,17 +16,22 @@ export async function deployNewRollup(
15
16
  mnemonicIndex: number,
16
17
  salt: number | undefined,
17
18
  testAccounts: boolean,
19
+ sponsoredFPC: boolean,
18
20
  json: boolean,
19
- initialValidators: EthAddress[],
21
+ initialValidators: Operator[],
22
+ realVerifier: boolean,
23
+ createVerificationJson: string | false,
20
24
  log: LogFn,
21
25
  debugLogger: Logger,
22
26
  ) {
23
27
  const config = getL1ContractsConfigEnvVars();
24
28
 
25
- const initialFundedAccounts = testAccounts ? await getInitialTestAccounts() : [];
26
- const { genesisBlockHash, genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
29
+ const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
30
+ const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
31
+ const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
32
+ const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
27
33
 
28
- const { payloadAddress, rollup } = await deployNewRollupContracts(
34
+ const { rollup, slashFactoryAddress } = await deployNewRollupContracts(
29
35
  registryAddress,
30
36
  rpcUrls,
31
37
  chainId,
@@ -35,8 +41,10 @@ export async function deployNewRollup(
35
41
  salt,
36
42
  initialValidators,
37
43
  genesisArchiveRoot,
38
- genesisBlockHash,
44
+ fundingNeeded,
39
45
  config,
46
+ realVerifier,
47
+ createVerificationJson,
40
48
  debugLogger,
41
49
  );
42
50
 
@@ -44,15 +52,21 @@ export async function deployNewRollup(
44
52
  log(
45
53
  JSON.stringify(
46
54
  {
47
- payloadAddress: payloadAddress.toString(),
48
55
  rollupAddress: rollup.address,
56
+ initialFundedAccounts: initialFundedAccounts.map(a => a.toString()),
57
+ initialValidators: initialValidators.map(a => a.attester.toString()),
58
+ genesisArchiveRoot: genesisArchiveRoot.toString(),
59
+ slashFactoryAddress: slashFactoryAddress.toString(),
49
60
  },
50
61
  null,
51
62
  2,
52
63
  ),
53
64
  );
54
65
  } else {
55
- log(`Payload Address: ${payloadAddress.toString()}`);
56
66
  log(`Rollup Address: ${rollup.address}`);
67
+ log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
68
+ log(`Initial validators: ${initialValidators.map(a => a.attester.toString()).join(', ')}`);
69
+ log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
70
+ log(`Slash Factory Address: ${slashFactoryAddress.toString()}`);
57
71
  }
58
72
  }