diff --git a/pkg/core/interop/contract/call.go b/pkg/core/interop/contract/call.go index 5da37e97b..c9c7bbc5a 100644 --- a/pkg/core/interop/contract/call.go +++ b/pkg/core/interop/contract/call.go @@ -113,7 +113,7 @@ func callExFromNative(ic *interop.Context, caller util.Uint160, cs *state.Contra } ic.VM.Invocations[cs.Hash]++ - ic.VM.LoadScriptWithCallingHash(caller, cs.NEF.Script, cs.Hash, ic.VM.Context().GetCallFlags()&f, hasReturn, uint16(len(args))) + ic.VM.LoadScriptWithCallingHash(caller, cs.NEF.Script, cs.Hash, ic.VM.Context().GetCallFlags()&f, hasReturn) ic.VM.Context().NEF = &cs.NEF for e, i := ic.VM.Estack(), len(args)-1; i >= 0; i-- { e.PushItem(args[i]) diff --git a/pkg/vm/context.go b/pkg/vm/context.go index 40a23a592..c81d29e7e 100644 --- a/pkg/vm/context.go +++ b/pkg/vm/context.go @@ -48,8 +48,6 @@ type Context struct { // Call flags this context was created with. callFlag callflag.CallFlag - // ParamCount specifies number of parameters. - ParamCount int // RetCount specifies number of return values. RetCount int // NEF represents NEF file for the current contract. @@ -73,17 +71,16 @@ var errNoInstParam = errors.New("failed to read instruction parameter") // NewContext returns a new Context object. func NewContext(b []byte) *Context { - return NewContextWithParams(b, 0, -1, 0) + return NewContextWithParams(b, -1, 0) } // NewContextWithParams creates new Context objects using script, parameter count, // return value count and initial position in script. -func NewContextWithParams(b []byte, pcount int, rvcount int, pos int) *Context { +func NewContextWithParams(b []byte, rvcount int, pos int) *Context { return &Context{ - prog: b, - ParamCount: pcount, - RetCount: rvcount, - nextip: pos, + prog: b, + RetCount: rvcount, + nextip: pos, } } diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index 246e87554..ed3f593a4 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -279,7 +279,7 @@ func (v *VM) LoadScript(b []byte) { // LoadScriptWithFlags loads script and sets call flag to f. func (v *VM) LoadScriptWithFlags(b []byte, f callflag.CallFlag) { v.checkInvocationStackSize() - ctx := NewContextWithParams(b, 0, -1, 0) + ctx := NewContextWithParams(b, -1, 0) v.estack = newStack("evaluation", &v.refs) ctx.estack = v.estack initStack(&ctx.tryStack, "exception", nil) @@ -297,13 +297,13 @@ func (v *VM) LoadScriptWithFlags(b []byte, f callflag.CallFlag) { // each other. func (v *VM) LoadScriptWithHash(b []byte, hash util.Uint160, f callflag.CallFlag) { shash := v.GetCurrentScriptHash() - v.LoadScriptWithCallingHash(shash, b, hash, f, true, 0) + v.LoadScriptWithCallingHash(shash, b, hash, f, true) } // LoadScriptWithCallingHash is similar to LoadScriptWithHash but sets calling hash explicitly. // It should be used for calling from native contracts. func (v *VM) LoadScriptWithCallingHash(caller util.Uint160, b []byte, hash util.Uint160, - f callflag.CallFlag, hasReturn bool, paramCount uint16) { + f callflag.CallFlag, hasReturn bool) { v.LoadScriptWithFlags(b, f) ctx := v.Context() ctx.scriptHash = hash @@ -313,7 +313,6 @@ func (v *VM) LoadScriptWithCallingHash(caller util.Uint160, b []byte, hash util. } else { ctx.RetCount = 0 } - ctx.ParamCount = int(paramCount) } // Context returns the current executed context. Nil if there is no context,