Skip to content

Commit 1a8d444

Browse files
ludamadclaude
andcommitted
refactor: rename deployL1ContractsWithForgeAndAccount to deployL1Contracts
Removes the alias and directly names the function deployL1Contracts as the main entry point for L1 contract deployment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b64e598 commit 1a8d444

20 files changed

+130
-1419
lines changed

docs/design/NETWORK_UPGRADE_IMPLEMENTATION_ROADMAP.md

Lines changed: 0 additions & 569 deletions
This file was deleted.

docs/design/NETWORK_UPGRADE_INFRASTRUCTURE_CONSOLIDATION.md

Lines changed: 0 additions & 527 deletions
This file was deleted.

l1-contracts/script/deploy/REQUIREMENTS.md

Lines changed: 0 additions & 242 deletions
This file was deleted.

yarn-project/aztec/src/local-network/local-network.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
2828
import { getGenesisValues } from '@aztec/world-state/testing';
2929

30-
import { type HDAccount, type PrivateKeyAccount, createPublicClient, fallback, http as httpViemTransport } from 'viem';
30+
import { type HDAccount, type Hex, createPublicClient, fallback, http as httpViemTransport } from 'viem';
3131
import { mnemonicToAccount, privateKeyToAddress } from 'viem/accounts';
3232
import { foundry } from 'viem/chains';
3333

@@ -48,7 +48,7 @@ const localAnvil = foundry;
4848
*/
4949
export async function deployContractsToL1(
5050
aztecNodeConfig: AztecNodeConfig,
51-
hdAccount: HDAccount | PrivateKeyAccount,
51+
hdAccount: HDAccount | Hex,
5252
contractDeployLogger = logger,
5353
opts: {
5454
assumeProvenThroughBlockNumber?: number;

yarn-project/cli/src/utils/aztec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,19 @@ export async function deployAztecContracts(
6262
debugLogger: Logger,
6363
): Promise<DeployL1ContractsReturnType> {
6464
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
65-
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
65+
const { mnemonicToAccount } = await import('viem/accounts');
6666

67-
const account = !privateKey
67+
// For Forge deployment, we need to pass either an HDAccount (from mnemonic)
68+
// or a raw private key hex string. We can't use PrivateKeyAccount because
69+
// viem doesn't expose the private key from it.
70+
const accountOrPrivateKey = !privateKey
6871
? mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex })
69-
: privateKeyToAccount(addLeadingHex(privateKey));
72+
: (addLeadingHex(privateKey) as `0x${string}`);
7073
const chain = createEthereumChain(rpcUrls, chainId);
7174

7275
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
7376

74-
const result = await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
77+
const result = await deployL1Contracts(chain.rpcUrls, accountOrPrivateKey, chain.chainInfo, debugLogger, {
7578
vkTreeRoot: getVKTreeRoot().toString() as `0x${string}`,
7679
protocolContractsHash: protocolContractsHash.toString() as `0x${string}`,
7780
genesisArchiveRoot: genesisArchiveRoot.toString() as `0x${string}`,

yarn-project/end-to-end/src/e2e_l1_publisher/e2e_l1_publisher.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('L1Publisher integration', () => {
156156
config.l1RpcUrls = [rpcUrl];
157157

158158
deployerAccount = privateKeyToAccount(deployerPK);
159-
({ l1ContractAddresses, l1Client } = await setupL1Contracts(config.l1RpcUrls, deployerAccount, logger, {
159+
({ l1ContractAddresses, l1Client } = await setupL1Contracts(config.l1RpcUrls, deployerPK, logger, {
160160
aztecTargetCommitteeSize: 0,
161161
slasherFlavor: 'none',
162162
...deployL1ContractsArgs,

yarn-project/end-to-end/src/e2e_l1_publisher/e2e_l1_publisher_fusaka_switch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('L1Publisher integration', () => {
134134
deployerAccount = privateKeyToAccount(deployerPK);
135135
({ l1ContractAddresses, l1Client } = await setupL1Contracts(
136136
config.l1RpcUrls,
137-
deployerAccount,
137+
deployerPK,
138138
logger,
139139
{
140140
aztecTargetCommitteeSize: 0,

yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ import { type DeployL1ContractsArgs, deployL1Contracts } from '@aztec/ethereum';
33
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
44
import { protocolContractsHash } from '@aztec/protocol-contracts';
55

6-
import type { Chain, HDAccount, Hex, PrivateKeyAccount } from 'viem';
6+
import type { Chain, HDAccount, Hex } from 'viem';
77
import { foundry } from 'viem/chains';
88

99
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
1010

1111
/**
1212
* Sets up L1 contracts for end-to-end tests using Forge scripts.
13+
*
14+
* @param l1RpcUrls - Array of RPC URLs
15+
* @param account - HDAccount (from mnemonicToAccount) or raw private key hex string.
16+
* Note: PrivateKeyAccount is NOT supported - pass the raw hex string instead.
17+
* @param logger - Logger instance
18+
* @param args - Partial deployment arguments
19+
* @param chain - Ethereum chain (defaults to foundry/anvil)
1320
*/
1421
export const setupL1Contracts = async (
1522
l1RpcUrls: string[],
16-
account: HDAccount | PrivateKeyAccount,
23+
account: HDAccount | Hex,
1724
logger: Logger,
1825
args: Partial<DeployL1ContractsArgs> = {},
1926
chain: Chain = foundry,

yarn-project/end-to-end/src/fixtures/utils.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,24 +402,27 @@ export async function setup(
402402
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
403403
}
404404

405-
let publisherPrivKey = undefined;
405+
let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
406406
let publisherHdAccount = undefined;
407407

408408
if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
409-
publisherHdAccount = privateKeyToAccount(opts.l1PublisherKey.getValue());
409+
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
410+
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
410411
} else if (
411412
config.publisherPrivateKeys &&
412413
config.publisherPrivateKeys.length > 0 &&
413414
config.publisherPrivateKeys[0].getValue() != NULL_KEY
414415
) {
415-
publisherHdAccount = privateKeyToAccount(config.publisherPrivateKeys[0].getValue());
416+
publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
417+
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
416418
} else if (!MNEMONIC) {
417419
throw new Error(`Mnemonic not provided and no publisher private key`);
418420
} else {
419421
publisherHdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
420422
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
421-
publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
422-
config.publisherPrivateKeys = [new SecretValue(`0x${publisherPrivKey!.toString('hex')}` as const)];
423+
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
424+
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as `0x${string}`;
425+
config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
423426
}
424427

425428
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
@@ -451,7 +454,7 @@ export async function setup(
451454
opts.deployL1ContractsValues ??
452455
(await setupL1Contracts(
453456
config.l1RpcUrls,
454-
publisherHdAccount!,
457+
publisherPrivKeyHex!,
455458
logger,
456459
{
457460
...opts,

0 commit comments

Comments
 (0)