diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-03 11:59:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 11:59:03 +0800 |
commit | 09393166791785ab6730b1c812b4a4fd07a92293 (patch) | |
tree | 0606f440bdd44eeac09f025de2fd4f86d48886f0 /simulation | |
parent | 3410f1156703a7249bade6e3cc90b60a1fcefa54 (diff) | |
download | tangerine-consensus-09393166791785ab6730b1c812b4a4fd07a92293.tar.gz tangerine-consensus-09393166791785ab6730b1c812b4a4fd07a92293.tar.zst tangerine-consensus-09393166791785ab6730b1c812b4a4fd07a92293.zip |
Add GetChainNumber to Goverance (#92)
Diffstat (limited to 'simulation')
-rw-r--r-- | simulation/config/config.go | 23 | ||||
-rw-r--r-- | simulation/governance.go | 15 | ||||
-rw-r--r-- | simulation/kubernetes/config.toml.in | 4 |
3 files changed, 19 insertions, 23 deletions
diff --git a/simulation/config/config.go b/simulation/config/config.go index 8a804a5..c59b663 100644 --- a/simulation/config/config.go +++ b/simulation/config/config.go @@ -33,17 +33,12 @@ const ( NetworkTypeTCPLocal NetworkType = "tcp-local" ) -// Agreement settings. -type Agreement struct { - GenesisCRS string `toml:"genesis_crs"` - K int -} - // Consensus settings. type Consensus struct { - Agreement Agreement - PhiRatio float32 - K int + PhiRatio float32 + K int + ChainNum uint32 + GenesisCRS string `toml:"genesis_crs"` } // Validator config for the simulation. @@ -90,12 +85,10 @@ func GenerateDefault(path string) error { Title: "DEXON Consensus Simulation Config", Validator: Validator{ Consensus: Consensus{ - Agreement: Agreement{ - GenesisCRS: "In DEXON we trust.", - K: 50, - }, - PhiRatio: float32(2) / 3, - K: 1, + PhiRatio: float32(2) / 3, + K: 1, + ChainNum: 7, + GenesisCRS: "In DEXON we trust.", }, Num: 7, ProposeIntervalMean: 500, diff --git a/simulation/governance.go b/simulation/governance.go index 42577d9..61794a5 100644 --- a/simulation/governance.go +++ b/simulation/governance.go @@ -34,8 +34,8 @@ type simGovernance struct { expectedNumValidators int k int phiRatio float32 + chainNum uint32 crs string - agreementK int } // newSimGovernance returns a new simGovernance instance. @@ -44,10 +44,10 @@ func newSimGovernance( return &simGovernance{ validatorSet: make(map[types.ValidatorID]decimal.Decimal), expectedNumValidators: numValidators, - k: consensusConfig.K, - phiRatio: consensusConfig.PhiRatio, - crs: consensusConfig.Agreement.GenesisCRS, - agreementK: consensusConfig.Agreement.K, + k: consensusConfig.K, + phiRatio: consensusConfig.PhiRatio, + chainNum: consensusConfig.ChainNum, + crs: consensusConfig.GenesisCRS, } } @@ -81,6 +81,11 @@ func (g *simGovernance) GetBlockProposingInterval() int { return 0 } +// GetChainNumber returns number of chain. +func (g *simGovernance) GetChainNumber() uint32 { + return g.chainNum +} + // GetConfigurationChangeEvent returns configuration change event since last // epoch. func (g *simGovernance) GetConfigurationChangeEvent( diff --git a/simulation/kubernetes/config.toml.in b/simulation/kubernetes/config.toml.in index 3019920..1cc18aa 100644 --- a/simulation/kubernetes/config.toml.in +++ b/simulation/kubernetes/config.toml.in @@ -9,10 +9,8 @@ max_block = 1000 [validator.consensus] phi_ratio = 6.66670024394989e-01 k = 1 - -[validator.consensus.agreement] +chain_num = 7 genesis_crs = "In DEXON we trust." -k = 50 [networking] type = "tcp" |