prysm-pulse/beacon-chain/p2p/parameter_test.go
Nishant Das af3d3e8cd3
Update Gossip Parameters (#8683)
* add in more accurate aggregate parameters

* add more param changes

* more cleanup

* fix order of operations

* comments

* remove redundant declaration

* clean up better

* fix up

* victor's review

* disable mesh scoring

* disable mesh scoring

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2021-04-02 20:21:19 +08:00

42 lines
1.4 KiB
Go

package p2p
import (
"testing"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
)
func TestOverlayParameters(t *testing.T) {
setPubSubParameters()
assert.Equal(t, gossipSubD, pubsub.GossipSubD, "gossipSubD")
assert.Equal(t, gossipSubDlo, pubsub.GossipSubDlo, "gossipSubDlo")
assert.Equal(t, gossipSubDhi, pubsub.GossipSubDhi, "gossipSubDhi")
}
func TestGossipParameters(t *testing.T) {
setPubSubParameters()
assert.Equal(t, gossipSubMcacheLen, pubsub.GossipSubHistoryLength, "gossipSubMcacheLen")
assert.Equal(t, gossipSubMcacheGossip, pubsub.GossipSubHistoryGossip, "gossipSubMcacheGossip")
assert.Equal(t, gossipSubSeenTTL, int(pubsub.TimeCacheDuration.Milliseconds()/pubsub.GossipSubHeartbeatInterval.Milliseconds()), "gossipSubSeenTtl")
}
func TestFanoutParameters(t *testing.T) {
setPubSubParameters()
if pubsub.GossipSubFanoutTTL != gossipSubFanoutTTL {
t.Errorf("gossipSubFanoutTTL, wanted: %d, got: %d", gossipSubFanoutTTL, pubsub.GossipSubFanoutTTL)
}
}
func TestHeartbeatParameters(t *testing.T) {
setPubSubParameters()
if pubsub.GossipSubHeartbeatInterval != gossipSubHeartbeatInterval {
t.Errorf("gossipSubHeartbeatInterval, wanted: %d, got: %d", gossipSubHeartbeatInterval, pubsub.GossipSubHeartbeatInterval)
}
}
func TestMiscParameters(t *testing.T) {
setPubSubParameters()
assert.Equal(t, randomSubD, pubsub.RandomSubD, "randomSubD")
}