From 95f150ed1e9e2a8b60dc4ff4da61024a23ad435b Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 14:26:11 +0000 Subject: [PATCH 1/2] fix --- yarn-project/end-to-end/src/e2e_p2p_network.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 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 5c2d746aa6a9..33659d9a7132 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 @@ -17,6 +17,9 @@ import { TestContractArtifact } from '@aztec/noir-contracts/Test'; import { BootstrapNode, P2PConfig, createLibP2PPeerId } from '@aztec/p2p'; import { ConstantKeyPair, PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe'; +import { mnemonicToAccount } from 'viem/accounts'; + +import { MNEMONIC } from './fixtures/fixtures.js'; import { setup } from './fixtures/utils.js'; const NUM_NODES = 4; @@ -55,7 +58,7 @@ describe('e2e_p2p_network', () => { // is if the txs are successfully gossiped around the nodes. const contexts: NodeContext[] = []; for (let i = 0; i < NUM_NODES; i++) { - const node = await createNode(i + 1 + BOOT_NODE_TCP_PORT, bootstrapNodeAddress); + const node = await createNode(i + 1 + BOOT_NODE_TCP_PORT, bootstrapNodeAddress, i); const context = await createPXEServiceAndSubmitTransactions(node, NUM_TXS_PER_NODE); contexts.push(context); } @@ -107,7 +110,13 @@ describe('e2e_p2p_network', () => { }; // creates a P2P enabled instance of Aztec Node Service - const createNode = async (tcpListenPort: number, bootstrapNode: string) => { + const createNode = async (tcpListenPort: number, bootstrapNode: string, publisherAddressIndex: number) => { + // We use different L1 publisher accounts in order to avoid duplicate tx nonces. We start from + // publisherAddressIndex + 1 because index 0 was already used during sandbox setup. + const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: publisherAddressIndex + 1 }); + const publisherPrivKey = Buffer.from(hdAccount.getHdKey().privateKey!); + config.publisherPrivateKey = `0x${publisherPrivKey!.toString('hex')}`; + const newConfig: AztecNodeConfig = { ...config, tcpListenPort, From 0363a1243f746770311270ab2b37f05a38e32e16 Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 14:29:33 +0000 Subject: [PATCH 2/2] comment --- yarn-project/end-to-end/src/e2e_p2p_network.test.ts | 2 ++ 1 file changed, 2 insertions(+) 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 33659d9a7132..a5888f24dcb6 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 @@ -22,6 +22,8 @@ import { mnemonicToAccount } from 'viem/accounts'; import { MNEMONIC } from './fixtures/fixtures.js'; import { 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 +// only 10 accounts with ETH (9 and not 10 because first account is used by sandbox). const NUM_NODES = 4; const NUM_TXS_PER_BLOCK = 4; const NUM_TXS_PER_NODE = 2;