aboutsummaryrefslogtreecommitdiffstats
path: root/params
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-02-25 18:27:34 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:57 +0800
commit5832a21db625bfa98a3b7909bb6996dd1fd2e4d3 (patch)
tree73f5de74fa6aa753349f00e11e989533de8a45ef /params
parent6e66efc9f69d59a011215f88a0de03508d9c56ab (diff)
downloaddexon-5832a21db625bfa98a3b7909bb6996dd1fd2e4d3.tar.gz
dexon-5832a21db625bfa98a3b7909bb6996dd1fd2e4d3.tar.zst
dexon-5832a21db625bfa98a3b7909bb6996dd1fd2e4d3.zip
core: Fixed gas price (#205)
* core/vm: update abi * core/vm: add MinGasPrice to gov * params: Add MinGasPrice to Config * dex: SuggestPrice from Governance * test: add minGasPrice to genesis.json * core: check underpriced tx * dex: verify with gas price
Diffstat (limited to 'params')
-rw-r--r--params/config.go12
-rw-r--r--params/gen_dexcon_config.go6
2 files changed, 15 insertions, 3 deletions
diff --git a/params/config.go b/params/config.go
index 174d19af3..cad58c33f 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("0x6c59132f64eae33054c0390e4d8f8ea5f0df1642b3a084c94388c44fe5eff70d")
- TestnetGenesisHash = common.HexToHash("0x31847855ec3c1ba9a03ac3311f283775a70d7b0422b525c335aa094e5b81c902")
+ MainnetGenesisHash = common.HexToHash("0xf80aae99a7c44bc54d7b0cc8a16645fa3ea65c01b180339f17b31a698b031271")
+ TestnetGenesisHash = common.HexToHash("0x7f704c8d0a773d0fcca231d40bf39495553886bf8800b4a06920786a802103e1")
)
var (
@@ -65,6 +65,7 @@ var (
new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)),
},
+ MinGasPrice: new(big.Int).Mul(big.NewInt(1e9), big.NewInt(1)),
},
}
@@ -110,6 +111,7 @@ var (
new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)),
},
+ MinGasPrice: new(big.Int).Mul(big.NewInt(1e9), big.NewInt(1)),
},
}
@@ -146,6 +148,7 @@ var (
new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e4)),
new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e5)),
},
+ MinGasPrice: new(big.Int).Mul(big.NewInt(1e9), big.NewInt(1)),
},
}
@@ -292,6 +295,7 @@ type DexconConfig struct {
RoundLength uint64 `json:"roundLength"`
MinBlockInterval uint64 `json:"minBlockInterval"`
FineValues []*big.Int `json:"fineValues"`
+ MinGasPrice *big.Int `json:"minGasPrice"`
}
type dexconConfigSpecMarshaling struct {
@@ -299,11 +303,12 @@ type dexconConfigSpecMarshaling struct {
NextHalvingSupply *math.HexOrDecimal256
LastHalvedAmount *math.HexOrDecimal256
FineValues []*math.HexOrDecimal256
+ MinGasPrice *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 MiningVelocity: %v NextHalvingSupply: %v LastHalvedAmount: %v BlockGasLimit: %v LambdaBA: %v LambdaDKG: %v NotarySetSize: %v DKGSetSize: %v RoundLength: %v MinBlockInterval: %v FineValues: %v}",
+ return fmt.Sprintf("{GenesisCRSText: %v Owner: %v MinStake: %v LockupPeriod: %v MiningVelocity: %v NextHalvingSupply: %v LastHalvedAmount: %v BlockGasLimit: %v LambdaBA: %v LambdaDKG: %v NotarySetSize: %v DKGSetSize: %v RoundLength: %v MinBlockInterval: %v FineValues: %v MinGasPrice: %v}",
d.GenesisCRSText,
d.Owner,
d.MinStake,
@@ -319,6 +324,7 @@ func (d *DexconConfig) String() string {
d.RoundLength,
d.MinBlockInterval,
d.FineValues,
+ d.MinGasPrice,
)
}
diff --git a/params/gen_dexcon_config.go b/params/gen_dexcon_config.go
index 566ed9fcd..1afe11f56 100644
--- a/params/gen_dexcon_config.go
+++ b/params/gen_dexcon_config.go
@@ -30,6 +30,7 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) {
RoundLength uint64 `json:"roundLength"`
MinBlockInterval uint64 `json:"minBlockInterval"`
FineValues []*math.HexOrDecimal256 `json:"fineValues"`
+ MinGasPrice *math.HexOrDecimal256 `json:"minGasPrice"`
}
var enc DexconConfig
enc.GenesisCRSText = d.GenesisCRSText
@@ -52,6 +53,7 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) {
enc.FineValues[k] = (*math.HexOrDecimal256)(v)
}
}
+ enc.MinGasPrice = (*math.HexOrDecimal256)(d.MinGasPrice)
return json.Marshal(&enc)
}
@@ -73,6 +75,7 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error {
RoundLength *uint64 `json:"roundLength"`
MinBlockInterval *uint64 `json:"minBlockInterval"`
FineValues []*math.HexOrDecimal256 `json:"fineValues"`
+ MinGasPrice *math.HexOrDecimal256 `json:"minGasPrice"`
}
var dec DexconConfig
if err := json.Unmarshal(input, &dec); err != nil {
@@ -126,5 +129,8 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error {
d.FineValues[k] = (*big.Int)(v)
}
}
+ if dec.MinGasPrice != nil {
+ d.MinGasPrice = (*big.Int)(dec.MinGasPrice)
+ }
return nil
}