Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ coverage.html
Session.vim
.undodir/*
/.idea/
/.vscode/
/cmd/*/.ethereum/
*.iml

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party/nwaku"]
path = third_party/nwaku
url = https://github.com/waku-org/nwaku
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
"cSpell.words": [
"unmarshalling"
],
"gopls":{
"buildFlags": ["-tags=use_nwaku,gowaku_skip_migrations,gowaku_no_rln"]
}
}
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.PHONY: statusgo statusd-prune all test clean help
.PHONY: statusgo-android statusgo-ios
.PHONY: build-libwaku test-libwaku clean-libwaku rebuild-libwaku

# Clear any GOROOT set outside of the Nix shell
export GOROOT=
Expand Down Expand Up @@ -355,9 +356,28 @@ mock: ##@other Regenerate mocks
mockgen -package=mock_paraswap -destination=services/wallet/thirdparty/paraswap/mock/types.go -source=services/wallet/thirdparty/paraswap/types.go
mockgen -package=mock_onramp -destination=services/wallet/onramp/mock/types.go -source=services/wallet/onramp/types.go

LIBWAKU := third_party/nwaku/build/libwaku.$(GOBIN_SHARED_LIB_EXT)
$(LIBWAKU):
echo "Building libwaku"
$(MAKE) -C third_party/nwaku update || { echo "nwaku make update failed"; exit 1; }
$(MAKE) -C ./third_party/nwaku libwaku

build-libwaku: $(LIBWAKU)

docker-test: ##@tests Run tests in a docker container with golang.
docker run --privileged --rm -it -v "$(PWD):$(DOCKER_TEST_WORKDIR)" -w "$(DOCKER_TEST_WORKDIR)" $(DOCKER_TEST_IMAGE) go test ${ARGS}

test-libwaku: | $(LIBWAKU)
// chequear nwaku
// sino lanzarlo
go test -tags '$(BUILD_TAGS) use_nwaku' -run TestBasicWakuV2 ./wakuv2/... -count 1 -v -json | jq -r '.Output'

clean-libwaku:
echo "Removing libwaku"
rm $(LIBWAKU)

rebuild-libwaku: | clean-libwaku $(LIBWAKU)

test: test-unit ##@tests Run basic, short tests during development

test-unit: export BUILD_TAGS ?=
Expand Down
6 changes: 3 additions & 3 deletions eth-node/bridge/geth/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
type gethNodeWrapper struct {
stack *node.Node
waku1 *waku.Waku
waku2 *wakuv2.NWaku
waku2 *wakuv2.Waku
}

