@@ -17,8 +17,13 @@ import { TestContractArtifact } from '@aztec/noir-contracts/Test';
17
17
import { BootstrapNode , P2PConfig , createLibP2PPeerId } from '@aztec/p2p' ;
18
18
import { ConstantKeyPair , PXEService , createPXEService , getPXEServiceConfig as getRpcConfig } from '@aztec/pxe' ;
19
19
20
+ import { mnemonicToAccount } from 'viem/accounts' ;
21
+
22
+ import { MNEMONIC } from './fixtures/fixtures.js' ;
20
23
import { setup } from './fixtures/utils.js' ;
21
24
25
+ // Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
26
+ // only 10 accounts with ETH (9 and not 10 because first account is used by sandbox).
22
27
const NUM_NODES = 4 ;
23
28
const NUM_TXS_PER_BLOCK = 4 ;
24
29
const NUM_TXS_PER_NODE = 2 ;
@@ -55,7 +60,7 @@ describe('e2e_p2p_network', () => {
55
60
// is if the txs are successfully gossiped around the nodes.
56
61
const contexts : NodeContext [ ] = [ ] ;
57
62
for ( let i = 0 ; i < NUM_NODES ; i ++ ) {
58
- const node = await createNode ( i + 1 + BOOT_NODE_TCP_PORT , bootstrapNodeAddress ) ;
63
+ const node = await createNode ( i + 1 + BOOT_NODE_TCP_PORT , bootstrapNodeAddress , i ) ;
59
64
const context = await createPXEServiceAndSubmitTransactions ( node , NUM_TXS_PER_NODE ) ;
60
65
contexts . push ( context ) ;
61
66
}
@@ -107,7 +112,13 @@ describe('e2e_p2p_network', () => {
107
112
} ;
108
113
109
114
// creates a P2P enabled instance of Aztec Node Service
110
- const createNode = async ( tcpListenPort : number , bootstrapNode : string ) => {
115
+ const createNode = async ( tcpListenPort : number , bootstrapNode : string , publisherAddressIndex : number ) => {
116
+ // We use different L1 publisher accounts in order to avoid duplicate tx nonces. We start from
117
+ // publisherAddressIndex + 1 because index 0 was already used during sandbox setup.
118
+ const hdAccount = mnemonicToAccount ( MNEMONIC , { addressIndex : publisherAddressIndex + 1 } ) ;
119
+ const publisherPrivKey = Buffer . from ( hdAccount . getHdKey ( ) . privateKey ! ) ;
120
+ config . publisherPrivateKey = `0x${ publisherPrivKey ! . toString ( 'hex' ) } ` ;
121
+
111
122
const newConfig : AztecNodeConfig = {
112
123
...config ,
113
124
tcpListenPort,
0 commit comments