smartcontract,vm: remove DynamicInvoke feature

It doesn't exist in NEO3.
This commit is contained in:
Evgenii Stratonikov 2020-06-09 16:16:32 +03:00
parent 76a2f62fbd
commit 5514b3f52f
6 changed files with 7 additions and 26 deletions

View file

@ -89,12 +89,12 @@ type ContractMD struct {
}
// GetContract returns script of the contract with the specified hash.
func (ic *Context) GetContract(h util.Uint160) ([]byte, bool) {
func (ic *Context) GetContract(h util.Uint160) []byte {
cs, err := ic.DAO.GetContractState(h)
if err != nil {
return nil, false
return nil
}
return cs.Script, cs.HasDynamicInvoke()
return cs.Script
}
// NewContractMD returns Contract with the specified list of methods.

View file

@ -484,7 +484,7 @@ func contractCallExInternal(ic *interop.Context, v *vm.VM, h []byte, method stac
if err != nil {
return errors.New("invalid contract hash")
}
script, _ := ic.GetContract(u)
script := ic.GetContract(u)
if script == nil {
return errors.New("contract not found")
}

View file

@ -53,11 +53,6 @@ func (cs *Contract) HasStorage() bool {
return (cs.Manifest.Features & smartcontract.HasStorage) != 0
}
// HasDynamicInvoke checks whether the contract has dynamic invoke property set.
func (cs *Contract) HasDynamicInvoke() bool {
return (cs.Manifest.Features & smartcontract.HasDynamicInvoke) != 0
}
// IsPayable checks whether the contract has payable property set.
func (cs *Contract) IsPayable() bool {
return (cs.Manifest.Features & smartcontract.IsPayable) != 0

View file

@ -23,8 +23,7 @@ type PropertyState byte
// List of supported properties.
const (
HasStorage PropertyState = 1 << iota
HasDynamicInvoke
IsPayable
IsPayable PropertyState = 1 << 2
NoProperties = 0
)

View file

@ -39,9 +39,6 @@ type Context struct {
// Script hash of the prog.
scriptHash util.Uint160
// Whether it's allowed to make dynamic calls from this context.
hasDynamicInvoke bool
}
var errNoInstParam = errors.New("failed to read instruction parameter")

View file

@ -268,16 +268,6 @@ func (v *VM) LoadScript(b []byte) {
v.istack.PushVal(ctx)
}
// loadScriptWithHash if similar to the LoadScript method, but it also loads
// given script hash directly into the Context to avoid its recalculations. It's
// up to user of this function to make sure the script and hash match each other.
func (v *VM) loadScriptWithHash(b []byte, hash util.Uint160, hasDynamicInvoke bool) {
v.LoadScript(b)
ctx := v.Context()
ctx.scriptHash = hash
ctx.hasDynamicInvoke = hasDynamicInvoke
}
// Context returns the current executed context. Nil if there is no context,
// which implies no program is loaded.
func (v *VM) Context() *Context {