diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-12-18 20:25:58 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:19 +0800 |
commit | 4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340 (patch) | |
tree | dad014cb96be5034998e0da6ff7021755d71ff4e /params | |
parent | 25170167372a41d22fc5951f459686b117c8380e (diff) | |
download | go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.tar go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.tar.gz go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.tar.bz2 go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.tar.lz go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.tar.xz go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.tar.zst go-tangerine-4cdf3cfea3cc93d0e18fd8c72b953cb62bf5b340.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 dae619912..50222c23b 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") ) // TrustedCheckpoints associates each known checkpoint with the genesis hash of @@ -55,6 +55,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, @@ -94,6 +95,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, @@ -123,6 +125,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, @@ -265,6 +268,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"` @@ -285,10 +289,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) } |