Fixes the order of fields of History Response protobuf (#676)

* shifts history response field numbers by 1

* adds changelog

* minor rewording

* minor
This commit is contained in:
Sanaz Taheri Boshrooyeh 2021-07-20 11:51:32 -07:00 committed by GitHub
parent 108599a1ed
commit 52b99f37af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -11,6 +11,8 @@ This release contains the following:
- Updates the `resume` Nim API to fetch historical messages in sequence of pages.
- Support for stable version of `relay` protocol, with protocol ID `/vac/waku/relay/2.0.0`
- Support for multiple protocol IDs - now matches any protocol that adds postfix to stable ID.
- Updates the order of fields of `HistoryResponse` protobuf message.
The filed numbers of the `HistoryResponse` are shifted up by one to match up the [13/WAKU2-STORE](https://rfc.vac.dev/spec/13/) specs.
#### General refactoring
#### Docs

View File

@ -174,17 +174,17 @@ proc init*(T: type HistoryResponse, buffer: seq[byte]): ProtoResult[T] =
let pb = initProtoBuffer(buffer)
var messages: seq[seq[byte]]
discard ? pb.getRepeatedField(1, messages)
discard ? pb.getRepeatedField(2, messages)
for buf in messages:
msg.messages.add(? WakuMessage.init(buf))
var pagingInfoBuffer: seq[byte]
discard ? pb.getField(2,pagingInfoBuffer)
discard ? pb.getField(3, pagingInfoBuffer)
msg.pagingInfo= ? PagingInfo.init(pagingInfoBuffer)
var error: uint32
discard ? pb.getField(3, error)
discard ? pb.getField(4, error)
msg.error = HistoryResponseError(error)
return ok(msg)
@ -232,11 +232,11 @@ proc encode*(response: HistoryResponse): ProtoBuffer =
var output = initProtoBuffer()
for msg in response.messages:
output.write(1, msg.encode())
output.write(2, msg.encode())
output.write(2, response.pagingInfo.encode())
output.write(3, response.pagingInfo.encode())
output.write(3, uint32(ord(response.error)))
output.write(4, uint32(ord(response.error)))
return output