mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-16 21:16:30 +00:00
core: add maximum constraint to setNotaryServiceFeePerKey
This commit is contained in:
parent
d7afb7bb2f
commit
50157b31cd
1 changed files with 5 additions and 4 deletions
|
@ -43,8 +43,9 @@ const (
|
||||||
// prefixDeposit is a prefix for storing Notary deposits.
|
// prefixDeposit is a prefix for storing Notary deposits.
|
||||||
prefixDeposit = 1
|
prefixDeposit = 1
|
||||||
defaultDepositDeltaTill = 5760
|
defaultDepositDeltaTill = 5760
|
||||||
defaultMaxNotValidBeforeDelta = 140 // 20 rounds for 7 validators, a little more than half an hour
|
defaultMaxNotValidBeforeDelta = 140 // 20 rounds for 7 validators, a little more than half an hour
|
||||||
defaultNotaryServiceFeePerKey = 1000_0000 // 0.1 GAS
|
defaultNotaryServiceFeePerKey = 1000_0000 // 0.1 GAS
|
||||||
|
maxNotaryServiceFeePerKey = 1_0000_0000 // 1 GAS
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -442,8 +443,8 @@ func (n *Notary) GetNotaryServiceFeePerKey(dao *dao.Simple) int64 {
|
||||||
// setNotaryServiceFeePerKey is a Notary contract method and sets a reward per notary request key for notary nodes.
|
// setNotaryServiceFeePerKey is a Notary contract method and sets a reward per notary request key for notary nodes.
|
||||||
func (n *Notary) setNotaryServiceFeePerKey(ic *interop.Context, args []stackitem.Item) stackitem.Item {
|
func (n *Notary) setNotaryServiceFeePerKey(ic *interop.Context, args []stackitem.Item) stackitem.Item {
|
||||||
value := toInt64(args[0])
|
value := toInt64(args[0])
|
||||||
if value < 0 {
|
if value < 0 || value > maxNotaryServiceFeePerKey {
|
||||||
panic("NotaryServiceFeePerKey can't be negative")
|
panic("NotaryServiceFeePerKey value is out of range")
|
||||||
}
|
}
|
||||||
if !n.NEO.checkCommittee(ic) {
|
if !n.NEO.checkCommittee(ic) {
|
||||||
panic("invalid committee signature")
|
panic("invalid committee signature")
|
||||||
|
|
Loading…
Add table
Reference in a new issue