@aztec/cli 0.85.0 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/cmds/devnet/bootstrap_network.js +14 -14
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +3 -3
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +2 -3
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_verifier.js +7 -7
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +2 -4
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +15 -15
- package/dest/utils/aztec.d.ts +2 -2
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +7 -9
- package/package.json +21 -23
- package/src/cmds/devnet/bootstrap_network.ts +18 -30
- package/src/cmds/l1/bridge_erc20.ts +3 -10
- package/src/cmds/l1/deploy_l1_contracts.ts +1 -3
- package/src/cmds/l1/deploy_l1_verifier.ts +7 -13
- package/src/cmds/l1/deploy_new_rollup.ts +1 -4
- package/src/cmds/l1/governance_utils.ts +16 -15
- package/src/utils/aztec.ts +5 -9
|
@@ -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,
|
|
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
|
|
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(
|
|
25
|
+
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
26
26
|
const { token, bridge } = await deployToken(wallet, portalAddress);
|
|
27
|
-
await initPortal(pxe,
|
|
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,
|
|
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(
|
|
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(
|
|
86
|
+
const { address: erc20Address } = await deployL1Contract(l1Client, erc20.contractAbi, erc20.contractBytecode, [
|
|
87
87
|
'DevCoin',
|
|
88
88
|
'DEV',
|
|
89
|
-
|
|
89
|
+
l1Client.account.address
|
|
90
90
|
]);
|
|
91
|
-
const { address: portalAddress } = await deployL1Contract(
|
|
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,
|
|
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:
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
7
|
+
const l1Client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
|
|
8
8
|
// Setup portal manager
|
|
9
|
-
const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress,
|
|
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,
|
|
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 {
|
|
12
|
-
const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot,
|
|
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,
|
|
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,
|
|
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
|
|
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:
|
|
20
|
+
client: extendedClient
|
|
21
21
|
});
|
|
22
|
-
const { address: verifierAddress } = await deployL1Contract(
|
|
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
|
|
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(
|
|
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:
|
|
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,
|
|
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 {
|
|
12
|
-
const { rollup, slashFactoryAddress } = await deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot,
|
|
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,
|
|
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,
|
|
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
|
|
6
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
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,
|
|
10
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
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
|
|
24
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
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,
|
|
26
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
27
27
|
const proposalId = await governance.proposeWithLock({
|
|
28
28
|
payloadAddress,
|
|
29
|
-
withdrawAddress:
|
|
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
|
|
44
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
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,
|
|
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
|
|
68
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
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,
|
|
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.`);
|
package/dest/utils/aztec.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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,
|
|
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"}
|
package/dest/utils/aztec.js
CHANGED
|
@@ -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,
|
|
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,
|
|
48
|
-
const { createEthereumChain, deployRollupForUpgrade,
|
|
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
|
|
54
|
+
const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
|
|
56
55
|
if (!initialValidators || initialValidators.length === 0) {
|
|
57
|
-
const registry = new RegistryContract(
|
|
58
|
-
const rollup = new RollupContract(
|
|
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(
|
|
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.
|
|
3
|
+
"version": "0.86.0",
|
|
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.
|
|
71
|
-
"@aztec/aztec.js": "0.
|
|
72
|
-
"@aztec/constants": "0.
|
|
73
|
-
"@aztec/entrypoints": "0.
|
|
74
|
-
"@aztec/foundation": "0.
|
|
75
|
-
"@aztec/l1-artifacts": "0.
|
|
76
|
-
"@aztec/p2p": "0.
|
|
77
|
-
"@aztec/stdlib": "0.
|
|
78
|
-
"@aztec/world-state": "0.
|
|
68
|
+
"@aztec/archiver": "0.86.0",
|
|
69
|
+
"@aztec/aztec.js": "0.86.0",
|
|
70
|
+
"@aztec/constants": "0.86.0",
|
|
71
|
+
"@aztec/entrypoints": "0.86.0",
|
|
72
|
+
"@aztec/foundation": "0.86.0",
|
|
73
|
+
"@aztec/l1-artifacts": "0.86.0",
|
|
74
|
+
"@aztec/p2p": "0.86.0",
|
|
75
|
+
"@aztec/stdlib": "0.86.0",
|
|
76
|
+
"@aztec/world-state": "0.86.0",
|
|
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.
|
|
91
|
-
"@aztec/ethereum": "0.
|
|
92
|
-
"@aztec/protocol-contracts": "0.
|
|
88
|
+
"@aztec/accounts": "0.86.0",
|
|
89
|
+
"@aztec/ethereum": "0.86.0",
|
|
90
|
+
"@aztec/protocol-contracts": "0.86.0",
|
|
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.
|
|
109
|
-
"@aztec/bb-prover": "0.
|
|
110
|
-
"@aztec/ethereum": "0.
|
|
111
|
-
"@aztec/l1-artifacts": "0.
|
|
112
|
-
"@aztec/noir-contracts.js": "0.
|
|
113
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
114
|
-
"@aztec/protocol-contracts": "0.
|
|
115
|
-
"@aztec/stdlib": "0.
|
|
106
|
+
"@aztec/accounts": "0.86.0",
|
|
107
|
+
"@aztec/bb-prover": "0.86.0",
|
|
108
|
+
"@aztec/ethereum": "0.86.0",
|
|
109
|
+
"@aztec/l1-artifacts": "0.86.0",
|
|
110
|
+
"@aztec/noir-contracts.js": "0.86.0",
|
|
111
|
+
"@aztec/noir-protocol-circuits-types": "0.86.0",
|
|
112
|
+
"@aztec/protocol-contracts": "0.86.0",
|
|
113
|
+
"@aztec/stdlib": "0.86.0"
|
|
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
|
|
18
|
+
type ExtendedViemWalletClient,
|
|
19
19
|
createEthereumChain,
|
|
20
|
-
|
|
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
|
|
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(
|
|
74
|
+
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
75
75
|
|
|
76
76
|
const { token, bridge } = await deployToken(wallet, portalAddress);
|
|
77
77
|
|
|
78
|
-
await initPortal(pxe,
|
|
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,
|
|
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(
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
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,
|
|
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
|
|
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 {
|
|
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,
|
|
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
|
|
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:
|
|
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
|
|
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
|
-
|
|
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:
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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(
|
|
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,
|
|
48
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
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
|
|
87
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
87
88
|
|
|
88
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
89
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
89
90
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
90
91
|
|
|
91
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
92
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
92
93
|
|
|
93
94
|
const proposalId = await governance.proposeWithLock({
|
|
94
95
|
payloadAddress,
|
|
95
|
-
withdrawAddress:
|
|
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
|
|
135
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
135
136
|
|
|
136
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
137
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
137
138
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
138
139
|
|
|
139
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
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
|
|
174
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
174
175
|
|
|
175
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
176
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
176
177
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
177
178
|
|
|
178
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
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.`);
|
package/src/utils/aztec.ts
CHANGED
|
@@ -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,
|
|
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
|
|
112
|
+
const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
|
|
116
113
|
|
|
117
114
|
if (!initialValidators || initialValidators.length === 0) {
|
|
118
|
-
const registry = new RegistryContract(
|
|
119
|
-
const rollup = new RollupContract(
|
|
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
|
-
|
|
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,
|