Skip to content

Commit

Permalink
chore_: remove wakuv1 and wakuv2 wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
osmaczko committed Jan 21, 2025
1 parent 3e0b1b2 commit 45fc2c6
Show file tree
Hide file tree
Showing 54 changed files with 761 additions and 1,141 deletions.
5 changes: 2 additions & 3 deletions eth-node/bridge/geth/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
gethnode "github.com/status-im/status-go/eth-node/node"
enstypes "github.com/status-im/status-go/eth-node/types/ens"

wakubridge "github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -50,15 +49,15 @@ func (w *gethNodeWrapper) GetWaku(ctx interface{}) (wakutypes.Waku, error) {
return nil, errors.New("waku service is not available")
}

return wakubridge.NewGethWakuWrapper(w.waku1), nil
return w.waku1, nil
}

func (w *gethNodeWrapper) GetWakuV2(ctx interface{}) (wakutypes.Waku, error) {
if w.waku2 == nil {
return nil, errors.New("waku service is not available")
}

return wakubridge.NewGethWakuV2Wrapper(w.waku2), nil
return w.waku2, nil
}

func (w *gethNodeWrapper) AddPeer(url string) error {
Expand Down
3 changes: 1 addition & 2 deletions mailserver/mailserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
"github.com/status-im/status-go/wakuv1"
wakuv1common "github.com/status-im/status-go/wakuv1/common"
Expand Down Expand Up @@ -126,7 +125,7 @@ func (s *WakuMailServer) Close() {
}

func (s *WakuMailServer) Archive(env *wakuv1common.Envelope) {
s.ms.Archive(bridge.NewWakuEnvelope(env))
s.ms.Archive(wakuv1.NewWakuEnvelope(env))
}

func (s *WakuMailServer) Deliver(peerID []byte, req wakuv1common.MessagesRequest) {
Expand Down
4 changes: 2 additions & 2 deletions mailserver/mailserver_db_postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/postgres"
"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
"github.com/status-im/status-go/wakuv1"
wakuv1common "github.com/status-im/status-go/wakuv1/common"
)

Expand Down Expand Up @@ -126,5 +126,5 @@ func newTestEnvelope(topic []byte) (wakutypes.Envelope, error) {
if err != nil {
return nil, err
}
return bridge.NewWakuEnvelope(envelope), nil
return wakuv1.NewWakuEnvelope(envelope), nil
}
3 changes: 1 addition & 2 deletions protocol/common/message_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

transport2 "github.com/status-im/status-go/protocol/transport"
"github.com/status-im/status-go/t/helpers"
"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
"github.com/status-im/status-go/wakuv1"

Expand Down Expand Up @@ -74,7 +73,7 @@ func (s *MessageSenderSuite) SetupTest() {
s.Require().NoError(shh.Start())

whisperTransport, err := transport2.NewTransport(
bridge.NewGethWakuWrapper(shh),
shh,
identity,
database,
"waku_keys",
Expand Down
8 changes: 4 additions & 4 deletions protocol/communities_messenger_shared_member_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv2"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -89,13 +89,13 @@ func (s *MessengerCommunitiesSharedMemberAddressSuite) TearDownTest() {
TearDownMessenger(&s.Suite, s.bob)
TearDownMessenger(&s.Suite, s.alice)
if s.ownerWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.ownerWaku).Stop())
s.Require().NoError(s.ownerWaku.(*wakuv2.Waku).Stop())
}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.(*wakuv2.Waku).Stop())
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.(*wakuv2.Waku).Stop())
}
_ = s.logger.Sync()
}
Expand Down
3 changes: 1 addition & 2 deletions protocol/communities_messenger_test_suite_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -52,7 +51,7 @@ func (s *CommunitiesMessengerTestSuiteBase) SetupTest() {
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())
}

Expand Down
10 changes: 5 additions & 5 deletions protocol/communities_messenger_token_permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/wallet/thirdparty"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -200,13 +199,13 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TearDownTest() {
TearDownMessenger(&s.Suite, s.bob)
TearDownMessenger(&s.Suite, s.alice)
if s.ownerWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.ownerWaku).Stop())
s.Require().NoError(s.ownerWaku.Stop())
}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.Stop())
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}
_ = s.logger.Sync()
}
Expand Down Expand Up @@ -494,7 +493,8 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestBecomeMemberPermissions(
}
wakuStoreNode := NewTestWakuV2(&s.Suite, cfg)

storeNodeListenAddresses := wakuStoreNode.ListenAddresses()
storeNodeListenAddresses, err := wakuStoreNode.ListenAddresses()
s.Require().NoError(err)
s.Require().LessOrEqual(1, len(storeNodeListenAddresses))

