demo-config flag (#3473)

* democonfig

* 3.2
This commit is contained in:
Preston Van Loon 2019-09-15 12:24:08 -07:00 committed by Raul Jordan
parent d597410d9b
commit a2685245f2
5 changed files with 21 additions and 9 deletions

View File

@ -82,9 +82,11 @@ func NewBeaconNode(ctx *cli.Context) (*BeaconNode, error) {
// Use custom config values if the --no-custom-config flag is set.
if !ctx.GlobalBool(flags.NoCustomConfigFlag.Name) {
log.Info("Using custom parameter configuration")
// TODO(3439): Conditionally use demo config?
// params.UseDemoBeaconConfig()
params.UseMinimalConfig()
if featureconfig.FeatureConfig().DemoConfig {
params.UseDemoBeaconConfig()
} else {
params.UseMinimalConfig()
}
}
featureconfig.ConfigureBeaconFeatures(ctx)

View File

@ -26,6 +26,7 @@ var log = logrus.WithField("prefix", "flags")
// FeatureFlagConfig is a struct to represent what features the client will perform on runtime.
type FeatureFlagConfig struct {
NoGenesisDelay bool // NoGenesisDelay when processing a chain start genesis event.
DemoConfig bool // DemoConfig with lower deposit thresholds.
// Cache toggles.
EnableActiveBalanceCache bool // EnableActiveBalanceCache; see https://github.com/prysmaticlabs/prysm/issues/3106.

View File

@ -10,6 +10,11 @@ var (
Name: "no-genesis-delay",
Usage: "Process genesis event 30s after the ETH1 block time, rather than wait to midnight of the next day.",
}
// DemoConfigFlag enables the demo configuration.
DemoConfigFlag = cli.BoolFlag{
Name: "demo-config",
Usage: "Use demo config with lower deposit thresholds.",
}
// EnableActiveBalanceCacheFlag see https://github.com/prysmaticlabs/prysm/issues/3106.
EnableActiveBalanceCacheFlag = cli.BoolFlag{
Name: "enable-active-balance-cache",
@ -48,11 +53,14 @@ var (
)
// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
var ValidatorFlags = []cli.Flag{}
var ValidatorFlags = []cli.Flag{
DemoConfigFlag,
}
// BeaconChainFlags contains a list of all the feature flags that apply to the beacon-chain client.
var BeaconChainFlags = []cli.Flag{
NoGenesisDelayFlag,
DemoConfigFlag,
EnableActiveBalanceCacheFlag,
EnableAttestationCacheFlag,
EnableAncestorBlockCacheFlag,

View File

@ -82,7 +82,6 @@ type BeaconChainConfig struct {
// Prysm constants.
GweiPerEth uint64 // GweiPerEth is the amount of gwei corresponding to 1 eth.
SyncPollingInterval int64 // SyncPollingInterval queries network nodes for sync status.
LogBlockDelay int64 // Number of blocks to wait from the current head before processing logs from the deposit contract.
BLSPubkeyLength int // BLSPubkeyLength defines the expected length of BLS public keys in bytes.
DefaultBufferSize int // DefaultBufferSize for channels across the Prysm repository.
@ -228,11 +227,9 @@ func MainnetConfig() *BeaconChainConfig {
func DemoBeaconConfig() *BeaconChainConfig {
demoConfig := MinimalSpecConfig()
demoConfig.MinDepositAmount = 100
demoConfig.MaxEffectiveBalance = 32 * 1e9
demoConfig.MaxEffectiveBalance = 3.2 * 1e9
demoConfig.EjectionBalance = 1.6 * 1e9
demoConfig.EffectiveBalanceIncrement = 0.1 * 1e9
demoConfig.SyncPollingInterval = 1 * 10 // Query nodes over the network every slot.
demoConfig.MinGenesisTime = 0
demoConfig.Eth1FollowDistance = 16
return demoConfig

View File

@ -59,7 +59,11 @@ func NewValidatorClient(ctx *cli.Context, keys map[string]*keystore.Key) (*Valid
// Use custom config values if the --no-custom-config flag is set.
if !ctx.GlobalBool(flags.NoCustomConfigFlag.Name) {
log.Info("Using custom parameter configuration")
params.UseDemoBeaconConfig()
if featureconfig.FeatureConfig().DemoConfig {
params.UseDemoBeaconConfig()
} else {
params.UseMinimalConfig()
}
}
featureconfig.ConfigureBeaconFeatures(ctx)