Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sharding tests update #1060

Merged
merged 107 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
0e0ff46
test: node with static sharding and multiple pubSubTopics
romanzac Mar 19, 2024
bbf7487
Merge branch 'master' into chore-sharding-tests-update
romanzac Mar 19, 2024
77468d6
Merge branch 'master' into chore-sharding-tests-update
romanzac Mar 20, 2024
abec5b0
test: remove Unsubscribe() calls
romanzac Mar 20, 2024
a8689eb
fix: add content topics to TestStaticShardingMultipleTopics
romanzac Mar 20, 2024
a3ec282
fix: add IsSubscribed() test
romanzac Mar 20, 2024
3fe24f6
fix: switch to use GetSubscription instead of GetSubscriptionWithPubs…
romanzac Mar 21, 2024
c0e44b6
Merge branch 'master' into chore-sharding-tests-update
romanzac Mar 21, 2024
77f1f59
fix: switch back to use GetSubscriptionWithPubsubTopic
romanzac Mar 21, 2024
6495860
fix: validate with messages
romanzac Mar 23, 2024
ff01699
fix: extend deadline for context
romanzac Mar 23, 2024
95f3ff0
fix: use select for timeout wait
romanzac Mar 23, 2024
d26f178
fix: refactor repeated code into waitForTimeout
romanzac Mar 23, 2024
265909a
Merge branch 'master' into chore-sharding-tests-update
romanzac Mar 26, 2024
54edf8b
Merge branch 'master' into chore-sharding-tests-update
romanzac Mar 26, 2024
5a76773
Merge branch 'master' into chore-sharding-tests-update
romanzac Mar 26, 2024
dc4ed27
test: Waku store with static sharding
romanzac Mar 27, 2024
4266513
fix: add WithClusterID to see its effect
romanzac Mar 28, 2024
b9e700f
test: static sharding for lightPush
romanzac Apr 1, 2024
c15768b
Merge branch 'master' into chore-sharding-tests-update
romanzac Apr 1, 2024
2c66e91
test: static sharding for Filter
romanzac Apr 2, 2024
4e89a8f
fix: reuse tests.WaitForTimeout
romanzac Apr 2, 2024
def82f2
fix: reuse tests.WaitForMsg
romanzac Apr 2, 2024
3b571ba
fix: forgot to add utils.go
romanzac Apr 2, 2024
c80456d
test: static sharding for Relay
romanzac Apr 2, 2024
873caa8
test: static sharding limits
romanzac Apr 3, 2024
502ff9d
fix: remove named shards
romanzac Apr 4, 2024
72be483
fix: change subscription to every 10ms
romanzac Apr 4, 2024
9693bed
fix: add ENR shard info comparison
romanzac Apr 8, 2024
b6fc2cb
fix: remove expected shardIDs array
romanzac Apr 8, 2024
5de4bfa
Merge branch 'master' into chore-sharding-tests-update
romanzac Apr 8, 2024
8efec1e
fix: reset subscriptions back to 1 per 100ms
romanzac Apr 8, 2024
1cd52ee
fix: add message publish to test
romanzac Apr 10, 2024
891d9a9
fix: add missing error check
romanzac Apr 10, 2024
d27c0ed
fix: missed assigment for relay2
romanzac Apr 10, 2024
e1210c7
fix: add IsSubscribed check
romanzac Apr 10, 2024
b562771
test: log peerstore content before subscribing to topics
romanzac Apr 11, 2024
8d7e31b
test: reduce number of topics to one
romanzac Apr 15, 2024
99e3f33
fix: add timeout param to WaitForTimeout and WaitForMsg
romanzac Apr 22, 2024
adaace3
Merge branch 'master' into chore-sharding-tests-update
romanzac Apr 22, 2024
590e4ff
fix: revert test to desired form and mark it flaky
romanzac Apr 23, 2024
7404bb4
fix: keep same cluster ID for topics
romanzac May 2, 2024
12a8923
fix: start s2 store with different sharded topic
romanzac May 2, 2024
73a90e0
fix: change node2 to lightpush receiver
romanzac May 2, 2024
fa01d17
fix: returned node2 to support lightpush and relay
romanzac May 2, 2024
093ea36
fix: added comment and improved readability
romanzac May 2, 2024
dd960ef
fix: align clusterID with valid pubsub topics
romanzac May 3, 2024
2d0af55
chore: fix test to use same shard
chaitanyaprem May 3, 2024
77f6917
test: ci test
romanzac May 3, 2024
6a72e6d
test: ci test - try without mac os
romanzac May 3, 2024
1afb587
test: copy go mod from PR1091
romanzac May 3, 2024
3a1a7e6
test: copy go sum from PR1091
romanzac May 3, 2024
a05971b
Revert "test: copy go sum from PR1091"
romanzac May 3, 2024
0741101
Revert "test: copy go mod from PR1091"
romanzac May 3, 2024
8968e59
test: update go mod
romanzac May 3, 2024
a047dd8
test: delete ci_test
romanzac May 3, 2024
01803de
Revert "test: update go mod"
romanzac May 3, 2024
28c2a27
feat: storeV3 client (#1028)
richard-ramos May 3, 2024
268b53c
test: node with static sharding and multiple pubSubTopics
romanzac Mar 19, 2024
561d00a
test: remove Unsubscribe() calls
romanzac Mar 20, 2024
f1ecedb
fix: add content topics to TestStaticShardingMultipleTopics
romanzac Mar 20, 2024
6b1646d
fix: add IsSubscribed() test
romanzac Mar 20, 2024
a48ae3b
fix: switch to use GetSubscription instead of GetSubscriptionWithPubs…
romanzac Mar 21, 2024
157717c
fix: switch back to use GetSubscriptionWithPubsubTopic
romanzac Mar 21, 2024
b7e6ecf
fix: validate with messages
romanzac Mar 23, 2024
a3f4be7
fix: extend deadline for context
romanzac Mar 23, 2024
e056bda
fix: use select for timeout wait
romanzac Mar 23, 2024
548870b
fix: refactor repeated code into waitForTimeout
romanzac Mar 23, 2024
b71305b
test: Waku store with static sharding
romanzac Mar 27, 2024
061f9f8
fix: add WithClusterID to see its effect
romanzac Mar 28, 2024
2b5592e
test: static sharding for lightPush
romanzac Apr 1, 2024
2e77516
test: static sharding for Filter
romanzac Apr 2, 2024
658311d
fix: reuse tests.WaitForTimeout
romanzac Apr 2, 2024
70ff74e
fix: reuse tests.WaitForMsg
romanzac Apr 2, 2024
e8f9dca
fix: forgot to add utils.go
romanzac Apr 2, 2024
2904f56
test: static sharding for Relay
romanzac Apr 2, 2024
e764fcb
test: static sharding limits
romanzac Apr 3, 2024
5357773
fix: remove named shards
romanzac Apr 4, 2024
64e27d3
fix: change subscription to every 10ms
romanzac Apr 4, 2024
134efd7
fix: add ENR shard info comparison
romanzac Apr 8, 2024
fd5cf3e
fix: remove expected shardIDs array
romanzac Apr 8, 2024
b2e9b96
fix: reset subscriptions back to 1 per 100ms
romanzac Apr 8, 2024
63f2957
fix: add message publish to test
romanzac Apr 10, 2024
ce6ff45
fix: add missing error check
romanzac Apr 10, 2024
daf9ac0
fix: missed assigment for relay2
romanzac Apr 10, 2024
aa4a3f5
fix: add IsSubscribed check
romanzac Apr 10, 2024
efbcfaf
test: log peerstore content before subscribing to topics
romanzac Apr 11, 2024
a812491
test: reduce number of topics to one
romanzac Apr 15, 2024
5f84d25
fix: add timeout param to WaitForTimeout and WaitForMsg
romanzac Apr 22, 2024
1c80ade
fix: revert test to desired form and mark it flaky
romanzac Apr 23, 2024
6778ecb
fix: keep same cluster ID for topics
romanzac May 2, 2024
3ff86db
fix: start s2 store with different sharded topic
romanzac May 2, 2024
401e8aa
fix: change node2 to lightpush receiver
romanzac May 2, 2024
281e6cf
fix: returned node2 to support lightpush and relay
romanzac May 2, 2024
4b12401
fix: added comment and improved readability
romanzac May 2, 2024
c7883d8
fix: align clusterID with valid pubsub topics
romanzac May 3, 2024
9086397
chore: fix test to use same shard
chaitanyaprem May 3, 2024
1b7d246
test: ci test
romanzac May 3, 2024
1d263a8
test: ci test - try without mac os
romanzac May 3, 2024
8a8e660
test: copy go mod from PR1091
romanzac May 3, 2024
ce0d316
test: copy go sum from PR1091
romanzac May 3, 2024
cd3f1f9
Revert "test: copy go sum from PR1091"
romanzac May 3, 2024
3aef4a7
Revert "test: copy go mod from PR1091"
romanzac May 3, 2024
3b2c0c6
test: update go mod
romanzac May 3, 2024
b0491b0
test: delete ci_test
romanzac May 3, 2024
cbc3c4a
Revert "test: update go mod"
romanzac May 3, 2024
a369fa4
Merge remote-tracking branch 'origin/chore-sharding-tests-update' int…
romanzac May 4, 2024
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 .github/.env

This file was deleted.

6 changes: 6 additions & 0 deletions .github/docker-compose/nwaku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
nwaku:
image: "harbor.status.im/wakuorg/nwaku:latest"
command: ["--relay", "--store", "--nodekey=1122334455667788990011223344556677889900112233445566778899001122"]
ports:
- "60000"
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: xom9ikk/dotenv@v2
with:
path: ".github/"
- run: |
echo "go_version=${{ env.GO_VERSION }}" >> $GITHUB_OUTPUT

- run: |
VERSION=$(cat ./VERSION)
echo "waku_version=$VERSION" >> $GITHUB_OUTPUT
Expand All @@ -73,9 +66,9 @@ jobs:
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ needs.env.outputs.go_version }}
go-version-file: 'go.mod'
cache: false

- name: Execute golangci-lint
Expand Down Expand Up @@ -112,9 +105,9 @@ jobs:
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ needs.env.outputs.go_version }}
go-version-file: 'go.mod'
cache: false

- name: Build binary
Expand Down Expand Up @@ -154,9 +147,9 @@ jobs:
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ needs.env.outputs.go_version }}
go-version-file: 'go.mod'
cache: false

- name: "Run tests"
Expand All @@ -166,3 +159,11 @@ jobs:
run: |
docker compose -f .github/docker-compose/ganache.yml up -d
make test-onchain${{ matrix.tests == 'test-with-race' && '-with-race' || '' }}

- name: "Run storev3 tests"
run: |
docker compose -f .github/docker-compose/nwaku.yml up -d
NWAKU_HOST=$(docker-compose -f .github/docker-compose/nwaku.yml port nwaku 60000)
NWAKU_PORT=$(echo $NWAKU_HOST | cut -d ":" -f 2)
sleep 5
make test-storev3 TEST_STOREV3_NODE="/ip4/127.0.0.1/tcp/${NWAKU_PORT}/p2p/16Uiu2HAmMGhfSTUzKbsjMWxc6T1X4wiTWSF1bEWSLjAukCm7KiHV"
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,7 @@ test-postgres:

test-postgres-with-race:
${GOCMD} test -race -p 1 -v -count 1 -tags="${PG_BUILD_TAGS}" github.com/waku-org/go-waku/waku/persistence/...

