core: adjust call flags

This commit is contained in:
Anna Shaleva 2020-12-11 11:38:14 +03:00
parent fadbae8997
commit 53e45d793b
4 changed files with 8 additions and 8 deletions

View file

@ -123,7 +123,7 @@ func NewContractMD(name string) *ContractMD {
func (c *ContractMD) AddMethod(md *MethodAndPrice, desc *manifest.Method) { func (c *ContractMD) AddMethod(md *MethodAndPrice, desc *manifest.Method) {
c.Manifest.ABI.Methods = append(c.Manifest.ABI.Methods, *desc) c.Manifest.ABI.Methods = append(c.Manifest.ABI.Methods, *desc)
md.MD = 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 c.Methods[desc.Name] = *md
} }

View file

@ -54,9 +54,9 @@ var systemInterops = []interop.Function{
{Name: interopnames.SystemBlockchainGetTransactionHeight, Func: bcGetTransactionHeight, Price: 1000000, {Name: interopnames.SystemBlockchainGetTransactionHeight, Func: bcGetTransactionHeight, Price: 1000000,
RequiredFlags: smartcontract.ReadStates, ParamCount: 1}, RequiredFlags: smartcontract.ReadStates, ParamCount: 1},
{Name: interopnames.SystemCallbackCreate, Func: callback.Create, Price: 400, ParamCount: 3, DisallowCallback: true}, {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.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, {Name: interopnames.SystemContractCall, Func: contract.Call, Price: 1000000,
RequiredFlags: smartcontract.AllowCall, ParamCount: 3, DisallowCallback: true}, RequiredFlags: smartcontract.AllowCall, ParamCount: 3, DisallowCallback: true},
{Name: interopnames.SystemContractCallEx, Func: contract.CallEx, Price: 1000000, {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.SystemRuntimeGetInvocationCounter, Func: runtime.GetInvocationCounter, Price: 400},
{Name: interopnames.SystemRuntimeGetNotifications, Func: runtime.GetNotifications, Price: 10000, ParamCount: 1}, {Name: interopnames.SystemRuntimeGetNotifications, Func: runtime.GetNotifications, Price: 10000, ParamCount: 1},
{Name: interopnames.SystemRuntimeGetScriptContainer, Func: engineGetScriptContainer, Price: 250}, {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.SystemRuntimeGetTrigger, Func: runtime.GetTrigger, Price: 250},
{Name: interopnames.SystemRuntimeLog, Func: runtime.Log, Price: 1000000, RequiredFlags: smartcontract.AllowNotify, {Name: interopnames.SystemRuntimeLog, Func: runtime.Log, Price: 1000000, RequiredFlags: smartcontract.AllowNotify,
ParamCount: 1, DisallowCallback: true}, ParamCount: 1, DisallowCallback: true},
@ -123,7 +123,7 @@ var neoInterops = []interop.Function{
{Name: interopnames.NeoCryptoCheckMultisigWithECDsaSecp256k1, Func: crypto.ECDSASecp256k1CheckMultisig, Price: 0, ParamCount: 3}, {Name: interopnames.NeoCryptoCheckMultisigWithECDsaSecp256k1, Func: crypto.ECDSASecp256k1CheckMultisig, Price: 0, ParamCount: 3},
{Name: interopnames.NeoCryptoSHA256, Func: crypto.Sha256, Price: 1000000, ParamCount: 1}, {Name: interopnames.NeoCryptoSHA256, Func: crypto.Sha256, Price: 1000000, ParamCount: 1},
{Name: interopnames.NeoCryptoRIPEMD160, Func: crypto.RipeMD160, 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}, {Name: interopnames.NeoNativeDeploy, Func: native.Deploy, Price: 0, RequiredFlags: smartcontract.WriteStates, DisallowCallback: true},
} }

View file

@ -79,7 +79,7 @@ func newNEP17Native(name string) *nep17TokenNative {
desc = newDescriptor("transfer", smartcontract.BoolType, desc = newDescriptor("transfer", smartcontract.BoolType,
append(transferParams, manifest.NewParameter("data", smartcontract.AnyType))..., 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) n.AddMethod(md, desc)
desc = newDescriptor("onPersist", smartcontract.VoidType) desc = newDescriptor("onPersist", smartcontract.VoidType)

View file

@ -111,11 +111,11 @@ func newOracle() *Oracle {
manifest.NewParameter("callback", smartcontract.StringType), manifest.NewParameter("callback", smartcontract.StringType),
manifest.NewParameter("userData", smartcontract.AnyType), manifest.NewParameter("userData", smartcontract.AnyType),
manifest.NewParameter("gasForResponse", smartcontract.IntegerType)) 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) o.AddMethod(md, desc)
desc = newDescriptor("finish", smartcontract.VoidType) 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) o.AddMethod(md, desc)
desc = newDescriptor("verify", smartcontract.BoolType) desc = newDescriptor("verify", smartcontract.BoolType)