native: fix minimum deployment fee setting

SA4003: no value of type uint32 is less than 0 (staticcheck)

But it's more involved than that, we should allow any positive big.Int here.
This commit is contained in:
Roman Khimov 2021-05-12 19:27:02 +03:00
parent d15cacc1ba
commit b5ff87c2bd

View file

@ -409,14 +409,14 @@ func (m *Management) GetMinimumDeploymentFee(dao dao.DAO) int64 {
}
func (m *Management) setMinimumDeploymentFee(ic *interop.Context, args []stackitem.Item) stackitem.Item {
value := toUint32(args[0])
if value < 0 {
panic(fmt.Errorf("MinimumDeploymentFee cannot be negative"))
value := toBigInt(args[0])
if value.Sign() < 0 {
panic("MinimumDeploymentFee cannot be negative")
}
if !m.NEO.checkCommittee(ic) {
panic("invalid committee signature")
}
err := setIntWithKey(m.ID, ic.DAO, keyMinimumDeploymentFee, int64(value))
err := ic.DAO.PutStorageItem(m.ID, keyMinimumDeploymentFee, bigint.ToBytes(value))
if err != nil {
panic(err)
}