applying feedback

This commit is contained in:
Gabriel mermelstein 2025-01-17 18:21:47 +01:00
parent be664cd6ec
commit 9dd3b09d78
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D
3 changed files with 8 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package common
import ( import (
"encoding/hex" "encoding/hex"
"errors"
"fmt" "fmt"
) )
@ -10,11 +11,11 @@ type MessageHash string
func ToMessageHash(val string) (MessageHash, error) { func ToMessageHash(val string) (MessageHash, error) {
if len(val) == 0 { if len(val) == 0 {
return "", fmt.Errorf("empty string not allowed") return "", errors.New("empty string not allowed")
} }
if len(val) < 2 || val[:2] != "0x" { if len(val) < 2 || val[:2] != "0x" {
return "", fmt.Errorf("string must start with 0x") return "", errors.New("string must start with 0x")
} }
// Remove "0x" prefix for hex decoding // Remove "0x" prefix for hex decoding

View File

@ -8,15 +8,15 @@ type StoreQueryRequest struct {
TimeStart *int64 `json:"time_start,omitempty"` TimeStart *int64 `json:"time_start,omitempty"`
TimeEnd *int64 `json:"time_end,omitempty"` TimeEnd *int64 `json:"time_end,omitempty"`
MessageHashes *[]MessageHash `json:"message_hashes,omitempty"` MessageHashes *[]MessageHash `json:"message_hashes,omitempty"`
PaginationCursor MessageHash `json:"pagination_cursor,omitempty"` PaginationCursor *MessageHash `json:"pagination_cursor,omitempty"`
PaginationForward bool `json:"pagination_forward"` PaginationForward bool `json:"pagination_forward"`
PaginationLimit *uint64 `json:"pagination_limit,omitempty"` PaginationLimit *uint64 `json:"pagination_limit,omitempty"`
} }
type StoreMessageResponse struct { type StoreMessageResponse struct {
WakuMessage tmpWakuMessageJson `json:"message"` WakuMessage *tmpWakuMessageJson `json:"message"`
PubsubTopic string `json:"pubsubTopic"` PubsubTopic string `json:"pubsubTopic"`
MessageHash MessageHash `json:"messageHash"` MessageHash MessageHash `json:"messageHash"`
} }
type StoreQueryResponse struct { type StoreQueryResponse struct {

View File

@ -777,7 +777,7 @@ func TestStore(t *testing.T) {
PaginationLimit: proto.Uint64(uint64(paginationLimit)), PaginationLimit: proto.Uint64(uint64(paginationLimit)),
PaginationForward: true, PaginationForward: true,
TimeStart: timeStart, TimeStart: timeStart,
PaginationCursor: res1.PaginationCursor, PaginationCursor: &res1.PaginationCursor,
} }
ctx4, cancel4 := context.WithTimeout(context.Background(), requestTimeout) ctx4, cancel4 := context.WithTimeout(context.Background(), requestTimeout)