chronos: bump (#5684)
This PR causes a few new warnings to appear - these are harmless but will need addressing separately as they span several libraries. * new asyncraises syntax * asyncraises support in several modules * `sink` usage reduces spurious copying * `?` compatiblity for `async` + `results` * remove `-d:chronosStrictException` (obsolete)
This commit is contained in:
parent
7a89404404
commit
3f525acb87
|
@ -215,7 +215,7 @@ jobs:
|
|||
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
|
||||
run: |
|
||||
excluded_files="config.yaml"
|
||||
excluded_extensions="ans|json|json\\.template|md|png|service|ssz|txt"
|
||||
excluded_extensions="ans|cfg|json|json\\.template|md|png|service|ssz|txt"
|
||||
|
||||
current_year=$(date +"%Y")
|
||||
outdated_files=()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# beacon_chain
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
@ -841,19 +841,23 @@ template gossipMaxSize(T: untyped): uint32 =
|
|||
static: doAssert maxSize <= GOSSIP_MAX_SIZE
|
||||
maxSize.uint32
|
||||
|
||||
proc readVarint2(conn: Connection): Future[NetRes[uint64]] {.async.} =
|
||||
try:
|
||||
ok await conn.readVarint()
|
||||
except LPStreamEOFError: #, LPStreamIncompleteError, InvalidVarintError
|
||||
# TODO compiler error - haha, uncaught exception
|
||||
# Error: unhandled exception: closureiters.nim(322, 17) `c[i].kind == nkType` [AssertionError]
|
||||
neterr UnexpectedEOF
|
||||
except LPStreamIncompleteError:
|
||||
neterr UnexpectedEOF
|
||||
except InvalidVarintError:
|
||||
neterr InvalidSizePrefix
|
||||
|
||||
proc readChunkPayload*(conn: Connection, peer: Peer,
|
||||
MsgType: type): Future[NetRes[MsgType]] {.async.} =
|
||||
let sm = now(chronos.Moment)
|
||||
let size =
|
||||
try: await conn.readVarint()
|
||||
except LPStreamEOFError: #, LPStreamIncompleteError, InvalidVarintError
|
||||
# TODO compiler error - haha, uncaught exception
|
||||
# Error: unhandled exception: closureiters.nim(322, 17) `c[i].kind == nkType` [AssertionError]
|
||||
return neterr UnexpectedEOF
|
||||
except LPStreamIncompleteError:
|
||||
return neterr UnexpectedEOF
|
||||
except InvalidVarintError:
|
||||
return neterr InvalidSizePrefix
|
||||
let
|
||||
sm = now(chronos.Moment)
|
||||
size = ? await readVarint2(conn)
|
||||
|
||||
const maxSize = chunkMaxSize[MsgType]()
|
||||
if size > maxSize:
|
||||
|
@ -862,16 +866,17 @@ proc readChunkPayload*(conn: Connection, peer: Peer,
|
|||
return neterr ZeroSizePrefix
|
||||
|
||||
# The `size.int` conversion is safe because `size` is bounded to `MAX_CHUNK_SIZE`
|
||||
let data = await conn.uncompressFramedStream(size.int)
|
||||
if data.isOk:
|
||||
# `10` is the maximum size of variable integer on wire, so error could
|
||||
# not be significant.
|
||||
peer.updateNetThroughput(now(chronos.Moment) - sm,
|
||||
uint64(10 + size))
|
||||
return ok SSZ.decode(data.get(), MsgType)
|
||||
else:
|
||||
debug "Snappy decompression/read failed", msg = $data.error, conn
|
||||
return neterr InvalidSnappyBytes
|
||||
let
|
||||
dataRes = await conn.uncompressFramedStream(size.int)
|
||||
data = dataRes.valueOr:
|
||||
debug "Snappy decompression/read failed", msg = $dataRes.error, conn
|
||||
return neterr InvalidSnappyBytes
|
||||
|
||||
# `10` is the maximum size of variable integer on wire, so error could
|
||||
# not be significant.
|
||||
peer.updateNetThroughput(now(chronos.Moment) - sm,
|
||||
uint64(10 + size))
|
||||
ok SSZ.decode(data, MsgType)
|
||||
|
||||
proc readResponseChunk(
|
||||
conn: Connection, peer: Peer, MsgType: typedesc):
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# Use only `secp256k1` public key cryptography as an identity in LibP2P.
|
||||
-d:"libp2p_pki_schemes=secp256k1"
|
||||
|
||||
-d:chronosStrictException
|
||||
--styleCheck:usages
|
||||
--styleCheck:hint
|
||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
-d:"libp2p_pki_schemes=secp256k1"
|
||||
|
||||
-d:chronosStrictException
|
||||
--styleCheck:usages
|
||||
--styleCheck:hint
|
||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
# beacon_chain
|
||||
# Copyright (c) 2020-2024 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
import
|
||||
strutils, strformat, parseutils
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
-d:"libp2p_pki_schemes=secp256k1"
|
||||
|
||||
-d:chronosStrictException
|
||||
--styleCheck:usages
|
||||
--styleCheck:hint
|
||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# Use only `secp256k1` public key cryptography as an identity in LibP2P.
|
||||
-d:"libp2p_pki_schemes=secp256k1"
|
||||
-d:"chronicles_runtime_filtering=on"
|
||||
-d:chronosStrictException
|
||||
|
||||
--styleCheck:usages
|
||||
--styleCheck:hint
|
||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit be2edab3ac101da03a70cbf52bc3f3d972b35d91
|
||||
Subproject commit 41f77d261ead2508acdd3bd3f88a5cbbcefff05f
|
|
@ -1 +1 @@
|
|||
Subproject commit f3c666a272c69d70cb41e7245e7f6844797303ad
|
||||
Subproject commit 113d433f48894ee8e7da3e340c8fe19ad7b9db4d
|
Loading…
Reference in New Issue