From 8c33027b943e08de21b7bddb82fecc2b2a5664a2 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Tue, 18 Sep 2018 17:57:36 +0800 Subject: core: refine governance interface to reduce Get* methods (#114) Since we have a bunch of static configurations in the governance contract, instead of using a Get* method for each of them, we instead implement a GetConfiguration() method to return a structure of the configurations. --- core/interfaces.go | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'core/interfaces.go') diff --git a/core/interfaces.go b/core/interfaces.go index 2b616ab..0a8ca8f 100644 --- a/core/interfaces.go +++ b/core/interfaces.go @@ -20,8 +20,6 @@ package core import ( "time" - "github.com/shopspring/decimal" - "github.com/dexon-foundation/dexon-consensus-core/common" "github.com/dexon-foundation/dexon-consensus-core/core/types" ) @@ -75,29 +73,13 @@ type Network interface { // Note that there are a lot more methods in the governance contract, that this // interface only define those that are required to run the consensus algorithm. type Governance interface { - // Get the current validator set and it's corresponding stake. - GetValidatorSet() map[types.ValidatorID]decimal.Decimal - - // Get K. - GetTotalOrderingK() int - - // Get PhiRatio. - GetPhiRatio() float32 - - // Get Number of shards. - GetNumShards() uint32 - - // Get Number of chains. - GetNumChains() uint32 - - // Get Genesis CRS. - GetGenesisCRS() string + // GetConfiguration returns the configuration at a given block height. + GetConfiguration(blockHeight uint64) *types.Config - // Get configuration change events after an epoch. - GetConfigurationChangeEvent(epoch int) []types.ConfigurationChangeEvent + // Get the current validator set. + GetNotarySet() map[types.ValidatorID]struct{} - // Get lambda for BA. - GetLambda() time.Duration + //// DKG-related methods. // AddDKGComplaint adds a DKGComplaint. AddDKGComplaint(complaint *types.DKGComplaint) -- cgit v1.2.3