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'
|
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
|
||||||
run: |
|
run: |
|
||||||
excluded_files="config.yaml"
|
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")
|
current_year=$(date +"%Y")
|
||||||
outdated_files=()
|
outdated_files=()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * 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).
|
# * 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
|
static: doAssert maxSize <= GOSSIP_MAX_SIZE
|
||||||
maxSize.uint32
|
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,
|
proc readChunkPayload*(conn: Connection, peer: Peer,
|
||||||
MsgType: type): Future[NetRes[MsgType]] {.async.} =
|
MsgType: type): Future[NetRes[MsgType]] {.async.} =
|
||||||
let sm = now(chronos.Moment)
|
let
|
||||||
let size =
|
sm = now(chronos.Moment)
|
||||||
try: await conn.readVarint()
|
size = ? await readVarint2(conn)
|
||||||
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
|
|
||||||
|
|
||||||
const maxSize = chunkMaxSize[MsgType]()
|
const maxSize = chunkMaxSize[MsgType]()
|
||||||
if size > maxSize:
|
if size > maxSize:
|
||||||
|
@ -862,16 +866,17 @@ proc readChunkPayload*(conn: Connection, peer: Peer,
|
||||||
return neterr ZeroSizePrefix
|
return neterr ZeroSizePrefix
|
||||||
|
|
||||||
# The `size.int` conversion is safe because `size` is bounded to `MAX_CHUNK_SIZE`
|
# The `size.int` conversion is safe because `size` is bounded to `MAX_CHUNK_SIZE`
|
||||||
let data = await conn.uncompressFramedStream(size.int)
|
let
|
||||||
if data.isOk:
|
dataRes = await conn.uncompressFramedStream(size.int)
|
||||||
# `10` is the maximum size of variable integer on wire, so error could
|
data = dataRes.valueOr:
|
||||||
# not be significant.
|
debug "Snappy decompression/read failed", msg = $dataRes.error, conn
|
||||||
peer.updateNetThroughput(now(chronos.Moment) - sm,
|
return neterr InvalidSnappyBytes
|
||||||
uint64(10 + size))
|
|
||||||
return ok SSZ.decode(data.get(), MsgType)
|
# `10` is the maximum size of variable integer on wire, so error could
|
||||||
else:
|
# not be significant.
|
||||||
debug "Snappy decompression/read failed", msg = $data.error, conn
|
peer.updateNetThroughput(now(chronos.Moment) - sm,
|
||||||
return neterr InvalidSnappyBytes
|
uint64(10 + size))
|
||||||
|
ok SSZ.decode(data, MsgType)
|
||||||
|
|
||||||
proc readResponseChunk(
|
proc readResponseChunk(
|
||||||
conn: Connection, peer: Peer, MsgType: typedesc):
|
conn: Connection, peer: Peer, MsgType: typedesc):
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
# Use only `secp256k1` public key cryptography as an identity in LibP2P.
|
# Use only `secp256k1` public key cryptography as an identity in LibP2P.
|
||||||
-d:"libp2p_pki_schemes=secp256k1"
|
-d:"libp2p_pki_schemes=secp256k1"
|
||||||
|
|
||||||
-d:chronosStrictException
|
|
||||||
--styleCheck:usages
|
--styleCheck:usages
|
||||||
--styleCheck:hint
|
--styleCheck:hint
|
||||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
-d:"libp2p_pki_schemes=secp256k1"
|
-d:"libp2p_pki_schemes=secp256k1"
|
||||||
|
|
||||||
-d:chronosStrictException
|
|
||||||
--styleCheck:usages
|
--styleCheck:usages
|
||||||
--styleCheck:hint
|
--styleCheck:hint
|
||||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
--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
|
import
|
||||||
strutils, strformat, parseutils
|
strutils, strformat, parseutils
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
-d:"libp2p_pki_schemes=secp256k1"
|
-d:"libp2p_pki_schemes=secp256k1"
|
||||||
|
|
||||||
-d:chronosStrictException
|
|
||||||
--styleCheck:usages
|
--styleCheck:usages
|
||||||
--styleCheck:hint
|
--styleCheck:hint
|
||||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# Use only `secp256k1` public key cryptography as an identity in LibP2P.
|
# Use only `secp256k1` public key cryptography as an identity in LibP2P.
|
||||||
-d:"libp2p_pki_schemes=secp256k1"
|
-d:"libp2p_pki_schemes=secp256k1"
|
||||||
-d:"chronicles_runtime_filtering=on"
|
-d:"chronicles_runtime_filtering=on"
|
||||||
-d:chronosStrictException
|
|
||||||
--styleCheck:usages
|
--styleCheck:usages
|
||||||
--styleCheck:hint
|
--styleCheck:hint
|
||||||
--hint[ConvFromXtoItselfNotNeeded]:off
|
--hint[ConvFromXtoItselfNotNeeded]:off
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit be2edab3ac101da03a70cbf52bc3f3d972b35d91
|
Subproject commit 41f77d261ead2508acdd3bd3f88a5cbbcefff05f
|
|
@ -1 +1 @@
|
||||||
Subproject commit f3c666a272c69d70cb41e7245e7f6844797303ad
|
Subproject commit 113d433f48894ee8e7da3e340c8fe19ad7b9db4d
|
Loading…
Reference in New Issue