aboutsummaryrefslogtreecommitdiffstats
path: root/simulation
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-09-27 14:27:18 +0800
committerGitHub <noreply@github.com>2018-09-27 14:27:18 +0800
commit506014f22faba150cd7197e7dd817e72a914dc84 (patch)
tree3f61287a4578c31c447cc8d9283fc3c728dd6cb7 /simulation
parent9c2f700be09c27e8a8d12fc5bc0ccd017d408a32 (diff)
downloaddexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar
dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.gz
dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.bz2
dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.lz
dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.xz
dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.zst
dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.zip
core: update governance interface and config (#145)
1) Remove RoundHeight from config. 2) NotarySet is not from governance contract, we get Node set intead. Notary set is caculated from the NodeSet using CRS. 3) CRS is not in the governance interface.
Diffstat (limited to 'simulation')
-rw-r--r--simulation/config/config.go26
-rw-r--r--simulation/governance.go14
2 files changed, 21 insertions, 19 deletions
diff --git a/simulation/config/config.go b/simulation/config/config.go
index cc31a5b..8bc4ab7 100644
--- a/simulation/config/config.go
+++ b/simulation/config/config.go
@@ -36,13 +36,12 @@ 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"`
- RoundHeight uint64
+ PhiRatio float32
+ K int
+ ChainNum uint32
+ GenesisCRS string `toml:"genesis_crs"`
+ LambdaBA int `toml:"lambda_ba"`
+ LambdaDKG int `toml:"lambda_dkg"`
}
// Legacy config.
@@ -94,13 +93,12 @@ 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,
- RoundHeight: 60,
+ PhiRatio: float32(2) / 3,
+ K: 1,
+ ChainNum: 7,
+ GenesisCRS: "In DEXON we trust.",
+ LambdaBA: 250,
+ LambdaDKG: 1000,
},
Legacy: Legacy{
ProposeIntervalMean: 500,
diff --git a/simulation/governance.go b/simulation/governance.go
index a48e221..eb0f2a2 100644
--- a/simulation/governance.go
+++ b/simulation/governance.go
@@ -70,8 +70,8 @@ func (g *simGovernance) setNetwork(network *network) {
g.network = network
}
-// GetNotarySet returns the current notary set.
-func (g *simGovernance) GetNotarySet(
+// GetNodeSet returns the current notary set.
+func (g *simGovernance) GetNodeSet(
blockHeight uint64) map[types.NodeID]struct{} {
g.lock.RLock()
defer g.lock.RUnlock()
@@ -84,12 +84,11 @@ func (g *simGovernance) GetNotarySet(
return ret
}
-// GetConfiguration returns the configuration at a given block height.
-func (g *simGovernance) GetConfiguration(blockHeight uint64) *types.Config {
+// GetConfiguration returns the configuration at a given round.
+func (g *simGovernance) GetConfiguration(round uint64) *types.Config {
return &types.Config{
NumShards: 1,
NumChains: g.chainNum,
- CRS: g.crs,
LambdaBA: g.lambdaBA,
LambdaDKG: g.lambdaDKG,
K: g.k,
@@ -97,6 +96,11 @@ func (g *simGovernance) GetConfiguration(blockHeight uint64) *types.Config {
}
}
+// GetCRS returns the CRS for a given round.
+func (g *simGovernance) GetCRS(round uint64) []byte {
+ return g.crs
+}
+
// addNode add a new node into the simulated governance contract.
func (g *simGovernance) addNode(nID types.NodeID) {
g.lock.Lock()