Skip to content

Commit

Permalink
start cleanup of basevm
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed Jul 21, 2023
1 parent d923f27 commit da425d5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 46 deletions.
41 changes: 7 additions & 34 deletions examples/basevm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ 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/trace"
"github.com/ava-labs/hypersdk/vm"

Expand All @@ -24,13 +23,6 @@ import (
var _ vm.Config = (*Config)(nil)

const (
defaultGossipInterval = 1 * time.Second
defaultGossipMaxSize = hconsts.NetworkSizeLimit
defaultGossipProposerDiff = 3
defaultGossipProposerDepth = 2
defaultBuildProposerDiff = 2
defaultVerifyTimeout = 10
defaultPreferredBlocksPerSecond = 2
defaultContinuousProfilerFrequency = 1 * time.Minute
defaultContinuousProfilerMaxFiles = 10
defaultMempoolVerifyBalances = true
Expand All @@ -39,17 +31,6 @@ const (
type Config struct {
*config.Config

// Builder
PreferredBlocksPerSecond uint64 `json:"preferredBlocksPerSecond"`

// Gossip
GossipInterval time.Duration `json:"gossipInterval"`
GossipMaxSize int `json:"gossipMaxSize"`
GossipProposerDiff int `json:"gossipProposerDiff"`
GossipProposerDepth int `json:"gossipProposerDepth"`
BuildProposerDiff int `json:"buildProposerDiff"`
VerifyTimeout int64 `json:"verifyTimeout"`

// Tracing
TraceEnabled bool `json:"traceEnabled"`
TraceSampleRate float64 `json:"traceSampleRate"`
Expand Down Expand Up @@ -102,29 +83,21 @@ 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
c.Parallelism = c.Config.GetParallelism()
c.PreferredBlocksPerSecond = defaultPreferredBlocksPerSecond
c.MempoolSize = c.Config.GetMempoolSize()
c.MempoolPayerSize = c.Config.GetMempoolPayerSize()
c.MempoolVerifyBalances = defaultMempoolVerifyBalances
c.StateSyncServerDelay = c.Config.GetStateSyncServerDelay()
c.StreamingBacklogSize = c.Config.GetStreamingBacklogSize()
}

func (c *Config) GetLogLevel() logging.Level { return c.LogLevel }
func (c *Config) GetTestMode() bool { return c.TestMode }
func (c *Config) GetParallelism() int { return c.Parallelism }
func (c *Config) GetPreferredBlocksPerSecond() uint64 { return c.PreferredBlocksPerSecond }
func (c *Config) GetMempoolSize() int { return c.MempoolSize }
func (c *Config) GetMempoolPayerSize() int { return c.MempoolPayerSize }
func (c *Config) GetMempoolExemptPayers() [][]byte { return c.parsedExemptPayers }
func (c *Config) GetMempoolVerifyBalances() bool { return c.MempoolVerifyBalances }
func (c *Config) GetLogLevel() logging.Level { return c.LogLevel }
func (c *Config) GetTestMode() bool { return c.TestMode }
func (c *Config) GetParallelism() int { return c.Parallelism }
func (c *Config) GetMempoolSize() int { return c.MempoolSize }
func (c *Config) GetMempoolPayerSize() int { return c.MempoolPayerSize }
func (c *Config) GetMempoolExemptPayers() [][]byte { return c.parsedExemptPayers }
func (c *Config) GetMempoolVerifyBalances() bool { return c.MempoolVerifyBalances }
func (c *Config) GetTraceConfig() *trace.Config {
return &trace.Config{
Enabled: c.TraceEnabled,
Expand Down
2 changes: 1 addition & 1 deletion examples/basevm/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
HRP = "base"
Name = "basevm"
Symbol = "WCGW"
Symbol = "BASE"
)

var ID ids.ID
Expand Down
6 changes: 0 additions & 6 deletions examples/basevm/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ func (c *Controller) Initialize(
} else {
build = builder.NewTime(inner)
gcfg := gossiper.DefaultProposerConfig()
gcfg.GossipInterval = c.config.GossipInterval
gcfg.GossipMaxSize = c.config.GossipMaxSize
gcfg.GossipProposerDiff = c.config.GossipProposerDiff
gcfg.GossipProposerDepth = c.config.GossipProposerDepth
gcfg.BuildProposerDiff = c.config.BuildProposerDiff
gcfg.VerifyTimeout = c.config.VerifyTimeout
gossip = gossiper.NewProposer(inner, gcfg)
}
return c.config, c.genesis, build, gossip, blockDB, stateDB, apis, consts.ActionRegistry, consts.AuthRegistry, nil
Expand Down
2 changes: 1 addition & 1 deletion examples/basevm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ava-labs/hypersdk/examples/basevm
go 1.20

require (
github.com/ava-labs/avalanche-network-runner v1.7.1-0.20230720220603-07c999585182
github.com/ava-labs/avalanche-network-runner v1.7.1
github.com/ava-labs/avalanchego v1.10.5
github.com/ava-labs/hypersdk v0.0.1
github.com/fatih/color v1.13.0
Expand Down
4 changes: 2 additions & 2 deletions examples/basevm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanche-network-runner v1.7.1-0.20230720220603-07c999585182 h1:fqPKBP6u4h3O2Phun/dLUAdvWsLnTnDkvM38rLjbHKs=
github.com/ava-labs/avalanche-network-runner v1.7.1-0.20230720220603-07c999585182/go.mod h1:q/2ws64daRXXsiq08bVA1iESRY1CNOQQQDKPeMauZrc=
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.5 h1:opYyroLzhJPTJw9LlSRks8ItcezerwuGAT0MkVSotBs=
github.com/ava-labs/avalanchego v1.10.5/go.mod h1:rXAX4UaE9ORIEJcMyzN6ibv4rnLwv0zUIPLmzA0MCno=
github.com/ava-labs/coreth v0.12.4-rc.4 h1:bK9He5M9TqG9Wjd4KZ5CBxkBZMm5wWVVeZFKOsvnXic=
Expand Down
2 changes: 1 addition & 1 deletion examples/basevm/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ ACK_GINKGO_RC=true ginkgo build ./tests/e2e
# download avalanche-network-runner
# https://github.com/ava-labs/avalanche-network-runner
ANR_REPO_PATH=github.com/ava-labs/avalanche-network-runner
ANR_VERSION=07c99958518220d3d8bec21e92183368d4f1903c
ANR_VERSION=v1.7.1
# version set
go install -v ${ANR_REPO_PATH}@${ANR_VERSION}

Expand Down
2 changes: 1 addition & 1 deletion examples/tokenvm/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ ACK_GINKGO_RC=true ginkgo build ./tests/e2e
# download avalanche-network-runner
# https://github.com/ava-labs/avalanche-network-runner
ANR_REPO_PATH=github.com/ava-labs/avalanche-network-runner
ANR_VERSION=07c99958518220d3d8bec21e92183368d4f1903c
ANR_VERSION=v1.7.1
# version set
go install -v ${ANR_REPO_PATH}@${ANR_VERSION}

Expand Down

0 comments on commit da425d5

Please sign in to comment.