@aztec/cli 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c
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/aztec_node/get_current_min_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/{get_current_base_fee.js → get_current_min_fee.js} +2 -2
- package/dest/cmds/aztec_node/index.js +3 -3
- package/dest/cmds/infrastructure/sequencers.d.ts +1 -1
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +2 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +3 -5
- package/dest/cmds/l1/index.d.ts +1 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +3 -2
- package/dest/cmds/l1/update_l1_validators.d.ts +3 -3
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +47 -12
- package/dest/config/chain_l2_config.d.ts +12 -39
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +33 -512
- package/dest/config/generated/networks.d.ts +205 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +206 -0
- package/dest/config/network_config.d.ts +1 -1
- package/dest/config/network_config.js +1 -1
- package/dest/utils/inspect.d.ts +1 -1
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +4 -1
- package/package.json +35 -30
- package/src/cmds/aztec_node/{get_current_base_fee.ts → get_current_min_fee.ts} +2 -2
- package/src/cmds/aztec_node/index.ts +3 -3
- package/src/cmds/infrastructure/sequencers.ts +2 -1
- package/src/cmds/infrastructure/setup_l2_contract.ts +1 -1
- package/src/cmds/l1/assume_proven_through.ts +4 -7
- package/src/cmds/l1/index.ts +5 -4
- package/src/cmds/l1/update_l1_validators.ts +41 -15
- package/src/config/chain_l2_config.ts +33 -670
- package/src/config/generated/networks.ts +210 -0
- package/src/config/network_config.ts +1 -1
- package/src/utils/inspect.ts +4 -1
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +0 -1
package/src/cmds/l1/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
4
|
|
|
@@ -497,14 +498,14 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
497
498
|
program
|
|
498
499
|
.command('set-proven-through', { hidden: true })
|
|
499
500
|
.description(
|
|
500
|
-
'Instructs the L1 rollup contract to assume all blocks until the given
|
|
501
|
+
'Instructs the L1 rollup contract to assume all blocks until the given checkpoint are automatically proven.',
|
|
501
502
|
)
|
|
502
|
-
.argument('[
|
|
503
|
+
.argument('[checkpoint]', 'The target checkpoint, defaults to the latest pending checkpoint.', parseBigint)
|
|
503
504
|
.addOption(l1RpcUrlsOption)
|
|
504
505
|
.addOption(nodeOption)
|
|
505
|
-
.action(async (
|
|
506
|
+
.action(async (checkpoint, options) => {
|
|
506
507
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
507
|
-
await assumeProvenThrough(
|
|
508
|
+
await assumeProvenThrough(CheckpointNumber.fromBigInt(checkpoint), options.l1RpcUrls, options.nodeUrl, log);
|
|
508
509
|
});
|
|
509
510
|
|
|
510
511
|
program
|
|
@@ -7,14 +7,12 @@ import { EthCheatCodes } from '@aztec/ethereum/test';
|
|
|
7
7
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
8
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
9
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
10
|
-
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
10
|
+
import { RollupAbi, StakingAssetHandlerAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
11
11
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
12
12
|
|
|
13
|
-
import { encodeFunctionData, formatEther, getContract } from 'viem';
|
|
13
|
+
import { encodeFunctionData, formatEther, getContract, maxUint256 } from 'viem';
|
|
14
14
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
15
15
|
|
|
16
|
-
import { addLeadingHex } from '../../utils/aztec.js';
|
|
17
|
-
|
|
18
16
|
export interface RollupCommandArgs {
|
|
19
17
|
rpcUrls: string[];
|
|
20
18
|
chainId: number;
|
|
@@ -53,8 +51,8 @@ export async function addL1Validator({
|
|
|
53
51
|
privateKey,
|
|
54
52
|
mnemonic,
|
|
55
53
|
attesterAddress,
|
|
54
|
+
withdrawerAddress,
|
|
56
55
|
stakingAssetHandlerAddress,
|
|
57
|
-
merkleProof,
|
|
58
56
|
proofParams,
|
|
59
57
|
blsSecretKey,
|
|
60
58
|
log,
|
|
@@ -63,8 +61,8 @@ export async function addL1Validator({
|
|
|
63
61
|
LoggerArgs & {
|
|
64
62
|
blsSecretKey: bigint; // scalar field element of BN254
|
|
65
63
|
attesterAddress: EthAddress;
|
|
64
|
+
withdrawerAddress: EthAddress;
|
|
66
65
|
proofParams: Buffer;
|
|
67
|
-
merkleProof: string[];
|
|
68
66
|
}) {
|
|
69
67
|
const dualLog = makeDualLog(log, debugLogger);
|
|
70
68
|
const account = getAccount(privateKey, mnemonic);
|
|
@@ -87,33 +85,61 @@ export async function addL1Validator({
|
|
|
87
85
|
});
|
|
88
86
|
|
|
89
87
|
const gseAddress = await rollup.read.getGSE();
|
|
90
|
-
|
|
91
88
|
const gse = new GSEContract(l1Client, gseAddress);
|
|
92
|
-
|
|
93
89
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
94
90
|
|
|
95
91
|
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
96
92
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
97
|
-
const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
|
|
98
93
|
|
|
99
|
-
|
|
94
|
+
// Step 1: Claim STK tokens from the faucet
|
|
95
|
+
dualLog(`Claiming STK tokens from faucet`);
|
|
96
|
+
const { receipt: claimReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
100
97
|
to: stakingAssetHandlerAddress.toString(),
|
|
101
98
|
data: encodeFunctionData({
|
|
102
99
|
abi: StakingAssetHandlerAbi,
|
|
103
|
-
functionName: '
|
|
100
|
+
functionName: 'claim',
|
|
101
|
+
args: [proofParamsObj.toViem()],
|
|
102
|
+
}),
|
|
103
|
+
abi: StakingAssetHandlerAbi,
|
|
104
|
+
});
|
|
105
|
+
dualLog(`Claim transaction hash: ${claimReceipt.transactionHash}`);
|
|
106
|
+
await l1Client.waitForTransactionReceipt({ hash: claimReceipt.transactionHash });
|
|
107
|
+
|
|
108
|
+
// Step 2: Approve the rollup to spend STK tokens
|
|
109
|
+
const stakingAssetAddress = await stakingAssetHandler.read.STAKING_ASSET();
|
|
110
|
+
dualLog(`Approving rollup to spend STK tokens`);
|
|
111
|
+
const { receipt: approveReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
112
|
+
to: stakingAssetAddress,
|
|
113
|
+
data: encodeFunctionData({
|
|
114
|
+
abi: TestERC20Abi,
|
|
115
|
+
functionName: 'approve',
|
|
116
|
+
args: [rollupAddress, maxUint256],
|
|
117
|
+
}),
|
|
118
|
+
abi: TestERC20Abi,
|
|
119
|
+
});
|
|
120
|
+
await l1Client.waitForTransactionReceipt({ hash: approveReceipt.transactionHash });
|
|
121
|
+
|
|
122
|
+
// Step 3: Deposit into the rollup to register as a validator
|
|
123
|
+
dualLog(`Depositing into rollup to register validator`);
|
|
124
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
125
|
+
to: rollupAddress,
|
|
126
|
+
data: encodeFunctionData({
|
|
127
|
+
abi: RollupAbi,
|
|
128
|
+
functionName: 'deposit',
|
|
104
129
|
args: [
|
|
105
130
|
attesterAddress.toString(),
|
|
106
|
-
|
|
107
|
-
proofParamsObj.toViem(),
|
|
131
|
+
withdrawerAddress.toString(),
|
|
108
132
|
registrationTuple.publicKeyInG1,
|
|
109
133
|
registrationTuple.publicKeyInG2,
|
|
110
134
|
registrationTuple.proofOfPossession,
|
|
135
|
+
false, // moveWithLatestRollup
|
|
111
136
|
],
|
|
112
137
|
}),
|
|
113
|
-
abi:
|
|
138
|
+
abi: RollupAbi,
|
|
114
139
|
});
|
|
115
|
-
dualLog(`
|
|
140
|
+
dualLog(`Deposit transaction hash: ${receipt.transactionHash}`);
|
|
116
141
|
await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
|
|
142
|
+
|
|
117
143
|
if (isAnvilTestChain(chainId)) {
|
|
118
144
|
dualLog(`Funding validator on L1`);
|
|
119
145
|
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|