Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load chain config from file #5694

Merged
merged 59 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
048ba7a
load chain config from file
shayzluf Apr 30, 2020
d588ab0
revert flag name change
shayzluf Apr 30, 2020
ed92bc1
add dependencies to image
shayzluf Apr 30, 2020
3f23d85
Merge branch 'master' of github.com:prysmaticlabs/prysm into yaml_cha…
shayzluf Apr 30, 2020
1691775
Update shared/cmd/flags.go
shayzluf Apr 30, 2020
3b531e8
Update beacon-chain/main.go
shayzluf Apr 30, 2020
feef5d5
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] Apr 30, 2020
cae5f6f
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] Apr 30, 2020
5c0c400
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
da564a0
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
b60409c
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
bf74332
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
e65c6ed
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
c5240ea
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
6a87c10
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
246e39c
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 1, 2020
4649b49
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 2, 2020
eb5c70f
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 2, 2020
c44eda7
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 2, 2020
49484c1
added test to load config file
shayzluf May 3, 2020
e33255d
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 3, 2020
4dd7b61
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 3, 2020
5b4ac97
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 4, 2020
319efb8
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 4, 2020
f4ae1cc
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 4, 2020
994c933
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 4, 2020
bf11aca
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 4, 2020
20fab1f
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 4, 2020
24e4537
replace hex with yaml format of fixed byte array
shayzluf May 5, 2020
ab0363c
fix test and check if comment
shayzluf May 5, 2020
9adf112
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 5, 2020
227af7c
Merge branch 'master' into yaml_chain_config
shayzluf May 5, 2020
a318a61
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 5, 2020
5efedc9
move to node package
shayzluf May 5, 2020
60c50dd
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 5, 2020
5e8cb1a
gaz
shayzluf May 5, 2020
7a28699
added contract address case
shayzluf May 5, 2020
0e58c6d
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 5, 2020
6df99ef
fix key name issue
shayzluf May 5, 2020
ef50062
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 5, 2020
2302d1e
add tests
shayzluf May 5, 2020
424aab4
gaz
shayzluf May 5, 2020
0963ab5
Merge branch 'master' of github.com:prysmaticlabs/prysm into yaml_cha…
shayzluf May 5, 2020
23ab4a1
add 1 byte handling
shayzluf May 5, 2020
21f0ead
change to fatal
shayzluf May 5, 2020
7e69729
add config printout
shayzluf May 5, 2020
2a6b3eb
Merge refs/heads/master into yaml_chain_config
prylabs-bulldozer[bot] May 5, 2020
85b8db1
revert main changes
shayzluf May 5, 2020
b302765
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 5, 2020
703d19f
revert line removal
shayzluf May 5, 2020
4520a94
fix one byte handling
shayzluf May 5, 2020
09a2915
fix test and one byte handling
shayzluf May 5, 2020
d6f2f2d
remove log
shayzluf May 5, 2020
86f63a6
Apply suggestions from code review
rauljordan May 5, 2020
0678344
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 5, 2020
09991a9
change to debug
shayzluf May 5, 2020
09c785c
Update beacon-chain/node/node.go
terencechain May 5, 2020
cace30b
move helper methods
shayzluf May 5, 2020
b7eff0c
Merge branch 'yaml_chain_config' of github.com:prysmaticlabs/prysm in…
shayzluf May 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions beacon-chain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ go_library(
"//shared/debug:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/logutil:go_default_library",
"//shared/params:go_default_library",
"//shared/version:go_default_library",
"@com_github_ethereum_go_ethereum//log:go_default_library",
"@com_github_ipfs_go_log//:go_default_library",
Expand All @@ -28,6 +29,7 @@ go_library(
"@com_github_x_cray_logrus_prefixed_formatter//:go_default_library",
"@in_gopkg_urfave_cli_v2//:go_default_library",
"@in_gopkg_urfave_cli_v2//altsrc:go_default_library",
"@in_gopkg_yaml_v2//:go_default_library",
"@org_uber_go_automaxprocs//:go_default_library",
],
)
Expand Down
18 changes: 17 additions & 1 deletion beacon-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"runtime"
runtimeDebug "runtime/debug"

"gopkg.in/yaml.v2"

