diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-04-22 15:25:54 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-15 22:09:56 +0800 |
commit | e7d3380b09a888008fd37efaa6692377a4f4e902 (patch) | |
tree | 92aa0a188784cde419e5fcb81f6271658a98b1c6 | |
parent | f8fb036b1b6985fa7dc5464f379507736e4b584f (diff) | |
download | go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.tar go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.tar.gz go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.tar.bz2 go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.tar.lz go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.tar.xz go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.tar.zst go-tangerine-e7d3380b09a888008fd37efaa6692377a4f4e902.zip |
core: vm: add sanity check for updateConfiguration (#383)
-rw-r--r-- | core/vm/oracle_contracts.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go index 90cef5def..4434dcf5c 100644 --- a/core/vm/oracle_contracts.go +++ b/core/vm/oracle_contracts.go @@ -1706,6 +1706,18 @@ func (g *GovernanceContract) updateConfiguration(cfg *rawConfigStruct) ([]byte, return nil, errExecutionReverted } + // Sanity checks. + if cfg.MinStake.Cmp(big.NewInt(0)) <= 0 || + cfg.LockupPeriod.Cmp(big.NewInt(0)) <= 0 || + cfg.BlockGasLimit.Cmp(big.NewInt(0)) <= 0 || + cfg.MinGasPrice.Cmp(big.NewInt(0)) <= 0 || + cfg.LambdaBA.Cmp(big.NewInt(0)) <= 0 || + cfg.LambdaDKG.Cmp(big.NewInt(0)) <= 0 || + cfg.RoundLength.Cmp(big.NewInt(0)) <= 0 || + cfg.MinBlockInterval.Cmp(big.NewInt(0)) <= 0 { + return nil, errExecutionReverted + } + g.state.UpdateConfigurationRaw(cfg) g.state.emitConfigurationChangedEvent() |