From 06a746061cd16ce9e273547a1f07a10ec0611ee0 Mon Sep 17 00:00:00 2001 From: AnkushinDaniil Date: Wed, 1 Jan 2025 11:56:29 +0900 Subject: [PATCH] Add IPAddressRegistry field to test --- l1/l1_test.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/l1/l1_test.go b/l1/l1_test.go index 26599d4555..f76cec9e39 100644 --- a/l1/l1_test.go +++ b/l1/l1_test.go @@ -16,6 +16,7 @@ import ( "github.com/NethermindEth/juno/l1" "github.com/NethermindEth/juno/l1/contract" "github.com/NethermindEth/juno/mocks" + "github.com/NethermindEth/juno/p2p" "github.com/NethermindEth/juno/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -110,6 +111,7 @@ func TestEventListener(t *testing.T) { ctrl := gomock.NewController(t) nopLog := utils.NewNopZapLogger() network := utils.Mainnet + network.IPAddressRegistry = &common.Address{} chain := blockchain.New(pebble.NewMemTest(t), &network, nil) subscriber := mocks.NewMockSubscriber(ctrl) @@ -126,6 +128,24 @@ func TestEventListener(t *testing.T) { Return(newFakeSubscription(), nil). Times(1) + subscriber. + EXPECT(). + GetIPAddresses(gomock.Any(), gomock.Any()). + Return([]string{}, nil). + Times(1) + + subscriber. + EXPECT(). + WatchIPAdded(gomock.Any(), gomock.Any()). + Return(newFakeSubscription(), nil). + Times(1) + + subscriber. + EXPECT(). + WatchIPRemoved(gomock.Any(), gomock.Any()). + Return(newFakeSubscription(), nil). + Times(1) + subscriber. EXPECT(). FinalisedHeight(gomock.Any()). @@ -141,7 +161,7 @@ func TestEventListener(t *testing.T) { subscriber.EXPECT().Close().Times(1) var got *core.L1Head - client := l1.NewClient(subscriber, chain, nopLog, nil). + client := l1.NewClient(subscriber, chain, nopLog, make(chan<- p2p.IPAddressRegistryEvent)). WithResubscribeDelay(0). WithPollFinalisedInterval(time.Nanosecond). WithEventListener(l1.SelectiveListener{