aboutsummaryrefslogtreecommitdiffstats
path: root/params
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-01-06 23:21:54 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commitc6c8b6cfd083058a255d614db14df0e75fdd3482 (patch)
tree23fd25eec0a08923f2516fc688ad2487592ae928 /params
parent2b7671af8b76f64bcbe69d99509d454cb33be5ad (diff)
downloadgo-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.tar
go-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.tar.gz
go-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.tar.bz2
go-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.tar.lz
go-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.tar.xz
go-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.tar.zst
go-tangerine-c6c8b6cfd083058a255d614db14df0e75fdd3482.zip
core: vm: implement byzantine reporting mechanism (#128)
Diffstat (limited to 'params')
-rw-r--r--params/config.go24
-rw-r--r--params/gen_dexcon_config.go74
2 files changed, 65 insertions, 33 deletions
diff --git a/params/config.go b/params/config.go
index 036644779..3234d5c59 100644
--- a/params/config.go
+++ b/params/config.go
@@ -26,8 +26,8 @@ import (
// Genesis hashes to enforce below configs on.
var (
- MainnetGenesisHash = common.HexToHash("0xf0510808109583b9ef62f846886179f2fb40d1d4f1872d33529947bdd03e9bc1")
- TestnetGenesisHash = common.HexToHash("0x3e14e72125f46254853814b6e9f0b79d296e16b1d60d312516002bf8cfad62f8")
+ MainnetGenesisHash = common.HexToHash("0x81abe3e66f63afe3806b64e7529d2a3f2ae9be7ba3e6fca2a561808bf7875a03")
+ TestnetGenesisHash = common.HexToHash("0x3fe7a48aca63addc5e502fe60a37a865b454c649e106d07d3cd810e086e1fc6d")
)
// TrustedCheckpoints associates each known checkpoint with the genesis hash of
@@ -67,6 +67,11 @@ var (
DKGSetSize: 4,
RoundInterval: 600000,
MinBlockInterval: 900,
+ FineValues: []*big.Int{
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)),
+ },
},
}
@@ -107,6 +112,11 @@ var (
DKGSetSize: 4,
RoundInterval: 600000,
MinBlockInterval: 900,
+ FineValues: []*big.Int{
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)),
+ },
},
}
@@ -138,6 +148,11 @@ var (
DKGSetSize: 13,
RoundInterval: 3600000,
MinBlockInterval: 900,
+ FineValues: []*big.Int{
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
+ new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)),
+ },
},
}
@@ -281,16 +296,18 @@ type DexconConfig struct {
DKGSetSize uint32 `json:"dkgSetSize"`
RoundInterval uint64 `json:"roundInterval"`
MinBlockInterval uint64 `json:"minBlockInterval"`
+ FineValues []*big.Int `json:"fineValues"`
}
type dexconConfigSpecMarshaling struct {
MinStake *math.HexOrDecimal256
BlockReward *math.HexOrDecimal256
+ FineValues []*math.HexOrDecimal256
}
// String implements the stringer interface, returning the consensus engine details.
func (d *DexconConfig) String() string {
- return fmt.Sprintf("{GenesisCRSText: %v Owner: %v MinStake: %v LockupPeriod: %v BlockReward: %v BlockGasLimit: %v NumChains: %v LambdaBA: %v LambdaDKG: %v K: %v PhiRatio: %v NotarySetSize: %v DKGSetSize: %v RoundInterval: %v MinBlockInterval: %v}",
+ return fmt.Sprintf("{GenesisCRSText: %v Owner: %v MinStake: %v LockupPeriod: %v BlockReward: %v BlockGasLimit: %v NumChains: %v LambdaBA: %v LambdaDKG: %v K: %v PhiRatio: %v NotarySetSize: %v DKGSetSize: %v RoundInterval: %v MinBlockInterval: %v FineValues: %v}",
d.GenesisCRSText,
d.Owner,
d.MinStake,
@@ -306,6 +323,7 @@ func (d *DexconConfig) String() string {
d.DKGSetSize,
d.RoundInterval,
d.MinBlockInterval,
+ d.FineValues,
)
}
diff --git a/params/gen_dexcon_config.go b/params/gen_dexcon_config.go
index 55d98ba37..4ec55c0c9 100644
--- a/params/gen_dexcon_config.go
+++ b/params/gen_dexcon_config.go
@@ -15,21 +15,22 @@ var _ = (*dexconConfigSpecMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (d DexconConfig) MarshalJSON() ([]byte, error) {
type DexconConfig struct {
- GenesisCRSText string `json:"genesisCRSText"`
- Owner common.Address `json:"owner"`
- MinStake *math.HexOrDecimal256 `json:"minStake"`
- LockupPeriod uint64 `json:"lockupPeriod"`
- BlockReward *math.HexOrDecimal256 `json:"blockReward"`
- BlockGasLimit uint64 `json:"blockGasLimit"`
- NumChains uint32 `json:"numChains"`
- LambdaBA uint64 `json:"lambdaBA"`
- LambdaDKG uint64 `json:"lambdaDKG"`
- K uint32 `json:"k"`
- PhiRatio float32 `json:"phiRatio"`
- NotarySetSize uint32 `json:"notarySetSize"`
- DKGSetSize uint32 `json:"dkgSetSize"`
- RoundInterval uint64 `json:"roundInterval"`
- MinBlockInterval uint64 `json:"minBlockInterval"`
+ GenesisCRSText string `json:"genesisCRSText"`
+ Owner common.Address `json:"owner"`
+ MinStake *math.HexOrDecimal256 `json:"minStake"`
+ LockupPeriod uint64 `json:"lockupPeriod"`
+ BlockReward *math.HexOrDecimal256 `json:"blockReward"`
+ BlockGasLimit uint64 `json:"blockGasLimit"`
+ NumChains uint32 `json:"numChains"`
+ LambdaBA uint64 `json:"lambdaBA"`
+ LambdaDKG uint64 `json:"lambdaDKG"`
+ K uint32 `json:"k"`
+ PhiRatio float32 `json:"phiRatio"`
+ NotarySetSize uint32 `json:"notarySetSize"`
+ DKGSetSize uint32 `json:"dkgSetSize"`
+ RoundInterval uint64 `json:"roundInterval"`
+ MinBlockInterval uint64 `json:"minBlockInterval"`
+ FineValues []*math.HexOrDecimal256 `json:"fineValues"`
}
var enc DexconConfig
enc.GenesisCRSText = d.GenesisCRSText
@@ -47,27 +48,34 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) {
enc.DKGSetSize = d.DKGSetSize
enc.RoundInterval = d.RoundInterval
enc.MinBlockInterval = d.MinBlockInterval
+ if d.FineValues != nil {
+ enc.FineValues = make([]*math.HexOrDecimal256, len(d.FineValues))
+ for k, v := range d.FineValues {
+ enc.FineValues[k] = (*math.HexOrDecimal256)(v)
+ }
+ }
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (d *DexconConfig) UnmarshalJSON(input []byte) error {
type DexconConfig struct {
- GenesisCRSText *string `json:"genesisCRSText"`
- Owner *common.Address `json:"owner"`
- MinStake *math.HexOrDecimal256 `json:"minStake"`
- LockupPeriod *uint64 `json:"lockupPeriod"`
- BlockReward *math.HexOrDecimal256 `json:"blockReward"`
- BlockGasLimit *uint64 `json:"blockGasLimit"`
- NumChains *uint32 `json:"numChains"`
- LambdaBA *uint64 `json:"lambdaBA"`
- LambdaDKG *uint64 `json:"lambdaDKG"`
- K *uint32 `json:"k"`
- PhiRatio *float32 `json:"phiRatio"`
- NotarySetSize *uint32 `json:"notarySetSize"`
- DKGSetSize *uint32 `json:"dkgSetSize"`
- RoundInterval *uint64 `json:"roundInterval"`
- MinBlockInterval *uint64 `json:"minBlockInterval"`
+ GenesisCRSText *string `json:"genesisCRSText"`
+ Owner *common.Address `json:"owner"`
+ MinStake *math.HexOrDecimal256 `json:"minStake"`
+ LockupPeriod *uint64 `json:"lockupPeriod"`
+ BlockReward *math.HexOrDecimal256 `json:"blockReward"`
+ BlockGasLimit *uint64 `json:"blockGasLimit"`
+ NumChains *uint32 `json:"numChains"`
+ LambdaBA *uint64 `json:"lambdaBA"`
+ LambdaDKG *uint64 `json:"lambdaDKG"`
+ K *uint32 `json:"k"`
+ PhiRatio *float32 `json:"phiRatio"`
+ NotarySetSize *uint32 `json:"notarySetSize"`
+ DKGSetSize *uint32 `json:"dkgSetSize"`
+ RoundInterval *uint64 `json:"roundInterval"`
+ MinBlockInterval *uint64 `json:"minBlockInterval"`
+ FineValues []*math.HexOrDecimal256 `json:"fineValues"`
}
var dec DexconConfig
if err := json.Unmarshal(input, &dec); err != nil {
@@ -118,5 +126,11 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error {
if dec.MinBlockInterval != nil {
d.MinBlockInterval = *dec.MinBlockInterval
}
+ if dec.FineValues != nil {
+ d.FineValues = make([]*big.Int, len(dec.FineValues))
+ for k, v := range dec.FineValues {
+ d.FineValues[k] = (*big.Int)(v)
+ }
+ }
return nil
}