@aztec/cli 0.85.0 → 0.86.0-nightly.20250426

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.
@@ -1,6 +1,6 @@
1
1
  import { getInitialTestAccountsManagers } from '@aztec/accounts/testing';
2
2
  import { BatchCall, Fr, L1FeeJuicePortalManager, createCompatibleClient, retryUntil, waitForProven } from '@aztec/aztec.js';
3
- import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum';
3
+ import { createEthereumChain, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
4
4
  import { getContract } from 'viem';
5
5
  import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
6
6
  const waitOpts = {
@@ -18,17 +18,17 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
18
18
  const [accountManager] = await getInitialTestAccountsManagers(pxe);
19
19
  await accountManager.register();
20
20
  const wallet = await accountManager.getWallet();
21
- const l1Clients = createL1Clients(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
21
+ const l1Client = createExtendedL1Client(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
22
22
  mnemonicToAccount(l1Mnemonic, {
23
23
  addressIndex
24
24
  }), createEthereumChain(l1Urls, +l1ChainId).chainInfo);
25
- const { erc20Address, portalAddress } = await deployERC20(l1Clients);
25
+ const { erc20Address, portalAddress } = await deployERC20(l1Client);
26
26
  const { token, bridge } = await deployToken(wallet, portalAddress);
27
- await initPortal(pxe, l1Clients, erc20Address, portalAddress, bridge.address);
27
+ await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
28
28
  const fpcAdmin = wallet.getAddress();
29
29
  const fpc = await deployFPC(wallet, token.address, fpcAdmin);
30
30
  const counter = await deployCounter(wallet);
31
- await fundFPC(pxe, counter.address, wallet, l1Clients, fpc.address, debugLog);
31
+ await fundFPC(pxe, counter.address, wallet, l1Client, fpc.address, debugLog);
32
32
  if (json) {
33
33
  log(JSON.stringify({
34
34
  devCoinL1: erc20Address.toString(),
@@ -73,7 +73,7 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
73
73
  }
74
74
  /**
75
75
  * Step 1. Deploy the L1 contracts, but don't initialize
76
- */ async function deployERC20({ walletClient, publicClient }) {
76
+ */ async function deployERC20(l1Client) {
77
77
  const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
78
78
  const erc20 = {
79
79
  contractAbi: TestERC20Abi,
@@ -83,12 +83,12 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
83
83
  contractAbi: TokenPortalAbi,
84
84
  contractBytecode: TokenPortalBytecode
85
85
  };
86
- const { address: erc20Address } = await deployL1Contract(walletClient, publicClient, erc20.contractAbi, erc20.contractBytecode, [
86
+ const { address: erc20Address } = await deployL1Contract(l1Client, erc20.contractAbi, erc20.contractBytecode, [
87
87
  'DevCoin',
88
88
  'DEV',
89
- walletClient.account.address
89
+ l1Client.account.address
90
90
  ]);
91
- const { address: portalAddress } = await deployL1Contract(walletClient, publicClient, portal.contractAbi, portal.contractBytecode);
91
+ const { address: portalAddress } = await deployL1Contract(l1Client, portal.contractAbi, portal.contractBytecode);
92
92
  return {
93
93
  erc20Address,
94
94
  portalAddress
@@ -128,20 +128,20 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
128
128
  }
129
129
  /**
130
130
  * Step 3. Initialize DevCoin's L1 portal
131
- */ async function initPortal(pxe, { walletClient, publicClient }, erc20, portal, bridge) {
131
+ */ async function initPortal(pxe, l1Client, erc20, portal, bridge) {
132
132
  const { TokenPortalAbi } = await import('@aztec/l1-artifacts');
133
133
  const { l1ContractAddresses: { registryAddress } } = await pxe.getNodeInfo();
134
134
  const contract = getContract({
135
135
  abi: TokenPortalAbi,
136
136
  address: portal.toString(),
137
- client: walletClient
137
+ client: l1Client
138
138
  });
139
139
  const hash = await contract.write.initialize([
140
140
  registryAddress.toString(),
141
141
  erc20.toString(),
142
142
  bridge.toString()
143
143
  ]);
144
- await publicClient.waitForTransactionReceipt({
144
+ await l1Client.waitForTransactionReceipt({
145
145
  hash
146
146
  });
147
147
  }
@@ -174,7 +174,7 @@ async function deployCounter(wallet) {
174
174
  return info;
175
175
  }
176
176
  // NOTE: Disabling for now in order to get devnet running
177
- async function fundFPC(pxe, counterAddress, wallet, l1Clients, fpcAddress, debugLog) {
177
+ async function fundFPC(pxe, counterAddress, wallet, l1Client, fpcAddress, debugLog) {
178
178
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
179
179
  // @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
180
180
  const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
@@ -183,7 +183,7 @@ async function fundFPC(pxe, counterAddress, wallet, l1Clients, fpcAddress, debug
183
183
  const { CounterContract } = await import('@aztec/noir-contracts.js/Counter');
184
184
  const { protocolContractAddresses: { feeJuice } } = await wallet.getPXEInfo();
185
185
  const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
186
- const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Clients.publicClient, l1Clients.walletClient, debugLog);
186
+ const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Client, debugLog);
187
187
  const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, undefined, true);
188
188
  await retryUntil(async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
189
189
  const counter = await CounterContract.at(counterAddress, wallet);
@@ -1 +1 @@
1
- {"version":3,"file":"bridge_erc20.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/bridge_erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAqC,MAAM,iBAAiB,CAAC;AAExG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,UAAU,GAAG,SAAS,EACtC,aAAa,EAAE,UAAU,EACzB,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAuCpB"}
1
+ {"version":3,"file":"bridge_erc20.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/bridge_erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAqC,MAAM,iBAAiB,CAAC;AAExG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,UAAU,GAAG,SAAS,EACtC,aAAa,EAAE,UAAU,EACzB,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAgCpB"}
@@ -1,12 +1,12 @@
1
1
  import { L1ToL2TokenPortalManager } from '@aztec/aztec.js';
2
- import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
2
+ import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
3
3
  import { prettyPrintJSON } from '../../utils/commands.js';
4
4
  export async function bridgeERC20(amount, recipient, l1RpcUrls, chainId, privateKey, mnemonic, tokenAddress, handlerAddress, portalAddress, privateTransfer, mint, json, log, debugLogger) {
5
5
  // Prepare L1 client
6
6
  const chain = createEthereumChain(l1RpcUrls, chainId);
7
- const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
7
+ const l1Client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
8
8
  // Setup portal manager
9
- const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress, publicClient, walletClient, debugLogger);
9
+ const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress, l1Client, debugLogger);
10
10
  let claimSecret;
11
11
  let messageHash;
12
12
  if (privateTransfer) {
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAqDpB"}
1
+ {"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAmDpB"}
@@ -8,8 +8,8 @@ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic,
8
8
  const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
9
9
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
10
10
  const initialFundedAccounts = initialAccounts.map((a)=>a.address).concat(sponsoredFPCAddress);
11
- const { genesisBlockHash, genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
12
- const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, fundingNeeded, acceleratedTestDeployments, config, debugLogger);
11
+ const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
12
+ const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, fundingNeeded, acceleratedTestDeployments, config, debugLogger);
13
13
  if (json) {
14
14
  log(JSON.stringify(Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v])=>[
15
15
  k,
@@ -32,7 +32,6 @@ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic,
32
32
  log(`StakingAssetHandler Address: ${l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
33
33
  log(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
34
34
  log(`Initial validators: ${initialValidators.map((a)=>a.toString()).join(', ')}`);
35
- log(`Genesis block hash: ${genesisBlockHash.toString()}`);
36
35
  log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
37
36
  }
38
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_l1_verifier.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAE7C,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAqCpB;AAED,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAmCpB"}
1
+ {"version":3,"file":"deploy_l1_verifier.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAE7C,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAgCpB;AAED,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAkCpB"}
@@ -1,10 +1,10 @@
1
1
  import { createCompatibleClient } from '@aztec/aztec.js';
2
- import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum';
2
+ import { createEthereumChain, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
3
3
  import { HonkVerifierAbi, HonkVerifierBytecode } from '@aztec/l1-artifacts';
4
4
  import { InvalidOptionArgumentError } from 'commander';
5
5
  import { getContract } from 'viem';
6
6
  export async function deployUltraHonkVerifier(rollupAddress, ethRpcUrls, l1ChainId, privateKey, mnemonic, pxeRpcUrl, log, debugLogger) {
7
- const { publicClient, walletClient } = createL1Clients(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
7
+ const extendedClient = createExtendedL1Client(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
8
8
  if (!rollupAddress && pxeRpcUrl) {
9
9
  const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger);
10
10
  const { l1ContractAddresses } = await pxe.getNodeInfo();
@@ -17,9 +17,9 @@ export async function deployUltraHonkVerifier(rollupAddress, ethRpcUrls, l1Chain
17
17
  const rollup = getContract({
18
18
  abi: RollupAbi,
19
19
  address: rollupAddress,
20
- client: walletClient
20
+ client: extendedClient
21
21
  });
22
- const { address: verifierAddress } = await deployL1Contract(walletClient, publicClient, HonkVerifierAbi, HonkVerifierBytecode);
22
+ const { address: verifierAddress } = await deployL1Contract(extendedClient, HonkVerifierAbi, HonkVerifierBytecode);
23
23
  log(`Deployed honk verifier at ${verifierAddress}`);
24
24
  await rollup.write.setEpochVerifier([
25
25
  verifierAddress.toString()
@@ -27,9 +27,9 @@ export async function deployUltraHonkVerifier(rollupAddress, ethRpcUrls, l1Chain
27
27
  log(`Rollup accepts only real proofs now`);
28
28
  }
29
29
  export async function deployMockVerifier(rollupAddress, ethRpcUrls, l1ChainId, privateKey, mnemonic, pxeRpcUrl, log, debugLogger) {
30
- const { publicClient, walletClient } = createL1Clients(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
30
+ const extendedClient = createExtendedL1Client(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
31
31
  const { MockVerifierAbi, MockVerifierBytecode, RollupAbi } = await import('@aztec/l1-artifacts');
32
- const { address: mockVerifierAddress } = await deployL1Contract(walletClient, publicClient, MockVerifierAbi, MockVerifierBytecode);
32
+ const { address: mockVerifierAddress } = await deployL1Contract(extendedClient, MockVerifierAbi, MockVerifierBytecode);
33
33
  log(`Deployed MockVerifier at ${mockVerifierAddress.toString()}`);
34
34
  if (!rollupAddress && pxeRpcUrl) {
35
35
  const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger);
@@ -42,7 +42,7 @@ export async function deployMockVerifier(rollupAddress, ethRpcUrls, l1ChainId, p
42
42
  const rollup = getContract({
43
43
  abi: RollupAbi,
44
44
  address: rollupAddress,
45
- client: walletClient
45
+ client: extendedClient
46
46
  });
47
47
  await rollup.write.setEpochVerifier([
48
48
  mockVerifierAddress.toString()
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_new_rollup.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_new_rollup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,eAAe,CACnC,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBAgDpB"}
1
+ {"version":3,"file":"deploy_new_rollup.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_new_rollup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,eAAe,CACnC,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBA6CpB"}
@@ -8,14 +8,13 @@ export async function deployNewRollup(registryAddress, rpcUrls, chainId, private
8
8
  const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
9
9
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
10
10
  const initialFundedAccounts = initialAccounts.map((a)=>a.address).concat(sponsoredFPCAddress);
11
- const { genesisBlockHash, genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
12
- const { rollup, slashFactoryAddress } = await deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, fundingNeeded, config, debugLogger);
11
+ const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
12
+ const { rollup, slashFactoryAddress } = await deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, fundingNeeded, config, debugLogger);
13
13
  if (json) {
14
14
  log(JSON.stringify({
15
15
  rollupAddress: rollup.address,
16
16
  initialFundedAccounts: initialFundedAccounts.map((a)=>a.toString()),
17
17
  initialValidators: initialValidators.map((a)=>a.toString()),
18
- genesisBlockHash: genesisBlockHash.toString(),
19
18
  genesisArchiveRoot: genesisArchiveRoot.toString(),
20
19
  slashFactoryAddress: slashFactoryAddress.toString()
21
20
  }, null, 2));
@@ -23,7 +22,6 @@ export async function deployNewRollup(registryAddress, rpcUrls, chainId, private
23
22
  log(`Rollup Address: ${rollup.address}`);
24
23
  log(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
25
24
  log(`Initial validators: ${initialValidators.map((a)=>a.toString()).join(', ')}`);
26
- log(`Genesis block hash: ${genesisBlockHash.toString()}`);
27
25
  log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
28
26
  log(`Slash Factory Address: ${slashFactoryAddress.toString()}`);
29
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"governance_utils.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/governance_utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,uBAAuB,CAAC,EAC5C,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,MAAM,EACN,WAAW,EACX,IAAI,GACL,EAAE;IACD,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,iBA0BA;AAED,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,WAAW,EACX,GAAG,GACJ,EAAE;IACD,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;CACf,iBAoBA;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,iBAmBA;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,iBAiBA"}
1
+ {"version":3,"file":"governance_utils.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/governance_utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,uBAAuB,CAAC,EAC5C,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,MAAM,EACN,WAAW,EACX,IAAI,GACL,EAAE;IACD,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,iBA2BA;AAED,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,WAAW,EACX,GAAG,GACJ,EAAE;IACD,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;CACf,iBAoBA;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,iBAmBA;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,iBAiBA"}
@@ -1,13 +1,13 @@
1
- import { FeeJuiceContract, GovernanceContract, ProposalState, RegistryContract, createEthereumChain, createL1Clients } from '@aztec/ethereum';
1
+ import { FeeJuiceContract, GovernanceContract, ProposalState, RegistryContract, createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
2
2
  export async function depositGovernanceTokens({ registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, recipient, amount, debugLogger, mint }) {
3
3
  debugLogger.info(`Depositing ${amount} governance tokens to ${recipient}`);
4
4
  const chain = createEthereumChain(rpcUrls, chainId);
5
- const { publicClient, walletClient } = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
6
- const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, 'canonical');
5
+ const extendedClient = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
6
+ const addresses = await RegistryContract.collectAddresses(extendedClient, registryAddress, 'canonical');
7
7
  const governanceAddress = addresses.governanceAddress.toString();
8
8
  const tokenAddress = addresses.stakingAssetAddress.toString();
9
- const feeJuice = new FeeJuiceContract(tokenAddress, publicClient, walletClient);
10
- const governance = new GovernanceContract(governanceAddress, publicClient, walletClient);
9
+ const feeJuice = new FeeJuiceContract(tokenAddress, extendedClient);
10
+ const governance = new GovernanceContract(governanceAddress, extendedClient);
11
11
  if (mint) {
12
12
  await feeJuice.mint(recipient, amount);
13
13
  debugLogger.info(`Minted ${amount} tokens to ${recipient}`);
@@ -20,13 +20,13 @@ export async function depositGovernanceTokens({ registryAddress, rpcUrls, chainI
20
20
  export async function proposeWithLock({ payloadAddress, registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, json, debugLogger, log }) {
21
21
  debugLogger.info(`Proposing with lock from ${payloadAddress} to ${registryAddress}`);
22
22
  const chain = createEthereumChain(rpcUrls, chainId);
23
- const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
24
- const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
23
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
24
+ const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
25
25
  const governanceAddress = addresses.governanceAddress.toString();
26
- const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
26
+ const governance = new GovernanceContract(governanceAddress, client);
27
27
  const proposalId = await governance.proposeWithLock({
28
28
  payloadAddress,
29
- withdrawAddress: clients.walletClient.account.address
29
+ withdrawAddress: client.account.address
30
30
  });
31
31
  if (json) {
32
32
  log(JSON.stringify({
@@ -40,10 +40,10 @@ export async function proposeWithLock({ payloadAddress, registryAddress, rpcUrls
40
40
  export async function voteOnGovernanceProposal({ proposalId, voteAmount, inFavor, waitTilActive, registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, debugLogger }) {
41
41
  debugLogger.info(`Voting on proposal ${proposalId} with ${voteAmount ? voteAmount : 'all'} tokens in favor: ${inFavor}`);
42
42
  const chain = createEthereumChain(rpcUrls, chainId);
43
- const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
44
- const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
43
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
44
+ const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
45
45
  const governanceAddress = addresses.governanceAddress.toString();
46
- const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
46
+ const governance = new GovernanceContract(governanceAddress, client);
47
47
  const state = await governance.getProposalState(proposalId);
48
48
  if (state !== ProposalState.Active && !waitTilActive) {
49
49
  debugLogger.warn(`Proposal is not active, but waitTilActive is false. Not voting.`);
@@ -64,10 +64,10 @@ export async function voteOnGovernanceProposal({ proposalId, voteAmount, inFavor
64
64
  export async function executeGovernanceProposal({ proposalId, waitTilExecutable, registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, debugLogger }) {
65
65
  debugLogger.info(`Executing proposal ${proposalId}`);
66
66
  const chain = createEthereumChain(rpcUrls, chainId);
67
- const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
68
- const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
67
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
68
+ const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
69
69
  const governanceAddress = addresses.governanceAddress.toString();
70
- const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
70
+ const governance = new GovernanceContract(governanceAddress, client);
71
71
  const state = await governance.getProposalState(proposalId);
72
72
  if (state !== ProposalState.Executable && !waitTilExecutable) {
73
73
  debugLogger.warn(`Proposal is not executable, but waitTilExecutable is false. Not executing.`);
@@ -1 +1 @@
1
- {"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAAG,UAAU,GAAG;IAAE,eAAe,EAAE,UAAU,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAAE,iBAqC/G;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAcnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAchC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
1
+ {"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAAG,UAAU,GAAG;IAAE,eAAe,EAAE,UAAU,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAAE,iBAiD/G;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAiBnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAgBhC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
@@ -1,6 +1,6 @@
1
- import { EthCheatCodes, RollupContract, createEthereumChain, getExpectedAddress, getL1ContractsConfigEnvVars, isAnvilTestChain } from '@aztec/ethereum';
1
+ import { EthCheatCodes, L1TxUtils, RollupContract, createEthereumChain, createExtendedL1Client, getExpectedAddress, getL1ContractsConfigEnvVars, getPublicClient, isAnvilTestChain } from '@aztec/ethereum';
2
2
  import { ForwarderAbi, ForwarderBytecode, RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
3
- import { createPublicClient, createWalletClient, fallback, formatEther, getContract, http } from 'viem';
3
+ import { encodeFunctionData, formatEther, getContract } from 'viem';
4
4
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
5
5
  export function generateL1Account() {
6
6
  const privateKey = generatePrivateKey();
@@ -13,32 +13,42 @@ export function generateL1Account() {
13
13
  }
14
14
  export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, proposerEOAAddress, stakingAssetHandlerAddress, log, debugLogger }) {
15
15
  const dualLog = makeDualLog(log, debugLogger);
16
- const publicClient = getPublicClient(rpcUrls, chainId);
17
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
16
+ const account = getAccount(privateKey, mnemonic);
17
+ const chain = createEthereumChain(rpcUrls, chainId);
18
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
18
19
  const stakingAssetHandler = getContract({
19
20
  address: stakingAssetHandlerAddress.toString(),
20
21
  abi: StakingAssetHandlerAbi,
21
- client: walletClient
22
+ client: l1Client
22
23
  });
23
24
  const rollup = await stakingAssetHandler.read.getRollup();
24
25
  const forwarderAddress = getExpectedAddress(ForwarderAbi, ForwarderBytecode, [
25
26
  proposerEOAAddress.toString()
26
27
  ], proposerEOAAddress.toString()).address;
27
28
  dualLog(`Adding validator (${attesterAddress}, ${proposerEOAAddress} [forwarder: ${forwarderAddress}]) to rollup ${rollup.toString()}`);
28
- const txHash = await stakingAssetHandler.write.addValidator([
29
- attesterAddress.toString(),
30
- forwarderAddress
31
- ]);
32
- dualLog(`Transaction hash: ${txHash}`);
33
- await publicClient.waitForTransactionReceipt({
34
- hash: txHash
29
+ const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
30
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
31
+ to: stakingAssetHandlerAddress.toString(),
32
+ data: encodeFunctionData({
33
+ abi: StakingAssetHandlerAbi,
34
+ functionName: 'addValidator',
35
+ args: [
36
+ attesterAddress.toString(),
37
+ forwarderAddress
38
+ ]
39
+ }),
40
+ abi: StakingAssetHandlerAbi
41
+ });
42
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
43
+ await l1Client.waitForTransactionReceipt({
44
+ hash: receipt.transactionHash
35
45
  });
36
46
  if (isAnvilTestChain(chainId)) {
37
47
  dualLog(`Funding validator on L1`);
38
48
  const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
39
49
  await cheatCodes.setBalance(proposerEOAAddress, 10n ** 20n);
40
50
  } else {
41
- const balance = await publicClient.getBalance({
51
+ const balance = await l1Client.getBalance({
42
52
  address: proposerEOAAddress.toString()
43
53
  });
44
54
  dualLog(`Proposer balance: ${formatEther(balance)} ETH`);
@@ -49,42 +59,46 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
49
59
  }
50
60
  export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger }) {
51
61
  const dualLog = makeDualLog(log, debugLogger);
52
- const publicClient = getPublicClient(rpcUrls, chainId);
53
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
54
- const rollup = getContract({
55
- address: rollupAddress.toString(),
56
- abi: RollupAbi,
57
- client: walletClient
58
- });
62
+ const account = getAccount(privateKey, mnemonic);
63
+ const chain = createEthereumChain(rpcUrls, chainId);
64
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
65
+ const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
59
66
  dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
60
- const txHash = await rollup.write.initiateWithdraw([
61
- validatorAddress.toString(),
62
- validatorAddress.toString()
63
- ]);
64
- dualLog(`Transaction hash: ${txHash}`);
65
- await publicClient.waitForTransactionReceipt({
66
- hash: txHash
67
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
68
+ to: rollupAddress.toString(),
69
+ data: encodeFunctionData({
70
+ abi: RollupAbi,
71
+ functionName: 'initiateWithdraw',
72
+ args: [
73
+ validatorAddress.toString(),
74
+ validatorAddress.toString()
75
+ ]
76
+ })
67
77
  });
78
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
68
79
  }
69
80
  export async function pruneRollup({ rpcUrls, chainId, privateKey, mnemonic, rollupAddress, log, debugLogger }) {
70
81
  const dualLog = makeDualLog(log, debugLogger);
71
- const publicClient = getPublicClient(rpcUrls, chainId);
72
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
73
- const rollup = getContract({
74
- address: rollupAddress.toString(),
75
- abi: RollupAbi,
76
- client: walletClient
77
- });
82
+ const account = getAccount(privateKey, mnemonic);
83
+ const chain = createEthereumChain(rpcUrls, chainId);
84
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
85
+ const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
78
86
  dualLog(`Trying prune`);
79
- const txHash = await rollup.write.prune();
80
- dualLog(`Transaction hash: ${txHash}`);
81
- await publicClient.waitForTransactionReceipt({
82
- hash: txHash
87
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
88
+ to: rollupAddress.toString(),
89
+ data: encodeFunctionData({
90
+ abi: RollupAbi,
91
+ functionName: 'prune'
92
+ })
83
93
  });
94
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
84
95
  }
85
96
  export async function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, numEpochs, log, debugLogger }) {
86
97
  const dualLog = makeDualLog(log, debugLogger);
87
- const publicClient = getPublicClient(rpcUrls, chainId);
98
+ const publicClient = getPublicClient({
99
+ l1RpcUrls: rpcUrls,
100
+ l1ChainId: chainId
101
+ });
88
102
  const rollup = getContract({
89
103
  address: rollupAddress.toString(),
90
104
  abi: RollupAbi,
@@ -111,7 +125,10 @@ export async function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, numEp
111
125
  }
112
126
  export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }) {
113
127
  const config = getL1ContractsConfigEnvVars();
114
- const publicClient = getPublicClient(rpcUrls, chainId);
128
+ const publicClient = getPublicClient({
129
+ l1RpcUrls: rpcUrls,
130
+ l1ChainId: chainId
131
+ });
115
132
  const rollup = new RollupContract(publicClient, rollupAddress);
116
133
  const pendingNum = await rollup.getBlockNumber();
117
134
  log(`Pending block num: ${pendingNum}`);
@@ -139,22 +156,10 @@ function makeDualLog(log, debugLogger) {
139
156
  debugLogger.info(msg);
140
157
  };
141
158
  }
142
- function getPublicClient(rpcUrls, chainId) {
143
- const chain = createEthereumChain(rpcUrls, chainId);
144
- return createPublicClient({
145
- chain: chain.chainInfo,
146
- transport: fallback(rpcUrls.map((url)=>http(url)))
147
- });
148
- }
149
- function getWalletClient(rpcUrls, chainId, privateKey, mnemonic) {
159
+ function getAccount(privateKey, mnemonic) {
150
160
  if (!privateKey && !mnemonic) {
151
161
  throw new Error('Either privateKey or mnemonic must be provided to create a wallet client');
152
162
  }
153
- const chain = createEthereumChain(rpcUrls, chainId);
154
163
  const account = !privateKey ? mnemonicToAccount(mnemonic) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
155
- return createWalletClient({
156
- account,
157
- chain: chain.chainInfo,
158
- transport: fallback(rpcUrls.map((url)=>http(url)))
159
- });
164
+ return account;
160
165
  }
@@ -18,8 +18,8 @@ export declare function getFunctionAbi(artifact: ContractArtifact, fnName: strin
18
18
  * @param privateKey - The private key to be used in contract deployment.
19
19
  * @param mnemonic - The mnemonic to be used in contract deployment.
20
20
  */
21
- export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: EthAddress[], genesisArchiveRoot: Fr, genesisBlockHash: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
22
- export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: EthAddress[], genesisArchiveRoot: Fr, genesisBlockHash: Fr, feeJuicePortalInitialBalance: bigint, config: L1ContractsConfig, logger: Logger): Promise<{
21
+ export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: EthAddress[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
22
+ export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: EthAddress[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, config: L1ContractsConfig, logger: Logger): Promise<{
23
23
  rollup: RollupContract;
24
24
  slashFactoryAddress: EthAddress;
25
25
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EAEtB,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAShE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,UAAU,EAAE,EAC/B,kBAAkB,EAAE,EAAE,EACtB,gBAAgB,EAAE,EAAE,EACpB,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,OAAO,EACnC,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC,CA6BtC;AAED,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,UAAU,EAAE,EAC/B,kBAAkB,EAAE,EAAE,EACtB,gBAAgB,EAAE,EAAE,EACpB,4BAA4B,EAAE,MAAM,EACpC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,mBAAmB,EAAE,UAAU,CAAA;CAAE,CAAC,CAoCtE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAKjE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,6BA4BpE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK;;;;GAO3G;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAS,MAAM,WAK1C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE;AAKD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAyB9E"}
1
+ {"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EAEtB,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAShE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,UAAU,EAAE,EAC/B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,OAAO,EACnC,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC,CA4BtC;AAED,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,UAAU,EAAE,EAC/B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,mBAAmB,EAAE,UAAU,CAAA;CAAE,CAAC,CAmCtE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAKjE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,6BA4BpE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK;;;;GAO3G;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAS,MAAM,WAK1C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE;AAKD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAyB9E"}
@@ -24,7 +24,7 @@ import { encodeArgs } from './encoding.js';
24
24
  * @param chainId - The chain ID of the L1 host.
25
25
  * @param privateKey - The private key to be used in contract deployment.
26
26
  * @param mnemonic - The mnemonic to be used in contract deployment.
27
- */ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, debugLogger) {
27
+ */ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, debugLogger) {
28
28
  const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
29
29
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
30
30
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
@@ -36,7 +36,6 @@ import { encodeArgs } from './encoding.js';
36
36
  vkTreeRoot: getVKTreeRoot(),
37
37
  protocolContractTreeRoot,
38
38
  genesisArchiveRoot,
39
- genesisBlockHash,
40
39
  salt,
41
40
  initialValidators,
42
41
  acceleratedTestDeployments,
@@ -44,29 +43,28 @@ import { encodeArgs } from './encoding.js';
44
43
  ...config
45
44
  }, config);
46
45
  }
47
- export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, feeJuicePortalInitialBalance, config, logger) {
48
- const { createEthereumChain, deployRollupForUpgrade, createL1Clients } = await import('@aztec/ethereum');
46
+ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, config, logger) {
47
+ const { createEthereumChain, deployRollupForUpgrade, createExtendedL1Client } = await import('@aztec/ethereum');
49
48
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
50
49
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
51
50
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
52
51
  addressIndex: mnemonicIndex
53
52
  }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
54
53
  const chain = createEthereumChain(rpcUrls, chainId);
55
- const clients = createL1Clients(rpcUrls, account, chain.chainInfo, mnemonicIndex);
54
+ const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
56
55
  if (!initialValidators || initialValidators.length === 0) {
57
- const registry = new RegistryContract(clients.publicClient, registryAddress);
58
- const rollup = new RollupContract(clients.publicClient, await registry.getCanonicalAddress());
56
+ const registry = new RegistryContract(client, registryAddress);
57
+ const rollup = new RollupContract(client, await registry.getCanonicalAddress());
59
58
  initialValidators = (await rollup.getAttesters()).map((str)=>EthAddress.fromString(str));
60
59
  logger.info('Initializing new rollup with old attesters', {
61
60
  initialValidators
62
61
  });
63
62
  }
64
- const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(clients, {
63
+ const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(client, {
65
64
  salt,
66
65
  vkTreeRoot: getVKTreeRoot(),
67
66
  protocolContractTreeRoot,
68
67
  genesisArchiveRoot,
69
- genesisBlockHash,
70
68
  initialValidators,
71
69
  feeJuicePortalInitialBalance,
72
70
  ...config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli",
3
- "version": "0.85.0",
3
+ "version": "0.86.0-nightly.20250426",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./contracts": "./dest/cmds/contracts/index.js",
@@ -25,8 +25,6 @@
25
25
  "build": "yarn clean && tsc -b",
26
26
  "build:dev": "tsc -b --watch",
27
27
  "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
28
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
31
29
  },
32
30
  "inherits": [
@@ -67,15 +65,15 @@
67
65
  ]
68
66
  },
69
67
  "dependencies": {
70
- "@aztec/archiver": "0.85.0",
71
- "@aztec/aztec.js": "0.85.0",
72
- "@aztec/constants": "0.85.0",
73
- "@aztec/entrypoints": "0.85.0",
74
- "@aztec/foundation": "0.85.0",
75
- "@aztec/l1-artifacts": "0.85.0",
76
- "@aztec/p2p": "0.85.0",
77
- "@aztec/stdlib": "0.85.0",
78
- "@aztec/world-state": "0.85.0",
68
+ "@aztec/archiver": "0.86.0-nightly.20250426",
69
+ "@aztec/aztec.js": "0.86.0-nightly.20250426",
70
+ "@aztec/constants": "0.86.0-nightly.20250426",
71
+ "@aztec/entrypoints": "0.86.0-nightly.20250426",
72
+ "@aztec/foundation": "0.86.0-nightly.20250426",
73
+ "@aztec/l1-artifacts": "0.86.0-nightly.20250426",
74
+ "@aztec/p2p": "0.86.0-nightly.20250426",
75
+ "@aztec/stdlib": "0.86.0-nightly.20250426",
76
+ "@aztec/world-state": "0.86.0-nightly.20250426",
79
77
  "@iarna/toml": "^2.2.5",
80
78
  "@libp2p/peer-id-factory": "^3.0.4",
81
79
  "commander": "^12.1.0",
@@ -87,9 +85,9 @@
87
85
  "viem": "2.23.7"
88
86
  },
89
87
  "devDependencies": {
90
- "@aztec/accounts": "0.85.0",
91
- "@aztec/ethereum": "0.85.0",
92
- "@aztec/protocol-contracts": "0.85.0",
88
+ "@aztec/accounts": "0.86.0-nightly.20250426",
89
+ "@aztec/ethereum": "0.86.0-nightly.20250426",
90
+ "@aztec/protocol-contracts": "0.86.0-nightly.20250426",
93
91
  "@jest/globals": "^29.5.0",
94
92
  "@types/jest": "^29.5.0",
95
93
  "@types/lodash.chunk": "^4.2.9",
@@ -105,14 +103,14 @@
105
103
  "typescript": "^5.0.4"
106
104
  },
107
105
  "peerDependencies": {
108
- "@aztec/accounts": "0.85.0",
109
- "@aztec/bb-prover": "0.85.0",
110
- "@aztec/ethereum": "0.85.0",
111
- "@aztec/l1-artifacts": "0.85.0",
112
- "@aztec/noir-contracts.js": "0.85.0",
113
- "@aztec/noir-protocol-circuits-types": "0.85.0",
114
- "@aztec/protocol-contracts": "0.85.0",
115
- "@aztec/stdlib": "0.85.0"
106
+ "@aztec/accounts": "0.86.0-nightly.20250426",
107
+ "@aztec/bb-prover": "0.86.0-nightly.20250426",
108
+ "@aztec/ethereum": "0.86.0-nightly.20250426",
109
+ "@aztec/l1-artifacts": "0.86.0-nightly.20250426",
110
+ "@aztec/noir-contracts.js": "0.86.0-nightly.20250426",
111
+ "@aztec/noir-protocol-circuits-types": "0.86.0-nightly.20250426",
112
+ "@aztec/protocol-contracts": "0.86.0-nightly.20250426",
113
+ "@aztec/stdlib": "0.86.0-nightly.20250426"
116
114
  },
117
115
  "files": [
118
116
  "dest",
@@ -15,9 +15,9 @@ import {
15
15
  } from '@aztec/aztec.js';
16
16
  import {
17
17
  type ContractArtifacts,
18
- type L1Clients,
18
+ type ExtendedViemWalletClient,
19
19
  createEthereumChain,
20
- createL1Clients,
20
+ createExtendedL1Client,
21
21
  deployL1Contract,
22
22
  } from '@aztec/ethereum';
23
23
  import type { LogFn, Logger } from '@aztec/foundation/log';
@@ -61,7 +61,7 @@ export async function bootstrapNetwork(
61
61
 
62
62
  const wallet = await accountManager.getWallet();
63
63
 
64
- const l1Clients = createL1Clients(
64
+ const l1Client = createExtendedL1Client(
65
65
  l1Urls,
66
66
  l1PrivateKey
67
67
  ? privateKeyToAccount(l1PrivateKey)
@@ -71,18 +71,18 @@ export async function bootstrapNetwork(
71
71
  createEthereumChain(l1Urls, +l1ChainId).chainInfo,
72
72
  );
73
73
 
74
- const { erc20Address, portalAddress } = await deployERC20(l1Clients);
74
+ const { erc20Address, portalAddress } = await deployERC20(l1Client);
75
75
 
76
76
  const { token, bridge } = await deployToken(wallet, portalAddress);
77
77
 
78
- await initPortal(pxe, l1Clients, erc20Address, portalAddress, bridge.address);
78
+ await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
79
79
 
80
80
  const fpcAdmin = wallet.getAddress();
81
81
  const fpc = await deployFPC(wallet, token.address, fpcAdmin);
82
82
 
83
83
  const counter = await deployCounter(wallet);
84
84
 
85
- await fundFPC(pxe, counter.address, wallet, l1Clients, fpc.address, debugLog);
85
+ await fundFPC(pxe, counter.address, wallet, l1Client, fpc.address, debugLog);
86
86
 
87
87
  if (json) {
88
88
  log(
@@ -136,7 +136,7 @@ export async function bootstrapNetwork(
136
136
  /**
137
137
  * Step 1. Deploy the L1 contracts, but don't initialize
138
138
  */
139
- async function deployERC20({ walletClient, publicClient }: L1Clients) {
139
+ async function deployERC20(l1Client: ExtendedViemWalletClient) {
140
140
  const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
141
141
 
142
142
  const erc20: ContractArtifacts = {
@@ -148,19 +148,12 @@ async function deployERC20({ walletClient, publicClient }: L1Clients) {
148
148
  contractBytecode: TokenPortalBytecode,
149
149
  };
150
150
 
151
- const { address: erc20Address } = await deployL1Contract(
152
- walletClient,
153
- publicClient,
154
- erc20.contractAbi,
155
- erc20.contractBytecode,
156
- ['DevCoin', 'DEV', walletClient.account.address],
157
- );
158
- const { address: portalAddress } = await deployL1Contract(
159
- walletClient,
160
- publicClient,
161
- portal.contractAbi,
162
- portal.contractBytecode,
163
- );
151
+ const { address: erc20Address } = await deployL1Contract(l1Client, erc20.contractAbi, erc20.contractBytecode, [
152
+ 'DevCoin',
153
+ 'DEV',
154
+ l1Client.account.address,
155
+ ]);
156
+ const { address: portalAddress } = await deployL1Contract(l1Client, portal.contractAbi, portal.contractBytecode);
164
157
 
165
158
  return {
166
159
  erc20Address,
@@ -214,7 +207,7 @@ async function deployToken(
214
207
  */
215
208
  async function initPortal(
216
209
  pxe: PXE,
217
- { walletClient, publicClient }: L1Clients,
210
+ l1Client: ExtendedViemWalletClient,
218
211
  erc20: EthAddress,
219
212
  portal: EthAddress,
220
213
  bridge: AztecAddress,
@@ -227,12 +220,12 @@ async function initPortal(
227
220
  const contract = getContract({
228
221
  abi: TokenPortalAbi,
229
222
  address: portal.toString(),
230
- client: walletClient,
223
+ client: l1Client,
231
224
  });
232
225
 
233
226
  const hash = await contract.write.initialize([registryAddress.toString(), erc20.toString(), bridge.toString()]);
234
227
 
235
- await publicClient.waitForTransactionReceipt({ hash });
228
+ await l1Client.waitForTransactionReceipt({ hash });
236
229
  }
237
230
 
238
231
  async function deployFPC(
@@ -272,7 +265,7 @@ async function fundFPC(
272
265
  pxe: PXE,
273
266
  counterAddress: AztecAddress,
274
267
  wallet: Wallet,
275
- l1Clients: L1Clients,
268
+ l1Client: ExtendedViemWalletClient,
276
269
  fpcAddress: AztecAddress,
277
270
  debugLog: Logger,
278
271
  ) {
@@ -288,12 +281,7 @@ async function fundFPC(
288
281
 
289
282
  const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
290
283
 
291
- const feeJuicePortal = await L1FeeJuicePortalManager.new(
292
- wallet,
293
- l1Clients.publicClient,
294
- l1Clients.walletClient,
295
- debugLog,
296
- );
284
+ const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Client, debugLog);
297
285
 
298
286
  const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(
299
287
  fpcAddress,
@@ -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';
@@ -22,17 +22,10 @@ export async function bridgeERC20(
22
22
  ) {
23
23
  // Prepare L1 client
24
24
  const chain = createEthereumChain(l1RpcUrls, chainId);
25
- const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
25
+ const l1Client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
26
26
 
27
27
  // Setup portal manager
28
- const manager = new L1ToL2TokenPortalManager(
29
- portalAddress,
30
- tokenAddress,
31
- handlerAddress,
32
- publicClient,
33
- walletClient,
34
- debugLogger,
35
- );
28
+ const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress, l1Client, debugLogger);
36
29
  let claimSecret: Fr;
37
30
  let messageHash: `0x${string}`;
38
31
  if (privateTransfer) {
@@ -27,7 +27,7 @@ export async function deployL1Contracts(
27
27
  const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
28
28
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
29
29
  const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
30
- const { genesisBlockHash, genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
30
+ const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
31
31
 
32
32
  const { l1ContractAddresses } = await deployAztecContracts(
33
33
  rpcUrls,
@@ -38,7 +38,6 @@ export async function deployL1Contracts(
38
38
  salt,
39
39
  initialValidators,
40
40
  genesisArchiveRoot,
41
- genesisBlockHash,
42
41
  fundingNeeded,
43
42
  acceleratedTestDeployments,
44
43
  config,
@@ -70,7 +69,6 @@ export async function deployL1Contracts(
70
69
  log(`StakingAssetHandler Address: ${l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
71
70
  log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
72
71
  log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
73
- log(`Genesis block hash: ${genesisBlockHash.toString()}`);
74
72
  log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
75
73
  }
76
74
  }
@@ -1,5 +1,5 @@
1
1
  import { createCompatibleClient } from '@aztec/aztec.js';
2
- import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum';
2
+ import { createEthereumChain, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
3
3
  import type { LogFn, Logger } from '@aztec/foundation/log';
4
4
  import { HonkVerifierAbi, HonkVerifierBytecode } from '@aztec/l1-artifacts';
5
5
 
@@ -16,7 +16,7 @@ export async function deployUltraHonkVerifier(
16
16
  log: LogFn,
17
17
  debugLogger: Logger,
18
18
  ) {
19
- const { publicClient, walletClient } = createL1Clients(
19
+ const extendedClient = createExtendedL1Client(
20
20
  ethRpcUrls,
21
21
  privateKey ?? mnemonic,
22
22
  createEthereumChain(ethRpcUrls, l1ChainId).chainInfo,
@@ -37,15 +37,10 @@ export async function deployUltraHonkVerifier(
37
37
  const rollup = getContract({
38
38
  abi: RollupAbi,
39
39
  address: rollupAddress,
40
- client: walletClient,
40
+ client: extendedClient,
41
41
  });
42
42
 
43
- const { address: verifierAddress } = await deployL1Contract(
44
- walletClient,
45
- publicClient,
46
- HonkVerifierAbi,
47
- HonkVerifierBytecode,
48
- );
43
+ const { address: verifierAddress } = await deployL1Contract(extendedClient, HonkVerifierAbi, HonkVerifierBytecode);
49
44
  log(`Deployed honk verifier at ${verifierAddress}`);
50
45
 
51
46
  await rollup.write.setEpochVerifier([verifierAddress.toString()]);
@@ -63,7 +58,7 @@ export async function deployMockVerifier(
63
58
  log: LogFn,
64
59
  debugLogger: Logger,
65
60
  ) {
66
- const { publicClient, walletClient } = createL1Clients(
61
+ const extendedClient = createExtendedL1Client(
67
62
  ethRpcUrls,
68
63
  privateKey ?? mnemonic,
69
64
  createEthereumChain(ethRpcUrls, l1ChainId).chainInfo,
@@ -71,8 +66,7 @@ export async function deployMockVerifier(
71
66
  const { MockVerifierAbi, MockVerifierBytecode, RollupAbi } = await import('@aztec/l1-artifacts');
72
67
 
73
68
  const { address: mockVerifierAddress } = await deployL1Contract(
74
- walletClient,
75
- publicClient,
69
+ extendedClient,
76
70
  MockVerifierAbi,
77
71
  MockVerifierBytecode,
78
72
  );
@@ -91,7 +85,7 @@ export async function deployMockVerifier(
91
85
  const rollup = getContract({
92
86
  abi: RollupAbi,
93
87
  address: rollupAddress,
94
- client: walletClient,
88
+ client: extendedClient,
95
89
  });
96
90
 
97
91
  await rollup.write.setEpochVerifier([mockVerifierAddress.toString()]);
@@ -27,7 +27,7 @@ export async function deployNewRollup(
27
27
  const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
28
28
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
29
29
  const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
30
- const { genesisBlockHash, genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
30
+ const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
31
31
 
32
32
  const { rollup, slashFactoryAddress } = await deployNewRollupContracts(
33
33
  registryAddress,
@@ -39,7 +39,6 @@ export async function deployNewRollup(
39
39
  salt,
40
40
  initialValidators,
41
41
  genesisArchiveRoot,
42
- genesisBlockHash,
43
42
  fundingNeeded,
44
43
  config,
45
44
  debugLogger,
@@ -52,7 +51,6 @@ export async function deployNewRollup(
52
51
  rollupAddress: rollup.address,
53
52
  initialFundedAccounts: initialFundedAccounts.map(a => a.toString()),
54
53
  initialValidators: initialValidators.map(a => a.toString()),
55
- genesisBlockHash: genesisBlockHash.toString(),
56
54
  genesisArchiveRoot: genesisArchiveRoot.toString(),
57
55
  slashFactoryAddress: slashFactoryAddress.toString(),
58
56
  },
@@ -64,7 +62,6 @@ export async function deployNewRollup(
64
62
  log(`Rollup Address: ${rollup.address}`);
65
63
  log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
66
64
  log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
67
- log(`Genesis block hash: ${genesisBlockHash.toString()}`);
68
65
  log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
69
66
  log(`Slash Factory Address: ${slashFactoryAddress.toString()}`);
70
67
  }
@@ -4,7 +4,7 @@ import {
4
4
  ProposalState,
5
5
  RegistryContract,
6
6
  createEthereumChain,
7
- createL1Clients,
7
+ createExtendedL1Client,
8
8
  } from '@aztec/ethereum';
9
9
  import type { LogFn, Logger } from '@aztec/foundation/log';
10
10
 
@@ -33,19 +33,20 @@ export async function depositGovernanceTokens({
33
33
  }) {
34
34
  debugLogger.info(`Depositing ${amount} governance tokens to ${recipient}`);
35
35
  const chain = createEthereumChain(rpcUrls, chainId);
36
- const { publicClient, walletClient } = createL1Clients(
36
+ const extendedClient = createExtendedL1Client(
37
37
  rpcUrls,
38
38
  privateKey ?? mnemonic,
39
39
  chain.chainInfo,
40
+ undefined,
40
41
  mnemonicIndex,
41
42
  );
42
43
 
43
- const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, 'canonical');
44
+ const addresses = await RegistryContract.collectAddresses(extendedClient, registryAddress, 'canonical');
44
45
  const governanceAddress = addresses.governanceAddress.toString();
45
46
  const tokenAddress = addresses.stakingAssetAddress.toString();
46
47
 
47
- const feeJuice = new FeeJuiceContract(tokenAddress, publicClient, walletClient);
48
- const governance = new GovernanceContract(governanceAddress, publicClient, walletClient);
48
+ const feeJuice = new FeeJuiceContract(tokenAddress, extendedClient);
49
+ const governance = new GovernanceContract(governanceAddress, extendedClient);
49
50
  if (mint) {
50
51
  await feeJuice.mint(recipient, amount);
51
52
  debugLogger.info(`Minted ${amount} tokens to ${recipient}`);
@@ -83,16 +84,16 @@ export async function proposeWithLock({
83
84
  }) {
84
85
  debugLogger.info(`Proposing with lock from ${payloadAddress} to ${registryAddress}`);
85
86
  const chain = createEthereumChain(rpcUrls, chainId);
86
- const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
87
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
87
88
 
88
- const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
89
+ const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
89
90
  const governanceAddress = addresses.governanceAddress.toString();
90
91
 
91
- const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
92
+ const governance = new GovernanceContract(governanceAddress, client);
92
93
 
93
94
  const proposalId = await governance.proposeWithLock({
94
95
  payloadAddress,
95
- withdrawAddress: clients.walletClient.account.address,
96
+ withdrawAddress: client.account.address,
96
97
  });
97
98
  if (json) {
98
99
  log(JSON.stringify({ proposalId: Number(proposalId) }, null, 2));
@@ -131,12 +132,12 @@ export async function voteOnGovernanceProposal({
131
132
  `Voting on proposal ${proposalId} with ${voteAmount ? voteAmount : 'all'} tokens in favor: ${inFavor}`,
132
133
  );
133
134
  const chain = createEthereumChain(rpcUrls, chainId);
134
- const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
135
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
135
136
 
136
- const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
137
+ const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
137
138
  const governanceAddress = addresses.governanceAddress.toString();
138
139
 
139
- const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
140
+ const governance = new GovernanceContract(governanceAddress, client);
140
141
  const state = await governance.getProposalState(proposalId);
141
142
  if (state !== ProposalState.Active && !waitTilActive) {
142
143
  debugLogger.warn(`Proposal is not active, but waitTilActive is false. Not voting.`);
@@ -170,12 +171,12 @@ export async function executeGovernanceProposal({
170
171
  }) {
171
172
  debugLogger.info(`Executing proposal ${proposalId}`);
172
173
  const chain = createEthereumChain(rpcUrls, chainId);
173
- const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
174
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
174
175
 
175
- const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
176
+ const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
176
177
  const governanceAddress = addresses.governanceAddress.toString();
177
178
 
178
- const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
179
+ const governance = new GovernanceContract(governanceAddress, client);
179
180
  const state = await governance.getProposalState(proposalId);
180
181
  if (state !== ProposalState.Executable && !waitTilExecutable) {
181
182
  debugLogger.warn(`Proposal is not executable, but waitTilExecutable is false. Not executing.`);
@@ -1,16 +1,19 @@
1
1
  import {
2
2
  EthCheatCodes,
3
+ L1TxUtils,
3
4
  RollupContract,
4
5
  createEthereumChain,
6
+ createExtendedL1Client,
5
7
  getExpectedAddress,
6
8
  getL1ContractsConfigEnvVars,
9
+ getPublicClient,
7
10
  isAnvilTestChain,
8
11
  } from '@aztec/ethereum';
9
12
  import type { EthAddress } from '@aztec/foundation/eth-address';
10
13
  import type { LogFn, Logger } from '@aztec/foundation/log';
11
14
  import { ForwarderAbi, ForwarderBytecode, RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
12
15
 
13
- import { createPublicClient, createWalletClient, fallback, formatEther, getContract, http } from 'viem';
16
+ import { encodeFunctionData, formatEther, getContract } from 'viem';
14
17
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
15
18
 
16
19
  export interface RollupCommandArgs {
@@ -57,13 +60,14 @@ export async function addL1Validator({
57
60
  debugLogger,
58
61
  }: StakingAssetHandlerCommandArgs & LoggerArgs & { attesterAddress: EthAddress; proposerEOAAddress: EthAddress }) {
59
62
  const dualLog = makeDualLog(log, debugLogger);
60
- const publicClient = getPublicClient(rpcUrls, chainId);
61
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
63
+ const account = getAccount(privateKey, mnemonic);
64
+ const chain = createEthereumChain(rpcUrls, chainId);
65
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
62
66
 
63
67
  const stakingAssetHandler = getContract({
64
68
  address: stakingAssetHandlerAddress.toString(),
65
69
  abi: StakingAssetHandlerAbi,
66
- client: walletClient,
70
+ client: l1Client,
67
71
  });
68
72
 
69
73
  const rollup = await stakingAssetHandler.read.getRollup();
@@ -78,15 +82,26 @@ export async function addL1Validator({
78
82
  dualLog(
79
83
  `Adding validator (${attesterAddress}, ${proposerEOAAddress} [forwarder: ${forwarderAddress}]) to rollup ${rollup.toString()}`,
80
84
  );
81
- const txHash = await stakingAssetHandler.write.addValidator([attesterAddress.toString(), forwarderAddress]);
82
- dualLog(`Transaction hash: ${txHash}`);
83
- await publicClient.waitForTransactionReceipt({ hash: txHash });
85
+
86
+ const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
87
+
88
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
89
+ to: stakingAssetHandlerAddress.toString(),
90
+ data: encodeFunctionData({
91
+ abi: StakingAssetHandlerAbi,
92
+ functionName: 'addValidator',
93
+ args: [attesterAddress.toString(), forwarderAddress],
94
+ }),
95
+ abi: StakingAssetHandlerAbi,
96
+ });
97
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
98
+ await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
84
99
  if (isAnvilTestChain(chainId)) {
85
100
  dualLog(`Funding validator on L1`);
86
101
  const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
87
102
  await cheatCodes.setBalance(proposerEOAAddress, 10n ** 20n);
88
103
  } else {
89
- const balance = await publicClient.getBalance({ address: proposerEOAAddress.toString() });
104
+ const balance = await l1Client.getBalance({ address: proposerEOAAddress.toString() });
90
105
  dualLog(`Proposer balance: ${formatEther(balance)} ETH`);
91
106
  if (balance === 0n) {
92
107
  dualLog(`WARNING: Proposer has no balance. Remember to fund it!`);
@@ -105,18 +120,21 @@ export async function removeL1Validator({
105
120
  debugLogger,
106
121
  }: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) {
107
122
  const dualLog = makeDualLog(log, debugLogger);
108
- const publicClient = getPublicClient(rpcUrls, chainId);
109
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
110
- const rollup = getContract({
111
- address: rollupAddress.toString(),
112
- abi: RollupAbi,
113
- client: walletClient,
114
- });
123
+ const account = getAccount(privateKey, mnemonic);
124
+ const chain = createEthereumChain(rpcUrls, chainId);
125
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
126
+ const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
115
127
 
116
128
  dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
117
- const txHash = await rollup.write.initiateWithdraw([validatorAddress.toString(), validatorAddress.toString()]);
118
- dualLog(`Transaction hash: ${txHash}`);
119
- await publicClient.waitForTransactionReceipt({ hash: txHash });
129
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
130
+ to: rollupAddress.toString(),
131
+ data: encodeFunctionData({
132
+ abi: RollupAbi,
133
+ functionName: 'initiateWithdraw',
134
+ args: [validatorAddress.toString(), validatorAddress.toString()],
135
+ }),
136
+ });
137
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
120
138
  }
121
139
 
122
140
  export async function pruneRollup({
@@ -129,18 +147,20 @@ export async function pruneRollup({
129
147
  debugLogger,
130
148
  }: RollupCommandArgs & LoggerArgs) {
131
149
  const dualLog = makeDualLog(log, debugLogger);
132
- const publicClient = getPublicClient(rpcUrls, chainId);
133
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
134
- const rollup = getContract({
135
- address: rollupAddress.toString(),
136
- abi: RollupAbi,
137
- client: walletClient,
138
- });
150
+ const account = getAccount(privateKey, mnemonic);
151
+ const chain = createEthereumChain(rpcUrls, chainId);
152
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
153
+ const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
139
154
 
140
155
  dualLog(`Trying prune`);
141
- const txHash = await rollup.write.prune();
142
- dualLog(`Transaction hash: ${txHash}`);
143
- await publicClient.waitForTransactionReceipt({ hash: txHash });
156
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
157
+ to: rollupAddress.toString(),
158
+ data: encodeFunctionData({
159
+ abi: RollupAbi,
160
+ functionName: 'prune',
161
+ }),
162
+ });
163
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
144
164
  }
145
165
 
146
166
  export async function fastForwardEpochs({
@@ -152,7 +172,7 @@ export async function fastForwardEpochs({
152
172
  debugLogger,
153
173
  }: RollupCommandArgs & LoggerArgs & { numEpochs: bigint }) {
154
174
  const dualLog = makeDualLog(log, debugLogger);
155
- const publicClient = getPublicClient(rpcUrls, chainId);
175
+ const publicClient = getPublicClient({ l1RpcUrls: rpcUrls, l1ChainId: chainId });
156
176
  const rollup = getContract({
157
177
  address: rollupAddress.toString(),
158
178
  abi: RollupAbi,
@@ -179,7 +199,7 @@ export async function fastForwardEpochs({
179
199
 
180
200
  export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: RollupCommandArgs & LoggerArgs) {
181
201
  const config = getL1ContractsConfigEnvVars();
182
- const publicClient = getPublicClient(rpcUrls, chainId);
202
+ const publicClient = getPublicClient({ l1RpcUrls: rpcUrls, l1ChainId: chainId });
183
203
  const rollup = new RollupContract(publicClient, rollupAddress);
184
204
 
185
205
  const pendingNum = await rollup.getBlockNumber();
@@ -210,24 +230,12 @@ function makeDualLog(log: LogFn, debugLogger: Logger) {
210
230
  };
211
231
  }
212
232
 
213
- function getPublicClient(rpcUrls: string[], chainId: number) {
214
- const chain = createEthereumChain(rpcUrls, chainId);
215
- return createPublicClient({ chain: chain.chainInfo, transport: fallback(rpcUrls.map(url => http(url))) });
216
- }
217
-
218
- function getWalletClient(
219
- rpcUrls: string[],
220
- chainId: number,
221
- privateKey: string | undefined,
222
- mnemonic: string | undefined,
223
- ) {
233
+ function getAccount(privateKey: string | undefined, mnemonic: string | undefined) {
224
234
  if (!privateKey && !mnemonic) {
225
235
  throw new Error('Either privateKey or mnemonic must be provided to create a wallet client');
226
236
  }
227
-
228
- const chain = createEthereumChain(rpcUrls, chainId);
229
237
  const account = !privateKey
230
238
  ? mnemonicToAccount(mnemonic!)
231
239
  : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
232
- return createWalletClient({ account, chain: chain.chainInfo, transport: fallback(rpcUrls.map(url => http(url))) });
240
+ return account;
233
241
  }
@@ -53,7 +53,6 @@ export async function deployAztecContracts(
53
53
  salt: number | undefined,
54
54
  initialValidators: EthAddress[],
55
55
  genesisArchiveRoot: Fr,
56
- genesisBlockHash: Fr,
57
56
  feeJuicePortalInitialBalance: bigint,
58
57
  acceleratedTestDeployments: boolean,
59
58
  config: L1ContractsConfig,
@@ -78,7 +77,6 @@ export async function deployAztecContracts(
78
77
  vkTreeRoot: getVKTreeRoot(),
79
78
  protocolContractTreeRoot,
80
79
  genesisArchiveRoot,
81
- genesisBlockHash,
82
80
  salt,
83
81
  initialValidators,
84
82
  acceleratedTestDeployments,
@@ -99,12 +97,11 @@ export async function deployNewRollupContracts(
99
97
  salt: number | undefined,
100
98
  initialValidators: EthAddress[],
101
99
  genesisArchiveRoot: Fr,
102
- genesisBlockHash: Fr,
103
100
  feeJuicePortalInitialBalance: bigint,
104
101
  config: L1ContractsConfig,
105
102
  logger: Logger,
106
103
  ): Promise<{ rollup: RollupContract; slashFactoryAddress: EthAddress }> {
107
- const { createEthereumChain, deployRollupForUpgrade, createL1Clients } = await import('@aztec/ethereum');
104
+ const { createEthereumChain, deployRollupForUpgrade, createExtendedL1Client } = await import('@aztec/ethereum');
108
105
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
109
106
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
110
107
 
@@ -112,23 +109,22 @@ export async function deployNewRollupContracts(
112
109
  ? mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex })
113
110
  : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
114
111
  const chain = createEthereumChain(rpcUrls, chainId);
115
- const clients = createL1Clients(rpcUrls, account, chain.chainInfo, mnemonicIndex);
112
+ const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
116
113
 
117
114
  if (!initialValidators || initialValidators.length === 0) {
118
- const registry = new RegistryContract(clients.publicClient, registryAddress);
119
- const rollup = new RollupContract(clients.publicClient, await registry.getCanonicalAddress());
115
+ const registry = new RegistryContract(client, registryAddress);
116
+ const rollup = new RollupContract(client, await registry.getCanonicalAddress());
120
117
  initialValidators = (await rollup.getAttesters()).map(str => EthAddress.fromString(str));
121
118
  logger.info('Initializing new rollup with old attesters', { initialValidators });
122
119
  }
123
120
 
124
121
  const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(
125
- clients,
122
+ client,
126
123
  {
127
124
  salt,
128
125
  vkTreeRoot: getVKTreeRoot(),
129
126
  protocolContractTreeRoot,
130
127
  genesisArchiveRoot,
131
- genesisBlockHash,
132
128
  initialValidators,
133
129
  feeJuicePortalInitialBalance,
134
130
  ...config,