func NewNodeBridge(stack *node.Node, waku1 *waku.Waku, waku2 *wakuv2.NWaku) types.Node {
func NewNodeBridge(stack *node.Node, waku1 *waku.Waku, waku2 *wakuv2.Waku) types.Node {
return &gethNodeWrapper{stack: stack, waku1: waku1, waku2: waku2}
}

Expand All @@ -38,7 +38,7 @@ func (w *gethNodeWrapper) SetWaku1(waku *waku.Waku) {
w.waku1 = waku
}

func (w *gethNodeWrapper) SetWaku2(waku *wakuv2.NWaku) {
func (w *gethNodeWrapper) SetWaku2(waku *wakuv2.Waku) {
w.waku2 = waku
}

Expand Down
6 changes: 3 additions & 3 deletions eth-node/bridge/geth/wakuv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
)

type gethWakuV2Wrapper struct {
waku *wakuv2.NWaku
waku *wakuv2.Waku
}

// NewGethWakuWrapper returns an object that wraps Geth's Waku in a types interface
func NewGethWakuV2Wrapper(w *wakuv2.NWaku) types.Waku {
func NewGethWakuV2Wrapper(w *wakuv2.Waku) types.Waku {
if w == nil {
panic("waku cannot be nil")
}
Expand All @@ -37,7 +37,7 @@ func NewGethWakuV2Wrapper(w *wakuv2.NWaku) types.Waku {
}

// GetGethWhisperFrom retrieves the underlying whisper Whisper struct from a wrapped Whisper interface
func GetGethWakuV2From(m types.Waku) *wakuv2.NWaku {
func GetGethWakuV2From(m types.Waku) *wakuv2.Waku {
return m.(*gethWakuV2Wrapper).waku
}

Expand Down
2 changes: 1 addition & 1 deletion nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in pkgs.mkShell {

buildInputs = with pkgs; [
git jq which
go golangci-lint go-junit-report gopls go-bindata gomobileMod
go golangci-lint go-junit-report gopls go-bindata gomobileMod openssl
mockgen protobuf3_20 protoc-gen-go gotestsum go-modvendor openjdk cc-test-reporter
] ++ lib.optionals (stdenv.isDarwin) [ xcodeWrapper ];

Expand Down
2 changes: 1 addition & 1 deletion node/get_status_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type StatusNode struct {
// nwakuSrvc *
wakuSrvc *waku.Waku
wakuExtSrvc *wakuext.Service
wakuV2Srvc *wakuv2.NWaku
wakuV2Srvc *wakuv2.Waku
wakuV2ExtSrvc *wakuv2ext.Service
ensSrvc *ens.Service
communityTokensSrvc *communitytokens.Service
Expand Down
4 changes: 2 additions & 2 deletions node/status_node_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (b *StatusNode) WakuExtService() *wakuext.Service {
func (b *StatusNode) WakuV2ExtService() *wakuv2ext.Service {
return b.wakuV2ExtSrvc
}
func (b *StatusNode) WakuV2Service() *wakuv2.NWaku {
func (b *StatusNode) WakuV2Service() *wakuv2.Waku {
return b.wakuV2Srvc
}

Expand Down Expand Up @@ -315,7 +315,7 @@ func (b *StatusNode) wakuService(wakuCfg *params.WakuConfig, clusterCfg *params.

}

func (b *StatusNode) wakuV2Service(nodeConfig *params.NodeConfig) (*wakuv2.NWaku, error) {
func (b *StatusNode) wakuV2Service(nodeConfig *params.NodeConfig) (*wakuv2.Waku, error) {
if b.wakuV2Srvc == nil {
cfg := &wakuv2.Config{
MaxMessageSize: wakucommon.DefaultMaxMessageSize,
Expand Down
4 changes: 2 additions & 2 deletions protocol/communities/persistence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ 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/protocol/common"
"github.com/status-im/status-go/protocol/common/shard"
"github.com/status-im/status-go/protocol/communities/token"
"github.com/status-im/status-go/protocol/encryption"
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/sqlite"
"github.com/status-im/status-go/services/wallet/bigint"
"github.com/status-im/status-go/t/helpers"
"github.com/status-im/status-go/wakuv2"
)

func TestPersistenceSuite(t *testing.T) {
Expand Down Expand Up @@ -787,7 +787,7 @@ func (s *PersistenceSuite) TestSaveShardInfo() {
s.Require().Nil(resultShard)

// not nil shard
expectedShard := &shard.Shard{
expectedShard := &wakuv2.Shard{
Cluster: 1,
Index: 2,
}
Expand Down
7 changes: 4 additions & 3 deletions protocol/communities_messenger_token_permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import (
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/common/shard"
"github.com/status-im/status-go/protocol/communities"
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/transport"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/services/wallet/thirdparty"
"github.com/status-im/status-go/wakuv2"
)

const testChainID1 = 1
Expand Down Expand Up @@ -488,11 +488,12 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestBecomeMemberPermissions(
cfg := testWakuV2Config{
logger: s.logger.Named("store-node-waku"),
enableStore: false,
clusterID: shard.MainStatusShardCluster,
clusterID: wakuv2.MainStatusShardCluster,
}
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
20 changes: 10 additions & 10 deletions protocol/messenger_communities_sharding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
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/protocol/common"
"github.com/status-im/status-go/protocol/common/shard"
"github.com/status-im/status-go/protocol/communities"
"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"
)

func TestMessengerCommunitiesShardingSuite(t *testing.T) {
Expand Down Expand Up @@ -108,7 +108,7 @@ func (s *MessengerCommunitiesShardingSuite) TearDownTest() {
_ = s.logger.Sync()
}

func (s *MessengerCommunitiesShardingSuite) testPostToCommunityChat(shard *shard.Shard, community *communities.Community, chat *Chat) {
func (s *MessengerCommunitiesShardingSuite) testPostToCommunityChat(shard *wakuv2.Shard, community *communities.Community, chat *Chat) {
_, err := s.owner.SetCommunityShard(&requests.SetCommunityShard{
CommunityID: community.ID(),
Shard: shard,
Expand Down Expand Up @@ -144,26 +144,26 @@ func (s *MessengerCommunitiesShardingSuite) TestPostToCommunityChat() {

// Members should be able to receive messages in a community with sharding enabled.
{
shard := &shard.Shard{
Cluster: shard.MainStatusShardCluster,
shard := &wakuv2.Shard{
Cluster: wakuv2.MainStatusShardCluster,
Index: 128,
}
s.testPostToCommunityChat(shard, community, chat)
}

// Members should be able to receive messages in a community where the sharding configuration has been edited.
{
shard := &shard.Shard{
Cluster: shard.MainStatusShardCluster,
shard := &wakuv2.Shard{
Cluster: wakuv2.MainStatusShardCluster,
Index: 256,
}
s.testPostToCommunityChat(shard, community, chat)
}

// Members should continue to receive messages in a community if it is moved back to default shard.
{
shard := &shard.Shard{
Cluster: shard.MainStatusShardCluster,
shard := &wakuv2.Shard{
Cluster: wakuv2.MainStatusShardCluster,
Index: 32,
}
s.testPostToCommunityChat(shard, community, chat)
Expand All @@ -176,8 +176,8 @@ func (s *MessengerCommunitiesShardingSuite) TestIgnoreOutdatedShardKey() {
advertiseCommunityToUserOldWay(&s.Suite, community, s.owner, s.alice)
joinCommunity(&s.Suite, community.ID(), s.owner, s.alice, alicePassword, []string{aliceAddress1})

shard := &shard.Shard{
Cluster: shard.MainStatusShardCluster,
shard := &wakuv2.Shard{
Cluster: wakuv2.MainStatusShardCluster,
Index: 128,
}

Expand Down
4 changes: 2 additions & 2 deletions protocol/messenger_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type config struct {

telemetryServerURL string
telemetrySendPeriod time.Duration
wakuService *wakuv2.NWaku
wakuService *wakuv2.Waku

messageResendMinDelay time.Duration
messageResendMaxCount int
Expand Down Expand Up @@ -387,7 +387,7 @@ func WithCommunityTokensService(s communities.CommunityTokensServiceInterface) O
}
}

func WithWakuService(s *wakuv2.NWaku) Option {
func WithWakuService(s *wakuv2.Waku) Option {
return func(c *config) error {
c.wakuService = s
return nil
Expand Down
9 changes: 5 additions & 4 deletions protocol/messenger_storenode_comunity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/multiformats/go-multiaddr"

"github.com/status-im/status-go/protocol/storenodes"
"github.com/status-im/status-go/wakuv2"

gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/protocol/common/shard"
"github.com/status-im/status-go/protocol/communities"
"github.com/status-im/status-go/protocol/tt"

Expand Down Expand Up @@ -92,11 +92,12 @@ func (s *MessengerStoreNodeCommunitySuite) createStore(name string) (*waku2.Waku
cfg := testWakuV2Config{
logger: s.logger.Named(name),
enableStore: true,
clusterID: shard.MainStatusShardCluster,
clusterID: wakuv2.MainStatusShardCluster,
}

storeNode := NewTestWakuV2(&s.Suite, cfg)
addresses := storeNode.ListenAddresses()
addresses, err := storeNode.ListenAddresses()
s.Require().NoError(err)
s.Require().GreaterOrEqual(len(addresses), 1, "no storenode listen address")
return storeNode, addresses[0]
}
Expand All @@ -109,7 +110,7 @@ func (s *MessengerStoreNodeCommunitySuite) newMessenger(name string, storenodeAd
cfg := testWakuV2Config{
logger: logger,
enableStore: false,
clusterID: shard.MainStatusShardCluster,
clusterID: wakuv2.MainStatusShardCluster,
}
wakuV2 := NewTestWakuV2(&s.Suite, cfg)
wakuV2Wrapper := gethbridge.NewGethWakuV2Wrapper(wakuV2)
Expand Down
Loading