core: fix verification call flag

Previous commit sets AllowCall flag as required for Neo.Native.Call, but
invocation script was loaded with ReadStates flag => native contracts
verification failed.

Other contracts can also make use of AllowCall call flag.
This commit is contained in:
Anna Shaleva 2020-12-11 16:37:13 +03:00
parent 53e45d793b
commit 2290b91b83
2 changed files with 2 additions and 2 deletions

View file

@ -1674,7 +1674,7 @@ func (bc *Blockchain) initVerificationVM(ic *interop.Context, hash util.Uint160,
return ErrInvalidVerificationContract
}
initMD := cs.Manifest.ABI.GetMethod(manifest.MethodInit)
v.LoadScriptWithHash(cs.Script, hash, smartcontract.ReadStates)
v.LoadScriptWithHash(cs.Script, hash, smartcontract.ReadStates|smartcontract.AllowCall)
v.Jump(v.Context(), md.Offset)
if cs.ID < 0 {

View file

@ -58,7 +58,7 @@ func Call(ic *interop.Context) error {
return fmt.Errorf("method %s not found", operation)
}
if !ic.VM.Context().GetCallFlags().Has(m.RequiredFlags) {
return errors.New("missing call flags")
return fmt.Errorf("missing call flags for native %s `%s` operation call: %05b vs %05b", name, operation, ic.VM.Context().GetCallFlags(), m.RequiredFlags)
}
if !ic.VM.AddGas(m.Price) {
return errors.New("gas limit exceeded")