Merge pull request #3518 from filecoin-project/feat/pubsub-red
integrate pubsub Random Early Drop
This commit is contained in:
commit
2080458f0d
2
go.mod
2
go.mod
@ -90,7 +90,7 @@ require (
|
||||
github.com/libp2p/go-libp2p-mplex v0.2.4
|
||||
github.com/libp2p/go-libp2p-noise v0.1.1
|
||||
github.com/libp2p/go-libp2p-peerstore v0.2.6
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.6-0.20200901174250-06a12f17b7de
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.6-0.20200907103802-a3445b756fdb
|
||||
github.com/libp2p/go-libp2p-quic-transport v0.8.0
|
||||
github.com/libp2p/go-libp2p-record v0.1.3
|
||||
github.com/libp2p/go-libp2p-routing-helpers v0.2.3
|
||||
|
3
go.sum
3
go.sum
@ -900,8 +900,9 @@ github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEX
|
||||
github.com/libp2p/go-libp2p-pubsub v0.1.1/go.mod h1:ZwlKzRSe1eGvSIdU5bD7+8RZN/Uzw0t1Bp9R1znpR/Q=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.2-0.20200527132641-c0712c6e92cf/go.mod h1:TxPOBuo1FPdsTjFnv+FGZbNbWYsp74Culx+4ViQpato=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.5-0.20200820194335-bfc96c2cd081/go.mod h1:DTMSVmZZfXodB/pvdTGrY2eHPZ9W2ev7hzTH83OKHrI=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.6-0.20200901174250-06a12f17b7de h1:Dl0B0x6u+OSKXAa1DeB6xHFsUOBAhjrXJ10zykVSN6Q=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.6-0.20200901174250-06a12f17b7de/go.mod h1:DTMSVmZZfXodB/pvdTGrY2eHPZ9W2ev7hzTH83OKHrI=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.6-0.20200907103802-a3445b756fdb h1:0jm9ZSDkteX9XRjZqZwG5X0wuR+e0zAJ6ZEnqo2vcb0=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.3.6-0.20200907103802-a3445b756fdb/go.mod h1:DTMSVmZZfXodB/pvdTGrY2eHPZ9W2ev7hzTH83OKHrI=
|
||||
github.com/libp2p/go-libp2p-quic-transport v0.1.1/go.mod h1:wqG/jzhF3Pu2NrhJEvE+IE0NTHNXslOPn9JQzyCAxzU=
|
||||
github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M=
|
||||
github.com/libp2p/go-libp2p-quic-transport v0.7.1/go.mod h1:TD31to4E5exogR/GWHClXCfkktigjAl5rXSt7HoxNvY=
|
||||
|
@ -277,6 +277,30 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) {
|
||||
options = append(options, pubsub.WithDirectPeers(directPeerInfo))
|
||||
}
|
||||
|
||||
// validation queue RED
|
||||
pgTopicWeights := map[string]float64{
|
||||
drandTopic: 5,
|
||||
build.BlocksTopic(in.Nn): 10,
|
||||
build.MessagesTopic(in.Nn): 1,
|
||||
}
|
||||
var pgParams *pubsub.PeerGaterParams
|
||||
|
||||
if isBootstrapNode {
|
||||
pgParams = pubsub.NewPeerGaterParams(
|
||||
0.33,
|
||||
pubsub.ScoreParameterDecay(2*time.Minute),
|
||||
pubsub.ScoreParameterDecay(10*time.Minute),
|
||||
).WithTopicDeliveryWeights(pgTopicWeights)
|
||||
} else {
|
||||
pgParams = pubsub.NewPeerGaterParams(
|
||||
0.33,
|
||||
pubsub.ScoreParameterDecay(2*time.Minute),
|
||||
pubsub.ScoreParameterDecay(time.Hour),
|
||||
).WithTopicDeliveryWeights(pgTopicWeights)
|
||||
}
|
||||
|
||||
options = append(options, pubsub.WithPeerGater(pgParams))
|
||||
|
||||
// tracer
|
||||
if in.Cfg.RemoteTracer != "" {
|
||||
a, err := ma.NewMultiaddr(in.Cfg.RemoteTracer)
|
||||
|
Loading…
Reference in New Issue
Block a user