@aztec/cli 1.0.0-staging.2 → 1.0.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.
@@ -1,5 +1,5 @@
1
1
  import type { LogFn, Logger } from '@aztec/foundation/log';
2
2
  import { type Command } from 'commander';
3
- export { addL1Validator } from './update_l1_validators.js';
3
+ export { addL1ValidatorToQueue, dripQueue } 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,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAW3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAuiB/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,qBAAqB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAW7E,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAiiB/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 { addL1Validator } from './update_l1_validators.js';
5
+ export { addL1ValidatorToQueue, dripQueue } 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,16 +95,15 @@ 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').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({
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({
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,
108
107
  proofParams: options.proof,
109
108
  log,
110
109
  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 addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs & {
26
+ export declare function addL1ValidatorToQueue({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, proofParams, log, debugLogger, }: StakingAssetHandlerCommandArgs & LoggerArgs & {
27
27
  attesterAddress: EthAddress;
28
28
  proofParams: Buffer;
29
- merkleProof: string[];
30
29
  }): 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;AAS3D,M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ACtC,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;AAO3D,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,qBAAqB,CAAC,EAC1C,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,WAAW,EACX,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAAG,UAAU,GAAG;IAAE,eAAe,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,iBAwCpG;AAED,wBAAsB,SAAS,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,0BAA0B,EAC1B,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAAG,UAAU,iBA0B7C;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,7 +3,6 @@ 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';
7
6
  export function generateL1Account() {
8
7
  const privateKey = generatePrivateKey();
9
8
  const account = privateKeyToAccount(privateKey);
@@ -13,7 +12,7 @@ export function generateL1Account() {
13
12
  address: account.address
14
13
  };
15
14
  }
16
- export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, merkleProof, proofParams, log, debugLogger }) {
15
+ export async function addL1ValidatorToQueue({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, stakingAssetHandlerAddress, proofParams, log, debugLogger }) {
17
16
  const dualLog = makeDualLog(log, debugLogger);
18
17
  const account = getAccount(privateKey, mnemonic);
19
18
  const chain = createEthereumChain(rpcUrls, chainId);
@@ -27,15 +26,13 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
27
26
  dualLog(`Adding validator ${attesterAddress} to rollup ${rollup.toString()}`);
28
27
  const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
29
28
  const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
30
- const merkleProofArray = merkleProof.map((proof)=>addLeadingHex(proof));
31
29
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
32
30
  to: stakingAssetHandlerAddress.toString(),
33
31
  data: encodeFunctionData({
34
32
  abi: StakingAssetHandlerAbi,
35
- functionName: 'addValidator',
33
+ functionName: 'addValidatorToQueue',
36
34
  args: [
37
35
  attesterAddress.toString(),
38
- merkleProofArray,
39
36
  proofParamsObj.toViem()
40
37
  ]
41
38
  }),
@@ -59,6 +56,29 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
59
56
  }
60
57
  }
61
58
  }
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
+ }
62
82
  export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger }) {
63
83
  const dualLog = makeDualLog(log, debugLogger);
64
84
  const account = getAccount(privateKey, mnemonic);
@@ -54,11 +54,10 @@ export declare function prepTx(contractFile: string, functionName: string, _func
54
54
  */
55
55
  export declare const stripLeadingHex: (hex: string) => string;
56
56
  /**
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
57
+ * Pretty prints Nargo.toml contents to a string
58
+ * @param config - Nargo.toml contents
59
+ * @returns The Nargo.toml contents as a string
60
60
  */
61
- export declare const addLeadingHex: (hex: string) => `0x${string}`;
62
61
  export declare function prettyPrintNargoToml(config: NoirPackageConfig): string;
63
62
  /**
64
63
  * 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,MA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,KAAK,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"}
@@ -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(addLeadingHex(privateKey));
31
+ }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${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(addLeadingHex(privateKey));
52
+ }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${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,16 +149,6 @@ 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
- /*
162
152
  * Pretty prints Nargo.toml contents to a string
163
153
  * @param config - Nargo.toml contents
164
154
  * @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.2",
3
+ "version": "1.0.0",
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.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",
72
+ "@aztec/archiver": "1.0.0",
73
+ "@aztec/aztec.js": "1.0.0",
74
+ "@aztec/constants": "1.0.0",
75
+ "@aztec/entrypoints": "1.0.0",
76
+ "@aztec/foundation": "1.0.0",
77
+ "@aztec/l1-artifacts": "1.0.0",
78
+ "@aztec/p2p": "1.0.0",
79
+ "@aztec/stdlib": "1.0.0",
80
+ "@aztec/world-state": "1.0.0",
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.2",
93
- "@aztec/ethereum": "1.0.0-staging.2",
94
- "@aztec/protocol-contracts": "1.0.0-staging.2",
92
+ "@aztec/accounts": "1.0.0",
93
+ "@aztec/ethereum": "1.0.0",
94
+ "@aztec/protocol-contracts": "1.0.0",
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.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"
110
+ "@aztec/accounts": "1.0.0",
111
+ "@aztec/bb-prover": "1.0.0",
112
+ "@aztec/ethereum": "1.0.0",
113
+ "@aztec/l1-artifacts": "1.0.0",
114
+ "@aztec/noir-contracts.js": "1.0.0",
115
+ "@aztec/noir-protocol-circuits-types": "1.0.0",
116
+ "@aztec/noir-test-contracts.js": "1.0.0",
117
+ "@aztec/protocol-contracts": "1.0.0",
118
+ "@aztec/stdlib": "1.0.0"
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 { addL1Validator } from './update_l1_validators.js';
18
+ export { addL1ValidatorToQueue, dripQueue } 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')
285
+ .command('add-l1-validator-to-queue')
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,21 +297,15 @@ 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
- )
305
300
  .action(async options => {
306
- const { addL1Validator } = await import('./update_l1_validators.js');
307
- await addL1Validator({
301
+ const { addL1ValidatorToQueue } = await import('./update_l1_validators.js');
302
+ await addL1ValidatorToQueue({
308
303
  rpcUrls: options.l1RpcUrls,
309
304
  chainId: options.l1ChainId,
310
305
  privateKey: options.privateKey,
311
306
  mnemonic: options.mnemonic,
312
307
  attesterAddress: options.attester,
313
308
  stakingAssetHandlerAddress: options.stakingAssetHandler,
314
- merkleProof: options.merkleProof,
315
309
  proofParams: options.proof,
316
310
  log,
317
311
  debugLogger,
@@ -16,8 +16,6 @@ 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
-
21
19
  export interface RollupCommandArgs {
22
20
  rpcUrls: string[];
23
21
  chainId: number;
@@ -50,19 +48,17 @@ export function generateL1Account() {
50
48
  };
51
49
  }
52
50
 
53
- export async function addL1Validator({
51
+ export async function addL1ValidatorToQueue({
54
52
  rpcUrls,
55
53
  chainId,
56
54
  privateKey,
57
55
  mnemonic,
58
56
  attesterAddress,
59
57
  stakingAssetHandlerAddress,
60
- merkleProof,
61
58
  proofParams,
62
59
  log,
63
60
  debugLogger,
64
- }: StakingAssetHandlerCommandArgs &
65
- LoggerArgs & { attesterAddress: EthAddress; proofParams: Buffer; merkleProof: string[] }) {
61
+ }: StakingAssetHandlerCommandArgs & LoggerArgs & { attesterAddress: EthAddress; proofParams: Buffer }) {
66
62
  const dualLog = makeDualLog(log, debugLogger);
67
63
  const account = getAccount(privateKey, mnemonic);
68
64
  const chain = createEthereumChain(rpcUrls, chainId);
@@ -79,14 +75,13 @@ export async function addL1Validator({
79
75
 
80
76
  const l1TxUtils = new L1TxUtils(l1Client, debugLogger);
81
77
  const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
82
- const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
83
78
 
84
79
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
85
80
  to: stakingAssetHandlerAddress.toString(),
86
81
  data: encodeFunctionData({
87
82
  abi: StakingAssetHandlerAbi,
88
- functionName: 'addValidator',
89
- args: [attesterAddress.toString(), merkleProofArray, proofParamsObj.toViem()],
83
+ functionName: 'addValidatorToQueue',
84
+ args: [attesterAddress.toString(), proofParamsObj.toViem()],
90
85
  }),
91
86
  abi: StakingAssetHandlerAbi,
92
87
  });
@@ -105,6 +100,42 @@ export async function addL1Validator({
105
100
  }
106
101
  }
107
102
 
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
+
108
139
  export async function removeL1Validator({
109
140
  rpcUrls,
110
141
  chainId,
@@ -64,7 +64,7 @@ export async function deployAztecContracts(
64
64
 
65
65
  const account = !privateKey
66
66
  ? mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex })
67
- : privateKeyToAccount(addLeadingHex(privateKey));
67
+ : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
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(addLeadingHex(privateKey));
113
+ : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
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): string => {
212
+ export const stripLeadingHex = (hex: string) => {
213
213
  if (hex.length > 2 && hex.startsWith('0x')) {
214
214
  return hex.substring(2);
215
215
  }
@@ -217,18 +217,6 @@ export const stripLeadingHex = (hex: string): 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
- /*
232
220
  * Pretty prints Nargo.toml contents to a string
233
221
  * @param config - Nargo.toml contents
234
222
  * @returns The Nargo.toml contents as a string