diff --git a/waku/node/waku_node.nim b/waku/node/waku_node.nim index a2be401d76..f869de5794 100644 --- a/waku/node/waku_node.nim +++ b/waku/node/waku_node.nim @@ -832,6 +832,7 @@ proc toStoreResult(res: ArchiveResult): StoreQueryResult = var res = StoreQueryResponse() res.statusCode = 200 + res.statusDesc = "OK" res.messages = response.hashes.zip(response.messages).mapIt( WakuMessageKeyValue(messageHash: it[0], message: it[1]) ) diff --git a/waku/waku_store/protocol.nim b/waku/waku_store/protocol.nim index 22210a64a3..ad43394a85 100644 --- a/waku/waku_store/protocol.nim +++ b/waku/waku_store/protocol.nim @@ -91,6 +91,7 @@ proc handleQueryRequest*( res.requestId = requestId res.statusCode = 200 + res.statusDesc = "OK" info "sending store query response", peerId = requestor, requestId = requestId, messages = res.messages.len diff --git a/waku/waku_store/rpc_codec.nim b/waku/waku_store/rpc_codec.nim index cfe7423a26..f1f49ad908 100644 --- a/waku/waku_store/rpc_codec.nim +++ b/waku/waku_store/rpc_codec.nim @@ -16,20 +16,20 @@ proc encode*(req: StoreQueryRequest): ProtoBuffer = pb.write3(1, req.requestId) pb.write3(2, req.includeData) - pb.write3(3, req.pubsubTopic) + pb.write3(10, req.pubsubTopic) for contentTopic in req.contentTopics: - pb.write3(4, contentTopic) + pb.write3(11, contentTopic) pb.write3( - 5, + 12, req.startTime.map( proc(time: int64): zint64 = zint64(time) ), ) pb.write3( - 6, + 13, req.endTime.map( proc(time: int64): zint64 = zint64(time) @@ -37,11 +37,11 @@ proc encode*(req: StoreQueryRequest): ProtoBuffer = ) for hash in req.messagehashes: - pb.write3(7, hash) + pb.write3(20, hash) - pb.write3(8, req.paginationCursor) - pb.write3(9, uint32(req.paginationForward)) - pb.write3(10, req.paginationLimit) + pb.write3(51, req.paginationCursor) + pb.write3(52, uint32(req.paginationForward)) + pb.write3(53, req.paginationLimit) pb.finish3() @@ -63,31 +63,31 @@ proc decode*( req.includeData = inclData == 1 var pubsubTopic: string - if not ?pb.getField(3, pubsubTopic): + if not ?pb.getField(10, pubsubTopic): req.pubsubTopic = none(string) else: req.pubsubTopic = some(pubsubTopic) var topics: seq[string] - if not ?pb.getRepeatedField(4, topics): + if not ?pb.getRepeatedField(11, topics): req.contentTopics = @[] else: req.contentTopics = topics var start: zint64 - if not ?pb.getField(5, start): + if not ?pb.getField(12, start): req.startTime = none(Timestamp) else: req.startTime = some(Timestamp(int64(start))) var endTime: zint64 - if not ?pb.getField(6, endTime): + if not ?pb.getField(13, endTime): req.endTime = none(Timestamp) else: req.endTime = some(Timestamp(int64(endTime))) var buffer: seq[seq[byte]] - if not ?pb.getRepeatedField(7, buffer): + if not ?pb.getRepeatedField(20, buffer): req.messageHashes = @[] else: req.messageHashes = newSeqOfCap[WakuMessageHash](buffer.len) @@ -97,7 +97,7 @@ proc decode*( req.messageHashes.add(hash) var cursor: seq[byte] - if not ?pb.getField(8, cursor): + if not ?pb.getField(51, cursor): req.paginationCursor = none(WakuMessageHash) else: var hash: WakuMessageHash @@ -105,13 +105,13 @@ proc decode*( req.paginationCursor = some(hash) var paging: uint32 - if not ?pb.getField(9, paging): + if not ?pb.getField(52, paging): req.paginationForward = PagingDirection.default() else: req.paginationForward = PagingDirection(paging) var limit: uint64 - if not ?pb.getField(10, limit): + if not ?pb.getField(53, limit): req.paginationLimit = none(uint64) else: req.paginationLimit = some(limit) @@ -135,13 +135,13 @@ proc encode*(res: StoreQueryResponse): ProtoBuffer = pb.write3(1, res.requestId) - pb.write3(2, res.statusCode) - pb.write3(3, res.statusDesc) + pb.write3(10, res.statusCode) + pb.write3(11, res.statusDesc) for msg in res.messages: - pb.write3(4, msg.encode()) + pb.write3(20, msg.encode()) - pb.write3(5, res.paginationCursor) + pb.write3(51, res.paginationCursor) pb.finish3() @@ -179,19 +179,19 @@ proc decode*( return err(ProtobufError.missingRequiredField("request_id")) var code: uint32 - if not ?pb.getField(2, code): + if not ?pb.getField(10, code): return err(ProtobufError.missingRequiredField("status_code")) else: res.statusCode = code var desc: string - if not ?pb.getField(3, desc): + if not ?pb.getField(11, desc): return err(ProtobufError.missingRequiredField("status_desc")) else: res.statusDesc = desc var buffer: seq[seq[byte]] - if not ?pb.getRepeatedField(4, buffer): + if not ?pb.getRepeatedField(20, buffer): res.messages = @[] else: res.messages = newSeqOfCap[WakuMessageKeyValue](buffer.len) @@ -200,7 +200,7 @@ proc decode*( res.messages.add(msg) var cursor: seq[byte] - if not ?pb.getField(5, cursor): + if not ?pb.getField(51, cursor): res.paginationCursor = none(WakuMessageHash) else: var hash: WakuMessageHash