Reduce compiler warnings related to rlp encode int (#699)

This commit is contained in:
andri lim 2024-06-12 09:29:18 +07:00 committed by GitHub
parent 9b6497ed8a
commit 4cccf25af7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View File

@ -52,7 +52,7 @@ proc append*(w: var RlpWriter, a: IpAddress) =
of IpAddressFamily.IPv4:
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, h: MDigest[256]) = w.append(h.data)
@ -114,7 +114,7 @@ proc send(d: DiscoveryProtocol, n: Node, data: seq[byte]) =
f.addCallback cb
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()))
let msg = pack(cmdPing, payload, d.privKey)
result = msg[0 ..< MAC_SIZE]

View File

@ -1000,7 +1000,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
var `rlpWriter` = `initRlpWriter`()
const `perProtocolMsgIdVar` {.used.} = `msgId`
let `perPeerMsgIdVar` = `perPeerMsgIdValue`
`append`(`rlpWriter`, `perPeerMsgIdVar`)
`append`(`rlpWriter`, `perPeerMsgIdVar`.uint)
when tracingEnabled:
appendParams.add logSentMsgFields(peerVar, protocol, msgId, paramsToWrite)
@ -1032,6 +1032,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
newLit(protocol.version),
protocol.peerInit, protocol.netInit)
p2pProtocol DevP2P(version = 5, rlpxName = "p2p"):
proc hello(peer: Peer,
version: uint,

View File

@ -460,7 +460,7 @@ proc mergeAndGraft(self: var HexaryTrie;
output.append hexPrefixEncode(NibblesSeq(), true)
else:
doAssert(not soleChild.isEmpty)
output.append int(hexPrefixEncodeByte(childPos))
output.append uint(hexPrefixEncodeByte(childPos))
output.append(soleChild)
result = output.finish()