TEST_STOREV3_NODE ?=
test-storev3:
TEST_STOREV3_NODE=${TEST_STOREV3_NODE} ${GOCMD} test -p 1 -v -count 1 -tags="${BUILD_TAGS} include_storev3_tests" github.com/waku-org/go-waku/waku/v2/protocol/store/...
4 changes: 2 additions & 2 deletions cmd/waku/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import (
"github.com/waku-org/go-waku/waku/v2/node"
wprotocol "github.com/waku-org/go-waku/waku/v2/protocol"
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
"github.com/waku-org/go-waku/waku/v2/protocol/legacy_store"
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
"github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange"
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
"github.com/waku-org/go-waku/waku/v2/protocol/store"
"github.com/waku-org/go-waku/waku/v2/utils"

humanize "github.com/dustin/go-humanize"
Expand Down Expand Up @@ -336,7 +336,7 @@ func Execute(options NodeOptions) error {

//For now assuming that static peers added support/listen on all topics specified via commandLine.
staticPeers := map[protocol.ID][]multiaddr.Multiaddr{
store.StoreID_v20beta4: options.Store.Nodes,
legacy_store.StoreID_v20beta4: options.Store.Nodes,
lightpush.LightPushID_v20beta1: options.LightPush.Nodes,
rendezvous.RendezvousID: options.Rendezvous.Nodes,
filter.FilterSubscribeID_v20beta1: options.Filter.Nodes,
Expand Down
28 changes: 14 additions & 14 deletions cmd/waku/server/rest/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/go-chi/chi/v5"
"github.com/multiformats/go-multiaddr"
"github.com/waku-org/go-waku/waku/v2/node"
"github.com/waku-org/go-waku/waku/v2/protocol/store"
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
"github.com/waku-org/go-waku/waku/v2/protocol/legacy_store"
"github.com/waku-org/go-waku/waku/v2/protocol/legacy_store/pb"
)

type StoreService struct {
Expand Down Expand Up @@ -55,9 +55,9 @@ func NewStoreService(node *node.WakuNode, m *chi.Mux) *StoreService {
return s
}

func getStoreParams(r *http.Request) (*store.Query, []store.HistoryRequestOption, error) {
query := &store.Query{}
var options []store.HistoryRequestOption
func getStoreParams(r *http.Request) (*legacy_store.Query, []legacy_store.HistoryRequestOption, error) {
query := &legacy_store.Query{}
var options []legacy_store.HistoryRequestOption
var err error
peerAddrStr := r.URL.Query().Get("peerAddr")
var m multiaddr.Multiaddr
Expand All @@ -66,12 +66,12 @@ func getStoreParams(r *http.Request) (*store.Query, []store.HistoryRequestOption
if err != nil {
return nil, nil, err
}
options = append(options, store.WithPeerAddr(m))
options = append(options, legacy_store.WithPeerAddr(m))
} else {
// The user didn't specify a peer address and self-node is configured as a store node.
// In this case we assume that the user is willing to retrieve the messages stored by
// the local/self store node.
options = append(options, store.WithLocalQuery())
options = append(options, legacy_store.WithLocalQuery())
}

query.PubsubTopic = r.URL.Query().Get("pubsubTopic")
Expand Down Expand Up @@ -131,14 +131,14 @@ func getStoreParams(r *http.Request) (*store.Query, []store.HistoryRequestOption

cursor.PubsubTopic = query.PubsubTopic

options = append(options, store.WithCursor(cursor))
options = append(options, legacy_store.WithCursor(cursor))
}

pageSizeStr := r.URL.Query().Get("pageSize")
ascendingStr := r.URL.Query().Get("ascending")
if ascendingStr != "" || pageSizeStr != "" {
ascending := true
pageSize := uint64(store.DefaultPageSize)
pageSize := uint64(legacy_store.DefaultPageSize)
if ascendingStr != "" {
ascending, err = strconv.ParseBool(ascendingStr)
if err != nil {
Expand All @@ -151,12 +151,12 @@ func getStoreParams(r *http.Request) (*store.Query, []store.HistoryRequestOption
if err != nil {
return nil, nil, err
}
if pageSize > store.MaxPageSize {
pageSize = store.MaxPageSize
if pageSize > legacy_store.MaxPageSize {
pageSize = legacy_store.MaxPageSize
}
}

options = append(options, store.WithPaging(ascending, pageSize))
options = append(options, legacy_store.WithPaging(ascending, pageSize))
}

return query, options, nil
Expand All @@ -166,7 +166,7 @@ func writeStoreError(w http.ResponseWriter, code int, err error) {
writeResponse(w, StoreResponse{ErrorMessage: err.Error()}, code)
}

func toStoreResponse(result *store.Result) StoreResponse {
func toStoreResponse(result *legacy_store.Result) StoreResponse {
response := StoreResponse{}

cursor := result.Cursor()
Expand Down Expand Up @@ -202,7 +202,7 @@ func (d *StoreService) getV1Messages(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
defer cancel()

result, err := d.node.Store().Query(ctx, *query, options...)
result, err := d.node.LegacyStore().Query(ctx, *query, options...)
if err != nil {
writeStoreError(w, http.StatusInternalServerError, err)
return
Expand Down
4 changes: 3 additions & 1 deletion cmd/waku/server/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/libp2p/go-libp2p/core/protocol"
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
"github.com/waku-org/go-waku/waku/v2/protocol/legacy_store"
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
"github.com/waku-org/go-waku/waku/v2/protocol/store"
Expand All @@ -16,7 +17,8 @@ func IsWakuProtocol(protocol protocol.ID) bool {
protocol == filter.FilterSubscribeID_v20beta1 ||
protocol == relay.WakuRelayID_v200 ||
protocol == lightpush.LightPushID_v20beta1 ||
protocol == store.StoreID_v20beta4
protocol == legacy_store.StoreID_v20beta4 ||
protocol == store.StoreQueryID_v300
}

type Base64URLByte []byte
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-relay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func write(ctx context.Context, wakuNode *node.WakuNode, contentTopic string, ms
if err != nil {
log.Error("Error sending a message", zap.Error(err))
}
log.Info("Published msg,", zap.String("data", string(msg.Payload)), logging.HexBytes("hash", hash))
log.Info("Published msg,", zap.String("data", string(msg.Payload)), logging.HexBytes("hash", hash.Bytes()))
}

func writeLoop(ctx context.Context, wakuNode *node.WakuNode, contentTopic string) {
Expand Down
16 changes: 8 additions & 8 deletions examples/chat2/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
"github.com/waku-org/go-waku/waku/v2/payload"
"github.com/waku-org/go-waku/waku/v2/protocol"
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
"github.com/waku-org/go-waku/waku/v2/protocol/legacy_store"
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
wrln "github.com/waku-org/go-waku/waku/v2/protocol/rln"
"github.com/waku-org/go-waku/waku/v2/protocol/store"
"github.com/waku-org/go-waku/waku/v2/utils"
"google.golang.org/protobuf/proto"
)
Expand Down Expand Up @@ -368,10 +368,10 @@ func (c *Chat) retrieveHistory(connectionWg *sync.WaitGroup) {
return
}

var storeOpt store.HistoryRequestOption
var storeOpt legacy_store.HistoryRequestOption
if c.options.Store.Node == nil {
c.ui.InfoMessage("No store node configured. Choosing one at random...")
storeOpt = store.WithAutomaticPeerSelection()
storeOpt = legacy_store.WithAutomaticPeerSelection()
} else {
peerID, err := (*c.options.Store.Node).ValueForProtocol(multiaddr.P_P2P)
if err != nil {
Expand All @@ -383,22 +383,22 @@ func (c *Chat) retrieveHistory(connectionWg *sync.WaitGroup) {
c.ui.ErrorMessage(err)
return
}
storeOpt = store.WithPeer(pID)
storeOpt = legacy_store.WithPeer(pID)
c.ui.InfoMessage(fmt.Sprintf("Querying historic messages from %s", peerID))

}

tCtx, cancel := context.WithTimeout(c.ctx, 10*time.Second)
defer cancel()

q := store.Query{
q := legacy_store.Query{
ContentTopics: []string{options.ContentTopic},
}

response, err := c.node.Store().Query(tCtx, q,
store.WithAutomaticRequestID(),
response, err := c.node.LegacyStore().Query(tCtx, q,
legacy_store.WithAutomaticRequestID(),
storeOpt,
store.WithPaging(false, 100))
legacy_store.WithPaging(false, 100))

if err != nil {
c.ui.ErrorMessage(fmt.Errorf("could not query storenode: %w", err))
Expand Down
4 changes: 2 additions & 2 deletions examples/chat2/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/waku-org/go-waku/waku/v2/node"
"github.com/waku-org/go-waku/waku/v2/peerstore"
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
"github.com/waku-org/go-waku/waku/v2/protocol/legacy_store"
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
"github.com/waku-org/go-waku/waku/v2/protocol/store"
)

func execute(options Options) {
Expand Down Expand Up @@ -77,7 +77,7 @@ func execute(options Options) {
return
}

err = addPeer(wakuNode, options.Store.Node, options.Relay.Topics.Value(), store.StoreID_v20beta4)
err = addPeer(wakuNode, options.Store.Node, options.Relay.Topics.Value(), legacy_store.StoreID_v20beta4)
if err != nil {
fmt.Println(err.Error())
return
Expand Down
4 changes: 2 additions & 2 deletions library/lightpush.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/waku-org/go-waku/waku/v2/protocol/pb"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
)
Expand Down Expand Up @@ -42,7 +41,8 @@ func lightpushPublish(instance *WakuInstance, msg *pb.WakuMessage, pubsubTopic s
}

hash, err := instance.node.Lightpush().Publish(ctx, msg, lpOptions...)
return hexutil.Encode(hash), err

return hash.String(), err
}

// LightpushPublish is used to publish a WakuMessage in a pubsub topic using Lightpush protocol
Expand Down
3 changes: 1 addition & 2 deletions library/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/peer"
Expand Down Expand Up @@ -444,7 +443,7 @@ type subscriptionMsg struct {

func toSubscriptionMessage(msg *protocol.Envelope) *subscriptionMsg {
return &subscriptionMsg{
MessageID: hexutil.Encode(msg.Hash()),
MessageID: msg.Hash().String(),
PubsubTopic: msg.PubsubTopic(),
Message: msg.Message(),
}
Expand Down
4 changes: 2 additions & 2 deletions library/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"time"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/waku-org/go-waku/waku/v2/protocol"
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
Expand Down Expand Up @@ -40,7 +39,8 @@ func relayPublish(instance *WakuInstance, msg *pb.WakuMessage, pubsubTopic strin
}

hash, err := instance.node.Relay().Publish(ctx, msg, relay.WithPubSubTopic(pubsubTopic))
return hexutil.Encode(hash), err

return hash.String(), err
}

// RelayPublish publishes a message using waku relay and returns the message ID
Expand Down
Loading
Loading