Skip to content

Commit

Permalink
[examples] Increase no gossip builder diff config (#316)
Browse files Browse the repository at this point in the history
* cleanup no gossip config

* align configs with defaults

* remove unsettable fields

* use gossip default object directly

* use tip of dev
  • Loading branch information
patrick-ogrady authored Aug 1, 2023
1 parent 57dc91d commit 8e00cca
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 38 deletions.
3 changes: 1 addition & 2 deletions examples/morpheusvm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/ava-labs/avalanche-network-runner v1.7.1
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642
github.com/ava-labs/hypersdk v0.0.1
github.com/fatih/color v1.13.0
github.com/onsi/ginkgo/v2 v2.8.1
Expand Down Expand Up @@ -83,7 +83,6 @@ require (
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/neilotoole/errgroup v0.1.6 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/otiai10/copy v1.11.0 // indirect
Expand Down
5 changes: 2 additions & 3 deletions examples/morpheusvm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanche-network-runner v1.7.1 h1:XRC2NcchESSxSlJEgb47lAkTG5eF1t2sMs8CoJKeAuE=
github.com/ava-labs/avalanche-network-runner v1.7.1/go.mod h1:q/2ws64daRXXsiq08bVA1iESRY1CNOQQQDKPeMauZrc=
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56 h1:F70bFbIROOqu2zEo6jJhHjyyQ3CFwniY8rpxQ9dCkyI=
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642 h1:io1G0MmM+I/mapbJEdgMegQbItKSl4N5yrXvTDvYf9k=
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/coreth v0.12.4-rc.4 h1:bK9He5M9TqG9Wjd4KZ5CBxkBZMm5wWVVeZFKOsvnXic=
github.com/ava-labs/coreth v0.12.4-rc.4/go.mod h1:LZ2jvvEjotqna/qZwzeiA8zO9IIpS992DyWNZGbk7CA=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down Expand Up @@ -438,7 +438,6 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
github.com/neilotoole/errgroup v0.1.6 h1:PODGqPXdT5BC/zCYIMoTrwV+ujKcW+gBXM6Ye9Ve3R8=
github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
5 changes: 1 addition & 4 deletions examples/morpheusvm/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ! [[ "$0" =~ scripts/run.sh ]]; then
exit 255
fi

VERSION=v1.10.5
VERSION=6e97e33e06422ef6e03a765729aaa90eb26d01a5
MODE=${MODE:-run}
LOGLEVEL=${LOGLEVEL:-info}
AVALANCHE_LOG_LEVEL=${AVALANCHE_LOG_LEVEL:-INFO}
Expand Down Expand Up @@ -131,9 +131,6 @@ cat <<EOF > ${TMPDIR}/morpheusvm.config
"verifySignatures":true,
"storeTransactions":true,
"streamingBacklogSize": 10000000,
"gossipMaxSize": 32768,
"gossipProposerDepth": 1,
"buildProposerDiff": 1,
"continuousProfilerDir":"${TMPDIR}/morpheusvm-e2e-profiles/*",
"logLevel": "${LOGLEVEL}",
"stateSyncServerDelay": ${STATESYNC_DELAY}
Expand Down
23 changes: 9 additions & 14 deletions examples/tokenvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/profiler"
"github.com/ava-labs/hypersdk/config"
hconsts "github.com/ava-labs/hypersdk/consts"
"github.com/ava-labs/hypersdk/gossiper"
"github.com/ava-labs/hypersdk/trace"
"github.com/ava-labs/hypersdk/vm"

Expand All @@ -25,12 +25,6 @@ import (
var _ vm.Config = (*Config)(nil)

const (
defaultGossipInterval = 1 * time.Second
defaultGossipMaxSize = hconsts.NetworkSizeLimit
defaultGossipProposerDiff = 3
defaultGossipProposerDepth = 2
defaultBuildProposerDiff = 2
defaultVerifyTimeout = 2_000 // ms
defaultContinuousProfilerFrequency = 1 * time.Minute
defaultContinuousProfilerMaxFiles = 10
defaultStoreTransactions = true
Expand All @@ -44,7 +38,7 @@ type Config struct {
GossipMaxSize int `json:"gossipMaxSize"`
GossipProposerDiff int `json:"gossipProposerDiff"`
GossipProposerDepth int `json:"gossipProposerDepth"`
BuildProposerDiff int `json:"buildProposerDiff"`
NoGossipBuilderDiff int `json:"noGossipBuilderDiff"`
VerifyTimeout int64 `json:"verifyTimeout"`

// Tracing
Expand Down Expand Up @@ -107,12 +101,13 @@ func New(nodeID ids.NodeID, b []byte) (*Config, error) {

func (c *Config) setDefault() {
c.LogLevel = c.Config.GetLogLevel()
c.GossipInterval = defaultGossipInterval
c.GossipMaxSize = defaultGossipMaxSize
c.GossipProposerDiff = defaultGossipProposerDiff
c.GossipProposerDepth = defaultGossipProposerDepth
c.BuildProposerDiff = defaultBuildProposerDiff
c.VerifyTimeout = defaultVerifyTimeout
gcfg := gossiper.DefaultProposerConfig()
c.GossipInterval = gcfg.GossipInterval
c.GossipMaxSize = gcfg.GossipMaxSize
c.GossipProposerDiff = gcfg.GossipProposerDiff
c.GossipProposerDepth = gcfg.GossipProposerDepth
c.NoGossipBuilderDiff = gcfg.NoGossipBuilderDiff
c.VerifyTimeout = gcfg.VerifyTimeout
c.Parallelism = c.Config.GetParallelism()
c.MempoolSize = c.Config.GetMempoolSize()
c.MempoolPayerSize = c.Config.GetMempoolPayerSize()
Expand Down
2 changes: 1 addition & 1 deletion examples/tokenvm/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *Controller) Initialize(
gcfg.GossipMaxSize = c.config.GossipMaxSize
gcfg.GossipProposerDiff = c.config.GossipProposerDiff
gcfg.GossipProposerDepth = c.config.GossipProposerDepth
gcfg.BuildProposerDiff = c.config.BuildProposerDiff
gcfg.NoGossipBuilderDiff = c.config.NoGossipBuilderDiff
gcfg.VerifyTimeout = c.config.VerifyTimeout
gossip = gossiper.NewProposer(inner, gcfg)
}
Expand Down
3 changes: 1 addition & 2 deletions examples/tokenvm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/ava-labs/avalanche-network-runner v1.7.1
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642
github.com/ava-labs/hypersdk v0.0.1
github.com/fatih/color v1.13.0
github.com/onsi/ginkgo/v2 v2.8.1
Expand Down Expand Up @@ -83,7 +83,6 @@ require (
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/neilotoole/errgroup v0.1.6 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/otiai10/copy v1.11.0 // indirect
Expand Down
5 changes: 2 additions & 3 deletions examples/tokenvm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanche-network-runner v1.7.1 h1:XRC2NcchESSxSlJEgb47lAkTG5eF1t2sMs8CoJKeAuE=
github.com/ava-labs/avalanche-network-runner v1.7.1/go.mod h1:q/2ws64daRXXsiq08bVA1iESRY1CNOQQQDKPeMauZrc=
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56 h1:F70bFbIROOqu2zEo6jJhHjyyQ3CFwniY8rpxQ9dCkyI=
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642 h1:io1G0MmM+I/mapbJEdgMegQbItKSl4N5yrXvTDvYf9k=
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/coreth v0.12.4-rc.4 h1:bK9He5M9TqG9Wjd4KZ5CBxkBZMm5wWVVeZFKOsvnXic=
github.com/ava-labs/coreth v0.12.4-rc.4/go.mod h1:LZ2jvvEjotqna/qZwzeiA8zO9IIpS992DyWNZGbk7CA=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down Expand Up @@ -438,7 +438,6 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
github.com/neilotoole/errgroup v0.1.6 h1:PODGqPXdT5BC/zCYIMoTrwV+ujKcW+gBXM6Ye9Ve3R8=
github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
5 changes: 3 additions & 2 deletions examples/tokenvm/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ! [[ "$0" =~ scripts/run.sh ]]; then
exit 255
fi

VERSION=v1.10.5
VERSION=6e97e33e06422ef6e03a765729aaa90eb26d01a5
MODE=${MODE:-run}
LOGLEVEL=${LOGLEVEL:-info}
AVALANCHE_LOG_LEVEL=${AVALANCHE_LOG_LEVEL:-INFO}
Expand Down Expand Up @@ -132,8 +132,9 @@ cat <<EOF > ${TMPDIR}/tokenvm.config
"storeTransactions":true,
"streamingBacklogSize": 10000000,
"gossipMaxSize": 32768,
"gossipProposerDiff": 3,
"gossipProposerDepth": 1,
"buildProposerDiff": 1,
"noGossipBuilderDiff": 5,
"trackedPairs":["*"],
"continuousProfilerDir":"${TMPDIR}/tokenvm-e2e-profiles/*",
"logLevel": "${LOGLEVEL}",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/ava-labs/avalanche-network-runner v1.7.1
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642
github.com/cockroachdb/pebble v0.0.0-20230224221607-fccb83b60d5c
github.com/golang/mock v1.6.0
github.com/gorilla/rpc v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanche-network-runner v1.7.1 h1:XRC2NcchESSxSlJEgb47lAkTG5eF1t2sMs8CoJKeAuE=
github.com/ava-labs/avalanche-network-runner v1.7.1/go.mod h1:q/2ws64daRXXsiq08bVA1iESRY1CNOQQQDKPeMauZrc=
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56 h1:F70bFbIROOqu2zEo6jJhHjyyQ3CFwniY8rpxQ9dCkyI=
github.com/ava-labs/avalanchego v1.10.6-0.20230726151441-ef023d2a8c56/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642 h1:io1G0MmM+I/mapbJEdgMegQbItKSl4N5yrXvTDvYf9k=
github.com/ava-labs/avalanchego v1.10.6-0.20230801011451-6e97e33e0642/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/coreth v0.12.4-rc.4 h1:bK9He5M9TqG9Wjd4KZ5CBxkBZMm5wWVVeZFKOsvnXic=
github.com/ava-labs/coreth v0.12.4-rc.4/go.mod h1:LZ2jvvEjotqna/qZwzeiA8zO9IIpS992DyWNZGbk7CA=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down
8 changes: 4 additions & 4 deletions gossiper/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ type ProposerConfig struct {
GossipReceivedCacheSize int
GossipMinLife int64 // ms
GossipMaxSize int
BuildProposerDiff int
NoGossipBuilderDiff int
VerifyTimeout int64 // ms
}

func DefaultProposerConfig() *ProposerConfig {
return &ProposerConfig{
GossipProposerDiff: 3,
GossipProposerDepth: 2,
GossipProposerDepth: 1,
GossipInterval: 1 * time.Second,
GossipPeerCacheSize: 10_240,
GossipReceivedCacheSize: 65_536,
GossipMinLife: 5 * 1000,
GossipMaxSize: consts.NetworkSizeLimit,
BuildProposerDiff: 2,
NoGossipBuilderDiff: 5,
VerifyTimeout: proposerWindow / 2,
}
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func (g *Proposer) Run(appSender common.AppSender) {
if time.Now().UnixMilli()-g.lastVerified < g.cfg.VerifyTimeout {
proposers, err := g.vm.Proposers(
tctx,
g.cfg.BuildProposerDiff,
g.cfg.NoGossipBuilderDiff,
1,
)
if err == nil && proposers.Contains(g.vm.NodeID()) {
Expand Down

0 comments on commit 8e00cca

Please sign in to comment.