shayzluf marked this conversation as resolved.
Show resolved Hide resolved
gethlog "github.com/ethereum/go-ethereum/log"
golog "github.com/ipfs/go-log"
joonix "github.com/joonix/log"
Expand All @@ -16,6 +19,7 @@ import (
"github.com/prysmaticlabs/prysm/shared/debug"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/logutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/version"
"github.com/sirupsen/logrus"
gologging "github.com/whyrusleeping/go-logging"
Expand Down Expand Up @@ -86,6 +90,7 @@ var appFlags = []cli.Flag{
cmd.LogFileName,
cmd.EnableUPnPFlag,
cmd.ConfigFileFlag,
cmd.ChainConfigFileFlag,
}

func init() {
Expand Down Expand Up @@ -141,7 +146,18 @@ func main() {
log.WithError(err).Error("Failed to configuring logging to disk.")
}
}

if ctx.IsSet(cmd.ChainConfigFileFlag.Name) {
chainConfigFileName := ctx.String(cmd.ChainConfigFileFlag.Name)
yamlFile, err := ioutil.ReadFile(chainConfigFileName)
if err != nil {
log.WithError(err).Error("Failed to read chain config file.")
}
conf := params.BeaconConfig()
if err := yaml.Unmarshal(yamlFile, conf); err != nil {
log.WithError(err).Error("Failed to parse chain config yaml file.")
shayzluf marked this conversation as resolved.
Show resolved Hide resolved
}
params.OverrideBeaconConfig(conf)
}
if ctx.IsSet(flags.SetGCPercent.Name) {
runtimeDebug.SetGCPercent(ctx.Int(flags.SetGCPercent.Name))
}
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var appHelpFlagGroups = []flagGroup{
cmd.ForceClearDB,
cmd.ClearDB,
cmd.ConfigFileFlag,
cmd.ChainConfigFileFlag,
},
},
{
Expand Down
7 changes: 6 additions & 1 deletion shared/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ var (
}
// ConfigFileFlag specifies the filepath to load flag values.
ConfigFileFlag = &cli.StringFlag{
Name: "config-file",
Name: "flag-config-file",
shayzluf marked this conversation as resolved.
Show resolved Hide resolved
Usage: "The filepath to a yaml file with flag values",
}
// ChainConfigFileFlag specifies the filepath to load flag values.
ChainConfigFileFlag = &cli.StringFlag{
Name: "chain-config-file",
Usage: "The filepath to a yaml file with chain config values",
shayzluf marked this conversation as resolved.
Show resolved Hide resolved
}
)
6 changes: 3 additions & 3 deletions shared/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ type BeaconChainConfig struct {
MinGenesisDelay uint64 `yaml:"MIN_GENESIS_DELAY"` // Minimum number of seconds to delay starting the ETH2 genesis. Must be at least 1 second.

// Misc constants.
TargetCommitteeSize uint64 `yaml:"TARGET_COMMITTEE_SIZE"` // TargetCommitteeSize is the number of validators in a committee when the chain is healthy.
MaxValidatorsPerCommittee uint64 `yaml:"MAX_VALIDATORS_PER_COMMITTEE"` // MaxValidatorsPerCommittee defines the upper bound of the size of a committee.
MaxCommitteesPerSlot uint64 // MaxCommitteesPerSlot defines the max amount of committee in a single slot.
TargetCommitteeSize uint64 `yaml:"TARGET_COMMITTEE_SIZE"` // TargetCommitteeSize is the number of validators in a committee when the chain is healthy.
MaxValidatorsPerCommittee uint64 `yaml:"MAX_VALIDATORS_PER_COMMITTEE"` // MaxValidatorsPerCommittee defines the upper bound of the size of a committee.
MaxCommitteesPerSlot uint64 `yaml:"MAX_COMMITTEES_PER_SLOT"` // MaxCommitteesPerSlot defines the max amount of committee in a single slot.
MinPerEpochChurnLimit uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT"` // MinPerEpochChurnLimit is the minimum amount of churn allotted for validator rotations.
ChurnLimitQuotient uint64 `yaml:"CHURN_LIMIT_QUOTIENT"` // ChurnLimitQuotient is used to determine the limit of how many validators can rotate per epoch.
ShuffleRoundCount uint64 `yaml:"SHUFFLE_ROUND_COUNT"` // ShuffleRoundCount is used for retrieving the permuted index.
shayzluf marked this conversation as resolved.
Show resolved Hide resolved
Expand Down