diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-02-20 12:53:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-20 12:53:18 +0800 |
commit | 8ef4fc213703620fbfa13890dee042d40eea8545 (patch) | |
tree | ba9a07d2423314396e5677b7294122caa505ae9a /simulation/config | |
parent | 2cf18fd299ea0fc270b213343314cab652cac271 (diff) | |
download | dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.tar dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.tar.gz dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.tar.bz2 dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.tar.lz dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.tar.xz dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.tar.zst dexon-consensus-8ef4fc213703620fbfa13890dee042d40eea8545.zip |
core: switch round by block height (#450)
Diffstat (limited to 'simulation/config')
-rw-r--r-- | simulation/config/config.go | 8 | ||||
-rw-r--r-- | simulation/config/utils.go | 18 |
2 files changed, 3 insertions, 23 deletions
diff --git a/simulation/config/config.go b/simulation/config/config.go index 428b128..0ee2109 100644 --- a/simulation/config/config.go +++ b/simulation/config/config.go @@ -29,9 +29,6 @@ import ( // Consensus settings. type Consensus struct { - PhiRatio float32 - K int - NumChains uint32 GenesisCRS string `toml:"genesis_crs"` LambdaBA int `toml:"lambda_ba"` LambdaDKG int `toml:"lambda_dkg"` @@ -114,13 +111,10 @@ func GenerateDefault(path string) error { Title: "DEXON Consensus Simulation Config", Node: Node{ Consensus: Consensus{ - PhiRatio: float32(2) / 3, - K: 0, - NumChains: 7, GenesisCRS: "In DEXON we trust.", LambdaBA: 250, LambdaDKG: 1000, - RoundInterval: 30 * 1000, + RoundInterval: 1000, NotarySetSize: 7, DKGSetSize: 7, MinBlockInterval: 750, diff --git a/simulation/config/utils.go b/simulation/config/utils.go index 9d97fbd..f8f1eec 100644 --- a/simulation/config/utils.go +++ b/simulation/config/utils.go @@ -27,8 +27,6 @@ import ( // StateChangeTypeFromString convert a string to test.StateChangeType. func StateChangeTypeFromString(s string) test.StateChangeType { switch s { - case "num_chains": - return test.StateChangeNumChains case "lambda_ba": return test.StateChangeLambdaBA case "lambda_dkg": @@ -37,10 +35,6 @@ func StateChangeTypeFromString(s string) test.StateChangeType { return test.StateChangeRoundInterval case "min_block_interval": return test.StateChangeMinBlockInterval - case "k": - return test.StateChangeK - case "phi_ratio": - return test.StateChangePhiRatio case "notary_set_size": return test.StateChangeNotarySetSize case "dkg_set_size": @@ -54,27 +48,19 @@ func StateChangeTypeFromString(s string) test.StateChangeType { func StateChangeValueFromString( t test.StateChangeType, v string) interface{} { switch t { - case test.StateChangeNumChains, test.StateChangeNotarySetSize, - test.StateChangeDKGSetSize: + case test.StateChangeNotarySetSize, test.StateChangeDKGSetSize: ret, err := strconv.ParseUint(v, 10, 32) if err != nil { panic(err) } return uint32(ret) case test.StateChangeLambdaBA, test.StateChangeLambdaDKG, - test.StateChangeRoundInterval, test.StateChangeMinBlockInterval, - test.StateChangeK: + test.StateChangeRoundInterval, test.StateChangeMinBlockInterval: ret, err := strconv.ParseInt(v, 10, 32) if err != nil { panic(err) } return int(ret) - case test.StateChangePhiRatio: - ret, err := strconv.ParseFloat(v, 32) - if err != nil { - panic(err) - } - return float32(ret) } panic(fmt.Errorf("unsupported state change type %s", t)) } |