From cc60bca4910378b5500865db578119cf7ed42b50 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 19 Jan 2022 11:33:33 +0300 Subject: [PATCH] core: adjust native Notary `withdraw` call flags It changes states and calls `transfer` method of GAS which emits `transfer` notification, so it requires States | AllowCall | AllowNotify, i.e. the widest permission. See https://github.com/nspcc-dev/neo-go/issues/1990#issuecomment-1014911528. --- pkg/core/native/notary.go | 2 +- pkg/interop/native/notary/notary.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/core/native/notary.go b/pkg/core/native/notary.go index 36d268a3e..ad1552a61 100644 --- a/pkg/core/native/notary.go +++ b/pkg/core/native/notary.go @@ -72,7 +72,7 @@ func newNotary() *Notary { desc = newDescriptor("withdraw", smartcontract.BoolType, manifest.NewParameter("from", smartcontract.Hash160Type), manifest.NewParameter("to", smartcontract.Hash160Type)) - md = newMethodAndPrice(n.withdraw, 1<<15, callflag.States) + md = newMethodAndPrice(n.withdraw, 1<<15, callflag.All) n.AddMethod(md, desc) desc = newDescriptor("balanceOf", smartcontract.IntegerType, diff --git a/pkg/interop/native/notary/notary.go b/pkg/interop/native/notary/notary.go index d34320583..7c1907a6e 100644 --- a/pkg/interop/native/notary/notary.go +++ b/pkg/interop/native/notary/notary.go @@ -22,7 +22,7 @@ func LockDepositUntil(addr interop.Hash160, till int) bool { // Withdraw represents `withdraw` method of Notary native contract. func Withdraw(from, to interop.Hash160) bool { - return neogointernal.CallWithToken(Hash, "withdraw", int(contract.States), + return neogointernal.CallWithToken(Hash, "withdraw", int(contract.All), from, to).(bool) }