From 7eaae89263250a6fc39d9cf364884725114fb0de Mon Sep 17 00:00:00 2001 From: tersec Date: Mon, 9 Nov 2020 18:11:09 +0000 Subject: [PATCH] keep AllTests-mainnet.md consistent; ensure don't send overly large messages aren't sent (#1973) --- beacon_chain.nimble | 4 ++-- beacon_chain/eth2_network.nim | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/beacon_chain.nimble b/beacon_chain.nimble index 29483f62e..662de5544 100644 --- a/beacon_chain.nimble +++ b/beacon_chain.nimble @@ -87,8 +87,8 @@ task test, "Run all tests": buildAndRunBinary "test_process_attestation", "tests/spec_block_processing/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v0.12.3" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" buildAndRunBinary "test_process_deposits", "tests/spec_block_processing/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v0.12.3" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" buildAndRunBinary "all_fixtures_require_ssz", "tests/official/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v0.12.3" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" - buildAndRunBinary "test_attestation_pool", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v0.12.3" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" - buildAndRunBinary "test_block_pool", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v0.12.3" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" + buildAndRunBinary "test_attestation_pool", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v1.0.0" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" + buildAndRunBinary "test_block_pool", "tests/", """-d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:ETH2_SPEC="v1.0.0" -d:BLS_FORCE_BACKEND=miracl -d:chronicles_sinks="json[file]"""" # State and block sims; getting to 4th epoch triggers consensus checks buildAndRunBinary "state_sim", "research/", "-d:const_preset=mainnet -d:ETH2_SPEC=\"v1.0.0\" -d:chronicles_log_level=INFO", "--validators=3000 --slots=128" diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index 3b218e395..fbe071abd 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -1470,8 +1470,12 @@ proc traceMessage(fut: FutureBase, msgId: string) = debug "Unexpected future state for gossip", msgId, state = fut.state proc broadcast*(node: Eth2Node, topic: string, msg: auto) = + let data = snappy.encode(SSZ.encode(msg)) + + # This is only for messages we create. A message this large amounts to an + # internal logic error. + doAssert data.len <= GOSSIP_MAX_SIZE inc nbc_gossip_messages_sent - let - data = snappy.encode(SSZ.encode(msg)) + var futSnappy = node.pubsub.publish(topic & "_snappy", data) traceMessage(futSnappy, string.fromBytes(gossipId(data)))