chore_: rename waku package to wakuv1

This is to free the `waku` namespace for interfaces and types that will
be moved from `eth-node`.
This commit is contained in:
Patryk Osmaczko 2025-01-10 19:56:00 +01:00 committed by osmaczko
parent 98e64838e2
commit ca92f67014
81 changed files with 216 additions and 217 deletions

View File

@ -5,15 +5,15 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
type wakuEnvelope struct { type wakuEnvelope struct {
env *waku.Envelope env *wakuv1common.Envelope
} }
// NewWakuEnvelope returns an object that wraps Geth's Waku Envelope in a types interface. // NewWakuEnvelope returns an object that wraps Geth's Waku Envelope in a types interface.
func NewWakuEnvelope(e *waku.Envelope) types.Envelope { func NewWakuEnvelope(e *wakuv1common.Envelope) types.Envelope {
return &wakuEnvelope{env: e} return &wakuEnvelope{env: e}
} }

View File

@ -2,12 +2,12 @@ package gethbridge
import ( import (
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
wakuv2 "github.com/status-im/status-go/wakuv2/common" wakuv2common "github.com/status-im/status-go/wakuv2/common"
) )
// NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError // NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError
func NewWakuEnvelopeErrorWrapper(envelopeError *waku.EnvelopeError) *types.EnvelopeError { func NewWakuEnvelopeErrorWrapper(envelopeError *wakuv1common.EnvelopeError) *types.EnvelopeError {
if envelopeError == nil { if envelopeError == nil {
panic("envelopeError should not be nil") panic("envelopeError should not be nil")
} }
@ -20,7 +20,7 @@ func NewWakuEnvelopeErrorWrapper(envelopeError *waku.EnvelopeError) *types.Envel
} }
// NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError // NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError
func NewWakuV2EnvelopeErrorWrapper(envelopeError *wakuv2.EnvelopeError) *types.EnvelopeError { func NewWakuV2EnvelopeErrorWrapper(envelopeError *wakuv2common.EnvelopeError) *types.EnvelopeError {
if envelopeError == nil { if envelopeError == nil {
panic("envelopeError should not be nil") panic("envelopeError should not be nil")
} }
@ -34,9 +34,9 @@ func NewWakuV2EnvelopeErrorWrapper(envelopeError *wakuv2.EnvelopeError) *types.E
func mapGethErrorCode(code uint) uint { func mapGethErrorCode(code uint) uint {
switch code { switch code {
case waku.EnvelopeTimeNotSynced: case wakuv1common.EnvelopeTimeNotSynced:
return types.EnvelopeTimeNotSynced return types.EnvelopeTimeNotSynced
case waku.EnvelopeOtherError: case wakuv1common.EnvelopeOtherError:
return types.EnvelopeOtherError return types.EnvelopeOtherError
} }
return types.EnvelopeOtherError return types.EnvelopeOtherError

View File

@ -2,26 +2,26 @@ package gethbridge
import ( import (
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
wakucommon "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
wakuv2common "github.com/status-im/status-go/wakuv2/common" wakuv2common "github.com/status-im/status-go/wakuv2/common"
) )
// NewWakuEnvelopeEventWrapper returns a types.EnvelopeEvent object that mimics Geth's EnvelopeEvent // NewWakuEnvelopeEventWrapper returns a types.EnvelopeEvent object that mimics Geth's EnvelopeEvent
func NewWakuEnvelopeEventWrapper(envelopeEvent *wakucommon.EnvelopeEvent) *types.EnvelopeEvent { func NewWakuEnvelopeEventWrapper(envelopeEvent *wakuv1common.EnvelopeEvent) *types.EnvelopeEvent {
if envelopeEvent == nil { if envelopeEvent == nil {
panic("envelopeEvent should not be nil") panic("envelopeEvent should not be nil")
} }
wrappedData := envelopeEvent.Data wrappedData := envelopeEvent.Data
switch data := envelopeEvent.Data.(type) { switch data := envelopeEvent.Data.(type) {
case []wakucommon.EnvelopeError: case []wakuv1common.EnvelopeError:
wrappedData := make([]types.EnvelopeError, len(data)) wrappedData := make([]types.EnvelopeError, len(data))
for index := range data { for index := range data {
wrappedData[index] = *NewWakuEnvelopeErrorWrapper(&data[index]) wrappedData[index] = *NewWakuEnvelopeErrorWrapper(&data[index])
} }
case *waku.MailServerResponse: case *wakuv1.MailServerResponse:
wrappedData = NewWakuMailServerResponseWrapper(data) wrappedData = NewWakuMailServerResponseWrapper(data)
} }
return &types.EnvelopeEvent{ return &types.EnvelopeEvent{

View File

@ -2,11 +2,11 @@ package gethbridge
import ( import (
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
// NewWakuMailServerResponseWrapper returns a types.MailServerResponse object that mimics Geth's MailServerResponse // NewWakuMailServerResponseWrapper returns a types.MailServerResponse object that mimics Geth's MailServerResponse
func NewWakuMailServerResponseWrapper(mailServerResponse *waku.MailServerResponse) *types.MailServerResponse { func NewWakuMailServerResponseWrapper(mailServerResponse *wakuv1.MailServerResponse) *types.MailServerResponse {
if mailServerResponse == nil { if mailServerResponse == nil {
panic("mailServerResponse should not be nil") panic("mailServerResponse should not be nil")
} }

View File

@ -5,7 +5,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2" "github.com/status-im/status-go/wakuv2"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
@ -18,11 +18,11 @@ import (
type gethNodeWrapper struct { type gethNodeWrapper struct {
stack *node.Node stack *node.Node
waku1 *waku.Waku waku1 *wakuv1.Waku
waku2 *wakuv2.Waku waku2 *wakuv2.Waku
} }
func NewNodeBridge(stack *node.Node, waku1 *waku.Waku, waku2 *wakuv2.Waku) types.Node { func NewNodeBridge(stack *node.Node, waku1 *wakuv1.Waku, waku2 *wakuv2.Waku) types.Node {
return &gethNodeWrapper{stack: stack, waku1: waku1, waku2: waku2} return &gethNodeWrapper{stack: stack, waku1: waku1, waku2: waku2}
} }
@ -34,7 +34,7 @@ func (w *gethNodeWrapper) NewENSVerifier(logger *zap.Logger) enstypes.ENSVerifie
return gethens.NewVerifier(logger) return gethens.NewVerifier(logger)
} }
func (w *gethNodeWrapper) SetWaku1(waku *waku.Waku) { func (w *gethNodeWrapper) SetWaku1(waku *wakuv1.Waku) {
w.waku1 = waku w.waku1 = waku
} }

View File

@ -6,16 +6,16 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
wakucommon "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
type GethPublicWakuAPIWrapper struct { type GethPublicWakuAPIWrapper struct {
api *waku.PublicWakuAPI api *wakuv1.PublicWakuAPI
} }
// NewGethPublicWakuAPIWrapper returns an object that wraps Geth's PublicWakuAPI in a types interface // NewGethPublicWakuAPIWrapper returns an object that wraps Geth's PublicWakuAPI in a types interface
func NewGethPublicWakuAPIWrapper(api *waku.PublicWakuAPI) types.PublicWakuAPI { func NewGethPublicWakuAPIWrapper(api *wakuv1.PublicWakuAPI) types.PublicWakuAPI {
if api == nil { if api == nil {
panic("PublicWakuAPI cannot be nil") panic("PublicWakuAPI cannot be nil")
} }
@ -43,12 +43,12 @@ func (w *GethPublicWakuAPIWrapper) DeleteKeyPair(ctx context.Context, key string
// NewMessageFilter creates a new filter that can be used to poll for // NewMessageFilter creates a new filter that can be used to poll for
// (new) messages that satisfy the given criteria. // (new) messages that satisfy the given criteria.
func (w *GethPublicWakuAPIWrapper) NewMessageFilter(req types.Criteria) (string, error) { func (w *GethPublicWakuAPIWrapper) NewMessageFilter(req types.Criteria) (string, error) {
topics := make([]wakucommon.TopicType, len(req.Topics)) topics := make([]wakuv1common.TopicType, len(req.Topics))
for index, tt := range req.Topics { for index, tt := range req.Topics {
topics[index] = wakucommon.TopicType(tt) topics[index] = wakuv1common.TopicType(tt)
} }
criteria := waku.Criteria{ criteria := wakuv1.Criteria{
SymKeyID: req.SymKeyID, SymKeyID: req.SymKeyID,
PrivateKeyID: req.PrivateKeyID, PrivateKeyID: req.PrivateKeyID,
Sig: req.Sig, Sig: req.Sig,
@ -92,12 +92,12 @@ func (w *GethPublicWakuAPIWrapper) GetFilterMessages(id string) ([]*types.Messag
// Post posts a message on the network. // Post posts a message on the network.
// returns the hash of the message in case of success. // returns the hash of the message in case of success.
func (w *GethPublicWakuAPIWrapper) Post(ctx context.Context, req types.NewMessage) ([]byte, error) { func (w *GethPublicWakuAPIWrapper) Post(ctx context.Context, req types.NewMessage) ([]byte, error) {
msg := waku.NewMessage{ msg := wakuv1.NewMessage{
SymKeyID: req.SymKeyID, SymKeyID: req.SymKeyID,
PublicKey: req.PublicKey, PublicKey: req.PublicKey,
Sig: req.SigID, // Sig is really a SigID Sig: req.SigID, // Sig is really a SigID
TTL: req.TTL, TTL: req.TTL,
Topic: wakucommon.TopicType(req.Topic), Topic: wakuv1common.TopicType(req.Topic),
Payload: req.Payload, Payload: req.Payload,
Padding: req.Padding, Padding: req.Padding,
PowTime: req.PowTime, PowTime: req.PowTime,

View File

@ -16,16 +16,16 @@ import (
gocommon "github.com/status-im/status-go/common" gocommon "github.com/status-im/status-go/common"
"github.com/status-im/status-go/connection" "github.com/status-im/status-go/connection"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
wakucommon "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
type GethWakuWrapper struct { type GethWakuWrapper struct {
waku *waku.Waku waku *wakuv1.Waku
} }
// NewGethWakuWrapper returns an object that wraps Geth's Waku in a types interface // NewGethWakuWrapper returns an object that wraps Geth's Waku in a types interface
func NewGethWakuWrapper(w *waku.Waku) types.Waku { func NewGethWakuWrapper(w *wakuv1.Waku) types.Waku {
if w == nil { if w == nil {
panic("waku cannot be nil") panic("waku cannot be nil")
} }
@ -36,12 +36,12 @@ func NewGethWakuWrapper(w *waku.Waku) types.Waku {
} }
// GetGethWhisperFrom retrieves the underlying whisper Whisper struct from a wrapped Whisper interface // GetGethWhisperFrom retrieves the underlying whisper Whisper struct from a wrapped Whisper interface
func GetGethWakuFrom(m types.Waku) *waku.Waku { func GetGethWakuFrom(m types.Waku) *wakuv1.Waku {
return m.(*GethWakuWrapper).waku return m.(*GethWakuWrapper).waku
} }
func (w *GethWakuWrapper) PublicWakuAPI() types.PublicWakuAPI { func (w *GethWakuWrapper) PublicWakuAPI() types.PublicWakuAPI {
return NewGethPublicWakuAPIWrapper(waku.NewPublicWakuAPI(w.waku)) return NewGethPublicWakuAPIWrapper(wakuv1.NewPublicWakuAPI(w.waku))
} }
func (w *GethWakuWrapper) Version() uint { func (w *GethWakuWrapper) Version() uint {
@ -166,7 +166,7 @@ func (w *GethWakuWrapper) GetCurrentTime() time.Time {
} }
func (w *GethWakuWrapper) SubscribeEnvelopeEvents(eventsProxy chan<- types.EnvelopeEvent) types.Subscription { func (w *GethWakuWrapper) SubscribeEnvelopeEvents(eventsProxy chan<- types.EnvelopeEvent) types.Subscription {
events := make(chan wakucommon.EnvelopeEvent, 100) // must be buffered to prevent blocking whisper events := make(chan wakuv1common.EnvelopeEvent, 100) // must be buffered to prevent blocking whisper
go func() { go func() {
defer gocommon.LogOnPanic() defer gocommon.LogOnPanic()
for e := range events { for e := range events {
@ -258,13 +258,13 @@ func (w *GethWakuWrapper) UnsubscribeMany(ids []string) error {
} }
func (w *GethWakuWrapper) createFilterWrapper(id string, keyAsym *ecdsa.PrivateKey, keySym []byte, pow float64, topics [][]byte) (types.Filter, error) { func (w *GethWakuWrapper) createFilterWrapper(id string, keyAsym *ecdsa.PrivateKey, keySym []byte, pow float64, topics [][]byte) (types.Filter, error) {
return NewWakuFilterWrapper(&wakucommon.Filter{ return NewWakuFilterWrapper(&wakuv1common.Filter{
KeyAsym: keyAsym, KeyAsym: keyAsym,
KeySym: keySym, KeySym: keySym,
PoW: pow, PoW: pow,
AllowP2P: true, AllowP2P: true,
Topics: topics, Topics: topics,
Messages: wakucommon.NewMemoryMessageStore(), Messages: wakuv1common.NewMemoryMessageStore(),
}, id), nil }, id), nil
} }
@ -283,12 +283,12 @@ func (w *GethWakuWrapper) ClearEnvelopesCache() {
} }
type wakuFilterWrapper struct { type wakuFilterWrapper struct {
filter *wakucommon.Filter filter *wakuv1common.Filter
id string id string
} }
// NewWakuFilterWrapper returns an object that wraps Geth's Filter in a types interface // NewWakuFilterWrapper returns an object that wraps Geth's Filter in a types interface
func NewWakuFilterWrapper(f *wakucommon.Filter, id string) types.Filter { func NewWakuFilterWrapper(f *wakuv1common.Filter, id string) types.Filter {
if f.Messages == nil { if f.Messages == nil {
panic("Messages should not be nil") panic("Messages should not be nil")
} }
@ -300,7 +300,7 @@ func NewWakuFilterWrapper(f *wakucommon.Filter, id string) types.Filter {
} }
// GetWakuFilterFrom retrieves the underlying whisper Filter struct from a wrapped Filter interface // GetWakuFilterFrom retrieves the underlying whisper Filter struct from a wrapped Filter interface
func GetWakuFilterFrom(f types.Filter) *wakucommon.Filter { func GetWakuFilterFrom(f types.Filter) *wakuv1common.Filter {
return f.(*wakuFilterWrapper).filter return f.(*wakuFilterWrapper).filter
} }

View File

@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
func TestCleaner(t *testing.T) { func TestCleaner(t *testing.T) {
@ -103,7 +103,7 @@ func setupTestServer(t *testing.T) *WakuMailServer {
return &s return &s
} }
func archiveEnvelope(t *testing.T, sentTime time.Time, server *WakuMailServer) *waku.Envelope { func archiveEnvelope(t *testing.T, sentTime time.Time, server *WakuMailServer) *wakuv1common.Envelope {
env, err := generateEnvelope(sentTime) env, err := generateEnvelope(sentTime)
require.NoError(t, err) require.NoError(t, err)
server.Archive(env) server.Archive(env)
@ -142,7 +142,7 @@ func countMessages(t *testing.T, db DB) int {
defer func() { _ = i.Release() }() defer func() { _ = i.Release() }()
for i.Next() { for i.Next() {
var env waku.Envelope var env wakuv1common.Envelope
value, err := i.GetEnvelopeByBloomFilter(query.bloom) value, err := i.GetEnvelopeByBloomFilter(query.bloom)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -36,8 +36,8 @@ import (
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/logutils" "github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
wakucommon "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
const ( const (
@ -83,14 +83,14 @@ type Config struct {
type WakuMailServer struct { type WakuMailServer struct {
ms *mailServer ms *mailServer
shh *waku.Waku shh *wakuv1.Waku
minRequestPoW float64 minRequestPoW float64
symFilter *wakucommon.Filter symFilter *wakuv1common.Filter
asymFilter *wakucommon.Filter asymFilter *wakuv1common.Filter
} }
func (s *WakuMailServer) Init(waku *waku.Waku, cfg *params.WakuConfig) error { func (s *WakuMailServer) Init(waku *wakuv1.Waku, cfg *params.WakuConfig) error {
s.shh = waku s.shh = waku
s.minRequestPoW = cfg.MinimumPoW s.minRequestPoW = cfg.MinimumPoW
@ -124,11 +124,11 @@ func (s *WakuMailServer) Close() {
s.ms.Close() s.ms.Close()
} }
func (s *WakuMailServer) Archive(env *wakucommon.Envelope) { func (s *WakuMailServer) Archive(env *wakuv1common.Envelope) {
s.ms.Archive(gethbridge.NewWakuEnvelope(env)) s.ms.Archive(gethbridge.NewWakuEnvelope(env))
} }
func (s *WakuMailServer) Deliver(peerID []byte, req wakucommon.MessagesRequest) { func (s *WakuMailServer) Deliver(peerID []byte, req wakuv1common.MessagesRequest) {
s.ms.DeliverMail(types.BytesToHash(peerID), types.BytesToHash(req.ID), MessagesRequestPayload{ s.ms.DeliverMail(types.BytesToHash(peerID), types.BytesToHash(req.ID), MessagesRequestPayload{
Lower: req.From, Lower: req.From,
Upper: req.To, Upper: req.To,
@ -141,7 +141,7 @@ func (s *WakuMailServer) Deliver(peerID []byte, req wakucommon.MessagesRequest)
} }
// DEPRECATED; user Deliver instead // DEPRECATED; user Deliver instead
func (s *WakuMailServer) DeliverMail(peerID []byte, req *wakucommon.Envelope) { func (s *WakuMailServer) DeliverMail(peerID []byte, req *wakuv1common.Envelope) {
payload, err := s.decodeRequest(peerID, req) payload, err := s.decodeRequest(peerID, req)
if err != nil { if err != nil {
deliveryFailuresCounter.WithLabelValues("validation").Inc() deliveryFailuresCounter.WithLabelValues("validation").Inc()
@ -160,21 +160,21 @@ func (s *WakuMailServer) DeliverMail(peerID []byte, req *wakucommon.Envelope) {
// bloomFromReceivedMessage for a given whisper.ReceivedMessage it extracts the // bloomFromReceivedMessage for a given whisper.ReceivedMessage it extracts the
// used bloom filter. // used bloom filter.
func (s *WakuMailServer) bloomFromReceivedMessage(msg *wakucommon.ReceivedMessage) ([]byte, error) { func (s *WakuMailServer) bloomFromReceivedMessage(msg *wakuv1common.ReceivedMessage) ([]byte, error) {
payloadSize := len(msg.Payload) payloadSize := len(msg.Payload)
if payloadSize < 8 { if payloadSize < 8 {
return nil, errors.New("Undersized p2p request") return nil, errors.New("Undersized p2p request")
} else if payloadSize == 8 { } else if payloadSize == 8 {
return wakucommon.MakeFullNodeBloom(), nil return wakuv1common.MakeFullNodeBloom(), nil
} else if payloadSize < 8+wakucommon.BloomFilterSize { } else if payloadSize < 8+wakuv1common.BloomFilterSize {
return nil, errors.New("Undersized bloom filter in p2p request") return nil, errors.New("Undersized bloom filter in p2p request")
} }
return msg.Payload[8 : 8+wakucommon.BloomFilterSize], nil return msg.Payload[8 : 8+wakuv1common.BloomFilterSize], nil
} }
func (s *WakuMailServer) decompositeRequest(peerID []byte, request *wakucommon.Envelope) (MessagesRequestPayload, error) { func (s *WakuMailServer) decompositeRequest(peerID []byte, request *wakuv1common.Envelope) (MessagesRequestPayload, error) {
var ( var (
payload MessagesRequestPayload payload MessagesRequestPayload
err error err error
@ -213,12 +213,12 @@ func (s *WakuMailServer) decompositeRequest(peerID []byte, request *wakucommon.E
return payload, err return payload, err
} }
if len(decrypted.Payload) >= requestTimeRangeLength+wakucommon.BloomFilterSize+requestLimitLength { if len(decrypted.Payload) >= requestTimeRangeLength+wakuv1common.BloomFilterSize+requestLimitLength {
payload.Limit = binary.BigEndian.Uint32(decrypted.Payload[requestTimeRangeLength+wakucommon.BloomFilterSize:]) payload.Limit = binary.BigEndian.Uint32(decrypted.Payload[requestTimeRangeLength+wakuv1common.BloomFilterSize:])
} }
if len(decrypted.Payload) == requestTimeRangeLength+wakucommon.BloomFilterSize+requestLimitLength+DBKeyLength { if len(decrypted.Payload) == requestTimeRangeLength+wakuv1common.BloomFilterSize+requestLimitLength+DBKeyLength {
payload.Cursor = decrypted.Payload[requestTimeRangeLength+wakucommon.BloomFilterSize+requestLimitLength:] payload.Cursor = decrypted.Payload[requestTimeRangeLength+wakuv1common.BloomFilterSize+requestLimitLength:]
} }
return payload, nil return payload, nil
@ -239,7 +239,7 @@ func (s *WakuMailServer) setupDecryptor(password, asymKey string) error {
return fmt.Errorf("save symmetric key: %v", err) return fmt.Errorf("save symmetric key: %v", err)
} }
s.symFilter = &wakucommon.Filter{KeySym: symKey} s.symFilter = &wakuv1common.Filter{KeySym: symKey}
} }
if asymKey != "" { if asymKey != "" {
@ -247,7 +247,7 @@ func (s *WakuMailServer) setupDecryptor(password, asymKey string) error {
if err != nil { if err != nil {
return err return err
} }
s.asymFilter = &wakucommon.Filter{KeyAsym: keyAsym} s.asymFilter = &wakuv1common.Filter{KeyAsym: keyAsym}
} }
return nil return nil
@ -255,7 +255,7 @@ func (s *WakuMailServer) setupDecryptor(password, asymKey string) error {
// openEnvelope tries to decrypt an envelope, first based on asymetric key (if // openEnvelope tries to decrypt an envelope, first based on asymetric key (if
// provided) and second on the symetric key (if provided) // provided) and second on the symetric key (if provided)
func (s *WakuMailServer) openEnvelope(request *wakucommon.Envelope) *wakucommon.ReceivedMessage { func (s *WakuMailServer) openEnvelope(request *wakuv1common.Envelope) *wakuv1common.ReceivedMessage {
if s.asymFilter != nil { if s.asymFilter != nil {
if d := request.Open(s.asymFilter); d != nil { if d := request.Open(s.asymFilter); d != nil {
return d return d
@ -269,7 +269,7 @@ func (s *WakuMailServer) openEnvelope(request *wakucommon.Envelope) *wakucommon.
return nil return nil
} }
func (s *WakuMailServer) decodeRequest(peerID []byte, request *wakucommon.Envelope) (MessagesRequestPayload, error) { func (s *WakuMailServer) decodeRequest(peerID []byte, request *wakuv1common.Envelope) (MessagesRequestPayload, error) {
var payload MessagesRequestPayload var payload MessagesRequestPayload
if s.minRequestPoW > 0.0 && request.PoW() < s.minRequestPoW { if s.minRequestPoW > 0.0 && request.PoW() < s.minRequestPoW {
@ -323,11 +323,11 @@ type wakuAdapter struct{}
var _ adapter = (*wakuAdapter)(nil) var _ adapter = (*wakuAdapter)(nil)
func (wakuAdapter) CreateRequestFailedPayload(reqID types.Hash, err error) []byte { func (wakuAdapter) CreateRequestFailedPayload(reqID types.Hash, err error) []byte {
return waku.CreateMailServerRequestFailedPayload(common.Hash(reqID), err) return wakuv1.CreateMailServerRequestFailedPayload(common.Hash(reqID), err)
} }
func (wakuAdapter) CreateRequestCompletedPayload(reqID, lastEnvelopeHash types.Hash, cursor []byte) []byte { func (wakuAdapter) CreateRequestCompletedPayload(reqID, lastEnvelopeHash types.Hash, cursor []byte) []byte {
return waku.CreateMailServerRequestCompletedPayload(common.Hash(reqID), common.Hash(lastEnvelopeHash), cursor) return wakuv1.CreateMailServerRequestCompletedPayload(common.Hash(reqID), common.Hash(lastEnvelopeHash), cursor)
} }
func (wakuAdapter) CreateSyncResponse(_ []types.Envelope, _ []byte, _ bool, _ string) interface{} { func (wakuAdapter) CreateSyncResponse(_ []types.Envelope, _ []byte, _ bool, _ string) interface{} {
@ -355,7 +355,7 @@ type service interface {
// ----------- // -----------
type wakuService struct { type wakuService struct {
*waku.Waku *wakuv1.Waku
} }
func (s *wakuService) SendRawSyncResponse(peerID []byte, data interface{}) error { func (s *wakuService) SendRawSyncResponse(peerID []byte, data interface{}) error {
@ -928,7 +928,7 @@ func (s *mailServer) sendHistoricMessageErrorResponse(peerID, reqID types.Hash,
} }
func extractBloomFromEncodedEnvelope(rawValue rlp.RawValue) ([]byte, error) { func extractBloomFromEncodedEnvelope(rawValue rlp.RawValue) ([]byte, error) {
var envelope wakucommon.Envelope var envelope wakuv1common.Envelope
decodeErr := rlp.DecodeBytes(rawValue, &envelope) decodeErr := rlp.DecodeBytes(rawValue, &envelope)
if decodeErr != nil { if decodeErr != nil {
return nil, decodeErr return nil, decodeErr

View File

@ -14,7 +14,7 @@ import (
"github.com/status-im/status-go/common" "github.com/status-im/status-go/common"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/logutils" "github.com/status-im/status-go/logutils"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
type LevelDB struct { type LevelDB struct {
@ -221,7 +221,7 @@ func (db *LevelDB) SaveEnvelope(env types.Envelope) error {
} }
archivedEnvelopesGauge.WithLabelValues(db.name).Inc() archivedEnvelopesGauge.WithLabelValues(db.name).Inc()
archivedEnvelopeSizeMeter.WithLabelValues(db.name).Observe( archivedEnvelopeSizeMeter.WithLabelValues(db.name).Observe(
float64(waku.EnvelopeHeaderLength + env.Size())) float64(wakuv1common.EnvelopeHeaderLength + env.Size()))
return err return err
} }

View File

@ -8,7 +8,7 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
func TestLevelDB_BuildIteratorWithTopic(t *testing.T) { func TestLevelDB_BuildIteratorWithTopic(t *testing.T) {
@ -36,10 +36,10 @@ func TestLevelDB_BuildIteratorWithTopic(t *testing.T) {
rawValue, err := iter.GetEnvelopeByTopicsMap(topicsMap) rawValue, err := iter.GetEnvelopeByTopicsMap(topicsMap)
require.NoError(t, err) require.NoError(t, err)
require.NotEmpty(t, rawValue) require.NotEmpty(t, rawValue)
var receivedEnvelope waku.Envelope var receivedEnvelope wakuv1common.Envelope
err = rlp.DecodeBytes(rawValue, &receivedEnvelope) err = rlp.DecodeBytes(rawValue, &receivedEnvelope)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, waku.BytesToTopic(topic), receivedEnvelope.Topic) require.EqualValues(t, wakuv1common.BytesToTopic(topic), receivedEnvelope.Topic)
err = iter.Release() err = iter.Release()
require.NoError(t, err) require.NoError(t, err)

View File

@ -22,7 +22,7 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
type PostgresDB struct { type PostgresDB struct {
@ -294,7 +294,7 @@ func (i *PostgresDB) SaveEnvelope(env types.Envelope) error {
archivedEnvelopesGauge.WithLabelValues(i.name).Inc() archivedEnvelopesGauge.WithLabelValues(i.name).Inc()
archivedEnvelopeSizeMeter.WithLabelValues(i.name).Observe( archivedEnvelopeSizeMeter.WithLabelValues(i.name).Observe(
float64(waku.EnvelopeHeaderLength + env.Size())) float64(wakuv1common.EnvelopeHeaderLength + env.Size()))
return nil return nil
} }

View File

@ -18,7 +18,7 @@ import (
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/postgres" "github.com/status-im/status-go/postgres"
waku "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
func TestMailServerPostgresDBSuite(t *testing.T) { func TestMailServerPostgresDBSuite(t *testing.T) {
@ -59,10 +59,10 @@ func (s *MailServerPostgresDBSuite) TestPostgresDB_BuildIteratorWithBloomFilter(
rawValue, err := iter.GetEnvelopeByBloomFilter(nil) rawValue, err := iter.GetEnvelopeByBloomFilter(nil)
s.NoError(err) s.NoError(err)
s.NotEmpty(rawValue) s.NotEmpty(rawValue)
var receivedEnvelope waku.Envelope var receivedEnvelope wakuv1common.Envelope
err = rlp.DecodeBytes(rawValue, &receivedEnvelope) err = rlp.DecodeBytes(rawValue, &receivedEnvelope)
s.NoError(err) s.NoError(err)
s.EqualValues(waku.BytesToTopic(topic), receivedEnvelope.Topic) s.EqualValues(wakuv1common.BytesToTopic(topic), receivedEnvelope.Topic)
err = iter.Release() err = iter.Release()
s.NoError(err) s.NoError(err)
@ -93,10 +93,10 @@ func (s *MailServerPostgresDBSuite) TestPostgresDB_BuildIteratorWithTopic() {
rawValue, err := iter.GetEnvelopeByBloomFilter(nil) rawValue, err := iter.GetEnvelopeByBloomFilter(nil)
s.NoError(err) s.NoError(err)
s.NotEmpty(rawValue) s.NotEmpty(rawValue)
var receivedEnvelope waku.Envelope var receivedEnvelope wakuv1common.Envelope
err = rlp.DecodeBytes(rawValue, &receivedEnvelope) err = rlp.DecodeBytes(rawValue, &receivedEnvelope)
s.NoError(err) s.NoError(err)
s.EqualValues(waku.BytesToTopic(topic), receivedEnvelope.Topic) s.EqualValues(wakuv1common.BytesToTopic(topic), receivedEnvelope.Topic)
err = iter.Release() err = iter.Release()
s.NoError(err) s.NoError(err)
@ -108,15 +108,15 @@ func newTestEnvelope(topic []byte) (types.Envelope, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
params := waku.MessageParams{ params := wakuv1common.MessageParams{
TTL: 10, TTL: 10,
PoW: 2.0, PoW: 2.0,
Payload: []byte("hello world"), Payload: []byte("hello world"),
WorkTime: 1, WorkTime: 1,
Topic: waku.BytesToTopic(topic), Topic: wakuv1common.BytesToTopic(topic),
Dst: &privateKey.PublicKey, Dst: &privateKey.PublicKey,
} }
message, err := waku.NewSentMessage(&params) message, err := wakuv1common.NewSentMessage(&params)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -32,8 +32,8 @@ import (
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
waku "github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
wakucommon "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
) )
const powRequirement = 0.00001 const powRequirement = 0.00001
@ -58,14 +58,14 @@ func TestMailserverSuite(t *testing.T) {
type MailserverSuite struct { type MailserverSuite struct {
suite.Suite suite.Suite
server *WakuMailServer server *WakuMailServer
shh *waku.Waku shh *wakuv1.Waku
config *params.WakuConfig config *params.WakuConfig
dataDir string dataDir string
} }
func (s *MailserverSuite) SetupTest() { func (s *MailserverSuite) SetupTest() {
s.server = &WakuMailServer{} s.server = &WakuMailServer{}
s.shh = waku.New(&waku.DefaultConfig, nil) s.shh = wakuv1.New(&wakuv1.DefaultConfig, nil)
s.shh.RegisterMailServer(s.server) s.shh.RegisterMailServer(s.server)
tmpDir := s.T().TempDir() tmpDir := s.T().TempDir()
@ -112,7 +112,7 @@ func (s *MailserverSuite) TestInit() {
tc := testCase tc := testCase
s.T().Run(tc.info, func(*testing.T) { s.T().Run(tc.info, func(*testing.T) {
mailServer := &WakuMailServer{} mailServer := &WakuMailServer{}
shh := waku.New(&waku.DefaultConfig, nil) shh := wakuv1.New(&wakuv1.DefaultConfig, nil)
shh.RegisterMailServer(mailServer) shh.RegisterMailServer(mailServer)
err := mailServer.Init(shh, &tc.config) err := mailServer.Init(shh, &tc.config)
@ -184,7 +184,7 @@ func (s *MailserverSuite) TestRequestPaginationLimit() {
defer s.server.Close() defer s.server.Close()
var ( var (
sentEnvelopes []*wakucommon.Envelope sentEnvelopes []*wakuv1common.Envelope
sentHashes []common.Hash sentHashes []common.Hash
receivedHashes []common.Hash receivedHashes []common.Hash
archiveKeys []string archiveKeys []string
@ -382,7 +382,7 @@ func (s *MailserverSuite) TestProcessRequestDeadlockHandling() {
s.setupServer(s.server) s.setupServer(s.server)
defer s.server.Close() defer s.server.Close()
var archievedEnvelopes []*wakucommon.Envelope var archievedEnvelopes []*wakuv1common.Envelope
now := time.Now() now := time.Now()
count := uint32(10) count := uint32(10)
@ -476,7 +476,7 @@ func (s *MailserverSuite) TestProcessRequestDeadlockHandling() {
} }
} }
func (s *MailserverSuite) messageExists(envelope *wakucommon.Envelope, low, upp uint32, bloom []byte, limit uint32) bool { func (s *MailserverSuite) messageExists(envelope *wakuv1common.Envelope, low, upp uint32, bloom []byte, limit uint32) bool {
receivedHashes, _, _ := processRequestAndCollectHashes(s.server, MessagesRequestPayload{ receivedHashes, _, _ := processRequestAndCollectHashes(s.server, MessagesRequestPayload{
Lower: low, Lower: low,
Upper: upp, Upper: upp,
@ -494,7 +494,7 @@ func (s *MailserverSuite) messageExists(envelope *wakucommon.Envelope, low, upp
func (s *MailserverSuite) setupServer(server *WakuMailServer) { func (s *MailserverSuite) setupServer(server *WakuMailServer) {
const password = "password_for_this_test" const password = "password_for_this_test"
s.shh = waku.New(&waku.DefaultConfig, nil) s.shh = wakuv1.New(&wakuv1.DefaultConfig, nil)
s.shh.RegisterMailServer(server) s.shh.RegisterMailServer(server)
err := server.Init(s.shh, &params.WakuConfig{ err := server.Init(s.shh, &params.WakuConfig{
@ -512,8 +512,8 @@ func (s *MailserverSuite) setupServer(server *WakuMailServer) {
} }
} }
func (s *MailserverSuite) prepareRequest(envelopes []*wakucommon.Envelope, limit uint32) ( func (s *MailserverSuite) prepareRequest(envelopes []*wakuv1common.Envelope, limit uint32) (
[]byte, *wakucommon.Envelope, error, []byte, *wakuv1common.Envelope, error,
) { ) {
if len(envelopes) == 0 { if len(envelopes) == 0 {
return nil, nil, errors.New("envelopes is empty") return nil, nil, errors.New("envelopes is empty")
@ -532,7 +532,7 @@ func (s *MailserverSuite) prepareRequest(envelopes []*wakucommon.Envelope, limit
return peerID, request, nil return peerID, request, nil
} }
func (s *MailserverSuite) defaultServerParams(env *wakucommon.Envelope) *ServerTestParams { func (s *MailserverSuite) defaultServerParams(env *wakuv1common.Envelope) *ServerTestParams {
id, err := s.shh.NewKeyPair() id, err := s.shh.NewKeyPair()
if err != nil { if err != nil {
s.T().Fatalf("failed to generate new key pair with seed %d: %s.", seed, err) s.T().Fatalf("failed to generate new key pair with seed %d: %s.", seed, err)
@ -553,7 +553,7 @@ func (s *MailserverSuite) defaultServerParams(env *wakucommon.Envelope) *ServerT
} }
} }
func (s *MailserverSuite) createRequest(p *ServerTestParams) *wakucommon.Envelope { func (s *MailserverSuite) createRequest(p *ServerTestParams) *wakuv1common.Envelope {
bloom := types.TopicToBloom(p.topic) bloom := types.TopicToBloom(p.topic)
data := make([]byte, 8) data := make([]byte, 8)
binary.BigEndian.PutUint32(data, p.low) binary.BigEndian.PutUint32(data, p.low)
@ -569,22 +569,22 @@ func (s *MailserverSuite) createRequest(p *ServerTestParams) *wakucommon.Envelop
return s.createEnvelope(p.topic, data, p.key) return s.createEnvelope(p.topic, data, p.key)
} }
func (s *MailserverSuite) createEnvelope(topic types.TopicType, data []byte, srcKey *ecdsa.PrivateKey) *wakucommon.Envelope { func (s *MailserverSuite) createEnvelope(topic types.TopicType, data []byte, srcKey *ecdsa.PrivateKey) *wakuv1common.Envelope {
key, err := s.shh.GetSymKey(keyID) key, err := s.shh.GetSymKey(keyID)
if err != nil { if err != nil {
s.T().Fatalf("failed to retrieve sym key with seed %d: %s.", seed, err) s.T().Fatalf("failed to retrieve sym key with seed %d: %s.", seed, err)
} }
params := &wakucommon.MessageParams{ params := &wakuv1common.MessageParams{
KeySym: key, KeySym: key,
Topic: wakucommon.TopicType(topic), Topic: wakuv1common.TopicType(topic),
Payload: data, Payload: data,
PoW: powRequirement * 2, PoW: powRequirement * 2,
WorkTime: 2, WorkTime: 2,
Src: srcKey, Src: srcKey,
} }
msg, err := wakucommon.NewSentMessage(params) msg, err := wakuv1common.NewSentMessage(params)
if err != nil { if err != nil {
s.T().Fatalf("failed to create new message with seed %d: %s.", seed, err) s.T().Fatalf("failed to create new message with seed %d: %s.", seed, err)
} }
@ -596,9 +596,9 @@ func (s *MailserverSuite) createEnvelope(topic types.TopicType, data []byte, src
return env return env
} }
func generateEnvelopeWithKeys(sentTime time.Time, keySym []byte, keyAsym *ecdsa.PublicKey) (*wakucommon.Envelope, error) { func generateEnvelopeWithKeys(sentTime time.Time, keySym []byte, keyAsym *ecdsa.PublicKey) (*wakuv1common.Envelope, error) {
params := &wakucommon.MessageParams{ params := &wakuv1common.MessageParams{
Topic: wakucommon.TopicType{0x1F, 0x7E, 0xA1, 0x7F}, Topic: wakuv1common.TopicType{0x1F, 0x7E, 0xA1, 0x7F},
Payload: testPayload, Payload: testPayload,
PoW: powRequirement, PoW: powRequirement,
WorkTime: 2, WorkTime: 2,
@ -610,7 +610,7 @@ func generateEnvelopeWithKeys(sentTime time.Time, keySym []byte, keyAsym *ecdsa.
params.Dst = keyAsym params.Dst = keyAsym
} }
msg, err := wakucommon.NewSentMessage(params) msg, err := wakuv1common.NewSentMessage(params)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create new message with seed %d: %s", seed, err) return nil, fmt.Errorf("failed to create new message with seed %d: %s", seed, err)
} }
@ -622,7 +622,7 @@ func generateEnvelopeWithKeys(sentTime time.Time, keySym []byte, keyAsym *ecdsa.
return env, nil return env, nil
} }
func generateEnvelope(sentTime time.Time) (*wakucommon.Envelope, error) { func generateEnvelope(sentTime time.Time) (*wakuv1common.Envelope, error) {
h := crypto.Keccak256Hash([]byte("test sample data")) h := crypto.Keccak256Hash([]byte("test sample data"))
return generateEnvelopeWithKeys(sentTime, h[:], nil) return generateEnvelopeWithKeys(sentTime, h[:], nil)
} }
@ -637,7 +637,7 @@ func processRequestAndCollectHashes(server *WakuMailServer, payload MessagesRequ
go func() { go func() {
for bundle := range bundles { for bundle := range bundles {
for _, rawEnvelope := range bundle { for _, rawEnvelope := range bundle {
var env *wakucommon.Envelope var env *wakuv1common.Envelope
if err := rlp.DecodeBytes(rawEnvelope, &env); err != nil { if err := rlp.DecodeBytes(rawEnvelope, &env); err != nil {
panic(err) panic(err)
} }

View File

@ -59,7 +59,7 @@ import (
"github.com/status-im/status-go/services/web3provider" "github.com/status-im/status-go/services/web3provider"
"github.com/status-im/status-go/timesource" "github.com/status-im/status-go/timesource"
"github.com/status-im/status-go/transactions" "github.com/status-im/status-go/transactions"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/wakuv2" "github.com/status-im/status-go/wakuv2"
) )
@ -123,7 +123,7 @@ type StatusNode struct {
localNotificationsSrvc *localnotifications.Service localNotificationsSrvc *localnotifications.Service
personalSrvc *personal.Service personalSrvc *personal.Service
timeSourceSrvc *timesource.NTPTimeSource timeSourceSrvc *timesource.NTPTimeSource
wakuSrvc *waku.Waku wakuSrvc *wakuv1.Waku
wakuExtSrvc *wakuext.Service wakuExtSrvc *wakuext.Service
wakuV2Srvc *wakuv2.Waku wakuV2Srvc *wakuv2.Waku
wakuV2ExtSrvc *wakuv2ext.Service wakuV2ExtSrvc *wakuv2ext.Service

View File

@ -16,6 +16,7 @@ import (
"github.com/status-im/status-go/server" "github.com/status-im/status-go/server"
"github.com/status-im/status-go/signal" "github.com/status-im/status-go/signal"
"github.com/status-im/status-go/transactions" "github.com/status-im/status-go/transactions"
"github.com/status-im/status-go/wakuv1"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
@ -63,8 +64,7 @@ import (
"github.com/status-im/status-go/services/wallet/transfer" "github.com/status-im/status-go/services/wallet/transfer"
"github.com/status-im/status-go/services/web3provider" "github.com/status-im/status-go/services/web3provider"
"github.com/status-im/status-go/timesource" "github.com/status-im/status-go/timesource"
"github.com/status-im/status-go/waku" wakuv1common "github.com/status-im/status-go/wakuv1/common"
wakucommon "github.com/status-im/status-go/waku/common"
"github.com/status-im/status-go/wakuv2" "github.com/status-im/status-go/wakuv2"
) )
@ -259,7 +259,7 @@ func (b *StatusNode) EnsService() *ens.Service {
return b.ensSrvc return b.ensSrvc
} }
func (b *StatusNode) WakuService() *waku.Waku { func (b *StatusNode) WakuService() *wakuv1.Waku {
return b.wakuSrvc return b.wakuSrvc
} }
@ -274,10 +274,10 @@ func (b *StatusNode) WakuV2Service() *wakuv2.Waku {
return b.wakuV2Srvc return b.wakuV2Srvc
} }
func (b *StatusNode) wakuService(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfig) (*waku.Waku, error) { func (b *StatusNode) wakuService(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfig) (*wakuv1.Waku, error) {
if b.wakuSrvc == nil { if b.wakuSrvc == nil {
cfg := &waku.Config{ cfg := &wakuv1.Config{
MaxMessageSize: wakucommon.DefaultMaxMessageSize, MaxMessageSize: wakuv1common.DefaultMaxMessageSize,
BloomFilterMode: wakuCfg.BloomFilterMode, BloomFilterMode: wakuCfg.BloomFilterMode,
FullNode: wakuCfg.FullNode, FullNode: wakuCfg.FullNode,
SoftBlacklistedPeerIDs: wakuCfg.SoftBlacklistedPeerIDs, SoftBlacklistedPeerIDs: wakuCfg.SoftBlacklistedPeerIDs,
@ -292,7 +292,7 @@ func (b *StatusNode) wakuService(wakuCfg *params.WakuConfig, clusterCfg *params.
cfg.MinimumAcceptedPoW = wakuCfg.MinimumPoW cfg.MinimumAcceptedPoW = wakuCfg.MinimumPoW
} }
w := waku.New(cfg, logutils.ZapLogger()) w := wakuv1.New(cfg, logutils.ZapLogger())
if wakuCfg.EnableRateLimiter { if wakuCfg.EnableRateLimiter {
r := wakuRateLimiter(wakuCfg, clusterCfg) r := wakuRateLimiter(wakuCfg, clusterCfg)
@ -325,7 +325,7 @@ func (b *StatusNode) wakuService(wakuCfg *params.WakuConfig, clusterCfg *params.
func (b *StatusNode) wakuV2Service(nodeConfig *params.NodeConfig) (*wakuv2.Waku, error) { func (b *StatusNode) wakuV2Service(nodeConfig *params.NodeConfig) (*wakuv2.Waku, error) {
if b.wakuV2Srvc == nil { if b.wakuV2Srvc == nil {
cfg := &wakuv2.Config{ cfg := &wakuv2.Config{
MaxMessageSize: wakucommon.DefaultMaxMessageSize, MaxMessageSize: wakuv1common.DefaultMaxMessageSize,
Host: nodeConfig.WakuV2Config.Host, Host: nodeConfig.WakuV2Config.Host,
Port: nodeConfig.WakuV2Config.Port, Port: nodeConfig.WakuV2Config.Port,
LightClient: nodeConfig.WakuV2Config.LightClient, LightClient: nodeConfig.WakuV2Config.LightClient,
@ -404,7 +404,7 @@ func setSettingsNotifier(db *accounts.Database, feed *event.Feed) {
}) })
} }
func wakuRateLimiter(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfig) *wakucommon.PeerRateLimiter { func wakuRateLimiter(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfig) *wakuv1common.PeerRateLimiter {
enodes := append( enodes := append(
parseNodes(clusterCfg.StaticNodes), parseNodes(clusterCfg.StaticNodes),
parseNodes(clusterCfg.TrustedMailServers)..., parseNodes(clusterCfg.TrustedMailServers)...,
@ -417,8 +417,8 @@ func wakuRateLimiter(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfi
ips = append(ips, item.IP().String()) ips = append(ips, item.IP().String())
peerIDs = append(peerIDs, item.ID()) peerIDs = append(peerIDs, item.ID())
} }
return wakucommon.NewPeerRateLimiter( return wakuv1common.NewPeerRateLimiter(
&wakucommon.PeerRateLimiterConfig{ &wakuv1common.PeerRateLimiterConfig{
PacketLimitPerSecIP: wakuCfg.PacketRateLimitIP, PacketLimitPerSecIP: wakuCfg.PacketRateLimitIP,
PacketLimitPerSecPeerID: wakuCfg.PacketRateLimitPeerID, PacketLimitPerSecPeerID: wakuCfg.PacketRateLimitPeerID,
BytesLimitPerSecIP: wakuCfg.BytesRateLimitIP, BytesLimitPerSecIP: wakuCfg.BytesRateLimitIP,
@ -426,8 +426,8 @@ func wakuRateLimiter(wakuCfg *params.WakuConfig, clusterCfg *params.ClusterConfi
WhitelistedIPs: ips, WhitelistedIPs: ips,
WhitelistedPeerIDs: peerIDs, WhitelistedPeerIDs: peerIDs,
}, },
&wakucommon.MetricsRateLimiterHandler{}, &wakuv1common.MetricsRateLimiterHandler{},
&wakucommon.DropPeerRateLimiterHandler{ &wakuv1common.DropPeerRateLimiterHandler{
Tolerance: wakuCfg.RateLimitTolerance, Tolerance: wakuCfg.RateLimitTolerance,
}, },
) )
@ -628,7 +628,7 @@ func (b *StatusNode) ethService() *eth.Service {
return b.ethSrvc return b.ethSrvc
} }
func registerWakuMailServer(wakuService *waku.Waku, config *params.WakuConfig) (err error) { func registerWakuMailServer(wakuService *wakuv1.Waku, config *params.WakuConfig) (err error) {
var mailServer mailserver.WakuMailServer var mailServer mailserver.WakuMailServer
wakuService.RegisterMailServer(&mailServer) wakuService.RegisterMailServer(&mailServer)

View File

@ -22,7 +22,7 @@ import (
"github.com/status-im/status-go/internal/version" "github.com/status-im/status-go/internal/version"
"github.com/status-im/status-go/logutils" "github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/static" "github.com/status-im/status-go/static"
wakucommon "github.com/status-im/status-go/waku/common" wakuv1common "github.com/status-im/status-go/wakuv1/common"
wakuv2common "github.com/status-im/status-go/wakuv2/common" wakuv2common "github.com/status-im/status-go/wakuv2/common"
) )
@ -913,7 +913,7 @@ func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) {
DataDir: wakuDir, DataDir: wakuDir,
MinimumPoW: WakuMinimumPoW, MinimumPoW: WakuMinimumPoW,
TTL: WakuTTL, TTL: WakuTTL,
MaxMessageSize: wakucommon.DefaultMaxMessageSize, MaxMessageSize: wakuv1common.DefaultMaxMessageSize,
}, },
WakuV2Config: WakuV2Config{ WakuV2Config: WakuV2Config{
Host: "0.0.0.0", Host: "0.0.0.0",

View File

@ -6,8 +6,7 @@ import (
transport2 "github.com/status-im/status-go/protocol/transport" transport2 "github.com/status-im/status-go/protocol/transport"
"github.com/status-im/status-go/t/helpers" "github.com/status-im/status-go/t/helpers"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/waku"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
@ -69,9 +68,9 @@ func (s *MessageSenderSuite) SetupTest() {
s.logger, s.logger,
) )
wakuConfig := waku.DefaultConfig wakuConfig := wakuv1.DefaultConfig
wakuConfig.MinimumAcceptedPoW = 0 wakuConfig.MinimumAcceptedPoW = 0
shh := waku.New(&wakuConfig, s.logger) shh := wakuv1.New(&wakuConfig, s.logger)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())
whisperTransport, err := transport2.NewTransport( whisperTransport, err := transport2.NewTransport(

View File

@ -10,7 +10,7 @@ import (
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestCommunityEventsEventualConsistencySuite(t *testing.T) { func TestCommunityEventsEventualConsistencySuite(t *testing.T) {
@ -30,9 +30,9 @@ func (s *CommunityEventsEventualConsistencySuite) SetupTest() {
s.accountsPasswords = make(map[string]string) s.accountsPasswords = make(map[string]string)
s.mockedBalances = createMockedWalletBalance(&s.Suite) s.mockedBalances = createMockedWalletBalance(&s.Suite)
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
wakuWrapper, err := newTestWakuWrapper(&config, s.logger) wakuWrapper, err := newTestWakuWrapper(&config, s.logger)
s.Require().NoError(err) s.Require().NoError(err)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -17,7 +17,7 @@ import (
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
// TODO: in future adapt this struct to use waku v2 and switch all tests to waku v2 // TODO: in future adapt this struct to use waku v2 and switch all tests to waku v2
@ -47,9 +47,9 @@ func (s *CommunitiesMessengerTestSuiteBase) SetupTest() {
s.mockedBalances = make(communities.BalancesByChain) s.mockedBalances = make(communities.BalancesByChain)
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())
} }

View File

@ -13,7 +13,7 @@ import (
"github.com/status-im/status-go/multiaccounts/settings" "github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
const DefaultProfileDisplayName = "" const DefaultProfileDisplayName = ""
@ -21,9 +21,9 @@ const DefaultProfileDisplayName = ""
func (s *MessengerBaseTestSuite) SetupTest() { func (s *MessengerBaseTestSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -16,7 +16,7 @@ import (
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestMessengerDeleteMessageForMeSuite(t *testing.T) { func TestMessengerDeleteMessageForMeSuite(t *testing.T) {
@ -59,9 +59,9 @@ func (s *MessengerDeleteMessageForMeSuite) otherNewMessenger() *Messenger {
func (s *MessengerDeleteMessageForMeSuite) SetupTest() { func (s *MessengerDeleteMessageForMeSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -23,7 +23,7 @@ import (
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestMessengerProfilePictureHandlerSuite(t *testing.T) { func TestMessengerProfilePictureHandlerSuite(t *testing.T) {
@ -45,10 +45,10 @@ func (s *MessengerProfilePictureHandlerSuite) SetupSuite() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
// Setup Waku things // Setup Waku things
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
wakuLogger := s.logger.Named("Waku") wakuLogger := s.logger.Named("Waku")
shh := waku.New(&config, wakuLogger) shh := wakuv1.New(&config, wakuLogger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())
} }

View File

@ -17,7 +17,7 @@ import (
"github.com/status-im/status-go/protocol/peersyncing" "github.com/status-im/status-go/protocol/peersyncing"
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestMessengerPeersyncingSuite(t *testing.T) { func TestMessengerPeersyncingSuite(t *testing.T) {
@ -42,9 +42,9 @@ func (s *MessengerPeersyncingSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
peerSyncingLoopInterval = 500 * time.Millisecond peerSyncingLoopInterval = 500 * time.Millisecond
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -5,13 +5,13 @@ import (
"testing" "testing"
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/multiaccounts/common" "github.com/status-im/status-go/multiaccounts/common"
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
@ -28,9 +28,9 @@ type MessengerSettingsSuite struct {
func (s *MessengerSettingsSuite) SetupTest() { func (s *MessengerSettingsSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -15,7 +15,7 @@ import (
"github.com/status-im/status-go/protocol/common" "github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
const publicChatName = "status" const publicChatName = "status"
@ -60,9 +60,9 @@ func (s *MessengerSyncChatSuite) otherNewMessenger() *Messenger {
func (s *MessengerSyncChatSuite) SetupTest() { func (s *MessengerSyncChatSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -8,13 +8,13 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"github.com/status-im/status-go/multiaccounts/common" "github.com/status-im/status-go/multiaccounts/common"
"github.com/status-im/status-go/wakuv1"
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku"
) )
func TestMessengerAccountCustomizationColor(t *testing.T) { func TestMessengerAccountCustomizationColor(t *testing.T) {
@ -34,9 +34,9 @@ type MessengerSyncAccountCustomizationColorSuite struct {
func (s *MessengerSyncAccountCustomizationColorSuite) SetupTest() { func (s *MessengerSyncAccountCustomizationColorSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -14,7 +14,7 @@ import (
"github.com/status-im/status-go/multiaccounts/accounts" "github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestMessengerSyncKeycardChangeSuite(t *testing.T) { func TestMessengerSyncKeycardChangeSuite(t *testing.T) {
@ -37,9 +37,9 @@ type MessengerSyncKeycardChangeSuite struct {
func (s *MessengerSyncKeycardChangeSuite) SetupTest() { func (s *MessengerSyncKeycardChangeSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -14,7 +14,7 @@ import (
"github.com/status-im/status-go/multiaccounts/accounts" "github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestMessengerSyncKeycardsStateSuite(t *testing.T) { func TestMessengerSyncKeycardsStateSuite(t *testing.T) {
@ -37,9 +37,9 @@ type MessengerSyncKeycardsStateSuite struct {
func (s *MessengerSyncKeycardsStateSuite) SetupTest() { func (s *MessengerSyncKeycardsStateSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -18,7 +18,7 @@ import (
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/wallet" "github.com/status-im/status-go/services/wallet"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
func TestMessengerSyncSavedAddressesSuite(t *testing.T) { func TestMessengerSyncSavedAddressesSuite(t *testing.T) {
@ -41,9 +41,9 @@ type MessengerSyncSavedAddressesSuite struct {
func (s *MessengerSyncSavedAddressesSuite) SetupTest() { func (s *MessengerSyncSavedAddressesSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -15,7 +15,7 @@ import (
"github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/stickers" "github.com/status-im/status-go/services/stickers"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
var ( var (
@ -79,9 +79,9 @@ func (s *MessengerSyncSettingsSuite) SetupSuite() {
func (s *MessengerSyncSettingsSuite) SetupTest() { func (s *MessengerSyncSettingsSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -7,7 +7,7 @@ import (
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
type testWakuWrapper struct { type testWakuWrapper struct {
@ -16,11 +16,11 @@ type testWakuWrapper struct {
publicWakuAPIWrapper *testPublicWakuAPIWrapper publicWakuAPIWrapper *testPublicWakuAPIWrapper
} }
func newTestWaku(w *waku.Waku) types.Waku { func newTestWaku(w *wakuv1.Waku) types.Waku {
wrapper := gethbridge.NewGethWakuWrapper(w) wrapper := gethbridge.NewGethWakuWrapper(w)
return &testWakuWrapper{ return &testWakuWrapper{
GethWakuWrapper: wrapper.(*gethbridge.GethWakuWrapper), GethWakuWrapper: wrapper.(*gethbridge.GethWakuWrapper),
publicWakuAPIWrapper: newTestPublicWakuAPI(waku.NewPublicWakuAPI(w)).(*testPublicWakuAPIWrapper), publicWakuAPIWrapper: newTestPublicWakuAPI(wakuv1.NewPublicWakuAPI(w)).(*testPublicWakuAPIWrapper),
} }
} }
@ -45,7 +45,7 @@ type testPublicWakuAPIWrapper struct {
postSubscriptions []chan *PostMessageSubscription postSubscriptions []chan *PostMessageSubscription
} }
func newTestPublicWakuAPI(api *waku.PublicWakuAPI) types.PublicWakuAPI { func newTestPublicWakuAPI(api *wakuv1.PublicWakuAPI) types.PublicWakuAPI {
wrapper := gethbridge.NewGethPublicWakuAPIWrapper(api) wrapper := gethbridge.NewGethPublicWakuAPIWrapper(api)
return &testPublicWakuAPIWrapper{ return &testPublicWakuAPIWrapper{
GethPublicWakuAPIWrapper: wrapper.(*gethbridge.GethPublicWakuAPIWrapper), GethPublicWakuAPIWrapper: wrapper.(*gethbridge.GethPublicWakuAPIWrapper),
@ -67,10 +67,10 @@ func (tp *testPublicWakuAPIWrapper) Post(ctx context.Context, req types.NewMessa
return id, err return id, err
} }
func newTestWakuWrapper(config *waku.Config, logger *zap.Logger) (*testWakuWrapper, error) { func newTestWakuWrapper(config *wakuv1.Config, logger *zap.Logger) (*testWakuWrapper, error) {
if config == nil { if config == nil {
config = &waku.DefaultConfig config = &wakuv1.DefaultConfig
} }
w := waku.New(config, logger) w := wakuv1.New(config, logger)
return newTestWaku(w).(*testWakuWrapper), w.Start() return newTestWaku(w).(*testWakuWrapper), w.Start()
} }

View File

@ -20,7 +20,7 @@ import (
"github.com/status-im/status-go/protocol/pushnotificationserver" "github.com/status-im/status-go/protocol/pushnotificationserver"
"github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
) )
const ( const (
@ -46,9 +46,9 @@ type MessengerPushNotificationSuite struct {
func (s *MessengerPushNotificationSuite) SetupTest() { func (s *MessengerPushNotificationSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger() s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig config := wakuv1.DefaultConfig
config.MinimumAcceptedPoW = 0 config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger) shh := wakuv1.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh) s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start()) s.Require().NoError(shh.Start())

View File

@ -10,13 +10,13 @@ import (
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/wakuv1"
_ "github.com/mutecomm/go-sqlcipher/v4" _ "github.com/mutecomm/go-sqlcipher/v4"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/waku"
) )
type testKeysPersistence struct { type testKeysPersistence struct {
@ -90,7 +90,7 @@ func (s *FiltersManagerSuite) SetupTest() {
keysPersistence := newTestKeysPersistence() keysPersistence := newTestKeysPersistence()
waku := gethbridge.NewGethWakuWrapper(waku.New(&waku.DefaultConfig, nil)) waku := gethbridge.NewGethWakuWrapper(wakuv1.New(&wakuv1.DefaultConfig, nil))
s.chats, err = NewFiltersManager(keysPersistence, waku, s.manager[0].privateKey, s.logger) s.chats, err = NewFiltersManager(keysPersistence, waku, s.manager[0].privateKey, s.logger)
s.Require().NoError(err) s.Require().NoError(err)

View File

@ -18,7 +18,7 @@ import (
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
"github.com/status-im/status-go/services/ext" "github.com/status-im/status-go/services/ext"
"github.com/status-im/status-go/t/helpers" "github.com/status-im/status-go/t/helpers"
"github.com/status-im/status-go/waku" "github.com/status-im/status-go/wakuv1"
"github.com/status-im/status-go/walletdatabase" "github.com/status-im/status-go/walletdatabase"
) )
@ -35,7 +35,7 @@ func TestInitProtocol(t *testing.T) {
db, err := leveldb.Open(storage.NewMemStorage(), nil) db, err := leveldb.Open(storage.NewMemStorage(), nil)
require.NoError(t, err) require.NoError(t, err)
waku := gethbridge.NewGethWakuWrapper(waku.New(nil, nil)) waku := gethbridge.NewGethWakuWrapper(wakuv1.New(nil, nil))
privateKey, err := crypto.GenerateKey() privateKey, err := crypto.GenerateKey()
require.NoError(t, err) require.NoError(t, err)

View File

@ -16,7 +16,7 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"context" "context"
@ -29,7 +29,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"github.com/status-im/status-go/logutils" "github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"

View File

@ -16,14 +16,14 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"bytes" "bytes"
"testing" "testing"
"time" "time"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
func TestMultipleTopicCopyInNewMessageFilter(t *testing.T) { func TestMultipleTopicCopyInNewMessageFilter(t *testing.T) {

View File

@ -16,10 +16,10 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
// Config represents the configuration state of a waku node. // Config represents the configuration state of a waku node.

View File

@ -16,14 +16,14 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
gethcommon "github.com/ethereum/go-ethereum/common" gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"

View File

@ -16,7 +16,7 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"bytes" "bytes"
@ -35,7 +35,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/p2p/nat"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
var keys = []string{ var keys = []string{

View File

@ -3,7 +3,7 @@ package v0
import ( import (
gethcommon "github.com/ethereum/go-ethereum/common" gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
// MultiVersionResponse allows to decode response into chosen version. // MultiVersionResponse allows to decode response into chosen version.

View File

@ -26,7 +26,7 @@ import (
gethcommon "github.com/ethereum/go-ethereum/common" gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
func TestEncodeDecodeVersionedResponse(t *testing.T) { func TestEncodeDecodeVersionedResponse(t *testing.T) {

View File

@ -23,7 +23,7 @@ import (
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
gocommon "github.com/status-im/status-go/common" gocommon "github.com/status-im/status-go/common"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
// Peer is the implementation of the Peer interface and represents a remote Waku client with which the local host Waku // Peer is the implementation of the Peer interface and represents a remote Waku client with which the local host Waku

View File

@ -28,7 +28,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
var seed int64 var seed int64

View File

@ -10,7 +10,7 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
// statusOptionKey is a current type used in StatusOptions as a key. // statusOptionKey is a current type used in StatusOptions as a key.

View File

@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
func TestEncodeDecodeRLP(t *testing.T) { func TestEncodeDecodeRLP(t *testing.T) {

View File

@ -3,7 +3,7 @@ package v1
import ( import (
gethcommon "github.com/ethereum/go-ethereum/common" gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
// MultiVersionResponse allows to decode response into chosen version. // MultiVersionResponse allows to decode response into chosen version.

View File

@ -26,7 +26,7 @@ import (
gethcommon "github.com/ethereum/go-ethereum/common" gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
func TestEncodeDecodeVersionedResponse(t *testing.T) { func TestEncodeDecodeVersionedResponse(t *testing.T) {

View File

@ -23,7 +23,7 @@ import (
gocommon "github.com/status-im/status-go/common" gocommon "github.com/status-im/status-go/common"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
type Peer struct { type Peer struct {

View File

@ -28,7 +28,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
var seed int64 var seed int64

View File

@ -11,7 +11,7 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
// statusOptionKey is a current type used in StatusOptions as a key. // statusOptionKey is a current type used in StatusOptions as a key.

View File

@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
) )
func TestEncodeDecodeRLP(t *testing.T) { func TestEncodeDecodeRLP(t *testing.T) {

View File

@ -16,7 +16,7 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"bytes" "bytes"
@ -47,9 +47,9 @@ import (
gocommon "github.com/status-im/status-go/common" gocommon "github.com/status-im/status-go/common"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/logutils" "github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
v0 "github.com/status-im/status-go/waku/v0" v0 "github.com/status-im/status-go/wakuv1/v0"
v1 "github.com/status-im/status-go/waku/v1" v1 "github.com/status-im/status-go/wakuv1/v1"
) )
const messageQueueLimit = 1024 const messageQueueLimit = 1024

View File

@ -16,7 +16,7 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
"bytes" "bytes"
@ -35,9 +35,9 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
v0 "github.com/status-im/status-go/waku/v0" v0 "github.com/status-im/status-go/wakuv1/v0"
v1 "github.com/status-im/status-go/waku/v1" v1 "github.com/status-im/status-go/wakuv1/v1"
) )
var seed int64 var seed int64

View File

@ -16,7 +16,7 @@
// This software uses the go-ethereum library, which is licensed // This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later. // under the GNU Lesser General Public Library, version 3 or any later.
package waku package wakuv1
import ( import (
mrand "math/rand" mrand "math/rand"
@ -25,9 +25,9 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/status-im/status-go/waku/common" "github.com/status-im/status-go/wakuv1/common"
v0 "github.com/status-im/status-go/waku/v0" v0 "github.com/status-im/status-go/wakuv1/v0"
v1 "github.com/status-im/status-go/waku/v1" v1 "github.com/status-im/status-go/wakuv1/v1"
"go.uber.org/zap" "go.uber.org/zap"