@aztec/cli 1.0.0-staging.0 → 1.0.0-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import type { LogFn, Logger } from '@aztec/foundation/log';
2
2
  import { type Command } from 'commander';
3
- export { addL1ValidatorToQueue, dripQueue } from './update_l1_validators.js';
3
+ export { addL1Validator } from './update_l1_validators.js';
4
4
  export declare function injectCommands(program: Command, log: LogFn, debugLogger: Logger): Command;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAG3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAajD,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAW7E,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAiiB/E"}
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;AAG3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAajD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAW3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAuiB/E"}
@@ -2,7 +2,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
2
2
  import { withoutHexPrefix } from '@aztec/foundation/string';
3
3
  import { Option } from 'commander';
4
4
  import { ETHEREUM_HOSTS, MNEMONIC, PRIVATE_KEY, l1ChainIdOption, parseAztecAddress, parseBigint, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
5
- export { addL1ValidatorToQueue, dripQueue } from './update_l1_validators.js';
5
+ export { addL1Validator } from './update_l1_validators.js';
6
6
  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([
7
7
  ETHEREUM_HOSTS
8
8
  ]).makeOptionMandatory(true).argParser((arg)=>arg.split(',').map((url)=>url.trim()));
@@ -95,15 +95,16 @@ export function injectCommands(program, log, debugLogger) {
95
95
  const account = generateL1Account();
96
96
  log(JSON.stringify(account, null, 2));
97
97
  });
