Skip to content

Commit

Permalink
miner: parametrize threshold for picking active set from first block (#…
Browse files Browse the repository at this point in the history
…4945)

this is not a protocol parameter, no reason to hardcode, this is local heuristic for a node to decide if it wants to build block from atxs synced on time, or from first block
  • Loading branch information
dshulyak committed Sep 1, 2023
1 parent cc34c4e commit 89cc44e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ func (cfg *Config) DataDir() string {
}

type TestConfig struct {
SmesherKey string `mapstructure:"testing-smesher-key"`
MinerGoodAtxPct int
SmesherKey string `mapstructure:"testing-smesher-key"`
}

// BaseConfig defines the default configuration options for spacemesh app.
Expand Down Expand Up @@ -114,6 +113,10 @@ type BaseConfig struct {
DatabaseLatencyMetering bool `mapstructure:"db-latency-metering"`

NetworkHRP string `mapstructure:"network-hrp"`

// MinerGoodAtxsPercent is a threshold to decide if tortoise activeset should be
// picked from first block insted of synced data.
MinerGoodAtxsPercent int `mapstructure:"miner-good-atxs-percent"`
}

type PublicMetrics struct {
Expand Down
3 changes: 2 additions & 1 deletion config/presets/fastnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func fastnet() config.Config {
types.SetNetworkHRP(conf.NetworkHRP) // set to generate coinbase
conf.BaseConfig.OptFilterThreshold = 90

conf.BaseConfig.TestConfig.MinerGoodAtxPct = 50
// set for systest TestEquivocation
conf.BaseConfig.MinerGoodAtxsPercent = 50

conf.HARE.Disable = 1 // non-zero low layer will prevent hare1 from running
conf.HARE.N = 800
Expand Down
5 changes: 2 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,8 @@ func (app *App) initServices(ctx context.Context) error {
}

minerGoodAtxPct := 90
if app.Config.TestConfig.MinerGoodAtxPct > 0 {
// only set this for systest TestEquivocation.
minerGoodAtxPct = app.Config.TestConfig.MinerGoodAtxPct
if app.Config.MinerGoodAtxsPercent > 0 {
minerGoodAtxPct = app.Config.MinerGoodAtxsPercent
}
proposalBuilder := miner.NewProposalBuilder(
ctx,
Expand Down

0 comments on commit 89cc44e

Please sign in to comment.