diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-12-18 20:25:58 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:54 +0800 |
commit | a6fd9c42d0d2632961f1f8adfe9db85ac125d294 (patch) | |
tree | 329aa6351559fc38db674879265ca3102ca74e43 /params | |
parent | 2e36ada5739437b6860d3978ac3e19f4073d94be (diff) | |
download | dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.tar dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.tar.gz dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.tar.bz2 dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.tar.lz dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.tar.xz dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.tar.zst dexon-a6fd9c42d0d2632961f1f8adfe9db85ac125d294.zip |
core: vm: add undelegate fund lockup mechanism (#94)
Only allow a user to withdraw funds after a certain lockup
period. This way, the fund of a bad actor could be confiscated before he
could escape.
Diffstat (limited to 'params')
-rw-r--r-- | params/config.go | 11 | ||||
-rw-r--r-- | params/gen_dexcon_config.go | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/params/config.go b/params/config.go index 09baec172..5bedf9772 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("0xc8e4d0c33d92b7751fe3747f778aa27600508c8c922be1dbbc7db6ee967f4e6c") - TestnetGenesisHash = common.HexToHash("0x63b758fa30bf833430171514448288d4e67c1d6a989d1474fdd5c5888dfe77fd") + MainnetGenesisHash = common.HexToHash("0x5fc1fdb2eca492d256600c0d96a2ca7bdfd9412ac8557bcab54e05332260e26b") + TestnetGenesisHash = common.HexToHash("0x252c41c125e4a9137a39a20b810ddcd33a8023c407cac863ad2326a521375d0f") ) var ( @@ -48,6 +48,7 @@ var ( GenesisCRSText: "In DEXON, we trust.", Owner: common.HexToAddress("BF8C48A620bacc46907f9B89732D25E47A2D7Cf7"), MinStake: new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)), + LockupPeriod: 86400 * 3 * 1000, BlockReward: big.NewInt(1e18), BlockGasLimit: 40000000, NumChains: 4, @@ -87,6 +88,7 @@ var ( GenesisCRSText: "In DEXON, we trust.", Owner: common.HexToAddress("BF8C48A620bacc46907f9B89732D25E47A2D7Cf7"), MinStake: new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)), + LockupPeriod: 86400 * 3 * 1000, BlockReward: big.NewInt(1e18), BlockGasLimit: 40000000, NumChains: 6, @@ -116,6 +118,7 @@ var ( GenesisCRSText: "In DEXON, we trust.", Owner: common.HexToAddress("BF8C48A620bacc46907f9B89732D25E47A2D7Cf7"), MinStake: new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)), + LockupPeriod: 86400 * 3 * 1000, BlockReward: big.NewInt(1e18), BlockGasLimit: 40000000, NumChains: 6, @@ -258,6 +261,7 @@ type DexconConfig struct { GenesisCRSText string `json:"genesisCRSText"` Owner common.Address `json:"owner"` MinStake *big.Int `json:"minStake"` + LockupPeriod uint64 `json:"lockupPeriod"` BlockReward *big.Int `json:"blockReward"` BlockGasLimit uint64 `json:"blockGasLimit"` NumChains uint32 `json:"numChains"` @@ -278,10 +282,11 @@ type dexconConfigSpecMarshaling struct { // String implements the stringer interface, returning the consensus engine details. func (d *DexconConfig) String() string { - return fmt.Sprintf("{GenesisCRSText: %v Owner: %v MinStake: %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}", d.GenesisCRSText, d.Owner, d.MinStake, + d.LockupPeriod, d.BlockReward, d.BlockGasLimit, d.NumChains, diff --git a/params/gen_dexcon_config.go b/params/gen_dexcon_config.go index 9cd9395cc..55d98ba37 100644 --- a/params/gen_dexcon_config.go +++ b/params/gen_dexcon_config.go @@ -18,6 +18,7 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) { 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"` @@ -34,6 +35,7 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) { enc.GenesisCRSText = d.GenesisCRSText enc.Owner = d.Owner enc.MinStake = (*math.HexOrDecimal256)(d.MinStake) + enc.LockupPeriod = d.LockupPeriod enc.BlockReward = (*math.HexOrDecimal256)(d.BlockReward) enc.BlockGasLimit = d.BlockGasLimit enc.NumChains = d.NumChains @@ -54,6 +56,7 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error { 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"` @@ -79,6 +82,9 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error { if dec.MinStake != nil { d.MinStake = (*big.Int)(dec.MinStake) } + if dec.LockupPeriod != nil { + d.LockupPeriod = *dec.LockupPeriod + } if dec.BlockReward != nil { d.BlockReward = (*big.Int)(dec.BlockReward) } |