aboutsummaryrefslogtreecommitdiffstats
path: root/core/interfaces.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-09-18 17:57:36 +0800
committerGitHub <noreply@github.com>2018-09-18 17:57:36 +0800
commit8c33027b943e08de21b7bddb82fecc2b2a5664a2 (patch)
treeeaa282b1238eb609d710e9c45bb0689e7a399039 /core/interfaces.go
parent476c759f5e2ea3949cf3aaf4e60ccc7e0439ee73 (diff)
downloadtangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.tar
tangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.tar.gz
tangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.tar.bz2
tangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.tar.lz
tangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.tar.xz
tangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.tar.zst
tangerine-consensus-8c33027b943e08de21b7bddb82fecc2b2a5664a2.zip
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.
Diffstat (limited to 'core/interfaces.go')
-rw-r--r--core/interfaces.go28
1 files changed, 5 insertions, 23 deletions
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)