Merge pull request #2491 from nspcc-dev/fix-2489

core: pop native call arguments after call invocation
This commit is contained in:
Roman Khimov 2022-05-16 11:12:45 +03:00 committed by GitHub
commit 4b785d4ffb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)
} }