Skip to content

Commit

Permalink
Default (nonces, threads) = (288, CPU*3/4) for Mainnet (#4741)
Browse files Browse the repository at this point in the history
Co-authored-by: kimmy lin <30611210+countvonzero@users.noreply.github.com>
  • Loading branch information
poszu and countvonzero committed Jul 22, 2023
1 parent 0bd65e1 commit 2dcfb7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion config/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math/big"
"os"
"path/filepath"
"runtime"
"time"

"github.com/spacemeshos/go-spacemesh/activation"
Expand All @@ -27,6 +28,14 @@ func MainnetConfig() Config {
panic(err)
}
p2pconfig := p2p.DefaultConfig()

smeshing := DefaultSmeshingConfig()
smeshing.ProvingOpts.Nonces = 288
smeshing.ProvingOpts.Threads = uint(runtime.NumCPU() * 3 / 4)
if smeshing.ProvingOpts.Threads < 1 {
smeshing.ProvingOpts.Threads = 1
}

return Config{
BaseConfig: BaseConfig{
DataDirParent: defaultDataDir,
Expand Down Expand Up @@ -115,7 +124,7 @@ func MainnetConfig() Config {
P2P: p2pconfig,
API: grpcserver.DefaultConfig(),
TIME: timeConfig.DefaultConfig(),
SMESHING: DefaultSmeshingConfig(),
SMESHING: smeshing,
FETCH: fetch.DefaultConfig(),
LOGGING: defaultLoggingConfig(),
Sync: syncer.DefaultConfig(),
Expand Down
2 changes: 2 additions & 0 deletions config/presets/fastnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func fastnet() config.Config {
conf.SMESHING.Opts.Throttle = true
// Override proof of work flags to use light mode (less memory intensive)
conf.SMESHING.ProvingOpts.Flags = postCfg.RecommendedPowFlags()
conf.SMESHING.ProvingOpts.Nonces = 16
conf.SMESHING.ProvingOpts.Threads = 1

conf.Beacon.Kappa = 40
conf.Beacon.Theta = big.NewRat(1, 4)
Expand Down

0 comments on commit 2dcfb7a

Please sign in to comment.