Fix changes from stint (#81)
* some formatting tweaks to make errors easier to grok * stint removed overloads for regular ints - use stew versions instead * various name style fixes * ignore vscode stuff * revert style changes * revert unneeded var rename changes --------- Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
This commit is contained in:
parent
ee5d8acb05
commit
60dc4e764c
|
@ -12,3 +12,4 @@ vendor/*
|
|||
NimBinaries
|
||||
.update.timestamp
|
||||
*.dSYM
|
||||
*.vscode/*
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
import
|
||||
std/[hashes, net, options, sugar, tables],
|
||||
stew/endians2,
|
||||
bearssl/rand,
|
||||
chronicles,
|
||||
stew/[results, byteutils],
|
||||
|
@ -200,7 +201,7 @@ proc hasHandshake*(c: Codec, key: HandshakeKey): bool =
|
|||
proc encodeStaticHeader*(flag: Flag, nonce: AESGCMNonce, authSize: int):
|
||||
seq[byte] =
|
||||
result.add(protocolId)
|
||||
result.add(version.toBytesBE())
|
||||
result.add(endians2.toBytesBE(version))
|
||||
result.add(byte(flag))
|
||||
result.add(nonce)
|
||||
# TODO: assert on authSize of > 2^16?
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import
|
||||
std/net,
|
||||
chronicles,
|
||||
stew/endians2,
|
||||
libp2p/routing_record,
|
||||
libp2p/signed_envelope,
|
||||
"."/[messages, spr, node],
|
||||
|
@ -98,7 +99,7 @@ proc getField*(pb: ProtoBuffer, field: int,
|
|||
if not(res):
|
||||
ok(false)
|
||||
else:
|
||||
family = uint8.fromBytesBE(buffer).IpAddressFamily
|
||||
family = endians2.fromBytesBE(uint8, buffer).IpAddressFamily
|
||||
ok(true)
|
||||
|
||||
proc write*(pb: var ProtoBuffer, field: int, family: IpAddressFamily) =
|
||||
|
|
|
@ -369,7 +369,7 @@ proc handleTalkReq(d: Protocol, fromId: NodeId, fromAddr: Address,
|
|||
|
||||
proc addProviderLocal(p: Protocol, cId: NodeId, prov: SignedPeerRecord) {.async.} =
|
||||
trace "adding provider to local db", n = p.localNode, cId, prov
|
||||
if (let res = (await p.providers.add(cid, prov)); res.isErr):
|
||||
if (let res = (await p.providers.add(cId, prov)); res.isErr):
|
||||
trace "Unable to add provider", cid, peerId = prov.data.peerId
|
||||
|
||||
proc handleAddProvider(
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
import std/options
|
||||
import std/sequtils
|
||||
|
||||
import pkg/stew/endians2
|
||||
import pkg/chronos
|
||||
import pkg/libp2p
|
||||
import pkg/datastore
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import std/sequtils
|
||||
import std/strutils
|
||||
|
||||
import pkg/stew/endians2
|
||||
import pkg/datastore
|
||||
import pkg/chronos
|
||||
import pkg/libp2p
|
||||
|
@ -79,7 +80,7 @@ proc add*(
|
|||
else:
|
||||
Moment.fromNow(self.ttl) - ZeroMoment
|
||||
|
||||
ttl = expires.microseconds.uint64.toBytesBE
|
||||
ttl = endians2.toBytesBE(expires.microseconds.uint64)
|
||||
|
||||
bytes: seq[byte] =
|
||||
if existing =? (await self.getProvByKey(provKey)) and
|
||||
|
|
|
@ -59,7 +59,7 @@ proc bootstrapNetwork(
|
|||
#waitFor bootNode.bootstrap() # immediate, since no bootnodes are defined above
|
||||
|
||||
var res = await bootstrapNodes(nodecount - 1,
|
||||
@[bootnode.localNode.record],
|
||||
@[bootNode.localNode.record],
|
||||
rng,
|
||||
delay)
|
||||
res.insert((bootNode, bootNodeKey), 0)
|
||||
|
|
Loading…
Reference in New Issue