core: pop native call arguments after call invocation

Close #2489.
This commit is contained in:
Anna Shaleva 2022-05-16 09:38:39 +03:00
parent 058a7eff90
commit a0774a2194

View file

@ -50,9 +50,12 @@ func Call(ic *interop.Context) error {
ctx := ic.VM.Context() ctx := ic.VM.Context()
args := make([]stackitem.Item, len(m.MD.Parameters)) args := make([]stackitem.Item, len(m.MD.Parameters))
for i := range args { for i := range args {
args[i] = ic.VM.Estack().Pop().Item() args[i] = ic.VM.Estack().Peek(i).Item()
} }
result := m.Func(ic, args) result := m.Func(ic, args)
for range m.MD.Parameters {
ic.VM.Estack().Pop()
}
if m.MD.ReturnType != smartcontract.VoidType { if m.MD.ReturnType != smartcontract.VoidType {
ctx.Estack().PushItem(result) ctx.Estack().PushItem(result)
} }