storeNodeAddress := storeNodeListenAddresses[0]
Expand Down
3 changes: 1 addition & 2 deletions protocol/messenger_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand All @@ -25,7 +24,7 @@ func (s *MessengerBaseTestSuite) SetupTest() {
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())

s.m = s.newMessenger()
Expand Down
5 changes: 2 additions & 3 deletions protocol/messenger_communities_sharding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -98,13 +97,13 @@ func (s *MessengerCommunitiesShardingSuite) TearDownTest() {
TearDownMessenger(&s.Suite, s.owner)
}
if s.ownerWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.ownerWaku).Stop())
s.Require().NoError(s.ownerWaku.Stop())
}
if s.alice != nil {
TearDownMessenger(&s.Suite, s.alice)
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}
_ = s.logger.Sync()
}
Expand Down
3 changes: 1 addition & 2 deletions protocol/messenger_delete_message_for_me_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -63,7 +62,7 @@ func (s *MessengerDeleteMessageForMeSuite) SetupTest() {
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())

s.alice1 = s.newMessenger()
Expand Down
5 changes: 2 additions & 3 deletions protocol/messenger_identity_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand All @@ -50,12 +49,12 @@ func (s *MessengerProfilePictureHandlerSuite) SetupSuite() {
config.MinimumAcceptedPoW = 0
wakuLogger := s.logger.Named("Waku")
shh := wakuv1.New(&config, wakuLogger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())
}

func (s *MessengerProfilePictureHandlerSuite) TearDownSuite() {
_ = bridge.GetGethWakuFrom(s.shh).Stop()
_ = s.shh.Stop()
_ = s.logger.Sync()
}

Expand Down
5 changes: 2 additions & 3 deletions protocol/messenger_messages_tracking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/signal"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -108,14 +107,14 @@ func (s *MessengerMessagesTrackingSuite) TearDownTest() {

}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.Stop())
}

if s.alice != nil {
TearDownMessenger(&s.Suite, s.alice)
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}

_ = s.logger.Sync()
Expand Down
10 changes: 5 additions & 5 deletions protocol/messenger_offline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv2"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -84,20 +84,20 @@ func (s *MessengerOfflineSuite) TearDownTest() {
s.Require().NoError(s.owner.Shutdown())
}
if s.ownerWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.ownerWaku).Stop())
s.Require().NoError(s.ownerWaku.Stop())
}

if s.bob != nil {
s.Require().NoError(s.bob.Shutdown())
}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.Stop())
}
if s.alice != nil {
s.Require().NoError(s.alice.Shutdown())
}
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}
_ = s.logger.Sync()
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func (s *MessengerOfflineSuite) TestCommunityOfflineEdit() {
s.checkMessageDelivery(ctx, inputMessage)

// Simulate going offline
wakuv2 := bridge.GetGethWakuV2From(s.aliceWaku)
wakuv2 := s.aliceWaku.(*wakuv2.Waku)
wakuv2.SkipPublishToTopic(true)

resp, err := s.alice.SendChatMessage(ctx, inputMessage)
Expand Down
3 changes: 1 addition & 2 deletions protocol/messenger_peersyncing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -46,7 +45,7 @@ func (s *MessengerPeersyncingSuite) SetupTest() {
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())

s.owner = s.newMessenger()
Expand Down
5 changes: 2 additions & 3 deletions protocol/messenger_raw_message_resend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/tt"

"github.com/status-im/status-go/waku/bridge"
wakutypes "github.com/status-im/status-go/waku/types"
)

Expand Down Expand Up @@ -77,10 +76,10 @@ func (s *MessengerRawMessageResendTest) TearDownTest() {
TearDownMessenger(&s.Suite, s.aliceMessenger)
TearDownMessenger(&s.Suite, s.bobMessenger)
if s.aliceWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.aliceWaku).Stop())
s.Require().NoError(s.aliceWaku.Stop())
}
if s.bobWaku != nil {
s.Require().NoError(bridge.GetGethWakuV2From(s.bobWaku).Stop())
s.Require().NoError(s.bobWaku.Stop())
}
_ = s.logger.Sync()
}
Expand Down
3 changes: 1 addition & 2 deletions protocol/messenger_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"testing"

"github.com/status-im/status-go/waku/bridge"
"github.com/status-im/status-go/wakuv1"

"github.com/status-im/status-go/eth-node/crypto"
Expand All @@ -31,7 +30,7 @@ func (s *MessengerSettingsSuite) SetupTest() {
config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := wakuv1.New(&config, s.logger)
s.shh = bridge.NewGethWakuWrapper(shh)
s.shh = shh
s.Require().NoError(shh.Start())

pk, err := crypto.GenerateKey()
Expand Down
Loading

0 comments on commit 45fc2c6

Please sign in to comment.