98
- program.command('add-l1-validator-to-queue').description('Adds a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use sending the transaction', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress).option('--staking-asset-handler <address>', 'ethereum address of the staking asset handler', parseEthereumAddress).option('--proof <buffer>', 'The proof to use for the attestation', (arg)=>Buffer.from(withoutHexPrefix(arg), 'hex')).action(async (options)=>{
99
- const { addL1ValidatorToQueue } = await import('./update_l1_validators.js');
100
- await addL1ValidatorToQueue({
98
+ program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use sending the transaction', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress).option('--staking-asset-handler <address>', 'ethereum address of the staking asset handler', parseEthereumAddress).option('--proof <buffer>', 'The proof to use for the attestation', (arg)=>Buffer.from(withoutHexPrefix(arg), 'hex')).option('--merkle-proof <string>', 'The merkle proof to use for the attestation (comma separated list of 32 byte buffers)', (arg)=>arg.split(',')).action(async (options)=>{
99
+ const { addL1Validator } = await import('./update_l1_validators.js');
100
+ await addL1Validator({
101
101
  rpcUrls: options.l1RpcUrls,
102
102
  chainId: options.l1ChainId,
103
103
  privateKey: options.privateKey,
104
104
  mnemonic: options.mnemonic,
105
105
  attesterAddress: options.attester,
106
106
  stakingAssetHandlerAddress: options.stakingAssetHandler,
107
+ merkleProof: options.merkleProof,
107
108
  proofParams: options.proof,
108
109
  log,
109
110
  debugLogger
@@ -23,11 +23,11 @@ export declare function generateL1Account(): {
23
23
  privateKey: `0x${string}`;
24
24
  address: `0x${string}`;
25
25
  };
26
- export declare function addL1ValidatorToQueue({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, proofParams, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs & {
26
+ export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs & {
27
27
  attesterAddress: EthAddress;
28
28
  proofParams: Buffer;
29
+ merkleProof: string[];
29
30
  }): Promise<void>;
30
- export declare function dripQueue({ rpcUrls, chainId, privateKey, mnemonic, stakingAssetHandlerAddress, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs): Promise<void>;
31
31
  export declare function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger, }: RollupCommandArgs & LoggerArgs & {
32
32
  validatorAddress: EthAddress;
33
33
  }): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;A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ACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAgBhC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
1
+ {"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAS3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAC/B,UAAU,GAAG;IAAE,eAAe,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,iBAyCzF;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAiBnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAgBhC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
@@ -3,6 +3,7 @@ import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
3
3
  import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
4
4
  import { encodeFunctionData, formatEther, getContract } from 'viem';
5
5
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
6
+ import { addLeadingHex } from '../../utils/aztec.js';
6
7
  export function generateL1Account() {
7
8
  const privateKey = generatePrivateKey();
8
9
  const account = privateKeyToAccount(privateKey);
@@ -12,7 +13,7 @@ export function generateL1Account() {
12
13
  address: account.address
13
14
  };
14
15
  }
15
- export async function addL1ValidatorToQueue({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, proofParams, log, debugLogger }) {
16
+ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, log, debugLogger }) {
16
17
  const dualLog = makeDualLog(log, debugLogger);
17
18
  const account = getAccount(privateKey, mnemonic);
18
19
  const chain = createEthereumChain(rpcUrls, chainId);
@@ -26,13 +27,15 @@ export async function addL1ValidatorToQueue({ rpcUrls, chainId, privateKey, mnem
26
27
  dualLog(`Adding validator ${attesterAddress} to rollup ${rollup.toString()}`);
27
28
  const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
28
29
  const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
30
+ const merkleProofArray = merkleProof.map((proof)=>addLeadingHex(proof));
29
31
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
30
32
  to: stakingAssetHandlerAddress.toString(),
31
33
  data: encodeFunctionData({
32
34
  abi: StakingAssetHandlerAbi,
33
- functionName: 'addValidatorToQueue',
35
+ functionName: 'addValidator',
34
36
  args: [
35
37
  attesterAddress.toString(),
38
+ merkleProofArray,
36
39
  proofParamsObj.toViem()
37
40
  ]
38
41
  }),
@@ -56,29 +59,6 @@ export async function addL1ValidatorToQueue({ rpcUrls, chainId, privateKey, mnem
56
59
  }
57
60
  }
58
61
  }
59
- export async function dripQueue({ rpcUrls, chainId, privateKey, mnemonic, stakingAssetHandlerAddress, log, debugLogger }) {
60
- const dualLog = makeDualLog(log, debugLogger);
61
- const account = getAccount(privateKey, mnemonic);
62
- const chain = createEthereumChain(rpcUrls, chainId);
63
- const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
64
- dualLog('Dripping Queue');
65
- const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
66
- const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
67
- to: stakingAssetHandlerAddress.toString(),
68
- data: encodeFunctionData({
69
- abi: StakingAssetHandlerAbi,
70
- functionName: 'dripQueue',
71
- args: []
72
- }),
73
- abi: StakingAssetHandlerAbi
74
- });
75
- dualLog(`Receipt: ${receipt.transactionHash}`);
76
- if (receipt.status === 'success') {
77
- dualLog('Queue dripped successfully');
78
- } else {
79
- dualLog('Queue drip failed');
80
- }
81
- }
82
62
  export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger }) {
83
63
  const dualLog = makeDualLog(log, debugLogger);
84
64
  const account = getAccount(privateKey, mnemonic);
@@ -54,10 +54,11 @@ export declare function prepTx(contractFile: string, functionName: string, _func
54
54
  */
55
55
  export declare const stripLeadingHex: (hex: string) => string;
56
56
  /**
57
- * Pretty prints Nargo.toml contents to a string
58
- * @param config - Nargo.toml contents
59
- * @returns The Nargo.toml contents as a string
57
+ * Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
58
+ * @param hex - A hex string
59
+ * @returns A new string with leading 0x added
60
60
  */
61
+ export declare const addLeadingHex: (hex: string) => `0x${string}`;
61
62
  export declare function prettyPrintNargoToml(config: NoirPackageConfig): string;
62
63
  /**
63
64
  * Checks that Private eXecution Environment (PXE) version matches the expected one by this CLI. Throws if not.
@@ -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,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,M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AAG,KAAK,MAAM,EAKtD,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE;AAKD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAyB9E"}
@@ -28,7 +28,7 @@ import { encodeArgs } from './encoding.js';
28
28
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
29
29
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
30
30
  addressIndex: mnemonicIndex
31
- }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
31
+ }) : privateKeyToAccount(addLeadingHex(privateKey));
32
32
  const chain = createEthereumChain(rpcUrls, chainId);
33
33
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
34
34
  return await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
@@ -49,7 +49,7 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
49
49
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
50
50
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
51
51
  addressIndex: mnemonicIndex
52
- }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
52
+ }) : privateKeyToAccount(addLeadingHex(privateKey));
53
53
  const chain = createEthereumChain(rpcUrls, chainId);
54
54
  const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
55
55
  if (!initialValidators || initialValidators.length === 0) {
@@ -149,6 +149,16 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
149
149
  return hex;
150
150
  };
151
151
  /**
152
+ * Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
153
+ * @param hex - A hex string
154
+ * @returns A new string with leading 0x added
155
+ */ export const addLeadingHex = (hex)=>{
156
+ if (hex.length > 2 && hex.startsWith('0x')) {
157
+ return hex;
158
+ }
159
+ return `0x${hex}`;
160
+ };
161
+ /*
152
162
  * Pretty prints Nargo.toml contents to a string
153
163
  * @param config - Nargo.toml contents
154
164
  * @returns The Nargo.toml contents as a string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli",
3
- "version": "1.0.0-staging.0",
3
+ "version": "1.0.0-staging.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./contracts": "./dest/cmds/contracts/index.js",
@@ -69,15 +69,15 @@
69
69
  ]
70
70
  },
71
71
  "dependencies": {
72
- "@aztec/archiver": "1.0.0-staging.0",
73
- "@aztec/aztec.js": "1.0.0-staging.0",
74
- "@aztec/constants": "1.0.0-staging.0",
75
- "@aztec/entrypoints": "1.0.0-staging.0",
76
- "@aztec/foundation": "1.0.0-staging.0",
77
- "@aztec/l1-artifacts": "1.0.0-staging.0",
78
- "@aztec/p2p": "1.0.0-staging.0",
79
- "@aztec/stdlib": "1.0.0-staging.0",
80
- "@aztec/world-state": "1.0.0-staging.0",
72
+ "@aztec/archiver": "1.0.0-staging.2",
73
+ "@aztec/aztec.js": "1.0.0-staging.2",
74
+ "@aztec/constants": "1.0.0-staging.2",
75
+ "@aztec/entrypoints": "1.0.0-staging.2",
76
+ "@aztec/foundation": "1.0.0-staging.2",
77
+ "@aztec/l1-artifacts": "1.0.0-staging.2",
78
+ "@aztec/p2p": "1.0.0-staging.2",
79
+ "@aztec/stdlib": "1.0.0-staging.2",
80
+ "@aztec/world-state": "1.0.0-staging.2",
81
81
  "@iarna/toml": "^2.2.5",
82
82
  "@libp2p/peer-id-factory": "^3.0.4",
83
83
  "commander": "^12.1.0",
@@ -89,9 +89,9 @@
89
89
  "viem": "2.23.7"
90
90
  },
91
91
  "devDependencies": {
92
- "@aztec/accounts": "1.0.0-staging.0",
93
- "@aztec/ethereum": "1.0.0-staging.0",
94
- "@aztec/protocol-contracts": "1.0.0-staging.0",
92
+ "@aztec/accounts": "1.0.0-staging.2",
93
+ "@aztec/ethereum": "1.0.0-staging.2",
94
+ "@aztec/protocol-contracts": "1.0.0-staging.2",
95
95
  "@jest/globals": "^30.0.0",
96
96
  "@types/jest": "^30.0.0",
97
97
  "@types/lodash.chunk": "^4.2.9",
@@ -107,15 +107,15 @@
107
107
  "typescript": "^5.3.3"
108
108
  },
109
109
  "peerDependencies": {
110
- "@aztec/accounts": "1.0.0-staging.0",
111
- "@aztec/bb-prover": "1.0.0-staging.0",
112
- "@aztec/ethereum": "1.0.0-staging.0",
113
- "@aztec/l1-artifacts": "1.0.0-staging.0",
114
- "@aztec/noir-contracts.js": "1.0.0-staging.0",
115
- "@aztec/noir-protocol-circuits-types": "1.0.0-staging.0",
116
- "@aztec/noir-test-contracts.js": "1.0.0-staging.0",
117
- "@aztec/protocol-contracts": "1.0.0-staging.0",
118
- "@aztec/stdlib": "1.0.0-staging.0"
110
+ "@aztec/accounts": "1.0.0-staging.2",
111
+ "@aztec/bb-prover": "1.0.0-staging.2",
112
+ "@aztec/ethereum": "1.0.0-staging.2",
113
+ "@aztec/l1-artifacts": "1.0.0-staging.2",
114
+ "@aztec/noir-contracts.js": "1.0.0-staging.2",
115
+ "@aztec/noir-protocol-circuits-types": "1.0.0-staging.2",
116
+ "@aztec/noir-test-contracts.js": "1.0.0-staging.2",
117
+ "@aztec/protocol-contracts": "1.0.0-staging.2",
118
+ "@aztec/stdlib": "1.0.0-staging.2"
119
119
  },
120
120
  "files": [
121
121
  "dest",
@@ -15,7 +15,7 @@ import {
15
15
  pxeOption,
16
16
  } from '../../utils/commands.js';
17
17
 
18
- export { addL1ValidatorToQueue, dripQueue } from './update_l1_validators.js';
18
+ export { addL1Validator } from './update_l1_validators.js';
19
19
 
20
20
  const l1RpcUrlsOption = new Option(
21
21
  '--l1-rpc-urls <string>',
@@ -282,7 +282,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
282
282
  });
283
283
 
284
284
  program
285
- .command('add-l1-validator-to-queue')
285
+ .command('add-l1-validator')
286
286
  .description('Adds a validator to the L1 rollup contract.')
287
287
  .addOption(l1RpcUrlsOption)
288
288
  .option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY)
@@ -297,15 +297,21 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
297
297
  .option('--proof <buffer>', 'The proof to use for the attestation', arg =>
298
298
  Buffer.from(withoutHexPrefix(arg), 'hex'),
299
299
  )
300
+ .option(
301
+ '--merkle-proof <string>',
302
+ 'The merkle proof to use for the attestation (comma separated list of 32 byte buffers)',
303
+ arg => arg.split(','),
304
+ )
300
305
  .action(async options => {
301
- const { addL1ValidatorToQueue } = await import('./update_l1_validators.js');
302
- await addL1ValidatorToQueue({
306
+ const { addL1Validator } = await import('./update_l1_validators.js');
307
+ await addL1Validator({
303
308
  rpcUrls: options.l1RpcUrls,
304
309
  chainId: options.l1ChainId,
305
310
  privateKey: options.privateKey,
306
311
  mnemonic: options.mnemonic,
307
312
  attesterAddress: options.attester,
308
313
  stakingAssetHandlerAddress: options.stakingAssetHandler,
314
+ merkleProof: options.merkleProof,
309
315
  proofParams: options.proof,
310
316
  log,
311
317
  debugLogger,
@@ -16,6 +16,8 @@ import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
16
16
  import { encodeFunctionData, formatEther, getContract } from 'viem';
17
17
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
18
18
 
19
+ import { addLeadingHex } from '../../utils/aztec.js';
20
+
19
21
  export interface RollupCommandArgs {
20
22
  rpcUrls: string[];
21
23
  chainId: number;
@@ -48,17 +50,19 @@ export function generateL1Account() {
48
50
  };
49
51
  }
50
52
 
51
- export async function addL1ValidatorToQueue({
53
+ export async function addL1Validator({
52
54
  rpcUrls,
53
55
  chainId,
54
56
  privateKey,
55
57
  mnemonic,
56
58
  attesterAddress,
57
59
  stakingAssetHandlerAddress,
60
+ merkleProof,
58
61
  proofParams,
59
62
  log,
60
63
  debugLogger,
61
- }: StakingAssetHandlerCommandArgs & LoggerArgs & { attesterAddress: EthAddress; proofParams: Buffer }) {
64
+ }: StakingAssetHandlerCommandArgs &
65
+ LoggerArgs & { attesterAddress: EthAddress; proofParams: Buffer; merkleProof: string[] }) {
62
66
  const dualLog = makeDualLog(log, debugLogger);
63
67
  const account = getAccount(privateKey, mnemonic);
64
68
  const chain = createEthereumChain(rpcUrls, chainId);
@@ -75,13 +79,14 @@ export async function addL1ValidatorToQueue({
75
79
 
76
80
  const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
77
81
  const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
82
+ const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
78
83
 
79
84
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
80
85
  to: stakingAssetHandlerAddress.toString(),
81
86
  data: encodeFunctionData({
82
87
  abi: StakingAssetHandlerAbi,
83
- functionName: 'addValidatorToQueue',
84
- args: [attesterAddress.toString(), proofParamsObj.toViem()],
88
+ functionName: 'addValidator',
89
+ args: [attesterAddress.toString(), merkleProofArray, proofParamsObj.toViem()],
85
90
  }),
86
91
  abi: StakingAssetHandlerAbi,
87
92
  });
@@ -100,42 +105,6 @@ export async function addL1ValidatorToQueue({
100
105
  }
101
106
  }
102
107
 
103
- export async function dripQueue({
104
- rpcUrls,
105
- chainId,
106
- privateKey,
107
- mnemonic,
108
- stakingAssetHandlerAddress,
109
- log,
110
- debugLogger,
111
- }: StakingAssetHandlerCommandArgs & LoggerArgs) {
112
- const dualLog = makeDualLog(log, debugLogger);
113
- const account = getAccount(privateKey, mnemonic);
114
- const chain = createEthereumChain(rpcUrls, chainId);
115
- const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
116
-
117
- dualLog('Dripping Queue');
118
-
119
- const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
120
-
121
- const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
122
- to: stakingAssetHandlerAddress.toString(),
123
- data: encodeFunctionData({
124
- abi: StakingAssetHandlerAbi,
125
- functionName: 'dripQueue',
126
- args: [],
127
- }),
128
- abi: StakingAssetHandlerAbi,
129
- });
130
- dualLog(`Receipt: ${receipt.transactionHash}`);
131
-
132
- if (receipt.status === 'success') {
133
- dualLog('Queue dripped successfully');
134
- } else {
135
- dualLog('Queue drip failed');
136
- }
137
- }
138
-
139
108
  export async function removeL1Validator({
140
109
  rpcUrls,
141
110
  chainId,
@@ -64,7 +64,7 @@ export async function deployAztecContracts(
64
64
 
65
65
  const account = !privateKey
66
66
  ? mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex })
67
- : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
67
+ : privateKeyToAccount(addLeadingHex(privateKey));
68
68
  const chain = createEthereumChain(rpcUrls, chainId);
69
69
 
70
70
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
@@ -110,7 +110,7 @@ export async function deployNewRollupContracts(
110
110
 
111
111
  const account = !privateKey
112
112
  ? mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex })
113
- : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
113
+ : privateKeyToAccount(addLeadingHex(privateKey));
114
114
  const chain = createEthereumChain(rpcUrls, chainId);
115
115
  const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
116
116
 
@@ -209,7 +209,7 @@ export async function prepTx(contractFile: string, functionName: string, _functi
209
209
  * @param hex - A hex string
210
210
  * @returns A new string with leading 0x removed
211
211
  */
212
- export const stripLeadingHex = (hex: string) => {
212
+ export const stripLeadingHex = (hex: string): string => {
213
213
  if (hex.length > 2 && hex.startsWith('0x')) {
214
214
  return hex.substring(2);
215
215
  }
@@ -217,6 +217,18 @@ export const stripLeadingHex = (hex: string) => {
217
217
  };
218
218
 
219
219
  /**
220
+ * Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
221
+ * @param hex - A hex string
222
+ * @returns A new string with leading 0x added
223
+ */
224
+ export const addLeadingHex = (hex: string): `0x${string}` => {
225
+ if (hex.length > 2 && hex.startsWith('0x')) {
226
+ return hex as `0x${string}`;
227
+ }
228
+ return `0x${hex}`;
229
+ };
230
+
231
+ /*
220
232
  * Pretty prints Nargo.toml contents to a string
221
233
  * @param config - Nargo.toml contents
222
234
  * @returns The Nargo.toml contents as a string