From 51b425e629b53a1985fc720e7ab28424c7ac823c Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Wed, 22 Nov 2023 18:20:12 +0000 Subject: [PATCH] miner: select active sets that were received 2 hours before start (#5289) related: https://github.com/spacemeshos/go-spacemesh/issues/5282 this should reduce variability in encoded active sets. previous grader was using hare preround delay, which is 25s and not sufficient for atx to propagate across the network. --- config/config.go | 5 +++++ config/mainnet.go | 1 + config/presets/testnet.go | 1 + node/node.go | 3 +-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 36152b5fd0..94efb384ed 100644 --- a/config/config.go +++ b/config/config.go @@ -124,6 +124,10 @@ type BaseConfig struct { MinerGoodAtxsPercent int `mapstructure:"miner-good-atxs-percent"` RegossipAtxInterval time.Duration `mapstructure:"regossip-atx-interval"` + + // ATXGradeDelay is used to grade ATXs for selection in tortoise active set. + // See grading fuction in miner/proposals_builder.go + ATXGradeDelay time.Duration `mapstructure:"atx-grade-delay"` } type PublicMetrics struct { @@ -201,6 +205,7 @@ func defaultBaseConfig() BaseConfig { DatabaseSizeMeteringInterval: 10 * time.Minute, DatabasePruneInterval: 30 * time.Minute, NetworkHRP: "sm", + ATXGradeDelay: 10 * time.Second, } } diff --git a/config/mainnet.go b/config/mainnet.go index b19e750edd..6c42334c60 100644 --- a/config/mainnet.go +++ b/config/mainnet.go @@ -91,6 +91,7 @@ func MainnetConfig() Config { "https://poet-112.spacemesh.network", }, RegossipAtxInterval: 2 * time.Hour, + ATXGradeDelay: 30 * time.Minute, }, Genesis: &GenesisConfig{ GenesisTime: "2023-07-14T08:00:00Z", diff --git a/config/presets/testnet.go b/config/presets/testnet.go index ac0dbe3783..9e46a08ad9 100644 --- a/config/presets/testnet.go +++ b/config/presets/testnet.go @@ -73,6 +73,7 @@ func testnet() config.Config { TickSize: 666514, PoETServers: []string{}, RegossipAtxInterval: time.Hour, + ATXGradeDelay: 30 * time.Minute, }, Genesis: &config.GenesisConfig{ GenesisTime: "2023-09-13T18:00:00Z", diff --git a/node/node.go b/node/node.go index 3c97d092f3..83474fa8ad 100644 --- a/node/node.go +++ b/node/node.go @@ -860,8 +860,7 @@ func (app *App) initServices(ctx context.Context) error { miner.WithLayerPerEpoch(layersPerEpoch), miner.WithMinimalActiveSetWeight(app.Config.Tortoise.MinimalActiveSetWeight), miner.WithHdist(app.Config.Tortoise.Hdist), - // TODO(dshulyak) ??? - miner.WithNetworkDelay(app.Config.HARE3.PreroundDelay), + miner.WithNetworkDelay(app.Config.ATXGradeDelay), miner.WithMinGoodAtxPercent(minerGoodAtxPct), miner.WithLogger(app.addLogger(ProposalBuilderLogger, lg)), )