From 13ab33ab8a5652577bba9b86297ba3a19d43388f Mon Sep 17 00:00:00 2001 From: Amin Sammara Date: Mon, 13 Jan 2025 15:01:54 -0500 Subject: [PATCH 1/6] Add cli optino to specify withdrawer address in the add-l1-validator flow --- yarn-project/cli/src/cmds/l1/index.ts | 2 ++ yarn-project/cli/src/cmds/l1/update_l1_validators.ts | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index f5d67fa77f7..01fe31ebff3 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -80,6 +80,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger .addOption(l1ChainIdOption) .option('--validator ', 'ethereum address of the validator', parseEthereumAddress) .option('--rollup
', 'ethereum address of the rollup contract', parseEthereumAddress) + .option(`--withdrawer
', 'ethereum address of the withdrawer`, parseEthereumAddress) .action(async options => { const { addL1Validator } = await import('./update_l1_validators.js'); await addL1Validator({ @@ -89,6 +90,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger mnemonic: options.mnemonic, validatorAddress: options.validator, rollupAddress: options.rollup, + withdrawerAddress: options.withdrawer, log, debugLogger, }); diff --git a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts index 40d06e2fd6d..701853c2030 100644 --- a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts +++ b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts @@ -13,6 +13,7 @@ export interface RollupCommandArgs { privateKey?: string; mnemonic?: string; rollupAddress: EthAddress; + withdrawerAddress: EthAddress; } export interface LoggerArgs { @@ -37,9 +38,10 @@ export async function addL1Validator({ mnemonic, validatorAddress, rollupAddress, + withdrawerAddress, log, debugLogger, -}: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) { +}: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress}) { const config = getL1ContractsConfigEnvVars(); const dualLog = makeDualLog(log, debugLogger); const publicClient = getPublicClient(rpcUrl, chainId); @@ -67,7 +69,7 @@ export async function addL1Validator({ const txHash = await rollup.write.deposit([ validatorAddress.toString(), validatorAddress.toString(), - validatorAddress.toString(), + withdrawerAddress.toString(), config.minimumStake, ]); dualLog(`Transaction hash: ${txHash}`); From 1c02f368268dc839f463e3093721264da6577ed0 Mon Sep 17 00:00:00 2001 From: Amin Sammara Date: Tue, 14 Jan 2025 10:32:30 -0500 Subject: [PATCH 2/6] format --- yarn-project/cli/src/cmds/l1/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 01fe31ebff3..3426343414a 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -15,7 +15,7 @@ import { } from '../../utils/commands.js'; export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { - const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env; + const { BB_BINARY_PATH, BB_WORKING_DIfRECTORY } = process.env; program .command('deploy-l1-contracts') From 122f0df342ac138ad84e18f2a781f68cd6a7cac8 Mon Sep 17 00:00:00 2001 From: Amin Sammara <84764772+aminsammara@users.noreply.github.com> Date: Tue, 14 Jan 2025 10:43:20 -0500 Subject: [PATCH 3/6] Update update_l1_validators.ts format --- yarn-project/cli/src/cmds/l1/update_l1_validators.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts index 701853c2030..cd416c38f0a 100644 --- a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts +++ b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts @@ -41,7 +41,7 @@ export async function addL1Validator({ withdrawerAddress, log, debugLogger, -}: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress}) { +}: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) { const config = getL1ContractsConfigEnvVars(); const dualLog = makeDualLog(log, debugLogger); const publicClient = getPublicClient(rpcUrl, chainId); From 992d2df032df4c21f7c0496f3ed502b38425eb5d Mon Sep 17 00:00:00 2001 From: Amin Sammara <84764772+aminsammara@users.noreply.github.com> Date: Tue, 14 Jan 2025 10:43:45 -0500 Subject: [PATCH 4/6] Update index.ts --- yarn-project/cli/src/cmds/l1/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 3426343414a..01fe31ebff3 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -15,7 +15,7 @@ import { } from '../../utils/commands.js'; export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { - const { BB_BINARY_PATH, BB_WORKING_DIfRECTORY } = process.env; + const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env; program .command('deploy-l1-contracts') From 7429f93f87657eb8f3e75c51e76a7f938e09beba Mon Sep 17 00:00:00 2001 From: Mitch Date: Tue, 14 Jan 2025 12:10:21 -0500 Subject: [PATCH 5/6] fix: option spec, call in native test --- yarn-project/cli/src/cmds/l1/index.ts | 4 ++-- yarn-project/end-to-end/scripts/native-network/validator.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 01fe31ebff3..77e14801d62 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -78,9 +78,9 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger 'test test test test test test test test test test test junk', ) .addOption(l1ChainIdOption) - .option('--validator ', 'ethereum address of the validator', parseEthereumAddress) + .option('--validator
', 'ethereum address of the validator', parseEthereumAddress) .option('--rollup
', 'ethereum address of the rollup contract', parseEthereumAddress) - .option(`--withdrawer
', 'ethereum address of the withdrawer`, parseEthereumAddress) + .option('--withdrawer
', 'ethereum address of the withdrawer', parseEthereumAddress) .action(async options => { const { addL1Validator } = await import('./update_l1_validators.js'); await addL1Validator({ diff --git a/yarn-project/end-to-end/scripts/native-network/validator.sh b/yarn-project/end-to-end/scripts/native-network/validator.sh index 580b60483b6..f2b7a7ee5a5 100755 --- a/yarn-project/end-to-end/scripts/native-network/validator.sh +++ b/yarn-project/end-to-end/scripts/native-network/validator.sh @@ -83,7 +83,7 @@ else # this may fail, so try 3 times echo "Adding validator $ADDRESS..." for i in {1..3}; do - node --no-warnings "$REPO"/yarn-project/aztec/dest/bin/index.js add-l1-validator --validator $ADDRESS --rollup $ROLLUP_CONTRACT_ADDRESS && break + node --no-warnings "$REPO"/yarn-project/aztec/dest/bin/index.js add-l1-validator --validator $ADDRESS --withdrawer $ADDRESS --rollup $ROLLUP_CONTRACT_ADDRESS && break sleep 15 done fi From 899d6db01624c2bce0d4f354f197c9455532d73a Mon Sep 17 00:00:00 2001 From: Mitch Date: Tue, 14 Jan 2025 12:15:37 -0500 Subject: [PATCH 6/6] fix: make withdrawer optional --- yarn-project/cli/src/cmds/l1/update_l1_validators.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts index cd416c38f0a..abbf6d1f266 100644 --- a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts +++ b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts @@ -13,7 +13,7 @@ export interface RollupCommandArgs { privateKey?: string; mnemonic?: string; rollupAddress: EthAddress; - withdrawerAddress: EthAddress; + withdrawerAddress?: EthAddress; } export interface LoggerArgs { @@ -69,7 +69,7 @@ export async function addL1Validator({ const txHash = await rollup.write.deposit([ validatorAddress.toString(), validatorAddress.toString(), - withdrawerAddress.toString(), + withdrawerAddress?.toString() ?? validatorAddress.toString(), config.minimumStake, ]); dualLog(`Transaction hash: ${txHash}`);