[#259] nns: Check admin in Renew
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
5b5ff8cb33
commit
b4fdd854b7
3 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,9 @@ Changelog for NeoFS Contract
|
|||
### Updated
|
||||
- NNS contract now sets domain expiration based on `register` arguments (#262)
|
||||
|
||||
### Fixed
|
||||
- NNS `renew` now can only be done by the domain owner
|
||||
|
||||
## [0.15.5] - 2022-08-23
|
||||
|
||||
### Updated
|
||||
|
|
|
@ -339,6 +339,7 @@ func Renew(name string) int64 {
|
|||
runtime.BurnGas(GetPrice())
|
||||
ctx := storage.GetContext()
|
||||
ns := getNameState(ctx, []byte(name))
|
||||
ns.checkAdmin()
|
||||
ns.Expiration += millisecondsInYear
|
||||
putNameState(ctx, ns)
|
||||
return ns.Expiration
|
||||
|
|
|
@ -347,7 +347,8 @@ func TestNNSRenew(t *testing.T) {
|
|||
ts := b.Timestamp + uint64(expire*1000) + uint64(msPerYear)
|
||||
|
||||
cAcc := c.WithSigners(acc)
|
||||
cAcc.Invoke(t, ts, "renew", "testdomain.com")
|
||||
cAcc.InvokeFail(t, "not witnessed by admin", "renew", "testdomain.com")
|
||||
c1.Invoke(t, ts, "renew", "testdomain.com")
|
||||
expected := stackitem.NewMapWithValue([]stackitem.MapElement{
|
||||
{Key: stackitem.Make("name"), Value: stackitem.Make("testdomain.com")},
|
||||
{Key: stackitem.Make("expiration"), Value: stackitem.Make(ts)}})
|
||||
|
|
Loading…
Reference in a new issue