mirror of https://github.com/status-im/nim-eth.git
Reduce compiler warnings related to rlp encode int (#699)
This commit is contained in:
parent
9b6497ed8a
commit
4cccf25af7
|
@ -52,7 +52,7 @@ proc append*(w: var RlpWriter, a: IpAddress) =
|
||||||
of IpAddressFamily.IPv4:
|
of IpAddressFamily.IPv4:
|
||||||
w.append(a.address_v4)
|
w.append(a.address_v4)
|
||||||
|
|
||||||
proc append(w: var RlpWriter, p: Port) = w.append(p.int)
|
proc append(w: var RlpWriter, p: Port) = w.append(p.uint)
|
||||||
proc append(w: var RlpWriter, pk: PublicKey) = w.append(pk.toRaw())
|
proc append(w: var RlpWriter, pk: PublicKey) = w.append(pk.toRaw())
|
||||||
proc append(w: var RlpWriter, h: MDigest[256]) = w.append(h.data)
|
proc append(w: var RlpWriter, h: MDigest[256]) = w.append(h.data)
|
||||||
|
|
||||||
|
@ -110,11 +110,11 @@ proc send(d: DiscoveryProtocol, n: Node, data: seq[byte]) =
|
||||||
debug "Discovery send failed", msg = f.readError.msg
|
debug "Discovery send failed", msg = f.readError.msg
|
||||||
except FutureError as exc:
|
except FutureError as exc:
|
||||||
error "Failed to get discovery send future error", msg=exc.msg
|
error "Failed to get discovery send future error", msg=exc.msg
|
||||||
|
|
||||||
f.addCallback cb
|
f.addCallback cb
|
||||||
|
|
||||||
proc sendPing*(d: DiscoveryProtocol, n: Node): seq[byte] =
|
proc sendPing*(d: DiscoveryProtocol, n: Node): seq[byte] =
|
||||||
let payload = rlp.encode((PROTO_VERSION, d.address, n.node.address,
|
let payload = rlp.encode((PROTO_VERSION.uint, d.address, n.node.address,
|
||||||
expiration()))
|
expiration()))
|
||||||
let msg = pack(cmdPing, payload, d.privKey)
|
let msg = pack(cmdPing, payload, d.privKey)
|
||||||
result = msg[0 ..< MAC_SIZE]
|
result = msg[0 ..< MAC_SIZE]
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
|
||||||
var `rlpWriter` = `initRlpWriter`()
|
var `rlpWriter` = `initRlpWriter`()
|
||||||
const `perProtocolMsgIdVar` {.used.} = `msgId`
|
const `perProtocolMsgIdVar` {.used.} = `msgId`
|
||||||
let `perPeerMsgIdVar` = `perPeerMsgIdValue`
|
let `perPeerMsgIdVar` = `perPeerMsgIdValue`
|
||||||
`append`(`rlpWriter`, `perPeerMsgIdVar`)
|
`append`(`rlpWriter`, `perPeerMsgIdVar`.uint)
|
||||||
|
|
||||||
when tracingEnabled:
|
when tracingEnabled:
|
||||||
appendParams.add logSentMsgFields(peerVar, protocol, msgId, paramsToWrite)
|
appendParams.add logSentMsgFields(peerVar, protocol, msgId, paramsToWrite)
|
||||||
|
@ -1032,6 +1032,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
|
||||||
newLit(protocol.version),
|
newLit(protocol.version),
|
||||||
protocol.peerInit, protocol.netInit)
|
protocol.peerInit, protocol.netInit)
|
||||||
|
|
||||||
|
|
||||||
p2pProtocol DevP2P(version = 5, rlpxName = "p2p"):
|
p2pProtocol DevP2P(version = 5, rlpxName = "p2p"):
|
||||||
proc hello(peer: Peer,
|
proc hello(peer: Peer,
|
||||||
version: uint,
|
version: uint,
|
||||||
|
|
|
@ -460,7 +460,7 @@ proc mergeAndGraft(self: var HexaryTrie;
|
||||||
output.append hexPrefixEncode(NibblesSeq(), true)
|
output.append hexPrefixEncode(NibblesSeq(), true)
|
||||||
else:
|
else:
|
||||||
doAssert(not soleChild.isEmpty)
|
doAssert(not soleChild.isEmpty)
|
||||||
output.append int(hexPrefixEncodeByte(childPos))
|
output.append uint(hexPrefixEncodeByte(childPos))
|
||||||
output.append(soleChild)
|
output.append(soleChild)
|
||||||
result = output.finish()
|
result = output.finish()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue