fix compilation issues

This commit is contained in:
Ivan Folgueira Bande 2026-01-25 23:08:12 +01:00
parent 78679c8369
commit ff7345b541
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7
3 changed files with 15 additions and 14 deletions

View File

@ -358,8 +358,8 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/libp2p/go-libp2p/core/peer"
libp2pproto "github.com/libp2p/go-libp2p/core/protocol"
"github.com/multiformats/go-multiaddr"
"github.com/logos-messaging/logos-messaging-go-bindings/waku/utils"
"github.com/multiformats/go-multiaddr"
"github.com/logos-messaging/logos-messaging-go-bindings/waku/common"
)
@ -993,12 +993,12 @@ func (n *WakuNode) StoreQuery(ctx context.Context, storeRequest *common.StoreQue
return nil, errors.New(errMsg)
}
func (n *WakuNode) RelayPublish(ctx context.Context, message *pb.WakuMessage, pubsubTopic string) (common.MessageHash, error) {
func (n *WakuNode) RelayPublish(ctx context.Context, message *common.WakuMessage, pubsubTopic string) (common.MessageHash, error) {
timeoutMs := getContextTimeoutMilliseconds(ctx)
jsonMsg, err := json.Marshal(message)
if err != nil {
return common.MessageHash(""), err
return common.MessageHash([32]byte{}), err
}
wg := sync.WaitGroup{}
@ -1017,19 +1017,19 @@ func (n *WakuNode) RelayPublish(ctx context.Context, message *pb.WakuMessage, pu
msgHash := C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp)))
parsedMsgHash, err := common.ToMessageHash(msgHash)
if err != nil {
return common.MessageHash(""), err
return common.MessageHash([32]byte{}), err
}
return parsedMsgHash, nil
}
errMsg := "WakuRelayPublish: " + C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp)))
return common.MessageHash(""), errors.New(errMsg)
return common.MessageHash([32]byte{}), errors.New(errMsg)
}
func (n *WakuNode) RelayPublishNoCTX(pubsubTopic string, message *pb.WakuMessage) (common.MessageHash, error) {
func (n *WakuNode) RelayPublishNoCTX(pubsubTopic string, message *common.WakuMessage) (common.MessageHash, error) {
if n == nil {
err := errors.New("cannot publish message; node is nil")
Error("Failed to publish message via relay: %v", err)
return "", err
return common.MessageHash([32]byte{}), err
}
// Handling context internally with a timeout
@ -1041,7 +1041,7 @@ func (n *WakuNode) RelayPublishNoCTX(pubsubTopic string, message *pb.WakuMessage
msgHash, err := n.RelayPublish(ctx, message, pubsubTopic)
if err != nil {
Error("Failed to publish message via relay on node %s: %v", n.nodeName, err)
return "", err
return common.MessageHash([32]byte{}), err
}
Debug("Successfully published message via relay on node %s, messageHash: %s", n.nodeName, msgHash.String())

View File

@ -87,7 +87,7 @@ func RetryWithBackOff(o func() error, options ...BackOffOption) error {
return backoff.Retry(o, &b)
}
func (n *WakuNode) CreateMessage(customMessage ...*pb.WakuMessage) *pb.WakuMessage {
func (n *WakuNode) CreateMessage(customMessage ...*common.WakuMessage) *common.WakuMessage {
Debug("Creating a WakuMessage on node %s", n.nodeName)
if len(customMessage) > 0 && customMessage[0] != nil {
@ -96,7 +96,7 @@ func (n *WakuNode) CreateMessage(customMessage ...*pb.WakuMessage) *pb.WakuMessa
}
Debug("Using default message format on node %s", n.nodeName)
defaultMessage := &pb.WakuMessage{
defaultMessage := &common.WakuMessage{
Payload: []byte("This is a default Waku message payload"),
ContentTopic: DefaultContentTopic,
Version: proto.Uint32(0),
@ -140,7 +140,7 @@ func WaitForAutoConnection(nodeList []*WakuNode) error {
return nil
}
func (n *WakuNode) VerifyMessageReceived(expectedMessage *pb.WakuMessage, expectedHash common.MessageHash, timeout ...time.Duration) error {
func (n *WakuNode) VerifyMessageReceived(expectedMessage *common.WakuMessage, expectedHash common.MessageHash, timeout ...time.Duration) error {
var verifyTimeout time.Duration
if len(timeout) > 0 {

View File

@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/logos-messaging/logos-messaging-go-bindings/waku/common"
)
// KeyKind indicates the type of encryption to apply
@ -89,7 +90,7 @@ func (payload Payload) Encode(version uint32) ([]byte, error) {
return nil, errors.New("unsupported wakumessage version")
}
func EncodeWakuMessage(message *WakuMessage, keyInfo *KeyInfo) error {
func EncodeWakuMessage(message *common.WakuMessage, keyInfo *KeyInfo) error {
msgPayload := message.Payload
payload := Payload{
Data: msgPayload,
@ -107,7 +108,7 @@ func EncodeWakuMessage(message *WakuMessage, keyInfo *KeyInfo) error {
// DecodePayload decodes a WakuMessage depending on the version parameter.
// 0 for raw unencrypted data, and 1 for using WakuV1 decoding
func DecodePayload(message *WakuMessage, keyInfo *KeyInfo) (*DecodedPayload, error) {
func DecodePayload(message *common.WakuMessage, keyInfo *KeyInfo) (*DecodedPayload, error) {
switch message.GetVersion() {
case uint32(0):
return &DecodedPayload{Data: message.Payload}, nil
@ -152,7 +153,7 @@ func DecodePayload(message *WakuMessage, keyInfo *KeyInfo) (*DecodedPayload, err
return nil, errors.New("unsupported wakumessage version")
}
func DecodeWakuMessage(message *WakuMessage, keyInfo *KeyInfo) error {
func DecodeWakuMessage(message *common.WakuMessage, keyInfo *KeyInfo) error {
decodedPayload, err := DecodePayload(message, keyInfo)
if err != nil {
return err