@@ -28,6 +28,7 @@ import (
2828 "github.com/ethereum/go-ethereum/log"
2929 "github.com/ethereum/go-ethereum/node"
3030 "github.com/ethereum/go-ethereum/params"
31+ "github.com/ethereum/go-ethereum/rpc"
3132 mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
3233 hdwallet "github.com/miguelmota/go-ethereum-hdwallet"
3334)
@@ -75,10 +76,12 @@ type SystemConfig struct {
7576 L2OOCfg L2OOContractConfig
7677 DepositCFG DepositContractConfig
7778
78- L1WsAddr string
79- L1WsPort int
80- L1ChainID * big.Int
81- L2ChainID * big.Int
79+ L1ChainID * big.Int
80+ L2ChainID * big.Int
81+
82+ JWTFilePath string
83+ JWTSecret [32 ]byte
84+
8285 Nodes map [string ]* rollupNode.Config // Per node config. Don't use populate rollup.Config
8386 Loggers map [string ]log.Logger
8487 RollupConfig rollup.Config // Shared rollup configs
@@ -293,8 +296,9 @@ func (cfg SystemConfig) start() (*System, error) {
293296 }
294297 sys .nodes ["l1" ] = l1Node
295298 sys .backends ["l1" ] = l1Backend
296- for name , l2Cfg := range cfg .Nodes {
297- node , backend , err := initL2Geth (name , l2Cfg .L2EngineAddrs [0 ], cfg .L2ChainID , l2Genesis )
299+
300+ for name := range cfg .Nodes {
301+ node , backend , err := initL2Geth (name , cfg .L2ChainID , l2Genesis , cfg .JWTFilePath )
298302 if err != nil {
299303 return nil , err
300304 }
@@ -324,14 +328,28 @@ func (cfg SystemConfig) start() (*System, error) {
324328 }
325329 }
326330
331+ // Configure connections to L1 and L2 for rollup nodes.
332+ // TODO: refactor testing to use in-process rpc connections instead of websockets.
333+ for name , rollupCfg := range cfg .Nodes {
334+ rollupCfg .L1 = & rollupNode.L1EndpointConfig {
335+ L1NodeAddr : l1Node .WSEndpoint (),
336+ L1TrustRPC : false ,
337+ }
338+ rollupCfg .L2s = & rollupNode.L2EndpointsConfig {
339+ L2EngineAddrs : []string {sys .nodes [name ].WSAuthEndpoint ()},
340+ L2EngineJWTSecrets : [][32 ]byte {cfg .JWTSecret },
341+ }
342+ }
343+
327344 // Geth Clients
328345 ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Second )
329346 defer cancel ()
330- l1Client , err := ethclient . DialContext ( ctx , fmt . Sprintf ( "ws://%s:%d" , cfg . L1WsAddr , cfg . L1WsPort ) )
347+ l1Srv , err := l1Node . RPCHandler ( )
331348 if err != nil {
332349 didErrAfterStart = true
333350 return nil , err
334351 }
352+ l1Client := ethclient .NewClient (rpc .DialInProc (l1Srv ))
335353 sys .Clients ["l1" ] = l1Client
336354 for name , node := range sys .nodes {
337355 client , err := ethclient .DialContext (ctx , node .WSEndpoint ())
@@ -512,8 +530,8 @@ func (cfg SystemConfig) start() (*System, error) {
512530
513531 // L2Output Submitter
514532 sys .l2OutputSubmitter , err = l2os .NewL2OutputSubmitter (l2os.Config {
515- L1EthRpc : "ws://127.0.0.1:9090" ,
516- L2EthRpc : sys .cfg . Nodes ["sequencer" ].L2NodeAddr ,
533+ L1EthRpc : sys . nodes [ "l1" ]. WSEndpoint () ,
534+ L2EthRpc : sys .nodes ["sequencer" ].WSEndpoint () ,
517535 RollupRpc : rollupEndpoint ,
518536 L2OOAddress : sys .L2OOContractAddr .String (),
519537 PollInterval : 50 * time .Millisecond ,
@@ -544,8 +562,8 @@ func (cfg SystemConfig) start() (*System, error) {
544562
545563 // Batch Submitter
546564 sys .batchSubmitter , err = bss .NewBatchSubmitter (bss.Config {
547- L1EthRpc : "ws://127.0.0.1:9090" ,
548- L2EthRpc : sys .cfg . Nodes ["sequencer" ].L2NodeAddr ,
565+ L1EthRpc : sys . nodes [ "l1" ]. WSEndpoint () ,
566+ L2EthRpc : sys .nodes ["sequencer" ].WSEndpoint () ,
549567 RollupRpc : rollupEndpoint ,
550568 MinL1TxSize : 1 ,
551569 MaxL1TxSize : 120000 ,
0 commit comments