fix compilation issues with latest libp2p (#27)
* fix compilation issues with latest libp2p * change package description * fix CI compiler * try with nim 1.4.2 * try with 1.4.2 * use more standardized ci config * set reasonable log level * remove nim version dependency * reverting to 1.4.6 as otherwise it fails on amd64
This commit is contained in:
parent
2fb39ca4a3
commit
ce66e43440
|
@ -7,7 +7,7 @@ jobs:
|
|||
fail-fast: false
|
||||
max-parallel: 20
|
||||
matrix:
|
||||
branch: [v1.2.6]
|
||||
branch: [v1.4.6]
|
||||
target:
|
||||
# Unit tests
|
||||
- os: linux
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
version = "0.1.0"
|
||||
author = "Dagger Team"
|
||||
description = "The hardrive for Web3"
|
||||
description = "p2p data durability engine"
|
||||
license = "MIT"
|
||||
|
||||
requires "nim >= 1.2.6",
|
||||
"libp2p#unstable",
|
||||
requires "libp2p#unstable",
|
||||
"nimcrypto >= 0.4.1",
|
||||
"bearssl >= 0.1.4",
|
||||
"chronicles >= 0.7.2",
|
||||
|
@ -16,4 +15,4 @@ requires "nim >= 1.2.6",
|
|||
"https://github.com/status-im/nim-nitro >= 0.4.0 & < 0.5.0",
|
||||
"questionable >= 0.9.1 & < 0.10.0",
|
||||
"upraises >= 0.1.0 & < 0.2.0",
|
||||
"asynctest >= 0.2.1 & < 0.3.0"
|
||||
"asynctest >= 0.3.0 & < 0.4.0"
|
||||
|
|
|
@ -300,11 +300,7 @@ method init*(b: BlockExcNetwork) =
|
|||
## Perform protocol initialization
|
||||
##
|
||||
|
||||
proc peerEventHandler(peerInfo: PeerInfo, event: PeerEvent) {.async.} =
|
||||
# TODO: temporary until libp2p moves back to PeerID
|
||||
let
|
||||
peerId = peerInfo.peerId
|
||||
|
||||
proc peerEventHandler(peerId: PeerID, event: PeerEvent) {.async.} =
|
||||
if event.kind == PeerEventKind.Joined:
|
||||
b.setupPeer(peerId)
|
||||
else:
|
||||
|
@ -314,7 +310,7 @@ method init*(b: BlockExcNetwork) =
|
|||
b.switch.addPeerEventHandler(peerEventHandler, PeerEventKind.Left)
|
||||
|
||||
proc handle(conn: Connection, proto: string) {.async, gcsafe, closure.} =
|
||||
let peerId = conn.peerInfo.peerId
|
||||
let peerId = conn.peerId
|
||||
let blockexcPeer = b.getOrCreatePeer(peerId)
|
||||
await blockexcPeer.readLoop(conn) # attach read loop
|
||||
|
||||
|
|
|
@ -132,11 +132,8 @@ proc new*(
|
|||
engine.scheduleTask = proc(task: BlockExcPeerCtx): bool {.gcsafe} =
|
||||
b.taskQueue.pushOrUpdateNoWait(task).isOk()
|
||||
|
||||
proc peerEventHandler(peerInfo: PeerInfo, event: PeerEvent) {.async.} =
|
||||
proc peerEventHandler(peerId: PeerID, event: PeerEvent) {.async.} =
|
||||
# TODO: temporary until libp2p moves back to PeerID
|
||||
let
|
||||
peerId = peerInfo.peerId
|
||||
|
||||
if event.kind == PeerEventKind.Joined:
|
||||
b.engine.setupPeer(peerId)
|
||||
else:
|
||||
|
|
2
nim.cfg
2
nim.cfg
|
@ -1 +1 @@
|
|||
-d:"chronicles_enabled=on" # disable logging by default
|
||||
-d:"chronicles_log_level=INFO"
|
||||
|
|
|
@ -21,7 +21,7 @@ suite "BlockExc engine basic":
|
|||
let
|
||||
rng = Rng.instance()
|
||||
seckey = PrivateKey.random(rng[]).tryGet()
|
||||
peerId = PeerID.init(seckey.getKey().tryGet()).tryGet()
|
||||
peerId = PeerID.init(seckey.getPublicKey().tryGet()).tryGet()
|
||||
chunker = newRandomChunker(Rng.instance(), size = 1024, chunkSize = 256)
|
||||
blocks = chunker.mapIt( !bt.Block.new(it) )
|
||||
wallet = WalletRef.example
|
||||
|
@ -73,7 +73,7 @@ suite "BlockExc engine handlers":
|
|||
let
|
||||
rng = Rng.instance()
|
||||
seckey = PrivateKey.random(rng[]).tryGet()
|
||||
peerId = PeerID.init(seckey.getKey().tryGet()).tryGet()
|
||||
peerId = PeerID.init(seckey.getPublicKey().tryGet()).tryGet()
|
||||
chunker = newRandomChunker(Rng.instance(), size = 1024, chunkSize = 256)
|
||||
blocks = chunker.mapIt( !bt.Block.new(it) )
|
||||
wallet = WalletRef.example
|
||||
|
@ -203,7 +203,7 @@ suite "Task Handler":
|
|||
|
||||
for i in 0..3:
|
||||
let seckey = PrivateKey.random(rng[]).tryGet()
|
||||
peers.add(PeerID.init(seckey.getKey().tryGet()).tryGet())
|
||||
peers.add(PeerID.init(seckey.getPublicKey().tryGet()).tryGet())
|
||||
|
||||
peersCtx.add(BlockExcPeerCtx(
|
||||
id: peers[i]
|
||||
|
|
|
@ -21,7 +21,7 @@ suite "BlockExc network":
|
|||
let
|
||||
rng = Rng.instance()
|
||||
seckey = PrivateKey.random(rng[]).tryGet()
|
||||
peerId = PeerID.init(seckey.getKey().tryGet()).tryGet()
|
||||
peerId = PeerID.init(seckey.getPublicKey().tryGet()).tryGet()
|
||||
chunker = newRandomChunker(Rng.instance(), size = 1024, chunkSize = 256)
|
||||
blocks = chunker.mapIt( !bt.Block.new(it) )
|
||||
|
||||
|
@ -36,7 +36,7 @@ suite "BlockExc network":
|
|||
|
||||
setup:
|
||||
done = newFuture[void]()
|
||||
buffer = newBufferStream()
|
||||
buffer = BufferStream.new()
|
||||
network = BlockExcNetwork.new(
|
||||
switch = newStandardSwitch(),
|
||||
connProvider = getConn)
|
||||
|
|
|
@ -46,7 +46,7 @@ proc example*(_: type Block): Block =
|
|||
|
||||
proc example*(_: type PeerId): PeerID =
|
||||
let key = PrivateKey.random(Rng.instance[]).get
|
||||
PeerId.init(key.getKey().get).get
|
||||
PeerId.init(key.getPublicKey().get).get
|
||||
|
||||
proc example*(_: type BlockExcPeerCtx): BlockExcPeerCtx =
|
||||
BlockExcPeerCtx(id: PeerID.example)
|
||||
|
|
Loading…
Reference in New Issue