From 0ce6c6f716d7a429e18bf6e8cd231a3eb3d806bd Mon Sep 17 00:00:00 2001 From: LHerskind Date: Thu, 22 Aug 2024 19:00:33 +0000 Subject: [PATCH] chore: address comments --- yarn-project/end-to-end/src/e2e_p2p_network.test.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts index 1a94b806906..58b6a8d06b1 100644 --- a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts @@ -6,9 +6,8 @@ import { type BootstrapNode } from '@aztec/p2p'; import { type PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe'; import fs from 'fs'; -import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts'; +import { privateKeyToAccount } from 'viem/accounts'; -import { MNEMONIC } from './fixtures/fixtures.js'; import { type NodeContext, createBootstrapNode, @@ -16,7 +15,7 @@ import { createNodes, generatePeerIdPrivateKeys, } from './fixtures/setup_p2p_test.js'; -import { setup } from './fixtures/utils.js'; +import { getPrivateKeyFromIndex, setup } from './fixtures/utils.js'; // Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds const NUM_NODES = 4; @@ -43,9 +42,7 @@ describe('e2e_p2p_network', () => { // We need the very first node to be the sequencer for this is the one doing everything throughout the setup. // Without it we will wait forever. - const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 }); - const publisherPrivKey = Buffer.from(hdAccount.getHdKey().privateKey!); - const account = privateKeyToAccount(`0x${publisherPrivKey!.toString('hex')}`); + const account = privateKeyToAccount(`0x${getPrivateKeyFromIndex(0)!.toString('hex')}`); const initialValidators = [EthAddress.fromString(account.address)]; @@ -53,9 +50,7 @@ describe('e2e_p2p_network', () => { // Each of these will become a validator and sign attestations. const limit = IS_DEV_NET ? 1 : NUM_NODES; for (let i = 0; i < limit; i++) { - const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: i + 1 }); - const publisherPrivKey = Buffer.from(hdAccount.getHdKey().privateKey!); - const account = privateKeyToAccount(`0x${publisherPrivKey!.toString('hex')}`); + const account = privateKeyToAccount(`0x${getPrivateKeyFromIndex(i + 1)!.toString('hex')}`); initialValidators.push(EthAddress.fromString(account.address)); }