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@byzantine-lab.io>2019-06-12 17:27:22 +0800
commit8e92e73dc650ac03c228fbb26a3afe88a5bc237c (patch)
tree0d0c74884bddd2c29e38dfb903ccfd1459c8f279 /params
parentf1a3f3a8f39d5490f4320591def9c2866d866bc4 (diff)
downloadgo-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.tar
go-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.tar.gz
go-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.tar.bz2
go-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.tar.lz
go-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.tar.xz
go-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.tar.zst
go-tangerine-8e92e73dc650ac03c228fbb26a3afe88a5bc237c.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 937234c84..c9a648bd8 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")
)
// TrustedCheckpoints associates each known checkpoint with the genesis hash of
@@ -72,6 +72,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)),
},
}
@@ -117,6 +118,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)),
},
}
@@ -153,6 +155,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)),
},
}
@@ -299,6 +302,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 {
@@ -306,11 +310,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,
@@ -326,6 +331,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
}