From 2c19e3f8cd47bd0f89303a084530ef07be810488 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Wed, 19 Aug 2020 14:33:52 +0300 Subject: [PATCH] [skip ci] Use GOSSIP_MAX_SIZE when snappy decoding in the inspector as well; Bumps --- beacon_chain/eth2_network.nim | 7 ------- beacon_chain/inspector.nim | 2 +- beacon_chain/spec/network.nim | 6 ++++++ beacon_chain/validator_client.nim | 2 +- vendor/nim-chronicles | 2 +- vendor/nim-eth | 2 +- vendor/nim-libp2p | 2 +- vendor/nim-snappy | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index b4a8174ff..017dc6c22 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -198,13 +198,6 @@ const TCP = net.Protocol.IPPROTO_TCP HandshakeTimeout = FaultOrError - # Spec constants - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#eth2-network-interaction-domains - MAX_CHUNK_SIZE* = 1 * 1024 * 1024 # bytes - GOSSIP_MAX_SIZE* = 1 * 1024 * 1024 # bytes - TTFB_TIMEOUT* = 5.seconds - RESP_TIMEOUT* = 10.seconds - NewPeerScore* = 200 ## Score which will be assigned to new connected Peer PeerScoreLowLimit* = 0 diff --git a/beacon_chain/inspector.nim b/beacon_chain/inspector.nim index 842b70686..3904aecbc 100644 --- a/beacon_chain/inspector.nim +++ b/beacon_chain/inspector.nim @@ -499,7 +499,7 @@ proc pubsubLogger(conf: InspectorConf, switch: Switch, if conf.decode: if topic.endsWith("_snappy"): try: - buffer = snappy.decode(data) + buffer = snappy.decode(data, GOSSIP_MAX_SIZE) except CatchableError as exc: warn "Unable to decompress message", errMsg = exc.msg else: diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index 40cdeec99..9f003d241 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -22,6 +22,12 @@ const # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#misc ATTESTATION_SUBNET_COUNT* = 64 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#eth2-network-interaction-domains + MAX_CHUNK_SIZE* = 1 * 1024 * 1024 # bytes + GOSSIP_MAX_SIZE* = 1 * 1024 * 1024 # bytes + TTFB_TIMEOUT* = 5.seconds + RESP_TIMEOUT* = 10.seconds + defaultEth2TcpPort* = 9000 # This is not part of the spec yet! diff --git a/beacon_chain/validator_client.nim b/beacon_chain/validator_client.nim index 48f6875ba..b479561e7 100644 --- a/beacon_chain/validator_client.nim +++ b/beacon_chain/validator_client.nim @@ -13,7 +13,7 @@ import stew/shims/[tables, macros], chronos, confutils, metrics, json_rpc/[rpcclient, jsonmarshal], chronicles, - blscurve, json_serialization/std/[options, sets, net], + json_serialization/std/[options, sets, net], # Local modules spec/[datatypes, digest, crypto, helpers, network], diff --git a/vendor/nim-chronicles b/vendor/nim-chronicles index 548e46b16..b60f70718 160000 --- a/vendor/nim-chronicles +++ b/vendor/nim-chronicles @@ -1 +1 @@ -Subproject commit 548e46b16db710dcfa4786216d72013cdef9d169 +Subproject commit b60f70718f8039c5c86dfc2a4680d8c1e37cbce2 diff --git a/vendor/nim-eth b/vendor/nim-eth index 7febbec67..73c1bb817 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit 7febbec673456773bd7f239c4ff5e87939dd5024 +Subproject commit 73c1bb817c7be238566481878ac0bb0c8dfd8427 diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index af0955c58..eb13845f6 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit af0955c58b06998b73540195363e6833b1382b42 +Subproject commit eb13845f6537a0af7564d3d4b535d88938eb104a diff --git a/vendor/nim-snappy b/vendor/nim-snappy index a368549c1..1e506c80a 160000 --- a/vendor/nim-snappy +++ b/vendor/nim-snappy @@ -1 +1 @@ -Subproject commit a368549c1a473d2e580ac814f4c21342259ed9b6 +Subproject commit 1e506c80a90e0776014dd23ccb28abdb24a1302a