From e81223a97c5f20565cf5fddb4fe07c8441465ba5 Mon Sep 17 00:00:00 2001 From: oskarth Date: Fri, 9 Apr 2021 03:31:17 +0000 Subject: [PATCH] deploy: b5f1becace723bdb3783bafaa6e352db8f1b78b7 --- .update.timestamp | 2 +- tests/v2/test_waku_store.nim | 15 ++-------- .../vendor/libbacktrace-upstream/libtool | 2 +- waku/v2/protocol/waku_store/waku_store.nim | 28 +++---------------- 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/.update.timestamp b/.update.timestamp index ebe554cc6..a98903177 100644 --- a/.update.timestamp +++ b/.update.timestamp @@ -1 +1 @@ -1617875719 \ No newline at end of file +1617937760 \ No newline at end of file diff --git a/tests/v2/test_waku_store.nim b/tests/v2/test_waku_store.nim index b8b8a9b2f..98e2c5db5 100644 --- a/tests/v2/test_waku_store.nim +++ b/tests/v2/test_waku_store.nim @@ -298,22 +298,10 @@ procSuite "Waku Store": decodedEmptyIndex.isErr == false decodedEmptyIndex.value == emptyIndex - - test "PagingDirection Protobuf encod/init test": - let - pagingDirection = PagingDirection.BACKWARD - pb = pagingDirection.encode() - decodedPagingDirection = PagingDirection.init(pb.buffer) - - check: - # the decodedPagingDirection must be the same as the original pagingDirection - decodedPagingDirection.isErr == false - decodedPagingDirection.value == pagingDirection - test "PagingInfo Protobuf encod/init test": let index = computeIndex(WakuMessage(payload: @[byte 1], contentTopic: defaultContentTopic)) - pagingInfo = PagingInfo(pageSize: 1, cursor: index, direction: PagingDirection.BACKWARD) + pagingInfo = PagingInfo(pageSize: 1, cursor: index, direction: PagingDirection.FORWARD) pb = pagingInfo.encode() decodedPagingInfo = PagingInfo.init(pb.buffer) @@ -321,6 +309,7 @@ procSuite "Waku Store": # the fields of decodedPagingInfo must be the same as the original pagingInfo decodedPagingInfo.isErr == false decodedPagingInfo.value == pagingInfo + decodedPagingInfo.value.direction == pagingInfo.direction let emptyPagingInfo = PagingInfo() diff --git a/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool b/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool index 909c0ffa4..e959d0065 100755 --- a/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool +++ b/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool @@ -2,7 +2,7 @@ # libtool - Provide generalized library-building support services. # Generated automatically by config.status (libbacktrace) version-unused -# Libtool was configured on host fv-az193-129: +# Libtool was configured on host fv-az278-724: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, diff --git a/waku/v2/protocol/waku_store/waku_store.nim b/waku/v2/protocol/waku_store/waku_store.nim index bc8044ad6..437925158 100644 --- a/waku/v2/protocol/waku_store/waku_store.nim +++ b/waku/v2/protocol/waku_store/waku_store.nim @@ -59,16 +59,6 @@ proc encode*(index: Index): ProtoBuffer = result.write(1, index.digest.data) result.write(2, index.receivedTime) -proc encode*(pd: PagingDirection): ProtoBuffer = - ## encodes a PagingDirection into a ProtoBuffer - ## returns the resultant ProtoBuffer - - # intiate a ProtoBuffer - result = initProtoBuffer() - - # encodes pd - result.write(1, uint32(ord(pd))) - proc encode*(pinfo: PagingInfo): ProtoBuffer = ## encodes a PagingInfo object into a ProtoBuffer ## returns the resultant ProtoBuffer @@ -79,7 +69,7 @@ proc encode*(pinfo: PagingInfo): ProtoBuffer = # encodes pinfo result.write(1, pinfo.pageSize) result.write(2, pinfo.cursor.encode()) - result.write(3, pinfo.direction.encode()) + result.write(3, uint32(ord(pinfo.direction))) proc init*(T: type Index, buffer: seq[byte]): ProtoResult[T] = ## creates and returns an Index object out of buffer @@ -101,16 +91,6 @@ proc init*(T: type Index, buffer: seq[byte]): ProtoResult[T] = ok(index) -proc init*(T: type PagingDirection, buffer: seq[byte]): ProtoResult[T] = - ## creates and returns a PagingDirection object out of buffer - let pb = initProtoBuffer(buffer) - - var dir: uint32 - discard ? pb.getField(1, dir) - var direction = PagingDirection(dir) - - ok(direction) - proc init*(T: type PagingInfo, buffer: seq[byte]): ProtoResult[T] = ## creates and returns a PagingInfo object out of buffer var pagingInfo = PagingInfo() @@ -125,9 +105,9 @@ proc init*(T: type PagingInfo, buffer: seq[byte]): ProtoResult[T] = discard ? pb.getField(2, cursorBuffer) pagingInfo.cursor = ? Index.init(cursorBuffer) - var directionBuffer: seq[byte] - discard ? pb.getField(3, directionBuffer) - pagingInfo.direction = ? PagingDirection.init(directionBuffer) + var direction: uint32 + discard ? pb.getField(3, direction) + pagingInfo.direction = PagingDirection(direction) ok(pagingInfo)