diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-09-25 18:52:35 +0800 |
---|---|---|
committer | missionliao <38416648+missionliao@users.noreply.github.com> | 2018-09-25 18:52:35 +0800 |
commit | 0ffea9dadcfc0d8a740942a2d666eccc00613cd4 (patch) | |
tree | 7984fd6c5a58abc96b1a808efb89806d48612299 /simulation | |
parent | d844c339a128322dff180a6ccc6e6b241e917546 (diff) | |
download | dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.gz dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.bz2 dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.lz dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.xz dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.zst dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.zip |
core: update governance interface to consider genesis state (#136)
Diffstat (limited to 'simulation')
-rw-r--r-- | simulation/app.go | 2 | ||||
-rw-r--r-- | simulation/governance.go | 21 |
2 files changed, 12 insertions, 11 deletions
diff --git a/simulation/app.go b/simulation/app.go index ab0bfcd..cb8c129 100644 --- a/simulation/app.go +++ b/simulation/app.go @@ -61,7 +61,7 @@ func (a *simApp) BlockConfirmed(_ common.Hash) { } // VerifyPayload implements core.Application. -func (a *simApp) VerifyPayload(payloads []byte) bool { +func (a *simApp) VerifyPayload(payload []byte) bool { return true } diff --git a/simulation/governance.go b/simulation/governance.go index 613205d..643c181 100644 --- a/simulation/governance.go +++ b/simulation/governance.go @@ -36,7 +36,7 @@ type simGovernance struct { k int phiRatio float32 chainNum uint32 - crs string + crs []byte dkgComplaint map[uint64][]*types.DKGComplaint dkgMasterPublicKey map[uint64][]*types.DKGMasterPublicKey lambdaBA time.Duration @@ -55,7 +55,7 @@ func newSimGovernance( k: consensusConfig.K, phiRatio: consensusConfig.PhiRatio, chainNum: consensusConfig.ChainNum, - crs: consensusConfig.GenesisCRS, + crs: []byte(consensusConfig.GenesisCRS), dkgComplaint: make(map[uint64][]*types.DKGComplaint), dkgMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey), lambdaBA: time.Duration(consensusConfig.LambdaBA) * time.Millisecond, @@ -68,7 +68,8 @@ func (g *simGovernance) setNetwork(network *network) { } // GetNotarySet returns the current notary set. -func (g *simGovernance) GetNotarySet() map[types.NodeID]struct{} { +func (g *simGovernance) GetNotarySet( + blockHeight uint64) map[types.NodeID]struct{} { g.lock.RLock() defer g.lock.RUnlock() @@ -83,13 +84,13 @@ func (g *simGovernance) GetNotarySet() map[types.NodeID]struct{} { // GetConfiguration returns the configuration at a given block height. func (g *simGovernance) GetConfiguration(blockHeight uint64) *types.Config { return &types.Config{ - NumShards: 1, - NumChains: g.chainNum, - GenesisCRS: g.crs, - LambdaBA: g.lambdaBA, - LambdaDKG: g.lambdaDKG, - K: g.k, - PhiRatio: g.phiRatio, + NumShards: 1, + NumChains: g.chainNum, + CRS: g.crs, + LambdaBA: g.lambdaBA, + LambdaDKG: g.lambdaDKG, + K: g.k, + PhiRatio: g.phiRatio, } } |