From b32b0f80644b96e9c2a0c6a46fc848775b9a4335 Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Thu, 9 Feb 2023 19:08:01 -0800 Subject: [PATCH] cli tests --- packages/relayer/cli/cli.go | 14 +++++++++++--- packages/relayer/cli/cli_test.go | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/relayer/cli/cli.go b/packages/relayer/cli/cli.go index 44f7021d8b6..1c4f0dc5be4 100644 --- a/packages/relayer/cli/cli.go +++ b/packages/relayer/cli/cli.go @@ -112,7 +112,7 @@ func Run( }() if !httpOnly { - indexers, closeFunc, err := makeIndexers(layer, db, profitableOnly, l1EthClient, l2EthClient) + indexers, closeFunc, err := makeIndexers(layer, db, profitableOnly) if err != nil { sqlDB.Close() log.Fatal(err) @@ -137,8 +137,6 @@ func makeIndexers( layer relayer.Layer, db relayer.DB, profitableOnly relayer.ProfitableOnly, - l1EthClient *ethclient.Client, - l2EthClient *ethclient.Client, ) ([]*indexer.Service, func(), error) { eventRepository, err := repo.NewEventRepository(db) if err != nil { @@ -179,6 +177,16 @@ func makeIndexers( confirmations = defaultConfirmations } + l1EthClient, err := ethclient.Dial(os.Getenv("L1_RPC_URL")) + if err != nil { + log.Fatal(err) + } + + l2EthClient, err := ethclient.Dial(os.Getenv("L2_RPC_URL")) + if err != nil { + log.Fatal(err) + } + l1RpcClient, err := rpc.DialContext(context.Background(), os.Getenv("L1_RPC_URL")) if err != nil { return nil, nil, err diff --git a/packages/relayer/cli/cli_test.go b/packages/relayer/cli/cli_test.go index c0bf8c641f4..0b587ae1b05 100644 --- a/packages/relayer/cli/cli_test.go +++ b/packages/relayer/cli/cli_test.go @@ -204,7 +204,7 @@ func Test_makeIndexers(t *testing.T) { defer reset() } - indexers, cancel, err := makeIndexers(tt.layer, tt.dbFunc(t), relayer.ProfitableOnly(true), nil, nil) + indexers, cancel, err := makeIndexers(tt.layer, tt.dbFunc(t), relayer.ProfitableOnly(true)) if cancel != nil { defer cancel() }