Gossip11 params (#2047)

* add rpc call to get chronos futures at runtime

* add eth2 spec gossip parameters

* bump libp2p

* fix url, remove 1.0

Co-authored-by: Jacek Sieka <jacek@status.im>
This commit is contained in:
Giovanni Petrantoni 2020-11-23 18:57:03 +09:00 committed by GitHub
parent 0856f0539a
commit 6f476ca380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 9 deletions

View File

@ -26,10 +26,7 @@ import
peer_pool, spec/[datatypes, digest, helpers, network], ./time,
keystore_management
when defined(nbc_gossipsub_10):
import libp2p/protocols/pubsub/gossipsub10
else:
import libp2p/protocols/pubsub/gossipsub
import libp2p/protocols/pubsub/gossipsub
when chronicles.enabledLogLevel == LogLevel.TRACE:
import std/sequtils
@ -1395,11 +1392,29 @@ proc createEth2Node*(rng: ref BrHmacDrbgContext,
],
rng = rng)
let pubsub = GossipSub.init(
switch = switch,
msgIdProvider = msgIdProvider,
triggerSelf = true, sign = false,
verifySignature = false, anonymize = true).PubSub
let
params =
block:
var p = GossipSubParams.init()
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#the-gossip-domain-gossipsub
p.d = 8
p.dLow = 6
p.dHigh = 12
p.dLazy = 6
p.heartbeatInterval = 700.milliseconds
p.fanoutTTL = 60.seconds
p.historyLength = 6
p.historyGossip = 3
p.validateParameters().tryGet()
p
pubsub = GossipSub.init(
switch = switch,
msgIdProvider = msgIdProvider,
triggerSelf = true,
sign = false,
verifySignature = false,
anonymize = true,
parameters = params).PubSub
switch.mount(pubsub)