mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-07 23:10:32 +00:00
core: introduce CheckReturnState constants
At the moment we should have 3 possible options to check return state during vm context unloading: * no check * ensure the stack is empty * ensure the stack is not empty It is necessary to distinguish them because new _deploy method shouldn't left anything on stack. Example: if we use _deploy method before some ordinary contract method which returns one value. Without these changes the contract invocation will fail due to 2 elements on stack left after invocation (the first `null` element is from _deploy, the second element is return-value from the ordinary contract method).
This commit is contained in:
parent
659fb89beb
commit
fe1f0a7245
5 changed files with 29 additions and 9 deletions
|
@ -203,7 +203,7 @@ func callDeploy(ic *interop.Context, cs *state.Contract, isUpdate bool) error {
|
|||
md := cs.Manifest.ABI.GetMethod(manifest.MethodDeploy)
|
||||
if md != nil {
|
||||
return contract.CallExInternal(ic, cs, manifest.MethodDeploy,
|
||||
[]stackitem.Item{stackitem.NewBool(isUpdate)}, smartcontract.All)
|
||||
[]stackitem.Item{stackitem.NewBool(isUpdate)}, smartcontract.All, vm.EnsureIsEmpty)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue