@aztec/cli 0.82.3 → 0.83.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/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +1 -6
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +9 -3
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_verifier.js +1 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +18 -7
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +5 -6
- package/dest/cmds/pxe/get_node_info.d.ts.map +1 -1
- package/dest/cmds/pxe/get_node_info.js +5 -3
- package/dest/utils/aztec.d.ts +5 -5
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +18 -8
- package/dest/utils/commands.d.ts +1 -1
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +1 -1
- package/dest/utils/setup_contracts.d.ts +1 -5
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +4 -33
- package/package.json +21 -21
- package/src/cmds/infrastructure/setup_l2_contract.ts +1 -7
- package/src/cmds/l1/deploy_l1_contracts.ts +9 -4
- package/src/cmds/l1/deploy_l1_verifier.ts +0 -6
- package/src/cmds/l1/deploy_new_rollup.ts +18 -5
- package/src/cmds/l1/index.ts +5 -8
- package/src/cmds/pxe/get_node_info.ts +4 -2
- package/src/utils/aztec.ts +22 -8
- package/src/utils/commands.ts +1 -1
- package/src/utils/setup_contracts.ts +3 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAKnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAKnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,EAAE,KAAK,iBAqCX"}
|
|
@@ -2,7 +2,7 @@ import { deployFundedSchnorrAccounts, getInitialTestAccounts } from '@aztec/acco
|
|
|
2
2
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
3
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
-
import {
|
|
5
|
+
import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
|
|
6
6
|
export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json, skipProofWait, log) {
|
|
7
7
|
const waitOpts = {
|
|
8
8
|
timeout: 180,
|
|
@@ -23,11 +23,6 @@ export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json,
|
|
|
23
23
|
1,
|
|
24
24
|
1
|
|
25
25
|
], false));
|
|
26
|
-
log('setupL2Contracts: Getting fee juice portal address...');
|
|
27
|
-
// Deploy Fee Juice
|
|
28
|
-
const feeJuicePortalAddress = (await pxe.getNodeInfo()).l1ContractAddresses.feeJuicePortalAddress;
|
|
29
|
-
log('setupL2Contracts: Setting up fee juice portal...');
|
|
30
|
-
await setupCanonicalL2FeeJuice(pxe, feeJuicePortalAddress, log, waitOpts, waitForProvenOptions);
|
|
31
26
|
let deployedAccounts = [];
|
|
32
27
|
if (testAccounts) {
|
|
33
28
|
log('setupL2Contracts: Deploying test accounts...');
|
|
@@ -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,iBAqDpB"}
|
|
@@ -5,10 +5,11 @@ import { deployAztecContracts } from '../../utils/aztec.js';
|
|
|
5
5
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
6
6
|
export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, initialValidators, log, debugLogger) {
|
|
7
7
|
const config = getL1ContractsConfigEnvVars();
|
|
8
|
-
const
|
|
8
|
+
const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
9
9
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
10
|
-
const
|
|
11
|
-
const {
|
|
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);
|
|
12
13
|
if (json) {
|
|
13
14
|
log(JSON.stringify(Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v])=>[
|
|
14
15
|
k,
|
|
@@ -28,5 +29,10 @@ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic,
|
|
|
28
29
|
log(`Governance Address: ${l1ContractAddresses.governanceAddress.toString()}`);
|
|
29
30
|
log(`SlashFactory Address: ${l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
30
31
|
log(`FeeAssetHandler Address: ${l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
32
|
+
log(`StakingAssetHandler Address: ${l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
33
|
+
log(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
34
|
+
log(`Initial validators: ${initialValidators.map((a)=>a.toString()).join(', ')}`);
|
|
35
|
+
log(`Genesis block hash: ${genesisBlockHash.toString()}`);
|
|
36
|
+
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
31
37
|
}
|
|
32
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { type Hex } from 'viem';
|
|
3
|
-
export declare function deployUltraHonkVerifier(rollupAddress: Hex | undefined, ethRpcUrls: string[], l1ChainId: string, privateKey: string | undefined, mnemonic: string, pxeRpcUrl: string,
|
|
3
|
+
export declare function deployUltraHonkVerifier(rollupAddress: Hex | undefined, ethRpcUrls: string[], l1ChainId: string, privateKey: string | undefined, mnemonic: string, pxeRpcUrl: string, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
4
4
|
export declare function deployMockVerifier(rollupAddress: Hex | undefined, ethRpcUrls: string[], l1ChainId: string, privateKey: string | undefined, mnemonic: string, pxeRpcUrl: string, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=deploy_l1_verifier.d.ts.map
|
|
@@ -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,
|
|
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"}
|
|
@@ -3,10 +3,7 @@ import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/e
|
|
|
3
3
|
import { HonkVerifierAbi, HonkVerifierBytecode } from '@aztec/l1-artifacts';
|
|
4
4
|
import { InvalidOptionArgumentError } from 'commander';
|
|
5
5
|
import { getContract } from 'viem';
|
|
6
|
-
export async function deployUltraHonkVerifier(rollupAddress, ethRpcUrls, l1ChainId, privateKey, mnemonic, pxeRpcUrl,
|
|
7
|
-
if (!bbBinaryPath || !bbWorkingDirectory) {
|
|
8
|
-
throw new InvalidOptionArgumentError('Missing path to bb binary and working directory');
|
|
9
|
-
}
|
|
6
|
+
export async function deployUltraHonkVerifier(rollupAddress, ethRpcUrls, l1ChainId, privateKey, mnemonic, pxeRpcUrl, log, debugLogger) {
|
|
10
7
|
const { publicClient, walletClient } = createL1Clients(ethRpcUrls, privateKey ?? mnemonic, createEthereumChain(ethRpcUrls, l1ChainId).chainInfo);
|
|
11
8
|
if (!rollupAddress && pxeRpcUrl) {
|
|
12
9
|
const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
export declare function deployNewRollup(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, json: boolean, initialValidators: EthAddress[], log: LogFn, debugLogger: Logger): Promise<void>;
|
|
3
|
+
export declare function deployNewRollup(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, json: boolean, initialValidators: EthAddress[], log: LogFn, debugLogger: Logger): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=deploy_new_rollup.d.ts.map
|
|
@@ -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;
|
|
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"}
|
|
@@ -2,18 +2,29 @@ import { getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
|
2
2
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
3
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
4
4
|
import { deployNewRollupContracts } from '../../utils/aztec.js';
|
|
5
|
-
|
|
5
|
+
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
6
|
+
export async function deployNewRollup(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, json, initialValidators, log, debugLogger) {
|
|
6
7
|
const config = getL1ContractsConfigEnvVars();
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
9
|
+
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
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);
|
|
10
13
|
if (json) {
|
|
11
14
|
log(JSON.stringify({
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
rollupAddress: rollup.address,
|
|
16
|
+
initialFundedAccounts: initialFundedAccounts.map((a)=>a.toString()),
|
|
17
|
+
initialValidators: initialValidators.map((a)=>a.toString()),
|
|
18
|
+
genesisBlockHash: genesisBlockHash.toString(),
|
|
19
|
+
genesisArchiveRoot: genesisArchiveRoot.toString(),
|
|
20
|
+
slashFactoryAddress: slashFactoryAddress.toString()
|
|
14
21
|
}, null, 2));
|
|
15
22
|
} else {
|
|
16
|
-
log(`Payload Address: ${payloadAddress.toString()}`);
|
|
17
23
|
log(`Rollup Address: ${rollup.address}`);
|
|
24
|
+
log(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
25
|
+
log(`Initial validators: ${initialValidators.map((a)=>a.toString()).join(', ')}`);
|
|
26
|
+
log(`Genesis block hash: ${genesisBlockHash.toString()}`);
|
|
27
|
+
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
28
|
+
log(`Slash Factory Address: ${slashFactoryAddress.toString()}`);
|
|
18
29
|
}
|
|
19
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAuBjD,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAohB/E"}
|
package/dest/cmds/l1/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { Option } from 'commander';
|
|
3
|
-
import { ETHEREUM_HOSTS, PRIVATE_KEY, l1ChainIdOption, makePxeOption, parseAztecAddress, parseBigint, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
3
|
+
import { ETHEREUM_HOSTS, MNEMONIC, PRIVATE_KEY, l1ChainIdOption, makePxeOption, parseAztecAddress, parseBigint, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
4
4
|
const l1RpcUrlsOption = new Option('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)').env('ETHEREUM_HOSTS').default([
|
|
5
5
|
ETHEREUM_HOSTS
|
|
6
6
|
]).makeOptionMandatory(true).argParser((arg)=>arg.split(',').map((url)=>url.trim()));
|
|
7
7
|
export function injectCommands(program, log, debugLogger) {
|
|
8
|
-
const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env;
|
|
9
8
|
program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false).action(async (options)=>{
|
|
10
9
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
11
10
|
const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
|
|
12
11
|
await deployL1Contracts(options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.sponsoredFpc, options.acceleratedTestDeployments, options.json, initialValidators, log, debugLogger);
|
|
13
12
|
});
|
|
14
|
-
program.command('deploy-new-rollup').description('Deploys a new rollup contract and
|
|
13
|
+
program.command('deploy-new-rollup').description('Deploys a new rollup contract and adds it to the registry (if you are the owner).').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', MNEMONIC ?? 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').action(async (options)=>{
|
|
15
14
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
16
15
|
const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
|
|
17
|
-
await deployNewRollup(options.registryAddress, options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.json, initialValidators, log, debugLogger);
|
|
16
|
+
await deployNewRollup(options.registryAddress, options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.sponsoredFpc, options.json, initialValidators, log, debugLogger);
|
|
18
17
|
});
|
|
19
18
|
program.command('deposit-governance-tokens').description('Deposits governance tokens to the governance contract.').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).requiredOption('--recipient <string>', 'The recipient of the tokens', parseEthereumAddress).requiredOption('-a, --amount <string>', 'The amount of tokens to deposit', parseBigint).option('--mint', 'Mint the tokens on L1', false).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('-p, --private-key <string>', 'The private key to use to deposit', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use to deposit', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use to deposit', (arg)=>parseInt(arg), 0).action(async (options)=>{
|
|
20
19
|
const { depositGovernanceTokens } = await import('./governance_utils.js');
|
|
@@ -156,12 +155,12 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
156
155
|
debugLogger
|
|
157
156
|
});
|
|
158
157
|
});
|
|
159
|
-
program.command('deploy-l1-verifier').description('Deploys the rollup verifier contract').addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).addOption(makePxeOption(false).conflicts('rollup-address')).addOption(new Option('--rollup-address <string>', 'The address of the rollup contract').env('ROLLUP_CONTRACT_ADDRESS').argParser(parseEthereumAddress).conflicts('rpc-url')).option('--l1-private-key <string>', 'The L1 private key to use for deployment', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').requiredOption('--verifier <verifier>', 'Either mock or real', 'real').
|
|
158
|
+
program.command('deploy-l1-verifier').description('Deploys the rollup verifier contract').addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).addOption(makePxeOption(false).conflicts('rollup-address')).addOption(new Option('--rollup-address <string>', 'The address of the rollup contract').env('ROLLUP_CONTRACT_ADDRESS').argParser(parseEthereumAddress).conflicts('rpc-url')).option('--l1-private-key <string>', 'The L1 private key to use for deployment', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').requiredOption('--verifier <verifier>', 'Either mock or real', 'real').action(async (options)=>{
|
|
160
159
|
const { deployMockVerifier, deployUltraHonkVerifier } = await import('./deploy_l1_verifier.js');
|
|
161
160
|
if (options.verifier === 'mock') {
|
|
162
161
|
await deployMockVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl, log, debugLogger);
|
|
163
162
|
} else {
|
|
164
|
-
await deployUltraHonkVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl,
|
|
163
|
+
await deployUltraHonkVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl, log, debugLogger);
|
|
165
164
|
}
|
|
166
165
|
});
|
|
167
166
|
program.command('bridge-erc20').description('Bridges ERC20 tokens to L2.').argument('<amount>', 'The amount of Fee Juice to mint and bridge.', parseBigint).argument('<recipient>', 'Aztec address of the recipient.', parseAztecAddress).addOption(l1RpcUrlsOption).option('-m, --mnemonic <string>', 'The mnemonic to use for deriving the Ethereum address that will mint and bridge', 'test test test test test test test test test test test junk').option('--mint', 'Mint the tokens on L1', false).option('--private', 'If the bridge should use the private flow', false).addOption(l1ChainIdOption).requiredOption('-t, --token <string>', 'The address of the token to bridge', parseEthereumAddress).requiredOption('-p, --portal <string>', 'The address of the portal contract', parseEthereumAddress).option('-f, --faucet <string>', 'The address of the faucet contract (only used if minting)', parseEthereumAddress).option('--l1-private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--json', 'Output the claim in JSON format').action(async (amount, recipient, options)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_node_info.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_node_info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,OAAO,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"get_node_info.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_node_info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,OAAO,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,iBAgE/B"}
|
|
@@ -11,7 +11,7 @@ export async function getNodeInfo(rpcUrl, pxeRequest, debugLogger, json, log, lo
|
|
|
11
11
|
logJson({
|
|
12
12
|
nodeVersion: info.nodeVersion,
|
|
13
13
|
l1ChainId: info.l1ChainId,
|
|
14
|
-
|
|
14
|
+
rollupVersion: info.rollupVersion,
|
|
15
15
|
enr: info.enr,
|
|
16
16
|
l1ContractAddresses: {
|
|
17
17
|
rollup: info.l1ContractAddresses.rollupAddress.toString(),
|
|
@@ -26,7 +26,8 @@ export async function getNodeInfo(rpcUrl, pxeRequest, debugLogger, json, log, lo
|
|
|
26
26
|
governanceProposer: info.l1ContractAddresses.governanceProposerAddress.toString(),
|
|
27
27
|
governance: info.l1ContractAddresses.governanceAddress.toString(),
|
|
28
28
|
slashFactory: info.l1ContractAddresses.slashFactoryAddress?.toString(),
|
|
29
|
-
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString()
|
|
29
|
+
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString(),
|
|
30
|
+
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()
|
|
30
31
|
},
|
|
31
32
|
protocolContractAddresses: {
|
|
32
33
|
classRegisterer: info.protocolContractAddresses.classRegisterer.toString(),
|
|
@@ -38,7 +39,7 @@ export async function getNodeInfo(rpcUrl, pxeRequest, debugLogger, json, log, lo
|
|
|
38
39
|
} else {
|
|
39
40
|
log(`Node Version: ${info.nodeVersion}`);
|
|
40
41
|
log(`Chain Id: ${info.l1ChainId}`);
|
|
41
|
-
log(`
|
|
42
|
+
log(`Rollup Version: ${info.rollupVersion}`);
|
|
42
43
|
log(`Node ENR: ${info.enr}`);
|
|
43
44
|
log(`L1 Contract Addresses:`);
|
|
44
45
|
log(` Rollup Address: ${info.l1ContractAddresses.rollupAddress.toString()}`);
|
|
@@ -54,6 +55,7 @@ export async function getNodeInfo(rpcUrl, pxeRequest, debugLogger, json, log, lo
|
|
|
54
55
|
log(` Governance Address: ${info.l1ContractAddresses.governanceAddress.toString()}`);
|
|
55
56
|
log(` SlashFactory Address: ${info.l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
56
57
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
58
|
+
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
57
59
|
log(`L2 Contract Addresses:`);
|
|
58
60
|
log(` Class Registerer: ${info.protocolContractAddresses.classRegisterer.toString()}`);
|
|
59
61
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
package/dest/utils/aztec.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EthAddress, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import { type ContractArtifact, type FunctionAbi } from '@aztec/aztec.js/abi';
|
|
3
|
-
import type
|
|
3
|
+
import { type DeployL1ContractsReturnType, type L1ContractsConfig, RollupContract } from '@aztec/ethereum';
|
|
4
4
|
import type { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
6
6
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
@@ -18,10 +18,10 @@ 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, 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, config: L1ContractsConfig, logger: Logger): Promise<{
|
|
23
|
-
payloadAddress: EthAddress;
|
|
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<{
|
|
24
23
|
rollup: RollupContract;
|
|
24
|
+
slashFactoryAddress: EthAddress;
|
|
25
25
|
}>;
|
|
26
26
|
/**
|
|
27
27
|
* Gets all contracts available in \@aztec/noir-contracts.js.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|
package/dest/utils/aztec.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js';
|
|
1
2
|
import { FunctionType, getAllFunctionAbis, loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
-
import {
|
|
3
|
+
import { RegistryContract, RollupContract } from '@aztec/ethereum';
|
|
4
|
+
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
3
5
|
import TOML from '@iarna/toml';
|
|
4
6
|
import { readFile } from 'fs/promises';
|
|
5
7
|
import { gtr, ltr, satisfies, valid } from 'semver';
|
|
@@ -22,7 +24,7 @@ import { encodeArgs } from './encoding.js';
|
|
|
22
24
|
* @param chainId - The chain ID of the L1 host.
|
|
23
25
|
* @param privateKey - The private key to be used in contract deployment.
|
|
24
26
|
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
25
|
-
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, acceleratedTestDeployments, config, debugLogger) {
|
|
27
|
+
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, debugLogger) {
|
|
26
28
|
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
|
|
27
29
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
28
30
|
const account = !privateKey ? mnemonicToAccount(mnemonic, {
|
|
@@ -31,7 +33,6 @@ import { encodeArgs } from './encoding.js';
|
|
|
31
33
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
32
34
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
33
35
|
return await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
|
|
34
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
35
36
|
vkTreeRoot: getVKTreeRoot(),
|
|
36
37
|
protocolContractTreeRoot,
|
|
37
38
|
genesisArchiveRoot,
|
|
@@ -39,10 +40,11 @@ import { encodeArgs } from './encoding.js';
|
|
|
39
40
|
salt,
|
|
40
41
|
initialValidators,
|
|
41
42
|
acceleratedTestDeployments,
|
|
43
|
+
feeJuicePortalInitialBalance,
|
|
42
44
|
...config
|
|
43
45
|
}, config);
|
|
44
46
|
}
|
|
45
|
-
export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, config, logger) {
|
|
47
|
+
export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, feeJuicePortalInitialBalance, config, logger) {
|
|
46
48
|
const { createEthereumChain, deployRollupForUpgrade, createL1Clients } = await import('@aztec/ethereum');
|
|
47
49
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
48
50
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
@@ -51,19 +53,27 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
51
53
|
}) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
|
|
52
54
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
53
55
|
const clients = createL1Clients(rpcUrls, account, chain.chainInfo, mnemonicIndex);
|
|
54
|
-
|
|
56
|
+
if (!initialValidators || initialValidators.length === 0) {
|
|
57
|
+
const registry = new RegistryContract(clients.publicClient, registryAddress);
|
|
58
|
+
const rollup = new RollupContract(clients.publicClient, await registry.getCanonicalAddress());
|
|
59
|
+
initialValidators = (await rollup.getAttesters()).map((str)=>EthAddress.fromString(str));
|
|
60
|
+
logger.info('Initializing new rollup with old attesters', {
|
|
61
|
+
initialValidators
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(clients, {
|
|
55
65
|
salt,
|
|
56
66
|
vkTreeRoot: getVKTreeRoot(),
|
|
57
67
|
protocolContractTreeRoot,
|
|
58
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
59
68
|
genesisArchiveRoot,
|
|
60
69
|
genesisBlockHash,
|
|
61
70
|
initialValidators,
|
|
71
|
+
feeJuicePortalInitialBalance,
|
|
62
72
|
...config
|
|
63
73
|
}, registryAddress, logger, config);
|
|
64
74
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
rollup,
|
|
76
|
+
slashFactoryAddress
|
|
67
77
|
};
|
|
68
78
|
}
|
|
69
79
|
/**
|
package/dest/utils/commands.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { type Command, Option } from 'commander';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const getLocalhost: () => Promise<string>;
|
|
16
16
|
export declare const LOCALHOST: string;
|
|
17
|
-
export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
|
|
17
|
+
export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, MNEMONIC: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
|
|
18
18
|
export declare function addOptions(program: Command, options: Option[]): Command;
|
|
19
19
|
export declare const makePxeOption: (mandatory: boolean) => Option;
|
|
20
20
|
export declare const pxeOption: Option;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,OAAO,EAAwC,MAAM,EAAE,MAAM,WAAW,CAAC;AAIvF;;;GAGG;AACH,eAAO,MAAM,YAAY,uBAGI,CAAC;AAE9B,eAAO,MAAM,SAAS,QAAuB,CAAC;AAC9C,eAAO,MAAQ,cAAc,UAA+B,WAAW,sBAAE,OAAO,sBAAE,WAAW,oBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,OAAO,EAAwC,MAAM,EAAE,MAAM,WAAW,CAAC;AAIvF;;;GAGG;AACH,eAAO,MAAM,YAAY,uBAGI,CAAC;AAE9B,eAAO,MAAM,SAAS,QAAuB,CAAC;AAC9C,eAAO,MAAQ,cAAc,UAA+B,WAAW,sBAAE,QAAQ,sBAAE,OAAO,sBAAE,WAAW,oBAAgB,CAAC;AAExH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAG7D;AAED,eAAO,MAAM,aAAa,cAAe,OAAO,WAKb,CAAC;AAEpC,eAAO,MAAM,SAAS,QAAsB,CAAC;AAE7C,eAAO,MAAM,eAAe,QASxB,CAAC;AAEL,eAAO,MAAM,qBAAqB,gBACnB,MAAM,aACR,OAAO,eACL,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,WAKf,CAAC;AAEpC,eAAO,MAAM,OAAO,QAAS,KAAK,WAAW,MAAM,SAAsC,CAAC;AAE1F;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAqBxE;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,yBAgBzD;AAcD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,EAAE,CAqBvD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAM/D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAMhE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAKnF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAKnE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CASpF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKtE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CASxE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,EAAE,CAMvD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,EAAE,CAMpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,CAyB5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAElD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAcjE"}
|
package/dest/utils/commands.js
CHANGED
|
@@ -13,7 +13,7 @@ import { rename, writeFile } from 'fs/promises';
|
|
|
13
13
|
* localhost as being host.docker.internal.
|
|
14
14
|
*/ export const getLocalhost = ()=>lookup('host.docker.internal').then(()=>'host.docker.internal').catch(()=>'localhost');
|
|
15
15
|
export const LOCALHOST = await getLocalhost();
|
|
16
|
-
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, API_KEY, CLI_VERSION } = process.env;
|
|
16
|
+
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, MNEMONIC, API_KEY, CLI_VERSION } = process.env;
|
|
17
17
|
export function addOptions(program, options) {
|
|
18
18
|
options.forEach((option)=>program.addOption(option));
|
|
19
19
|
return program;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PXE, type WaitForProvenOpts } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
/**
|
|
4
|
-
* Deploys the contract to pay for gas on L2.
|
|
5
|
-
*/
|
|
6
|
-
export declare function setupCanonicalL2FeeJuice(pxe: PXE, feeJuicePortalAddress: EthAddress, log: LogFn, waitOpts?: import("@aztec/aztec.js").WaitOpts, waitForProvenOptions?: WaitForProvenOpts): Promise<void>;
|
|
7
3
|
export declare function getSponsoredFPCAddress(): Promise<import("@aztec/aztec.js").AztecAddress>;
|
|
8
4
|
export declare function setupSponsoredFPC(pxe: PXE, log: LogFn, waitOpts?: import("@aztec/aztec.js").WaitOpts, waitForProvenOptions?: WaitForProvenOpts): Promise<void>;
|
|
9
5
|
//# sourceMappingURL=setup_contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EAGR,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,wBAAsB,sBAAsB,oDAM3C;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,KAAK,EACV,QAAQ,qCAAkB,EAC1B,oBAAoB,CAAC,EAAE,iBAAiB,iBAsBzC"}
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
import { DefaultWaitOpts,
|
|
2
|
-
import {
|
|
1
|
+
import { DefaultWaitOpts, Fr, SignerlessWallet, SponsoredFeePaymentMethod, getContractInstanceFromDeployParams, waitForProven } from '@aztec/aztec.js';
|
|
2
|
+
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
3
3
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
4
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
6
|
-
/**
|
|
7
|
-
* Deploys the contract to pay for gas on L2.
|
|
8
|
-
*/ export async function setupCanonicalL2FeeJuice(pxe, feeJuicePortalAddress, log, waitOpts = DefaultWaitOpts, waitForProvenOptions) {
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
-
// @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
|
|
11
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
12
|
-
const deployer = new SignerlessWallet(pxe);
|
|
13
|
-
const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer);
|
|
14
|
-
const portalAddress = await pxe.getPublicStorageAt(feeJuiceContract.address, feeJuiceContract.artifact.storageLayout.portal_address.slot);
|
|
15
|
-
if (portalAddress.isZero()) {
|
|
16
|
-
log('setupCanonicalL2FeeJuice: Calling initialize on fee juice contract...');
|
|
17
|
-
const paymentMethod = new FeeJuicePaymentMethod(ProtocolContractAddress.FeeJuice);
|
|
18
|
-
const receipt = await feeJuiceContract.methods.initialize(feeJuicePortalAddress, FEE_JUICE_INITIAL_MINT).send({
|
|
19
|
-
fee: {
|
|
20
|
-
paymentMethod,
|
|
21
|
-
gasSettings: {
|
|
22
|
-
teardownGasLimits: Gas.empty()
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}).wait(waitOpts);
|
|
26
|
-
if (waitForProvenOptions !== undefined) {
|
|
27
|
-
await waitForProven(pxe, receipt, waitForProvenOptions);
|
|
28
|
-
}
|
|
29
|
-
} else {
|
|
30
|
-
log('setupCanonicalL2FeeJuice: Fee juice contract already initialized. Fee Juice Portal address: ' + portalAddress.toString());
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
4
|
async function getSponsoredFPCContract() {
|
|
34
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
35
6
|
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
@@ -47,8 +18,8 @@ export async function setupSponsoredFPC(pxe, log, waitOpts = DefaultWaitOpts, wa
|
|
|
47
18
|
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
48
19
|
const address = await getSponsoredFPCAddress();
|
|
49
20
|
const paymentMethod = new SponsoredFeePaymentMethod(address);
|
|
50
|
-
const { l1ChainId: chainId,
|
|
51
|
-
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId,
|
|
21
|
+
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
|
|
22
|
+
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
52
23
|
const deployTx = SponsoredFPCContract.deploy(deployer).send({
|
|
53
24
|
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|
|
54
25
|
universalDeploy: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -67,15 +67,15 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"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.
|
|
70
|
+
"@aztec/archiver": "0.83.0",
|
|
71
|
+
"@aztec/aztec.js": "0.83.0",
|
|
72
|
+
"@aztec/constants": "0.83.0",
|
|
73
|
+
"@aztec/entrypoints": "0.83.0",
|
|
74
|
+
"@aztec/foundation": "0.83.0",
|
|
75
|
+
"@aztec/l1-artifacts": "0.83.0",
|
|
76
|
+
"@aztec/p2p": "0.83.0",
|
|
77
|
+
"@aztec/stdlib": "0.83.0",
|
|
78
|
+
"@aztec/world-state": "0.83.0",
|
|
79
79
|
"@iarna/toml": "^2.2.5",
|
|
80
80
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
81
81
|
"commander": "^12.1.0",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"viem": "2.23.7"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@aztec/accounts": "0.
|
|
91
|
-
"@aztec/ethereum": "0.
|
|
92
|
-
"@aztec/protocol-contracts": "0.
|
|
90
|
+
"@aztec/accounts": "0.83.0",
|
|
91
|
+
"@aztec/ethereum": "0.83.0",
|
|
92
|
+
"@aztec/protocol-contracts": "0.83.0",
|
|
93
93
|
"@jest/globals": "^29.5.0",
|
|
94
94
|
"@types/jest": "^29.5.0",
|
|
95
95
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
"typescript": "^5.0.4"
|
|
106
106
|
},
|
|
107
107
|
"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.
|
|
108
|
+
"@aztec/accounts": "0.83.0",
|
|
109
|
+
"@aztec/bb-prover": "0.83.0",
|
|
110
|
+
"@aztec/ethereum": "0.83.0",
|
|
111
|
+
"@aztec/l1-artifacts": "0.83.0",
|
|
112
|
+
"@aztec/noir-contracts.js": "0.83.0",
|
|
113
|
+
"@aztec/noir-protocol-circuits-types": "0.83.0",
|
|
114
|
+
"@aztec/protocol-contracts": "0.83.0",
|
|
115
|
+
"@aztec/stdlib": "0.83.0"
|
|
116
116
|
},
|
|
117
117
|
"files": [
|
|
118
118
|
"dest",
|
|
@@ -4,7 +4,7 @@ import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
|
4
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
5
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
|
|
8
8
|
|
|
9
9
|
export async function setupL2Contracts(
|
|
10
10
|
rpcUrl: string,
|
|
@@ -30,12 +30,6 @@ export async function setupL2Contracts(
|
|
|
30
30
|
log('setupL2Contracts: Creating PXE client...');
|
|
31
31
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([1, 1, 1, 1, 1], false));
|
|
32
32
|
|
|
33
|
-
log('setupL2Contracts: Getting fee juice portal address...');
|
|
34
|
-
// Deploy Fee Juice
|
|
35
|
-
const feeJuicePortalAddress = (await pxe.getNodeInfo()).l1ContractAddresses.feeJuicePortalAddress;
|
|
36
|
-
log('setupL2Contracts: Setting up fee juice portal...');
|
|
37
|
-
await setupCanonicalL2FeeJuice(pxe, feeJuicePortalAddress, log, waitOpts, waitForProvenOptions);
|
|
38
|
-
|
|
39
33
|
let deployedAccounts: InitialAccountData[] = [];
|
|
40
34
|
if (testAccounts) {
|
|
41
35
|
log('setupL2Contracts: Deploying test accounts...');
|
|
@@ -24,11 +24,10 @@ export async function deployL1Contracts(
|
|
|
24
24
|
) {
|
|
25
25
|
const config = getL1ContractsConfigEnvVars();
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
28
28
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
);
|
|
29
|
+
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
30
|
+
const { genesisBlockHash, genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
32
31
|
|
|
33
32
|
const { l1ContractAddresses } = await deployAztecContracts(
|
|
34
33
|
rpcUrls,
|
|
@@ -40,6 +39,7 @@ export async function deployL1Contracts(
|
|
|
40
39
|
initialValidators,
|
|
41
40
|
genesisArchiveRoot,
|
|
42
41
|
genesisBlockHash,
|
|
42
|
+
fundingNeeded,
|
|
43
43
|
acceleratedTestDeployments,
|
|
44
44
|
config,
|
|
45
45
|
debugLogger,
|
|
@@ -67,5 +67,10 @@ export async function deployL1Contracts(
|
|
|
67
67
|
log(`Governance Address: ${l1ContractAddresses.governanceAddress.toString()}`);
|
|
68
68
|
log(`SlashFactory Address: ${l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
69
69
|
log(`FeeAssetHandler Address: ${l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
70
|
+
log(`StakingAssetHandler Address: ${l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
71
|
+
log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
|
|
72
|
+
log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
|
|
73
|
+
log(`Genesis block hash: ${genesisBlockHash.toString()}`);
|
|
74
|
+
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
70
75
|
}
|
|
71
76
|
}
|
|
@@ -13,15 +13,9 @@ export async function deployUltraHonkVerifier(
|
|
|
13
13
|
privateKey: string | undefined,
|
|
14
14
|
mnemonic: string,
|
|
15
15
|
pxeRpcUrl: string,
|
|
16
|
-
bbBinaryPath: string,
|
|
17
|
-
bbWorkingDirectory: string,
|
|
18
16
|
log: LogFn,
|
|
19
17
|
debugLogger: Logger,
|
|
20
18
|
) {
|
|
21
|
-
if (!bbBinaryPath || !bbWorkingDirectory) {
|
|
22
|
-
throw new InvalidOptionArgumentError('Missing path to bb binary and working directory');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
19
|
const { publicClient, walletClient } = createL1Clients(
|
|
26
20
|
ethRpcUrls,
|
|
27
21
|
privateKey ?? mnemonic,
|
|
@@ -5,6 +5,7 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
5
5
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
6
6
|
|
|
7
7
|
import { deployNewRollupContracts } from '../../utils/aztec.js';
|
|
8
|
+
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
8
9
|
|
|
9
10
|
export async function deployNewRollup(
|
|
10
11
|
registryAddress: EthAddress,
|
|
@@ -15,6 +16,7 @@ export async function deployNewRollup(
|
|
|
15
16
|
mnemonicIndex: number,
|
|
16
17
|
salt: number | undefined,
|
|
17
18
|
testAccounts: boolean,
|
|
19
|
+
sponsoredFPC: boolean,
|
|
18
20
|
json: boolean,
|
|
19
21
|
initialValidators: EthAddress[],
|
|
20
22
|
log: LogFn,
|
|
@@ -22,10 +24,12 @@ export async function deployNewRollup(
|
|
|
22
24
|
) {
|
|
23
25
|
const config = getL1ContractsConfigEnvVars();
|
|
24
26
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
+
const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
28
|
+
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
29
|
+
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
30
|
+
const { genesisBlockHash, genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
27
31
|
|
|
28
|
-
const {
|
|
32
|
+
const { rollup, slashFactoryAddress } = await deployNewRollupContracts(
|
|
29
33
|
registryAddress,
|
|
30
34
|
rpcUrls,
|
|
31
35
|
chainId,
|
|
@@ -36,6 +40,7 @@ export async function deployNewRollup(
|
|
|
36
40
|
initialValidators,
|
|
37
41
|
genesisArchiveRoot,
|
|
38
42
|
genesisBlockHash,
|
|
43
|
+
fundingNeeded,
|
|
39
44
|
config,
|
|
40
45
|
debugLogger,
|
|
41
46
|
);
|
|
@@ -44,15 +49,23 @@ export async function deployNewRollup(
|
|
|
44
49
|
log(
|
|
45
50
|
JSON.stringify(
|
|
46
51
|
{
|
|
47
|
-
payloadAddress: payloadAddress.toString(),
|
|
48
52
|
rollupAddress: rollup.address,
|
|
53
|
+
initialFundedAccounts: initialFundedAccounts.map(a => a.toString()),
|
|
54
|
+
initialValidators: initialValidators.map(a => a.toString()),
|
|
55
|
+
genesisBlockHash: genesisBlockHash.toString(),
|
|
56
|
+
genesisArchiveRoot: genesisArchiveRoot.toString(),
|
|
57
|
+
slashFactoryAddress: slashFactoryAddress.toString(),
|
|
49
58
|
},
|
|
50
59
|
null,
|
|
51
60
|
2,
|
|
52
61
|
),
|
|
53
62
|
);
|
|
54
63
|
} else {
|
|
55
|
-
log(`Payload Address: ${payloadAddress.toString()}`);
|
|
56
64
|
log(`Rollup Address: ${rollup.address}`);
|
|
65
|
+
log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
|
|
66
|
+
log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
|
|
67
|
+
log(`Genesis block hash: ${genesisBlockHash.toString()}`);
|
|
68
|
+
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
69
|
+
log(`Slash Factory Address: ${slashFactoryAddress.toString()}`);
|
|
57
70
|
}
|
|
58
71
|
}
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { type Command, Option } from 'commander';
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
ETHEREUM_HOSTS,
|
|
8
|
+
MNEMONIC,
|
|
8
9
|
PRIVATE_KEY,
|
|
9
10
|
l1ChainIdOption,
|
|
10
11
|
makePxeOption,
|
|
@@ -24,8 +25,6 @@ const l1RpcUrlsOption = new Option(
|
|
|
24
25
|
.argParser((arg: string) => arg.split(',').map(url => url.trim()));
|
|
25
26
|
|
|
26
27
|
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
27
|
-
const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env;
|
|
28
|
-
|
|
29
28
|
program
|
|
30
29
|
.command('deploy-l1-contracts')
|
|
31
30
|
.description('Deploys all necessary Ethereum contracts for Aztec.')
|
|
@@ -68,7 +67,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
68
67
|
|
|
69
68
|
program
|
|
70
69
|
.command('deploy-new-rollup')
|
|
71
|
-
.description('Deploys a new rollup contract and
|
|
70
|
+
.description('Deploys a new rollup contract and adds it to the registry (if you are the owner).')
|
|
72
71
|
.requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress)
|
|
73
72
|
.addOption(l1RpcUrlsOption)
|
|
74
73
|
.option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
@@ -76,13 +75,14 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
76
75
|
.option(
|
|
77
76
|
'-m, --mnemonic <string>',
|
|
78
77
|
'The mnemonic to use in deployment',
|
|
79
|
-
'test test test test test test test test test test test junk',
|
|
78
|
+
MNEMONIC ?? 'test test test test test test test test test test test junk',
|
|
80
79
|
)
|
|
81
80
|
.option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', arg => parseInt(arg), 0)
|
|
82
81
|
.addOption(l1ChainIdOption)
|
|
83
82
|
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
84
83
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
85
84
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
85
|
+
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
86
86
|
.action(async options => {
|
|
87
87
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
88
88
|
|
|
@@ -97,6 +97,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
97
97
|
options.mnemonicIndex,
|
|
98
98
|
options.salt,
|
|
99
99
|
options.testAccounts,
|
|
100
|
+
options.sponsoredFpc,
|
|
100
101
|
options.json,
|
|
101
102
|
initialValidators,
|
|
102
103
|
log,
|
|
@@ -412,8 +413,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
412
413
|
'test test test test test test test test test test test junk',
|
|
413
414
|
)
|
|
414
415
|
.requiredOption('--verifier <verifier>', 'Either mock or real', 'real')
|
|
415
|
-
.option('--bb <path>', 'Path to bb binary', BB_BINARY_PATH)
|
|
416
|
-
.option('--bb-working-dir <path>', 'Path to bb working directory', BB_WORKING_DIRECTORY)
|
|
417
416
|
.action(async options => {
|
|
418
417
|
const { deployMockVerifier, deployUltraHonkVerifier } = await import('./deploy_l1_verifier.js');
|
|
419
418
|
if (options.verifier === 'mock') {
|
|
@@ -435,8 +434,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
435
434
|
options.l1PrivateKey,
|
|
436
435
|
options.mnemonic,
|
|
437
436
|
options.rpcUrl,
|
|
438
|
-
options.bb,
|
|
439
|
-
options.bbWorkingDir,
|
|
440
437
|
log,
|
|
441
438
|
debugLogger,
|
|
442
439
|
);
|
|
@@ -20,7 +20,7 @@ export async function getNodeInfo(
|
|
|
20
20
|
logJson({
|
|
21
21
|
nodeVersion: info.nodeVersion,
|
|
22
22
|
l1ChainId: info.l1ChainId,
|
|
23
|
-
|
|
23
|
+
rollupVersion: info.rollupVersion,
|
|
24
24
|
enr: info.enr,
|
|
25
25
|
l1ContractAddresses: {
|
|
26
26
|
rollup: info.l1ContractAddresses.rollupAddress.toString(),
|
|
@@ -36,6 +36,7 @@ export async function getNodeInfo(
|
|
|
36
36
|
governance: info.l1ContractAddresses.governanceAddress.toString(),
|
|
37
37
|
slashFactory: info.l1ContractAddresses.slashFactoryAddress?.toString(),
|
|
38
38
|
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString(),
|
|
39
|
+
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString(),
|
|
39
40
|
},
|
|
40
41
|
protocolContractAddresses: {
|
|
41
42
|
classRegisterer: info.protocolContractAddresses.classRegisterer.toString(),
|
|
@@ -47,7 +48,7 @@ export async function getNodeInfo(
|
|
|
47
48
|
} else {
|
|
48
49
|
log(`Node Version: ${info.nodeVersion}`);
|
|
49
50
|
log(`Chain Id: ${info.l1ChainId}`);
|
|
50
|
-
log(`
|
|
51
|
+
log(`Rollup Version: ${info.rollupVersion}`);
|
|
51
52
|
log(`Node ENR: ${info.enr}`);
|
|
52
53
|
log(`L1 Contract Addresses:`);
|
|
53
54
|
log(` Rollup Address: ${info.l1ContractAddresses.rollupAddress.toString()}`);
|
|
@@ -63,6 +64,7 @@ export async function getNodeInfo(
|
|
|
63
64
|
log(` Governance Address: ${info.l1ContractAddresses.governanceAddress.toString()}`);
|
|
64
65
|
log(` SlashFactory Address: ${info.l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
65
66
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
67
|
+
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
66
68
|
log(`L2 Contract Addresses:`);
|
|
67
69
|
log(` Class Registerer: ${info.protocolContractAddresses.classRegisterer.toString()}`);
|
|
68
70
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
package/src/utils/aztec.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EthAddress, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import {
|
|
3
3
|
type ContractArtifact,
|
|
4
4
|
type FunctionAbi,
|
|
@@ -6,11 +6,16 @@ import {
|
|
|
6
6
|
getAllFunctionAbis,
|
|
7
7
|
loadContractArtifact,
|
|
8
8
|
} from '@aztec/aztec.js/abi';
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
type DeployL1ContractsReturnType,
|
|
11
|
+
type L1ContractsConfig,
|
|
12
|
+
RegistryContract,
|
|
13
|
+
RollupContract,
|
|
14
|
+
} from '@aztec/ethereum';
|
|
10
15
|
import type { Fr } from '@aztec/foundation/fields';
|
|
11
16
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
12
17
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
13
|
-
import {
|
|
18
|
+
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
14
19
|
|
|
15
20
|
import TOML from '@iarna/toml';
|
|
16
21
|
import { readFile } from 'fs/promises';
|
|
@@ -49,6 +54,7 @@ export async function deployAztecContracts(
|
|
|
49
54
|
initialValidators: EthAddress[],
|
|
50
55
|
genesisArchiveRoot: Fr,
|
|
51
56
|
genesisBlockHash: Fr,
|
|
57
|
+
feeJuicePortalInitialBalance: bigint,
|
|
52
58
|
acceleratedTestDeployments: boolean,
|
|
53
59
|
config: L1ContractsConfig,
|
|
54
60
|
debugLogger: Logger,
|
|
@@ -69,7 +75,6 @@ export async function deployAztecContracts(
|
|
|
69
75
|
chain.chainInfo,
|
|
70
76
|
debugLogger,
|
|
71
77
|
{
|
|
72
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
73
78
|
vkTreeRoot: getVKTreeRoot(),
|
|
74
79
|
protocolContractTreeRoot,
|
|
75
80
|
genesisArchiveRoot,
|
|
@@ -77,6 +82,7 @@ export async function deployAztecContracts(
|
|
|
77
82
|
salt,
|
|
78
83
|
initialValidators,
|
|
79
84
|
acceleratedTestDeployments,
|
|
85
|
+
feeJuicePortalInitialBalance,
|
|
80
86
|
...config,
|
|
81
87
|
},
|
|
82
88
|
config,
|
|
@@ -94,9 +100,10 @@ export async function deployNewRollupContracts(
|
|
|
94
100
|
initialValidators: EthAddress[],
|
|
95
101
|
genesisArchiveRoot: Fr,
|
|
96
102
|
genesisBlockHash: Fr,
|
|
103
|
+
feeJuicePortalInitialBalance: bigint,
|
|
97
104
|
config: L1ContractsConfig,
|
|
98
105
|
logger: Logger,
|
|
99
|
-
): Promise<{
|
|
106
|
+
): Promise<{ rollup: RollupContract; slashFactoryAddress: EthAddress }> {
|
|
100
107
|
const { createEthereumChain, deployRollupForUpgrade, createL1Clients } = await import('@aztec/ethereum');
|
|
101
108
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
102
109
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
@@ -107,16 +114,23 @@ export async function deployNewRollupContracts(
|
|
|
107
114
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
108
115
|
const clients = createL1Clients(rpcUrls, account, chain.chainInfo, mnemonicIndex);
|
|
109
116
|
|
|
110
|
-
|
|
117
|
+
if (!initialValidators || initialValidators.length === 0) {
|
|
118
|
+
const registry = new RegistryContract(clients.publicClient, registryAddress);
|
|
119
|
+
const rollup = new RollupContract(clients.publicClient, await registry.getCanonicalAddress());
|
|
120
|
+
initialValidators = (await rollup.getAttesters()).map(str => EthAddress.fromString(str));
|
|
121
|
+
logger.info('Initializing new rollup with old attesters', { initialValidators });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(
|
|
111
125
|
clients,
|
|
112
126
|
{
|
|
113
127
|
salt,
|
|
114
128
|
vkTreeRoot: getVKTreeRoot(),
|
|
115
129
|
protocolContractTreeRoot,
|
|
116
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
117
130
|
genesisArchiveRoot,
|
|
118
131
|
genesisBlockHash,
|
|
119
132
|
initialValidators,
|
|
133
|
+
feeJuicePortalInitialBalance,
|
|
120
134
|
...config,
|
|
121
135
|
},
|
|
122
136
|
registryAddress,
|
|
@@ -124,7 +138,7 @@ export async function deployNewRollupContracts(
|
|
|
124
138
|
config,
|
|
125
139
|
);
|
|
126
140
|
|
|
127
|
-
return {
|
|
141
|
+
return { rollup, slashFactoryAddress };
|
|
128
142
|
}
|
|
129
143
|
|
|
130
144
|
/**
|
package/src/utils/commands.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const getLocalhost = () =>
|
|
|
22
22
|
.catch(() => 'localhost');
|
|
23
23
|
|
|
24
24
|
export const LOCALHOST = await getLocalhost();
|
|
25
|
-
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, API_KEY, CLI_VERSION } = process.env;
|
|
25
|
+
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, MNEMONIC, API_KEY, CLI_VERSION } = process.env;
|
|
26
26
|
|
|
27
27
|
export function addOptions(program: Command, options: Option[]) {
|
|
28
28
|
options.forEach(option => program.addOption(option));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DefaultWaitOpts,
|
|
3
|
-
type EthAddress,
|
|
4
|
-
FeeJuicePaymentMethod,
|
|
5
3
|
Fr,
|
|
6
4
|
type PXE,
|
|
7
5
|
SignerlessWallet,
|
|
@@ -10,52 +8,9 @@ import {
|
|
|
10
8
|
getContractInstanceFromDeployParams,
|
|
11
9
|
waitForProven,
|
|
12
10
|
} from '@aztec/aztec.js';
|
|
13
|
-
import {
|
|
11
|
+
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
14
12
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
15
13
|
import type { LogFn } from '@aztec/foundation/log';
|
|
16
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
17
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Deploys the contract to pay for gas on L2.
|
|
21
|
-
*/
|
|
22
|
-
export async function setupCanonicalL2FeeJuice(
|
|
23
|
-
pxe: PXE,
|
|
24
|
-
feeJuicePortalAddress: EthAddress,
|
|
25
|
-
log: LogFn,
|
|
26
|
-
waitOpts = DefaultWaitOpts,
|
|
27
|
-
waitForProvenOptions?: WaitForProvenOpts,
|
|
28
|
-
) {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
30
|
-
// @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
|
|
31
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
32
|
-
|
|
33
|
-
const deployer = new SignerlessWallet(pxe);
|
|
34
|
-
|
|
35
|
-
const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer);
|
|
36
|
-
|
|
37
|
-
const portalAddress = await pxe.getPublicStorageAt(
|
|
38
|
-
feeJuiceContract.address,
|
|
39
|
-
feeJuiceContract.artifact.storageLayout.portal_address.slot,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
if (portalAddress.isZero()) {
|
|
43
|
-
log('setupCanonicalL2FeeJuice: Calling initialize on fee juice contract...');
|
|
44
|
-
const paymentMethod = new FeeJuicePaymentMethod(ProtocolContractAddress.FeeJuice);
|
|
45
|
-
const receipt = await feeJuiceContract.methods
|
|
46
|
-
.initialize(feeJuicePortalAddress, FEE_JUICE_INITIAL_MINT)
|
|
47
|
-
.send({ fee: { paymentMethod, gasSettings: { teardownGasLimits: Gas.empty() } } })
|
|
48
|
-
.wait(waitOpts);
|
|
49
|
-
if (waitForProvenOptions !== undefined) {
|
|
50
|
-
await waitForProven(pxe, receipt, waitForProvenOptions);
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
log(
|
|
54
|
-
'setupCanonicalL2FeeJuice: Fee juice contract already initialized. Fee Juice Portal address: ' +
|
|
55
|
-
portalAddress.toString(),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
14
|
|
|
60
15
|
async function getSponsoredFPCContract() {
|
|
61
16
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -81,9 +36,9 @@ export async function setupSponsoredFPC(
|
|
|
81
36
|
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
82
37
|
const address = await getSponsoredFPCAddress();
|
|
83
38
|
const paymentMethod = new SponsoredFeePaymentMethod(address);
|
|
84
|
-
const { l1ChainId: chainId,
|
|
39
|
+
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
|
|
85
40
|
|
|
86
|
-
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId,
|
|
41
|
+
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
87
42
|
|
|
88
43
|
const deployTx = SponsoredFPCContract.deploy(deployer).send({
|
|
89
44
|
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|