From a0774a21944c5e3164811f86314c40afce657145 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 16 May 2022 09:38:39 +0300 Subject: [PATCH] core: pop native call arguments after call invocation Close #2489. --- pkg/core/native/interop.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/core/native/interop.go b/pkg/core/native/interop.go index a7d97dce4..e106e321c 100644 --- a/pkg/core/native/interop.go +++ b/pkg/core/native/interop.go @@ -50,9 +50,12 @@ func Call(ic *interop.Context) error { ctx := ic.VM.Context() args := make([]stackitem.Item, len(m.MD.Parameters)) for i := range args { - args[i] = ic.VM.Estack().Pop().Item() + args[i] = ic.VM.Estack().Peek(i).Item() } result := m.Func(ic, args) + for range m.MD.Parameters { + ic.VM.Estack().Pop() + } if m.MD.ReturnType != smartcontract.VoidType { ctx.Estack().PushItem(result) }