diff --git a/pkg/core/interop/context.go b/pkg/core/interop/context.go index a504e6851..0f06e96d9 100644 --- a/pkg/core/interop/context.go +++ b/pkg/core/interop/context.go @@ -123,7 +123,7 @@ func NewContractMD(name string) *ContractMD { func (c *ContractMD) AddMethod(md *MethodAndPrice, desc *manifest.Method) { c.Manifest.ABI.Methods = append(c.Manifest.ABI.Methods, *desc) md.MD = desc - desc.Safe = (md.RequiredFlags & smartcontract.WriteStates) == 0 + desc.Safe = md.RequiredFlags&(smartcontract.All^smartcontract.ReadOnly) == 0 c.Methods[desc.Name] = *md } diff --git a/pkg/core/interops.go b/pkg/core/interops.go index 983efe671..83ac95824 100644 --- a/pkg/core/interops.go +++ b/pkg/core/interops.go @@ -54,9 +54,9 @@ var systemInterops = []interop.Function{ {Name: interopnames.SystemBlockchainGetTransactionHeight, Func: bcGetTransactionHeight, Price: 1000000, RequiredFlags: smartcontract.ReadStates, ParamCount: 1}, {Name: interopnames.SystemCallbackCreate, Func: callback.Create, Price: 400, ParamCount: 3, DisallowCallback: true}, - {Name: interopnames.SystemCallbackCreateFromMethod, Func: callback.CreateFromMethod, Price: 1000000, ParamCount: 2, DisallowCallback: true}, + {Name: interopnames.SystemCallbackCreateFromMethod, Func: callback.CreateFromMethod, Price: 1000000, RequiredFlags: smartcontract.ReadStates, ParamCount: 2, DisallowCallback: true}, {Name: interopnames.SystemCallbackCreateFromSyscall, Func: callback.CreateFromSyscall, Price: 400, ParamCount: 1, DisallowCallback: true}, - {Name: interopnames.SystemCallbackInvoke, Func: callback.Invoke, Price: 1000000, ParamCount: 2, DisallowCallback: true}, + {Name: interopnames.SystemCallbackInvoke, Func: callback.Invoke, Price: 1000000, RequiredFlags: smartcontract.AllowCall, ParamCount: 2, DisallowCallback: true}, {Name: interopnames.SystemContractCall, Func: contract.Call, Price: 1000000, RequiredFlags: smartcontract.AllowCall, ParamCount: 3, DisallowCallback: true}, {Name: interopnames.SystemContractCallEx, Func: contract.CallEx, Price: 1000000, @@ -89,7 +89,7 @@ var systemInterops = []interop.Function{ {Name: interopnames.SystemRuntimeGetInvocationCounter, Func: runtime.GetInvocationCounter, Price: 400}, {Name: interopnames.SystemRuntimeGetNotifications, Func: runtime.GetNotifications, Price: 10000, ParamCount: 1}, {Name: interopnames.SystemRuntimeGetScriptContainer, Func: engineGetScriptContainer, Price: 250}, - {Name: interopnames.SystemRuntimeGetTime, Func: runtime.GetTime, Price: 250, RequiredFlags: smartcontract.ReadStates}, + {Name: interopnames.SystemRuntimeGetTime, Func: runtime.GetTime, Price: 250}, {Name: interopnames.SystemRuntimeGetTrigger, Func: runtime.GetTrigger, Price: 250}, {Name: interopnames.SystemRuntimeLog, Func: runtime.Log, Price: 1000000, RequiredFlags: smartcontract.AllowNotify, ParamCount: 1, DisallowCallback: true}, @@ -123,7 +123,7 @@ var neoInterops = []interop.Function{ {Name: interopnames.NeoCryptoCheckMultisigWithECDsaSecp256k1, Func: crypto.ECDSASecp256k1CheckMultisig, Price: 0, ParamCount: 3}, {Name: interopnames.NeoCryptoSHA256, Func: crypto.Sha256, Price: 1000000, ParamCount: 1}, {Name: interopnames.NeoCryptoRIPEMD160, Func: crypto.RipeMD160, Price: 1000000, ParamCount: 1}, - {Name: interopnames.NeoNativeCall, Func: native.Call, Price: 0, ParamCount: 1, DisallowCallback: true}, + {Name: interopnames.NeoNativeCall, Func: native.Call, Price: 0, RequiredFlags: smartcontract.AllowCall, ParamCount: 1, DisallowCallback: true}, {Name: interopnames.NeoNativeDeploy, Func: native.Deploy, Price: 0, RequiredFlags: smartcontract.WriteStates, DisallowCallback: true}, } diff --git a/pkg/core/native/native_nep17.go b/pkg/core/native/native_nep17.go index 88d9d9770..8f42dc8da 100644 --- a/pkg/core/native/native_nep17.go +++ b/pkg/core/native/native_nep17.go @@ -79,7 +79,7 @@ func newNEP17Native(name string) *nep17TokenNative { desc = newDescriptor("transfer", smartcontract.BoolType, append(transferParams, manifest.NewParameter("data", smartcontract.AnyType))..., ) - md = newMethodAndPrice(n.Transfer, 8000000, smartcontract.WriteStates) + md = newMethodAndPrice(n.Transfer, 8000000, smartcontract.WriteStates|smartcontract.AllowCall|smartcontract.AllowNotify) n.AddMethod(md, desc) desc = newDescriptor("onPersist", smartcontract.VoidType) diff --git a/pkg/core/native/oracle.go b/pkg/core/native/oracle.go index 50848d80c..92ff3f57c 100644 --- a/pkg/core/native/oracle.go +++ b/pkg/core/native/oracle.go @@ -111,11 +111,11 @@ func newOracle() *Oracle { manifest.NewParameter("callback", smartcontract.StringType), manifest.NewParameter("userData", smartcontract.AnyType), manifest.NewParameter("gasForResponse", smartcontract.IntegerType)) - md := newMethodAndPrice(o.request, oracleRequestPrice, smartcontract.WriteStates) + md := newMethodAndPrice(o.request, oracleRequestPrice, smartcontract.WriteStates|smartcontract.AllowNotify) o.AddMethod(md, desc) desc = newDescriptor("finish", smartcontract.VoidType) - md = newMethodAndPrice(o.finish, 0, smartcontract.WriteStates) + md = newMethodAndPrice(o.finish, 0, smartcontract.WriteStates|smartcontract.AllowCall|smartcontract.AllowNotify) o.AddMethod(md, desc) desc = newDescriptor("verify", smartcontract.BoolType)