diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-28 13:06:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-28 13:06:16 +0800 |
commit | 9ad4ae71b5a49ddc77687cc368c31416a0ee0688 (patch) | |
tree | ca29f72aa63b6610f0a8ec1aef2e842677e9ac6f /simulation | |
parent | 5fc0efa940c7663a33d0fc501807a2627d2cb573 (diff) | |
download | dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.tar dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.tar.gz dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.tar.bz2 dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.tar.lz dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.tar.xz dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.tar.zst dexon-consensus-9ad4ae71b5a49ddc77687cc368c31416a0ee0688.zip |
core: Add sizes of various nodeSets (#148)
Diffstat (limited to 'simulation')
-rw-r--r-- | simulation/config/config.go | 26 | ||||
-rw-r--r-- | simulation/governance.go | 19 | ||||
-rw-r--r-- | simulation/kubernetes/config.toml.in | 3 |
3 files changed, 30 insertions, 18 deletions
diff --git a/simulation/config/config.go b/simulation/config/config.go index 8bc4ab7..ac4303d 100644 --- a/simulation/config/config.go +++ b/simulation/config/config.go @@ -36,12 +36,13 @@ const ( // Consensus settings. type Consensus struct { - PhiRatio float32 - K int - ChainNum uint32 - GenesisCRS string `toml:"genesis_crs"` - LambdaBA int `toml:"lambda_ba"` - LambdaDKG int `toml:"lambda_dkg"` + PhiRatio float32 + K int + ChainNum uint32 + GenesisCRS string `toml:"genesis_crs"` + LambdaBA int `toml:"lambda_ba"` + LambdaDKG int `toml:"lambda_dkg"` + RoundInterval int } // Legacy config. @@ -93,12 +94,13 @@ func GenerateDefault(path string) error { Title: "DEXON Consensus Simulation Config", Node: Node{ Consensus: Consensus{ - PhiRatio: float32(2) / 3, - K: 1, - ChainNum: 7, - GenesisCRS: "In DEXON we trust.", - LambdaBA: 250, - LambdaDKG: 1000, + PhiRatio: float32(2) / 3, + K: 1, + ChainNum: 7, + GenesisCRS: "In DEXON we trust.", + LambdaBA: 250, + LambdaDKG: 1000, + RoundInterval: 365 * 86400 * 1000, }, Legacy: Legacy{ ProposeIntervalMean: 500, diff --git a/simulation/governance.go b/simulation/governance.go index 3290075..3351202 100644 --- a/simulation/governance.go +++ b/simulation/governance.go @@ -43,6 +43,7 @@ type simGovernance struct { dkgMasterPublicKey map[uint64][]*types.DKGMasterPublicKey lambdaBA time.Duration lambdaDKG time.Duration + roundInterval time.Duration network *network } @@ -63,6 +64,7 @@ func newSimGovernance( dkgMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey), lambdaBA: time.Duration(consensusConfig.LambdaBA) * time.Millisecond, lambdaDKG: time.Duration(consensusConfig.LambdaDKG) * time.Millisecond, + roundInterval: time.Duration(consensusConfig.RoundInterval) * time.Millisecond, } } @@ -84,12 +86,17 @@ func (g *simGovernance) GetNodeSet(round uint64) (ret []crypto.PublicKey) { // GetConfiguration returns the configuration at a given round. func (g *simGovernance) GetConfiguration(round uint64) *types.Config { return &types.Config{ - NumShards: 1, - NumChains: g.chainNum, - LambdaBA: g.lambdaBA, - LambdaDKG: g.lambdaDKG, - K: g.k, - PhiRatio: g.phiRatio, + NumShards: 1, + NumChains: g.chainNum, + LambdaBA: g.lambdaBA, + LambdaDKG: g.lambdaDKG, + K: g.k, + PhiRatio: g.phiRatio, + NumNotarySet: len(g.nodeSet), + NumWitnessSet: len(g.nodeSet), + NumDKGSet: len(g.nodeSet), + MinBlockInterval: g.lambdaBA * 3, + MaxBlockInterval: g.lambdaBA * 8, } } diff --git a/simulation/kubernetes/config.toml.in b/simulation/kubernetes/config.toml.in index dee1fe2..f34ee76 100644 --- a/simulation/kubernetes/config.toml.in +++ b/simulation/kubernetes/config.toml.in @@ -11,6 +11,9 @@ phi_ratio = 6.66670024394989e-01 k = 1 chain_num = 7 genesis_crs = "In DEXON we trust." +lambda_ba = 250 +lambda_dkg = 1000 +round_interval = 31536000000 [node.legacy] propose_interval_mean = 5e+02 |