From 39857d57f0a96a23bbb34c3c3d6c6ab2321c742f Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Wed, 18 Dec 2019 01:16:28 +0200 Subject: [PATCH] Fix build issues manifesting in our controlled build environment --- eth/p2p/discoveryv5/protocol.nim | 7 +++++-- eth/p2p/discoveryv5/types.nim | 5 +++++ eth/rlp.nim | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/eth/p2p/discoveryv5/protocol.nim b/eth/p2p/discoveryv5/protocol.nim index 19a3c54..d926737 100644 --- a/eth/p2p/discoveryv5/protocol.nim +++ b/eth/p2p/discoveryv5/protocol.nim @@ -1,5 +1,8 @@ -import tables, sets, endians, options, math -import types, encoding, node, routing_table, eth/[rlp, keys], chronicles, chronos, ../enode, stint, enr, byteutils +import + tables, sets, endians, options, math, + stew/byteutils, eth/[rlp, keys], chronicles, chronos, stint, + ../enode, types, encoding, node, routing_table, enr + import nimcrypto except toHex type diff --git a/eth/p2p/discoveryv5/types.nim b/eth/p2p/discoveryv5/types.nim index 2cb15e3..0277f1e 100644 --- a/eth/p2p/discoveryv5/types.nim +++ b/eth/p2p/discoveryv5/types.nim @@ -14,6 +14,11 @@ type Database* = ref object of RootRef PacketKind* = enum + # TODO This is needed only to make Nim 1.0.4 happy + # Without it, the `PacketKind` type cannot be used as + # a discriminator in case objects. + unused = 0x00 + ping = 0x01 pong = 0x02 findnode = 0x03 diff --git a/eth/rlp.nim b/eth/rlp.nim index bc075cf..82107f7 100644 --- a/eth/rlp.nim +++ b/eth/rlp.nim @@ -61,7 +61,7 @@ proc rlpFromHex*(input: string): Rlp = proc hasData*(self: Rlp): bool = position < bytes.len -proc currentElemEnd(self: Rlp): int {.gcsafe.} +proc currentElemEnd*(self: Rlp): int {.gcsafe.} proc rawData*(self: Rlp): BytesRange = return self.bytes[position ..< self.currentElemEnd] @@ -233,7 +233,7 @@ proc toBytes*(self: Rlp): BytesRange = result = bytes.slice(ibegin, iend) -proc currentElemEnd(self: Rlp): int = +proc currentElemEnd*(self: Rlp): int = doAssert hasData() result = position