diff --git a/src/neo-vm/ExecutionContext.cs b/src/neo-vm/ExecutionContext.cs
index 4d45a91a..a8bcb790 100644
--- a/src/neo-vm/ExecutionContext.cs
+++ b/src/neo-vm/ExecutionContext.cs
@@ -25,10 +25,11 @@ public sealed class ExecutionContext
///
public EvaluationStack EvaluationStack { get; }
- ///
- /// Alternative stack
- ///
- public EvaluationStack AltStack { get; }
+ public Slot StaticFields { get; internal set; }
+
+ public Slot LocalVariables { get; internal set; }
+
+ public Slot Arguments { get; internal set; }
///
/// Instruction pointer
@@ -62,22 +63,21 @@ public Instruction NextInstruction
/// Script
/// Number of items to be returned
internal ExecutionContext(Script script, int rvcount, ReferenceCounter referenceCounter)
- : this(script, rvcount, new EvaluationStack(referenceCounter), new EvaluationStack(referenceCounter), new Dictionary())
+ : this(script, rvcount, new EvaluationStack(referenceCounter), new Dictionary())
{
}
- private ExecutionContext(Script script, int rvcount, EvaluationStack stack, EvaluationStack alt, Dictionary states)
+ private ExecutionContext(Script script, int rvcount, EvaluationStack stack, Dictionary states)
{
this.RVCount = rvcount;
this.Script = script;
this.EvaluationStack = stack;
- this.AltStack = alt;
this.states = states;
}
internal ExecutionContext Clone()
{
- return new ExecutionContext(Script, 0, EvaluationStack, AltStack, states);
+ return new ExecutionContext(Script, 0, EvaluationStack, states) { StaticFields = StaticFields };
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/neo-vm/ExecutionEngine.cs b/src/neo-vm/ExecutionEngine.cs
index d58e7737..22845cef 100644
--- a/src/neo-vm/ExecutionEngine.cs
+++ b/src/neo-vm/ExecutionEngine.cs
@@ -311,10 +311,12 @@ private bool ExecuteInstruction()
if (rvcount > 0)
context_pop.EvaluationStack.CopyTo(stack_eval);
}
- if (InvocationStack.Count == 0 || context_pop.AltStack != CurrentContext.AltStack)
+ if (InvocationStack.Count == 0 || context_pop.StaticFields != CurrentContext.StaticFields)
{
- context_pop.AltStack.Clear();
+ context_pop.StaticFields?.ClearReferences();
}
+ context_pop.LocalVariables?.ClearReferences();
+ context_pop.Arguments?.ClearReferences();
if (InvocationStack.Count == 0)
{
State = VMState.HALT;
@@ -419,32 +421,139 @@ private bool ExecuteInstruction()
if (!context.EvaluationStack.Reverse((int)n.ToBigInteger())) return false;
break;
}
- case OpCode.DUPFROMALTSTACKBOTTOM:
+ case OpCode.ISNULL:
{
- Push(context.AltStack.Peek(-1));
+ if (!TryPop(out StackItem x)) return false;
+ Push(x.IsNull);
break;
}
- case OpCode.DUPFROMALTSTACK:
+
+ //Slot
+ case OpCode.INITSSLOT:
{
- Push(context.AltStack.Peek());
+ if (context.StaticFields != null) return false;
+ if (instruction.TokenU8 == 0) return false;
+ context.StaticFields = new Slot(instruction.TokenU8, ReferenceCounter);
break;
}
- case OpCode.TOALTSTACK:
+ case OpCode.INITSLOT:
{
- if (!TryPop(out StackItem x)) return false;
- context.AltStack.Push(x);
+ if (context.LocalVariables != null || context.Arguments != null) return false;
+ if (instruction.TokenU16 == 0) return false;
+ if (instruction.TokenU8 > 0)
+ {
+ context.LocalVariables = new Slot(instruction.TokenU8, ReferenceCounter);
+ }
+ if (instruction.TokenU8_1 > 0)
+ {
+ StackItem[] items = new StackItem[instruction.TokenU8_1];
+ for (int i = instruction.TokenU8_1 - 1; i >= 0; i--)
+ if (!TryPop(out items[i]))
+ return false;
+ context.Arguments = new Slot(items, ReferenceCounter);
+ }
break;
}
- case OpCode.FROMALTSTACK:
+ case OpCode.LDSFLD0:
+ case OpCode.LDSFLD1:
+ case OpCode.LDSFLD2:
+ case OpCode.LDSFLD3:
+ case OpCode.LDSFLD4:
+ case OpCode.LDSFLD5:
+ case OpCode.LDSFLD6:
{
- if (!context.AltStack.TryPop(out StackItem x)) return false;
- Push(x);
+ if (!ExecuteLoadFromSlot(context.StaticFields, instruction.OpCode - OpCode.LDSFLD0))
+ return false;
break;
}
- case OpCode.ISNULL:
+ case OpCode.LDSFLD:
{
- if (!TryPop(out StackItem x)) return false;
- Push(x.IsNull);
+ if (!ExecuteLoadFromSlot(context.StaticFields, instruction.TokenU8)) return false;
+ break;
+ }
+ case OpCode.STSFLD0:
+ case OpCode.STSFLD1:
+ case OpCode.STSFLD2:
+ case OpCode.STSFLD3:
+ case OpCode.STSFLD4:
+ case OpCode.STSFLD5:
+ case OpCode.STSFLD6:
+ {
+ if (!ExecuteStoreToSlot(context.StaticFields, instruction.OpCode - OpCode.STSFLD0))
+ return false;
+ break;
+ }
+ case OpCode.STSFLD:
+ {
+ if (!ExecuteStoreToSlot(context.StaticFields, instruction.TokenU8)) return false;
+ break;
+ }
+ case OpCode.LDLOC0:
+ case OpCode.LDLOC1:
+ case OpCode.LDLOC2:
+ case OpCode.LDLOC3:
+ case OpCode.LDLOC4:
+ case OpCode.LDLOC5:
+ case OpCode.LDLOC6:
+ {
+ if (!ExecuteLoadFromSlot(context.LocalVariables, instruction.OpCode - OpCode.LDLOC0))
+ return false;
+ break;
+ }
+ case OpCode.LDLOC:
+ {
+ if (!ExecuteLoadFromSlot(context.LocalVariables, instruction.TokenU8)) return false;
+ break;
+ }
+ case OpCode.STLOC0:
+ case OpCode.STLOC1:
+ case OpCode.STLOC2:
+ case OpCode.STLOC3:
+ case OpCode.STLOC4:
+ case OpCode.STLOC5:
+ case OpCode.STLOC6:
+ {
+ if (!ExecuteStoreToSlot(context.LocalVariables, instruction.OpCode - OpCode.STLOC0))
+ return false;
+ break;
+ }
+ case OpCode.STLOC:
+ {
+ if (!ExecuteStoreToSlot(context.LocalVariables, instruction.TokenU8)) return false;
+ break;
+ }
+ case OpCode.LDARG0:
+ case OpCode.LDARG1:
+ case OpCode.LDARG2:
+ case OpCode.LDARG3:
+ case OpCode.LDARG4:
+ case OpCode.LDARG5:
+ case OpCode.LDARG6:
+ {
+ if (!ExecuteLoadFromSlot(context.Arguments, instruction.OpCode - OpCode.LDARG0))
+ return false;
+ break;
+ }
+ case OpCode.LDARG:
+ {
+ if (!ExecuteLoadFromSlot(context.Arguments, instruction.TokenU8)) return false;
+ break;
+ }
+ case OpCode.STARG0:
+ case OpCode.STARG1:
+ case OpCode.STARG2:
+ case OpCode.STARG3:
+ case OpCode.STARG4:
+ case OpCode.STARG5:
+ case OpCode.STARG6:
+ {
+ if (!ExecuteStoreToSlot(context.Arguments, instruction.OpCode - OpCode.STARG0))
+ return false;
+ break;
+ }
+ case OpCode.STARG:
+ {
+ if (!ExecuteStoreToSlot(context.Arguments, instruction.TokenU8)) return false;
break;
}
@@ -984,6 +1093,14 @@ private bool ExecuteJump(bool condition, int offset)
return true;
}
+ private bool ExecuteLoadFromSlot(Slot slot, int index)
+ {
+ if (slot is null) return false;
+ if (index < 0 || index >= slot.Count) return false;
+ Push(slot[index]);
+ return true;
+ }
+
internal protected void ExecuteNext()
{
if (InvocationStack.Count == 0)
@@ -1005,6 +1122,15 @@ internal protected void ExecuteNext()
}
}
+ private bool ExecuteStoreToSlot(Slot slot, int index)
+ {
+ if (slot is null) return false;
+ if (index < 0 || index >= slot.Count) return false;
+ if (!TryPop(out StackItem item)) return false;
+ slot[index] = item;
+ return true;
+ }
+
protected virtual void LoadContext(ExecutionContext context)
{
if (InvocationStack.Count >= MaxInvocationStackSize)
diff --git a/src/neo-vm/Instruction.cs b/src/neo-vm/Instruction.cs
index 72cc1153..893038cf 100644
--- a/src/neo-vm/Instruction.cs
+++ b/src/neo-vm/Instruction.cs
@@ -66,6 +66,15 @@ public string TokenString
}
}
+ public ushort TokenU16
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ return BinaryPrimitives.ReadUInt16LittleEndian(Operand.Span);
+ }
+ }
+
public uint TokenU32
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -75,6 +84,24 @@ public uint TokenU32
}
}
+ public byte TokenU8
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ return Operand.Span[0];
+ }
+ }
+
+ public byte TokenU8_1
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ return Operand.Span[1];
+ }
+ }
+
static Instruction()
{
foreach (FieldInfo field in typeof(OpCode).GetFields(BindingFlags.Public | BindingFlags.Static))
diff --git a/src/neo-vm/OpCode.cs b/src/neo-vm/OpCode.cs
index b10e70b1..591a658d 100644
--- a/src/neo-vm/OpCode.cs
+++ b/src/neo-vm/OpCode.cs
@@ -310,74 +310,270 @@ public enum OpCode : byte
#endregion
- #region Old opcodes
+ #region Slot
///
- /// Puts the input onto the top of the alt stack. Removes it from the main stack.
+ /// Initialize the static field list for the current execution context.
///
- TOALTSTACK = 0x6B,
+ [OperandSize(Size = 1)]
+ INITSSLOT = 0x56,
///
- /// Puts the input onto the top of the main stack. Removes it from the alt stack.
+ /// Initialize the argument slot and the local variable list for the current execution context.
///
- FROMALTSTACK = 0x6C,
+ [OperandSize(Size = 2)]
+ INITSLOT = 0x57,
///
- /// Duplicates the item on top of alt stack and put it on top of main stack.
+ /// Loads the static field at index 0 onto the evaluation stack.
///
- DUPFROMALTSTACK = 0x6D,
+ LDSFLD0 = 0x58,
///
- /// Copies the bottom of alt stack and put it on top of main stack.
- ///
- DUPFROMALTSTACKBOTTOM = 0x6E,
+ /// Loads the static field at index 1 onto the evaluation stack.
+ ///
+ LDSFLD1 = 0x59,
///
- /// Returns true if the input is null. Returns false otherwise.
+ /// Loads the static field at index 2 onto the evaluation stack.
+ ///
+ LDSFLD2 = 0x5A,
+ ///
+ /// Loads the static field at index 3 onto the evaluation stack.
+ ///
+ LDSFLD3 = 0x5B,
+ ///
+ /// Loads the static field at index 4 onto the evaluation stack.
+ ///
+ LDSFLD4 = 0x5C,
+ ///
+ /// Loads the static field at index 5 onto the evaluation stack.
+ ///
+ LDSFLD5 = 0x5D,
+ ///
+ /// Loads the static field at index 6 onto the evaluation stack.
+ ///
+ LDSFLD6 = 0x5E,
+ ///
+ /// Loads the static field at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer.
+ ///
+ [OperandSize(Size = 1)]
+ LDSFLD = 0x5F,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 0.
+ ///
+ STSFLD0 = 0x60,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 1.
+ ///
+ STSFLD1 = 0x61,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 2.
+ ///
+ STSFLD2 = 0x62,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 3.
+ ///
+ STSFLD3 = 0x63,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 4.
+ ///
+ STSFLD4 = 0x64,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 5.
+ ///
+ STSFLD5 = 0x65,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at index 6.
+ ///
+ STSFLD6 = 0x66,
+ ///
+ /// Stores the value on top of the evaluation stack in the static field list at a specified index. The index is represented as a 1-byte unsigned integer.
+ ///
+ [OperandSize(Size = 1)]
+ STSFLD = 0x67,
+ ///
+ /// Loads the local variable at index 0 onto the evaluation stack.
+ ///
+ LDLOC0 = 0x68,
+ ///
+ /// Loads the local variable at index 1 onto the evaluation stack.
+ ///
+ LDLOC1 = 0x69,
+ ///
+ /// Loads the local variable at index 2 onto the evaluation stack.
+ ///
+ LDLOC2 = 0x6A,
+ ///
+ /// Loads the local variable at index 3 onto the evaluation stack.
+ ///
+ LDLOC3 = 0x6B,
+ ///
+ /// Loads the local variable at index 4 onto the evaluation stack.
+ ///
+ LDLOC4 = 0x6C,
+ ///
+ /// Loads the local variable at index 5 onto the evaluation stack.
+ ///
+ LDLOC5 = 0x6D,
+ ///
+ /// Loads the local variable at index 6 onto the evaluation stack.
+ ///
+ LDLOC6 = 0x6E,
+ ///
+ /// Loads the local variable at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer.
+ ///
+ [OperandSize(Size = 1)]
+ LDLOC = 0x6F,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 0.
+ ///
+ STLOC0 = 0x70,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 1.
///
- ISNULL = 0x70,
+ STLOC1 = 0x71,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 2.
+ ///
+ STLOC2 = 0x72,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 3.
+ ///
+ STLOC3 = 0x73,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 4.
+ ///
+ STLOC4 = 0x74,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 5.
+ ///
+ STLOC5 = 0x75,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at index 6.
+ ///
+ STLOC6 = 0x76,
+ ///
+ /// Stores the value on top of the evaluation stack in the local variable list at a specified index. The index is represented as a 1-byte unsigned integer.
+ ///
+ [OperandSize(Size = 1)]
+ STLOC = 0x77,
+ ///
+ /// Loads the argument at index 0 onto the evaluation stack.
+ ///
+ LDARG0 = 0x78,
+ ///
+ /// Loads the argument at index 1 onto the evaluation stack.
+ ///
+ LDARG1 = 0x79,
+ ///
+ /// Loads the argument at index 2 onto the evaluation stack.
+ ///
+ LDARG2 = 0x7A,
+ ///
+ /// Loads the argument at index 3 onto the evaluation stack.
+ ///
+ LDARG3 = 0x7B,
+ ///
+ /// Loads the argument at index 4 onto the evaluation stack.
+ ///
+ LDARG4 = 0x7C,
+ ///
+ /// Loads the argument at index 5 onto the evaluation stack.
+ ///
+ LDARG5 = 0x7D,
+ ///
+ /// Loads the argument at index 6 onto the evaluation stack.
+ ///
+ LDARG6 = 0x7E,
+ ///
+ /// Loads the argument at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer.
+ ///
+ [OperandSize(Size = 1)]
+ LDARG = 0x7F,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 0.
+ ///
+ STARG0 = 0x80,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 1.
+ ///
+ STARG1 = 0x81,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 2.
+ ///
+ STARG2 = 0x82,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 3.
+ ///
+ STARG3 = 0x83,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 4.
+ ///
+ STARG4 = 0x84,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 5.
+ ///
+ STARG5 = 0x85,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at index 6.
+ ///
+ STARG6 = 0x86,
+ ///
+ /// Stores the value on top of the evaluation stack in the argument slot at a specified index. The index is represented as a 1-byte unsigned integer.
+ ///
+ [OperandSize(Size = 1)]
+ STARG = 0x87,
+ #endregion
+
+ #region Old opcodes
+
+ ///
+ /// Returns true if the input is null. Returns false otherwise.
+ ///
+ ISNULL = 0xD0,
// Splice
///
/// Concatenates two strings.
///
- CAT = 0x7E,
+ CAT = 0xDE,
///
/// Returns a section of a string.
///
- SUBSTR = 0x7F,
+ SUBSTR = 0xDF,
///
/// Keeps only characters left of the specified point in a string.
///
- LEFT = 0x80,
+ LEFT = 0xE0,
///
/// Keeps only characters right of the specified point in a string.
///
- RIGHT = 0x81,
+ RIGHT = 0xE1,
///
/// Returns the length of the input string.
///
- SIZE = 0x82,
+ SIZE = 0xE2,
// Bitwise logic
///
/// Flips all of the bits in the input.
///
- INVERT = 0x83,
+ INVERT = 0xE3,
///
/// Boolean and between each bit in the inputs.
///
- AND = 0x84,
+ AND = 0xE4,
///
/// Boolean or between each bit in the inputs.
///
- OR = 0x85,
+ OR = 0xE5,
///
/// Boolean exclusive or between each bit in the inputs.
///
- XOR = 0x86,
+ XOR = 0xE6,
///
/// Returns 1 if the inputs are exactly equal, 0 otherwise.
///
- EQUAL = 0x87,
+ EQUAL = 0xE7,
// Arithmetic
diff --git a/src/neo-vm/Slot.cs b/src/neo-vm/Slot.cs
new file mode 100644
index 00000000..5b5b04fc
--- /dev/null
+++ b/src/neo-vm/Slot.cs
@@ -0,0 +1,58 @@
+using Neo.VM.Types;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Neo.VM
+{
+ public class Slot : IReadOnlyList
+ {
+ private readonly ReferenceCounter referenceCounter;
+ private readonly StackItem[] items;
+
+ public StackItem this[int index]
+ {
+ get
+ {
+ return items[index];
+ }
+ internal set
+ {
+ referenceCounter.RemoveStackReference(items[index]);
+ items[index] = value;
+ referenceCounter.AddStackReference(value);
+ }
+ }
+
+ public int Count => items.Length;
+
+ public Slot(StackItem[] items, ReferenceCounter referenceCounter)
+ {
+ this.referenceCounter = referenceCounter;
+ this.items = items;
+ foreach (StackItem item in items)
+ referenceCounter.AddStackReference(item);
+ }
+
+ public Slot(int count, ReferenceCounter referenceCounter)
+ : this(Enumerable.Repeat(StackItem.Null, count).ToArray(), referenceCounter)
+ {
+ }
+
+ internal void ClearReferences()
+ {
+ foreach (StackItem item in items)
+ referenceCounter.RemoveStackReference(item);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ foreach (StackItem item in items) yield return item;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/APPEND.json b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/APPEND.json
index f9fb75d7..935ffdcd 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/APPEND.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/APPEND.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Arrays",
"name": "APPEND",
"tests": [
@@ -40,21 +40,23 @@
{
"name": "Clone test [Array]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH0",
"NEWARRAY",
"DUP",
"PUSH5",
"APPEND",
- "TOALTSTACK",
+ "STSFLD0",
"PUSH0",
"NEWARRAY",
"DUP",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"APPEND",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"PUSH6",
"APPEND",
- "FROMALTSTACK"
+ "LDSFLD0"
],
"steps": [
{
@@ -64,15 +66,16 @@
"stepInto",
"stepInto",
"stepInto",
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
+ "instructionPointer": 8,
"nextInstruction": "PUSH0",
- "altStack": [
+ "staticFields": [
{
"type": "array",
"value": [
@@ -96,7 +99,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
+ "instructionPointer": 10,
"nextInstruction": "DUP",
"evaluationStack": [
{
@@ -104,7 +107,7 @@
"value": []
}
],
- "altStack": [
+ "staticFields": [
{
"type": "array",
"value": [
@@ -129,8 +132,8 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 11,
- "nextInstruction": "DUPFROMALTSTACK",
+ "instructionPointer": 13,
+ "nextInstruction": "LDSFLD0",
"evaluationStack": [
{
"type": "array",
@@ -147,7 +150,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "array",
"value": [
@@ -173,7 +176,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 15,
+ "instructionPointer": 17,
"nextInstruction": "RET",
"evaluationStack": [
{
@@ -207,6 +210,21 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "array",
+ "value": [
+ {
+ "type": "Integer",
+ "value": "5"
+ },
+ {
+ "type": "Integer",
+ "value": "6"
+ }
+ ]
+ }
]
}
]
@@ -258,21 +276,23 @@
{
"name": "Clone test [Struct]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH0",
"NEWSTRUCT",
"DUP",
"PUSH5",
"APPEND",
- "TOALTSTACK",
+ "STSFLD0",
"PUSH0",
"NEWSTRUCT",
"DUP",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"APPEND",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"PUSH6",
"APPEND",
- "FROMALTSTACK"
+ "LDSFLD0"
],
"steps": [
{
@@ -282,15 +302,16 @@
"stepInto",
"stepInto",
"stepInto",
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
+ "instructionPointer": 8,
"nextInstruction": "PUSH0",
- "altStack": [
+ "staticFields": [
{
"type": "struct",
"value": [
@@ -314,7 +335,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
+ "instructionPointer": 10,
"nextInstruction": "DUP",
"evaluationStack": [
{
@@ -322,7 +343,7 @@
"value": []
}
],
- "altStack": [
+ "staticFields": [
{
"type": "struct",
"value": [
@@ -347,8 +368,8 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 11,
- "nextInstruction": "DUPFROMALTSTACK",
+ "instructionPointer": 13,
+ "nextInstruction": "LDSFLD0",
"evaluationStack": [
{
"type": "struct",
@@ -365,7 +386,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "struct",
"value": [
@@ -391,7 +412,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 15,
+ "instructionPointer": 17,
"nextInstruction": "RET",
"evaluationStack": [
{
@@ -421,6 +442,21 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "struct",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 5
+ },
+ {
+ "type": "Integer",
+ "value": 6
+ }
+ ]
+ }
]
}
]
@@ -640,4 +676,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/PICKITEM.json b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/PICKITEM.json
index 77843d7e..ef3d37a1 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/PICKITEM.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/PICKITEM.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Arrays",
"name": "PICKITEM",
"tests": [
@@ -192,22 +192,24 @@
{
"name": "Real test [Array]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH3",
"NEWARRAY",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"PUSH0",
"PUSH1",
"SETITEM",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"PUSH1",
"PUSH2",
"SETITEM",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"PUSH2",
"PUSH3",
"SETITEM",
- "FROMALTSTACK",
+ "LDSFLD0",
"PUSH2",
"PICKITEM"
],
@@ -230,13 +232,14 @@
"stepInto",
"stepInto",
"stepInto",
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 17,
+ "instructionPointer": 19,
"nextInstruction": "PICKITEM",
"evaluationStack": [
{
@@ -260,6 +263,25 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "array",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ }
+ ]
+ }
]
}
]
@@ -273,13 +295,32 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 18,
+ "instructionPointer": 20,
"nextInstruction": "RET",
"evaluationStack": [
{
"type": "integer",
"value": 3
}
+ ],
+ "staticFields": [
+ {
+ "type": "array",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ }
+ ]
+ }
]
}
]
@@ -304,22 +345,24 @@
{
"name": "Real test [Struct]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH3",
"NEWSTRUCT",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"PUSH0",
"PUSH1",
"SETITEM",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"PUSH1",
"PUSH2",
"SETITEM",
- "DUPFROMALTSTACK",
+ "LDSFLD0",
"PUSH2",
"PUSH3",
"SETITEM",
- "FROMALTSTACK",
+ "LDSFLD0",
"PUSH2",
"PICKITEM"
],
@@ -342,13 +385,14 @@
"stepInto",
"stepInto",
"stepInto",
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 17,
+ "instructionPointer": 19,
"nextInstruction": "PICKITEM",
"evaluationStack": [
{
@@ -372,6 +416,25 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "struct",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ }
+ ]
+ }
]
}
]
@@ -385,13 +448,32 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 18,
+ "instructionPointer": 20,
"nextInstruction": "RET",
"evaluationStack": [
{
"type": "integer",
"value": 3
}
+ ],
+ "staticFields": [
+ {
+ "type": "struct",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ }
+ ]
+ }
]
}
]
@@ -575,4 +657,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/REMOVE.json b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/REMOVE.json
index 20c538b5..7b39f289 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/REMOVE.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/REMOVE.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Arrays",
"name": "REMOVE",
"tests": [
@@ -79,15 +79,17 @@
{
"name": "Real test [Array]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH6",
"PUSH5",
"PUSH2",
"PACK",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"PUSH0",
"REMOVE",
- "FROMALTSTACK",
+ "LDSFLD0",
"UNPACK"
],
"steps": [
@@ -99,13 +101,14 @@
"stepInto",
"stepInto",
"stepInto",
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 7,
+ "instructionPointer": 9,
"nextInstruction": "REMOVE",
"evaluationStack": [
{
@@ -126,7 +129,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "array",
"value": [
@@ -153,9 +156,9 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
- "nextInstruction": "FROMALTSTACK",
- "altStack": [
+ "instructionPointer": 10,
+ "nextInstruction": "LDSFLD0",
+ "staticFields": [
{
"type": "array",
"value": [
@@ -193,16 +196,18 @@
{
"name": "Real test [Struct]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH0",
"NEWSTRUCT",
"DUP",
"PUSH5",
"APPEND",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"PUSH0",
"REMOVE",
- "FROMALTSTACK",
+ "LDSFLD0",
"UNPACK"
],
"steps": [
@@ -215,13 +220,14 @@
"stepInto",
"stepInto",
"stepInto",
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
+ "instructionPointer": 10,
"nextInstruction": "REMOVE",
"evaluationStack": [
{
@@ -238,7 +244,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "struct",
"value": [
@@ -261,9 +267,9 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 9,
- "nextInstruction": "FROMALTSTACK",
- "altStack": [
+ "instructionPointer": 11,
+ "nextInstruction": "LDSFLD0",
+ "staticFields": [
{
"type": "struct",
"value": []
@@ -290,4 +296,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/SETITEM.json b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/SETITEM.json
index b87e98d6..32b7dbf9 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Arrays/SETITEM.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Arrays/SETITEM.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Arrays",
"name": "SETITEM",
"tests": [
@@ -229,17 +229,20 @@
{
"name": "Real test [Map]",
"script": [
+ "INITSSLOT",
+ "01",
"NEWMAP",
"DUP",
- "TOALTSTACK",
+ "STSFLD0",
"PUSH1",
"PUSH2",
"SETITEM",
- "FROMALTSTACK"
+ "LDSFLD0"
],
"steps": [
{
"actions": [
+ "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -248,7 +251,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 3,
+ "instructionPointer": 5,
"nextInstruction": "PUSH1",
"evaluationStack": [
{
@@ -256,7 +259,7 @@
"value": {}
}
],
- "altStack": [
+ "staticFields": [
{
"type": "map",
"value": {}
@@ -275,7 +278,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 7,
"nextInstruction": "SETITEM",
"evaluationStack": [
{
@@ -291,7 +294,7 @@
"value": {}
}
],
- "altStack": [
+ "staticFields": [
{
"type": "map",
"value": {}
@@ -309,9 +312,9 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "FROMALTSTACK",
- "altStack": [
+ "instructionPointer": 8,
+ "nextInstruction": "LDSFLD0",
+ "staticFields": [
{
"type": "map",
"value": {
@@ -334,7 +337,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 7,
+ "instructionPointer": 9,
"nextInstruction": "RET",
"evaluationStack": [
{
@@ -346,6 +349,17 @@
}
}
}
+ ],
+ "staticFields": [
+ {
+ "type": "map",
+ "value": {
+ "0x01": {
+ "type": "Integer",
+ "value": 2
+ }
+ }
+ }
]
}
]
@@ -577,23 +591,26 @@
{
"name": "Clone test [Array]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH1",
"NEWARRAY",
"DUP",
"PUSH0",
"PUSH5",
"SETITEM",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"DUP",
"PUSH0",
"PUSH4",
"SETITEM",
- "FROMALTSTACK"
+ "LDSFLD0"
],
"steps": [
{
"actions": [
+ "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -602,7 +619,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 3,
+ "instructionPointer": 5,
"nextInstruction": "PUSH0",
"evaluationStack": [
{
@@ -621,6 +638,11 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "Null"
+ }
]
}
]
@@ -636,8 +658,8 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "TOALTSTACK",
+ "instructionPointer": 8,
+ "nextInstruction": "STSFLD0",
"evaluationStack": [
{
"type": "array",
@@ -648,6 +670,11 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "Null"
+ }
]
}
]
@@ -663,7 +690,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 9,
+ "instructionPointer": 11,
"nextInstruction": "PUSH0",
"evaluationStack": [
{
@@ -685,7 +712,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "array",
"value": [
@@ -710,8 +737,8 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 12,
- "nextInstruction": "FROMALTSTACK",
+ "instructionPointer": 14,
+ "nextInstruction": "LDSFLD0",
"evaluationStack": [
{
"type": "array",
@@ -723,7 +750,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "array",
"value": [
@@ -746,7 +773,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 13,
+ "instructionPointer": 15,
"nextInstruction": "RET",
"evaluationStack": [
{
@@ -767,6 +794,17 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "array",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 4
+ }
+ ]
+ }
]
}
]
@@ -805,23 +843,26 @@
{
"name": "Clone test [Struct]",
"script": [
+ "INITSSLOT",
+ "01",
"PUSH1",
"NEWSTRUCT",
"DUP",
"PUSH0",
"PUSH5",
"SETITEM",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"DUP",
"PUSH0",
"PUSH4",
"SETITEM",
- "FROMALTSTACK"
+ "LDSFLD0"
],
"steps": [
{
"actions": [
+ "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -830,7 +871,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 3,
+ "instructionPointer": 5,
"nextInstruction": "PUSH0",
"evaluationStack": [
{
@@ -849,6 +890,11 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "Null"
+ }
]
}
]
@@ -864,8 +910,8 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "TOALTSTACK",
+ "instructionPointer": 8,
+ "nextInstruction": "STSFLD0",
"evaluationStack": [
{
"type": "struct",
@@ -876,6 +922,11 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "Null"
+ }
]
}
]
@@ -891,7 +942,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 9,
+ "instructionPointer": 11,
"nextInstruction": "PUSH0",
"evaluationStack": [
{
@@ -913,7 +964,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "struct",
"value": [
@@ -938,8 +989,8 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 12,
- "nextInstruction": "FROMALTSTACK",
+ "instructionPointer": 14,
+ "nextInstruction": "LDSFLD0",
"evaluationStack": [
{
"type": "struct",
@@ -951,7 +1002,7 @@
]
}
],
- "altStack": [
+ "staticFields": [
{
"type": "struct",
"value": [
@@ -974,7 +1025,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 13,
+ "instructionPointer": 15,
"nextInstruction": "RET",
"evaluationStack": [
{
@@ -995,6 +1046,17 @@
}
]
}
+ ],
+ "staticFields": [
+ {
+ "type": "struct",
+ "value": [
+ {
+ "type": "Integer",
+ "value": 4
+ }
+ ]
+ }
]
}
]
@@ -1031,4 +1093,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/BitwiseLogic/EQUAL.json b/tests/neo-vm.Tests/Tests/OpCodes/BitwiseLogic/EQUAL.json
index 25beea14..83d99239 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/BitwiseLogic/EQUAL.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/BitwiseLogic/EQUAL.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Bitwise Logic",
"name": "EQUAL same types",
"tests": [
@@ -338,16 +338,12 @@
"script": [
"PUSH0",
"NEWARRAY",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"EQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -356,7 +352,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "EQUAL",
"evaluationStack": [
{
@@ -367,12 +363,6 @@
"type": "array",
"value": []
}
- ],
- "altStack": [
- {
- "type": "array",
- "value": []
- }
]
}
]
@@ -386,19 +376,13 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
+ "instructionPointer": 4,
"nextInstruction": "RET",
"evaluationStack": [
{
"type": "boolean",
"value": true
}
- ],
- "altStack": [
- {
- "type": "array",
- "value": []
- }
]
}
]
@@ -498,16 +482,12 @@
"script": [
"PUSH0",
"NEWSTRUCT",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"EQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -516,7 +496,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "EQUAL",
"evaluationStack": [
{
@@ -527,12 +507,6 @@
"type": "struct",
"value": []
}
- ],
- "altStack": [
- {
- "type": "struct",
- "value": []
- }
]
}
]
@@ -546,19 +520,13 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
+ "instructionPointer": 4,
"nextInstruction": "RET",
"evaluationStack": [
{
"type": "boolean",
"value": true
}
- ],
- "altStack": [
- {
- "type": "struct",
- "value": []
- }
]
}
]
@@ -734,16 +702,12 @@
"name": "Real test [Map,Map]=true",
"script": [
"NEWMAP",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"EQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto"
],
@@ -751,7 +715,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 4,
+ "instructionPointer": 2,
"nextInstruction": "EQUAL",
"evaluationStack": [
{
@@ -762,12 +726,6 @@
"type": "map",
"value": {}
}
- ],
- "altStack": [
- {
- "type": "map",
- "value": {}
- }
]
}
]
@@ -781,19 +739,13 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "RET",
"evaluationStack": [
{
"type": "boolean",
"value": true
}
- ],
- "altStack": [
- {
- "type": "map",
- "value": {}
- }
]
}
]
@@ -1181,24 +1133,21 @@
"script": [
"SYSCALL",
"0x77777777",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"EQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "DUPFROMALTSTACK",
- "altStack": [
+ "instructionPointer": 5,
+ "nextInstruction": "DUP",
+ "evaluationStack": [
{
"type": "interop",
"value": "Object"
@@ -1210,14 +1159,13 @@
},
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
+ "instructionPointer": 6,
"nextInstruction": "EQUAL",
"evaluationStack": [
{
@@ -1228,12 +1176,6 @@
"type": "interop",
"value": "Object"
}
- ],
- "altStack": [
- {
- "type": "interop",
- "value": "Object"
- }
]
}
]
@@ -1247,19 +1189,13 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 9,
+ "instructionPointer": 7,
"nextInstruction": "RET",
"evaluationStack": [
{
"type": "boolean",
"value": true
}
- ],
- "altStack": [
- {
- "type": "interop",
- "value": "Object"
- }
]
}
]
@@ -1333,4 +1269,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMEQUAL.json b/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMEQUAL.json
index 3b5ee43e..f8528d55 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMEQUAL.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMEQUAL.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Numeric",
"name": "NUMEQUAL same types",
"tests": [
@@ -338,16 +338,12 @@
"script": [
"PUSH0",
"NEWARRAY",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -356,7 +352,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "NUMEQUAL",
"evaluationStack": [
{
@@ -367,12 +363,6 @@
"type": "array",
"value": []
}
- ],
- "altStack": [
- {
- "type": "array",
- "value": []
- }
]
}
]
@@ -440,16 +430,12 @@
"script": [
"PUSH0",
"NEWSTRUCT",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -458,7 +444,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "NUMEQUAL",
"evaluationStack": [
{
@@ -469,12 +455,6 @@
"type": "struct",
"value": []
}
- ],
- "altStack": [
- {
- "type": "struct",
- "value": []
- }
]
}
]
@@ -592,16 +572,12 @@
"name": "Real test [Map,Map]=Fault",
"script": [
"NEWMAP",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto"
],
@@ -609,7 +585,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 4,
+ "instructionPointer": 2,
"nextInstruction": "NUMEQUAL",
"evaluationStack": [
{
@@ -620,12 +596,6 @@
"type": "map",
"value": {}
}
- ],
- "altStack": [
- {
- "type": "map",
- "value": {}
- }
]
}
]
@@ -981,24 +951,21 @@
"script": [
"SYSCALL",
"0x77777777",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "DUPFROMALTSTACK",
- "altStack": [
+ "instructionPointer": 5,
+ "nextInstruction": "DUP",
+ "evaluationStack": [
{
"type": "interop",
"value": "Object"
@@ -1010,14 +977,13 @@
},
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
+ "instructionPointer": 6,
"nextInstruction": "NUMEQUAL",
"evaluationStack": [
{
@@ -1028,12 +994,6 @@
"type": "interop",
"value": "Object"
}
- ],
- "altStack": [
- {
- "type": "interop",
- "value": "Object"
- }
]
}
]
@@ -1095,4 +1055,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMNOTEQUAL.json b/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMNOTEQUAL.json
index 37587644..27da9b4a 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMNOTEQUAL.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Numeric/NUMNOTEQUAL.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Numeric",
"name": "NUMNOTEQUAL same types",
"tests": [
@@ -338,16 +338,12 @@
"script": [
"PUSH0",
"NEWARRAY",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMNOTEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -356,7 +352,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "NUMNOTEQUAL",
"evaluationStack": [
{
@@ -367,12 +363,6 @@
"type": "array",
"value": []
}
- ],
- "altStack": [
- {
- "type": "array",
- "value": []
- }
]
}
]
@@ -440,16 +430,12 @@
"script": [
"PUSH0",
"NEWSTRUCT",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMNOTEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -458,7 +444,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 5,
+ "instructionPointer": 3,
"nextInstruction": "NUMNOTEQUAL",
"evaluationStack": [
{
@@ -469,12 +455,6 @@
"type": "struct",
"value": []
}
- ],
- "altStack": [
- {
- "type": "struct",
- "value": []
- }
]
}
]
@@ -592,16 +572,12 @@
"name": "Real test [Map,Map]=Fault",
"script": [
"NEWMAP",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMNOTEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto",
"stepInto",
"stepInto"
],
@@ -609,7 +585,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 4,
+ "instructionPointer": 2,
"nextInstruction": "NUMNOTEQUAL",
"evaluationStack": [
{
@@ -620,12 +596,6 @@
"type": "map",
"value": {}
}
- ],
- "altStack": [
- {
- "type": "map",
- "value": {}
- }
]
}
]
@@ -981,24 +951,21 @@
"script": [
"SYSCALL",
"0x77777777",
- "TOALTSTACK",
- "DUPFROMALTSTACK",
- "DUPFROMALTSTACK",
+ "DUP",
"NUMNOTEQUAL"
],
"steps": [
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "DUPFROMALTSTACK",
- "altStack": [
+ "instructionPointer": 5,
+ "nextInstruction": "DUP",
+ "evaluationStack": [
{
"type": "interop",
"value": "Object"
@@ -1010,14 +977,13 @@
},
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 8,
+ "instructionPointer": 6,
"nextInstruction": "NUMNOTEQUAL",
"evaluationStack": [
{
@@ -1028,12 +994,6 @@
"type": "interop",
"value": "Object"
}
- ],
- "altStack": [
- {
- "type": "interop",
- "value": "Object"
- }
]
}
]
@@ -1095,4 +1055,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Push/PUSHDATA4.json b/tests/neo-vm.Tests/Tests/OpCodes/Push/PUSHDATA4.json
index 84117bfd..99d24934 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Push/PUSHDATA4.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Push/PUSHDATA4.json
@@ -1,4 +1,4 @@
-{
+{
"category": "Push",
"name": "PUSHDATA4",
"tests": [
@@ -59,6 +59,24 @@
}
}
]
+ },
+ {
+ "name": "Max length",
+ "script": [
+ "PUSHDATA4",
+ "0x01001000",
+ "0xFF*1048577"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Stack/DUPFROMALTSTACK.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/INITSLOT.json
similarity index 51%
rename from tests/neo-vm.Tests/Tests/OpCodes/Stack/DUPFROMALTSTACK.json
rename to tests/neo-vm.Tests/Tests/OpCodes/Slot/INITSLOT.json
index 02e93433..46bcd668 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Stack/DUPFROMALTSTACK.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/INITSLOT.json
@@ -1,11 +1,12 @@
-{
- "category": "Stack",
- "name": "DUPFROMALTSTACK",
+{
+ "category": "Slot",
+ "name": "INITSLOT",
"tests": [
{
- "name": "Without push",
+ "name": "Without enough items",
"script": [
- "DUPFROMALTSTACK"
+ "INITSLOT",
+ "0x0101"
],
"steps": [
{
@@ -19,28 +20,25 @@
]
},
{
- "name": "Real test [BigInteger]",
+ "name": "Real test [LocalVariables]",
"script": [
- "PUSH5",
- "TOALTSTACK",
- "DUPFROMALTSTACK"
+ "INITSLOT",
+ "0x0100"
],
"steps": [
{
"actions": [
- "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 2,
- "nextInstruction": "DUPFROMALTSTACK",
- "altStack": [
+ "instructionPointer": 3,
+ "nextInstruction": "RET",
+ "localVariables": [
{
- "type": "integer",
- "value": 5
+ "type": "Null"
}
]
}
@@ -49,24 +47,37 @@
},
{
"actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test [Arguments]",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 3,
+ "instructionPointer": 4,
"nextInstruction": "RET",
- "evaluationStack": [
- {
- "type": "integer",
- "value": 5
- }
- ],
- "altStack": [
+ "arguments": [
{
- "type": "integer",
- "value": 5
+ "type": "Integer",
+ "value": 1
}
]
}
@@ -75,27 +86,20 @@
},
{
"actions": [
- "stepInto"
+ "Execute"
],
"result": {
- "state": "HALT",
- "resultStack": [
- {
- "type": "integer",
- "value": 5
- }
- ]
+ "state": "HALT"
}
}
]
},
{
- "name": "Real test [Interop]",
+ "name": "Real test [LocalVariables + Arguments]",
"script": [
- "SYSCALL",
- "0x77777777",
- "TOALTSTACK",
- "DUPFROMALTSTACK"
+ "PUSH1",
+ "INITSLOT",
+ "0x0101"
],
"steps": [
{
@@ -107,12 +111,17 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "DUPFROMALTSTACK",
- "altStack": [
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "localVariables": [
+ {
+ "type": "Null"
+ }
+ ],
+ "arguments": [
{
- "type": "interop",
- "value": "Object"
+ "type": "Integer",
+ "value": 1
}
]
}
@@ -121,24 +130,45 @@
},
{
"actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Initialize twice",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0101",
+ "PUSH0",
+ "INITSLOT",
+ "0x0101"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "stepInto",
"stepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 7,
- "nextInstruction": "RET",
- "evaluationStack": [
+ "instructionPointer": 4,
+ "nextInstruction": "PUSH0",
+ "localVariables": [
{
- "type": "interop",
- "value": "Object"
+ "type": "Null"
}
],
- "altStack": [
+ "arguments": [
{
- "type": "interop",
- "value": "Object"
+ "type": "Integer",
+ "value": 0
}
]
}
@@ -147,19 +177,13 @@
},
{
"actions": [
- "stepInto"
+ "Execute"
],
"result": {
- "state": "HALT",
- "resultStack": [
- {
- "type": "interop",
- "value": "Object"
- }
- ]
+ "state": "FAULT"
}
}
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/INITSSLOT.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/INITSSLOT.json
new file mode 100644
index 00000000..9635bc17
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/INITSSLOT.json
@@ -0,0 +1,80 @@
+{
+ "category": "Slot",
+ "name": "INITSSLOT",
+ "tests": [
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x01"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "stepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 2,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Initialize twice",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "INITSSLOT",
+ "0x02"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "stepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 2,
+ "nextInstruction": "INITSSLOT",
+ "staticFields": [
+ {
+ "type": "Null"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG.json
new file mode 100644
index 00000000..e3be41d3
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG.json
@@ -0,0 +1,69 @@
+{
+ "category": "Slot",
+ "name": "LDARG",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG",
+ "0x01"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG0.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG0.json
new file mode 100644
index 00000000..038e8db3
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG0.json
@@ -0,0 +1,47 @@
+{
+ "category": "Slot",
+ "name": "LDARG0",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG1.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG1.json
new file mode 100644
index 00000000..97f5993e
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG1.json
@@ -0,0 +1,67 @@
+{
+ "category": "Slot",
+ "name": "LDARG1",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "INITSLOT",
+ "0x0002",
+ "LDARG1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG2.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG2.json
new file mode 100644
index 00000000..647a4314
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG2.json
@@ -0,0 +1,68 @@
+{
+ "category": "Slot",
+ "name": "LDARG2",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "INITSLOT",
+ "0x0003",
+ "LDARG2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG3.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG3.json
new file mode 100644
index 00000000..507831dc
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG3.json
@@ -0,0 +1,69 @@
+{
+ "category": "Slot",
+ "name": "LDARG3",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "INITSLOT",
+ "0x0004",
+ "LDARG3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 4
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG4.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG4.json
new file mode 100644
index 00000000..0e561c5d
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG4.json
@@ -0,0 +1,70 @@
+{
+ "category": "Slot",
+ "name": "LDARG4",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "PUSH5",
+ "INITSLOT",
+ "0x0005",
+ "LDARG4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 5
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG5.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG5.json
new file mode 100644
index 00000000..f77cc3ab
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG5.json
@@ -0,0 +1,71 @@
+{
+ "category": "Slot",
+ "name": "LDARG5",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "PUSH5",
+ "PUSH6",
+ "INITSLOT",
+ "0x0006",
+ "LDARG5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 6
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG6.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG6.json
new file mode 100644
index 00000000..d9c79fe5
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDARG6.json
@@ -0,0 +1,72 @@
+{
+ "category": "Slot",
+ "name": "LDARG6",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDARG6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "LDARG6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "PUSH5",
+ "PUSH6",
+ "PUSH7",
+ "INITSLOT",
+ "0x0007",
+ "LDARG6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 7
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC.json
new file mode 100644
index 00000000..87f165db
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC.json
@@ -0,0 +1,70 @@
+{
+ "category": "Slot",
+ "name": "LDLOC",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC",
+ "0x01"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "PUSH1",
+ "STLOC",
+ "0x00",
+ "LDLOC",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC0.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC0.json
new file mode 100644
index 00000000..294a7b8d
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC0.json
@@ -0,0 +1,48 @@
+{
+ "category": "Slot",
+ "name": "LDLOC0",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "PUSH1",
+ "STLOC0",
+ "LDLOC0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC1.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC1.json
new file mode 100644
index 00000000..f9e64820
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC1.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDLOC1",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0200",
+ "PUSH1",
+ "STLOC1",
+ "LDLOC1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC2.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC2.json
new file mode 100644
index 00000000..075f3386
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC2.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDLOC2",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0300",
+ "PUSH1",
+ "STLOC2",
+ "LDLOC2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC3.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC3.json
new file mode 100644
index 00000000..5463edae
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC3.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDLOC3",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0400",
+ "PUSH1",
+ "STLOC3",
+ "LDLOC3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC4.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC4.json
new file mode 100644
index 00000000..23a61697
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC4.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDLOC4",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0500",
+ "PUSH1",
+ "STLOC4",
+ "LDLOC4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC5.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC5.json
new file mode 100644
index 00000000..9bde0a55
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC5.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDLOC5",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0600",
+ "PUSH1",
+ "STLOC5",
+ "LDLOC5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC6.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC6.json
new file mode 100644
index 00000000..edf79632
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDLOC6.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDLOC6",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDLOC6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSLOT",
+ "0x0100",
+ "LDLOC6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSLOT",
+ "0x0700",
+ "PUSH1",
+ "STLOC6",
+ "LDLOC6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD.json
new file mode 100644
index 00000000..311c0a59
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD.json
@@ -0,0 +1,70 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD",
+ "0x01"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "PUSH1",
+ "STSFLD",
+ "0x00",
+ "LDSFLD",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD0.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD0.json
new file mode 100644
index 00000000..8a750b04
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD0.json
@@ -0,0 +1,48 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD0",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "PUSH1",
+ "STSFLD0",
+ "LDSFLD0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD1.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD1.json
new file mode 100644
index 00000000..4289e1aa
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD1.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD1",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x02",
+ "PUSH1",
+ "STSFLD1",
+ "LDSFLD1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD2.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD2.json
new file mode 100644
index 00000000..e03ab04d
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD2.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD2",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x03",
+ "PUSH1",
+ "STSFLD2",
+ "LDSFLD2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD3.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD3.json
new file mode 100644
index 00000000..d10624f5
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD3.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD3",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x04",
+ "PUSH1",
+ "STSFLD3",
+ "LDSFLD3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD4.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD4.json
new file mode 100644
index 00000000..b405defe
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD4.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD4",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x05",
+ "PUSH1",
+ "STSFLD4",
+ "LDSFLD4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD5.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD5.json
new file mode 100644
index 00000000..c6b3ee05
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD5.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD5",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x06",
+ "PUSH1",
+ "STSFLD5",
+ "LDSFLD5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD6.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD6.json
new file mode 100644
index 00000000..cd7ae9b5
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/LDSFLD6.json
@@ -0,0 +1,66 @@
+{
+ "category": "Slot",
+ "name": "LDSFLD6",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "LDSFLD6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "LDSFLD6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x07",
+ "PUSH1",
+ "STSFLD6",
+ "LDSFLD6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "resultStack": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG.json
new file mode 100644
index 00000000..bdf9f2f5
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG.json
@@ -0,0 +1,72 @@
+{
+ "category": "Slot",
+ "name": "STARG",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG",
+ "0x01"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "INITSLOT",
+ "0x0001",
+ "PUSH0",
+ "STARG",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG0.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG0.json
new file mode 100644
index 00000000..b5666c37
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG0.json
@@ -0,0 +1,49 @@
+{
+ "category": "Slot",
+ "name": "STARG0",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG0"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG1.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG1.json
new file mode 100644
index 00000000..da520069
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG1.json
@@ -0,0 +1,74 @@
+{
+ "category": "Slot",
+ "name": "STARG1",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "INITSLOT",
+ "0x0002",
+ "PUSH0",
+ "STARG1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG2.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG2.json
new file mode 100644
index 00000000..8c6952ee
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG2.json
@@ -0,0 +1,79 @@
+{
+ "category": "Slot",
+ "name": "STARG2",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "INITSLOT",
+ "0x0003",
+ "PUSH0",
+ "STARG2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG3.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG3.json
new file mode 100644
index 00000000..e8ed64b0
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG3.json
@@ -0,0 +1,84 @@
+{
+ "category": "Slot",
+ "name": "STARG3",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "INITSLOT",
+ "0x0004",
+ "PUSH0",
+ "STARG3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ },
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG4.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG4.json
new file mode 100644
index 00000000..7b32e0e0
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG4.json
@@ -0,0 +1,89 @@
+{
+ "category": "Slot",
+ "name": "STARG4",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "PUSH5",
+ "INITSLOT",
+ "0x0005",
+ "PUSH0",
+ "STARG4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ },
+ {
+ "type": "Integer",
+ "value": 4
+ },
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG5.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG5.json
new file mode 100644
index 00000000..9bcef878
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG5.json
@@ -0,0 +1,94 @@
+{
+ "category": "Slot",
+ "name": "STARG5",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "PUSH5",
+ "PUSH6",
+ "INITSLOT",
+ "0x0006",
+ "PUSH0",
+ "STARG5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ },
+ {
+ "type": "Integer",
+ "value": 4
+ },
+ {
+ "type": "Integer",
+ "value": 5
+ },
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG6.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG6.json
new file mode 100644
index 00000000..e8c0f09b
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STARG6.json
@@ -0,0 +1,99 @@
+{
+ "category": "Slot",
+ "name": "STARG6",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "PUSH1",
+ "STARG6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "PUSH0",
+ "INITSLOT",
+ "0x0001",
+ "PUSH1",
+ "STARG6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "PUSH1",
+ "PUSH2",
+ "PUSH3",
+ "PUSH4",
+ "PUSH5",
+ "PUSH6",
+ "PUSH7",
+ "INITSLOT",
+ "0x0007",
+ "PUSH0",
+ "STARG6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT",
+ "arguments": [
+ {
+ "type": "Integer",
+ "value": 1
+ },
+ {
+ "type": "Integer",
+ "value": 2
+ },
+ {
+ "type": "Integer",
+ "value": 3
+ },
+ {
+ "type": "Integer",
+ "value": 4
+ },
+ {
+ "type": "Integer",
+ "value": 5
+ },
+ {
+ "type": "Integer",
+ "value": 6
+ },
+ {
+ "type": "Integer",
+ "value": 0
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD.json
new file mode 100644
index 00000000..149244cb
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD.json
@@ -0,0 +1,84 @@
+{
+ "category": "Slot",
+ "name": "STSFLD",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD",
+ "0x01"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "PUSH1",
+ "STSFLD",
+ "0x00"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 5,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Stack/TOALTSTACK.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD0.json
similarity index 62%
rename from tests/neo-vm.Tests/Tests/OpCodes/Stack/TOALTSTACK.json
rename to tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD0.json
index f68a6833..d2ee516f 100644
--- a/tests/neo-vm.Tests/Tests/OpCodes/Stack/TOALTSTACK.json
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD0.json
@@ -1,16 +1,16 @@
-{
- "category": "Stack",
- "name": "TOALTSTACK",
+{
+ "category": "Slot",
+ "name": "STSFLD0",
"tests": [
{
- "name": "Without push",
+ "name": "Without slot",
"script": [
- "TOALTSTACK"
+ "STSFLD0"
],
"steps": [
{
"actions": [
- "stepInto"
+ "Execute"
],
"result": {
"state": "FAULT"
@@ -21,25 +21,28 @@
{
"name": "Real test",
"script": [
- "PUSH5",
- "TOALTSTACK"
+ "INITSSLOT",
+ "0x01",
+ "PUSH1",
+ "STSFLD0"
],
"steps": [
{
"actions": [
- "stepInto",
- "stepInto"
+ "StepInto",
+ "StepInto",
+ "StepInto"
],
"result": {
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 2,
+ "instructionPointer": 4,
"nextInstruction": "RET",
- "altStack": [
+ "staticFields": [
{
- "type": "integer",
- "value": 5
+ "type": "Integer",
+ "value": 1
}
]
}
@@ -48,7 +51,7 @@
},
{
"actions": [
- "stepInto"
+ "Execute"
],
"result": {
"state": "HALT"
@@ -57,4 +60,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD1.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD1.json
new file mode 100644
index 00000000..5ba84602
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD1.json
@@ -0,0 +1,84 @@
+{
+ "category": "Slot",
+ "name": "STSFLD1",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x02",
+ "PUSH1",
+ "STSFLD1"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD2.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD2.json
new file mode 100644
index 00000000..d5c42ba7
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD2.json
@@ -0,0 +1,87 @@
+{
+ "category": "Slot",
+ "name": "STSFLD2",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x03",
+ "PUSH1",
+ "STSFLD2"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD3.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD3.json
new file mode 100644
index 00000000..f4ba41a6
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD3.json
@@ -0,0 +1,90 @@
+{
+ "category": "Slot",
+ "name": "STSFLD3",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x04",
+ "PUSH1",
+ "STSFLD3"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD4.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD4.json
new file mode 100644
index 00000000..48f4d09a
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD4.json
@@ -0,0 +1,93 @@
+{
+ "category": "Slot",
+ "name": "STSFLD4",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x05",
+ "PUSH1",
+ "STSFLD4"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD5.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD5.json
new file mode 100644
index 00000000..f3d2573d
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD5.json
@@ -0,0 +1,96 @@
+{
+ "category": "Slot",
+ "name": "STSFLD5",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x06",
+ "PUSH1",
+ "STSFLD5"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD6.json b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD6.json
new file mode 100644
index 00000000..2d89c718
--- /dev/null
+++ b/tests/neo-vm.Tests/Tests/OpCodes/Slot/STSFLD6.json
@@ -0,0 +1,99 @@
+{
+ "category": "Slot",
+ "name": "STSFLD6",
+ "tests": [
+ {
+ "name": "Without slot",
+ "script": [
+ "STSFLD6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Index out of range",
+ "script": [
+ "INITSSLOT",
+ "0x01",
+ "STSFLD6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "FAULT"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Real test",
+ "script": [
+ "INITSSLOT",
+ "0x07",
+ "PUSH1",
+ "STSFLD6"
+ ],
+ "steps": [
+ {
+ "actions": [
+ "StepInto",
+ "StepInto",
+ "StepInto"
+ ],
+ "result": {
+ "state": "BREAK",
+ "invocationStack": [
+ {
+ "instructionPointer": 4,
+ "nextInstruction": "RET",
+ "staticFields": [
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Null"
+ },
+ {
+ "type": "Integer",
+ "value": 1
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "actions": [
+ "Execute"
+ ],
+ "result": {
+ "state": "HALT"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Stack/DUPFROMALTSTACKBOTTOM.json b/tests/neo-vm.Tests/Tests/OpCodes/Stack/DUPFROMALTSTACKBOTTOM.json
deleted file mode 100644
index 68cd7513..00000000
--- a/tests/neo-vm.Tests/Tests/OpCodes/Stack/DUPFROMALTSTACKBOTTOM.json
+++ /dev/null
@@ -1,181 +0,0 @@
-{
- "category": "Stack",
- "name": "DUPFROMALTSTACKBOTTOM",
- "tests": [
- {
- "name": "Without push",
- "script": [
- "DUPFROMALTSTACKBOTTOM"
- ],
- "steps": [
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "FAULT"
- }
- }
- ]
- },
- {
- "name": "Without push in alt stack",
- "script": [
- "PUSH5",
- "DUPFROMALTSTACKBOTTOM"
- ],
- "steps": [
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "BREAK",
- "invocationStack": [
- {
- "instructionPointer": 1,
- "nextInstruction": "DUPFROMALTSTACKBOTTOM",
- "evaluationStack": [
- {
- "type": "integer",
- "value": 5
- }
- ]
- }
- ]
- }
- },
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "FAULT"
- }
- }
- ]
- },
- {
- "name": "Real test",
- "script": [
- "PUSH1",
- "PUSH2",
- "PUSH3",
- "TOALTSTACK",
- "TOALTSTACK",
- "TOALTSTACK",
- "DUPFROMALTSTACKBOTTOM"
- ],
- "steps": [
- {
- "actions": [
- "stepInto",
- "stepInto",
- "stepInto"
- ],
- "result": {
- "state": "BREAK",
- "invocationStack": [
- {
- "instructionPointer": 3,
- "nextInstruction": "TOALTSTACK",
- "evaluationStack": [
- {
- "type": "integer",
- "value": 3
- },
- {
- "type": "integer",
- "value": 2
- },
- {
- "type": "integer",
- "value": 1
- }
- ]
- }
- ]
- }
- },
- {
- "actions": [
- "stepInto",
- "stepInto",
- "stepInto"
- ],
- "result": {
- "state": "BREAK",
- "invocationStack": [
- {
- "instructionPointer": 6,
- "nextInstruction": "DUPFROMALTSTACKBOTTOM",
- "altStack": [
- {
- "type": "integer",
- "value": 1
- },
- {
- "type": "integer",
- "value": 2
- },
- {
- "type": "integer",
- "value": 3
- }
- ]
- }
- ]
- }
- },
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "BREAK",
- "invocationStack": [
- {
- "instructionPointer": 7,
- "nextInstruction": "RET",
- "evaluationStack": [
- {
- "type": "integer",
- "value": 3
- }
- ],
- "altStack": [
- {
- "type": "integer",
- "value": 1
- },
- {
- "type": "integer",
- "value": 2
- },
- {
- "type": "integer",
- "value": 3
- }
- ]
- }
- ]
- }
- },
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "HALT",
- "resultStack": [
- {
- "type": "integer",
- "value": 3
- }
- ]
- }
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/tests/neo-vm.Tests/Tests/OpCodes/Stack/FROMALTSTACK.json b/tests/neo-vm.Tests/Tests/OpCodes/Stack/FROMALTSTACK.json
deleted file mode 100644
index 4040d107..00000000
--- a/tests/neo-vm.Tests/Tests/OpCodes/Stack/FROMALTSTACK.json
+++ /dev/null
@@ -1,105 +0,0 @@
-{
- "category": "Stack",
- "name": "FROMALTSTACK",
- "tests": [
- {
- "name": "Without push",
- "script": [
- "FROMALTSTACK"
- ],
- "steps": [
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "FAULT"
- }
- }
- ]
- },
- {
- "name": "Without push in Alt Stack",
- "script": [
- "PUSH5",
- "FROMALTSTACK"
- ],
- "steps": [
- {
- "actions": [
- "stepInto",
- "stepInto"
- ],
- "result": {
- "state": "FAULT"
- }
- }
- ]
- },
- {
- "name": "Real Test",
- "script": [
- "PUSH5",
- "TOALTSTACK",
- "FROMALTSTACK"
- ],
- "steps": [
- {
- "actions": [
- "stepInto",
- "stepInto"
- ],
- "result": {
- "state": "BREAK",
- "invocationStack": [
- {
- "instructionPointer": 2,
- "nextInstruction": "FROMALTSTACK",
- "altStack": [
- {
- "type": "integer",
- "value": 5
- }
- ]
- }
- ]
- }
- },
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "BREAK",
- "invocationStack": [
- {
- "instructionPointer": 3,
- "nextInstruction": "RET",
- "evaluationStack": [
- {
- "type": "integer",
- "value": 5
- }
- ]
- }
- ]
- }
- },
- {
- "actions": [
- "stepInto"
- ],
- "result": {
- "state": "HALT",
- "resultStack": [
- {
- "type": "integer",
- "value": 5
- }
- ]
- }
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/tests/neo-vm.Tests/Tests/Others/InvocationLimits.json b/tests/neo-vm.Tests/Tests/Others/InvocationLimits.json
index 1586fa35..b5273808 100644
--- a/tests/neo-vm.Tests/Tests/Others/InvocationLimits.json
+++ b/tests/neo-vm.Tests/Tests/Others/InvocationLimits.json
@@ -1,19 +1,21 @@
-{
+{
"category": "Limits",
"name": "Invocation limits [InvocationLimits] [InvocationLimits] [InvocationLimits]",
"tests": [
{
"name": "More than 1024 ExecutionContext",
"script": [
+ "INITSSLOT",
+ "01",
"PUSHDATA1",
"0x02",
"0x0004",
"INC",
- "TOALTSTACK",
- "FROMALTSTACK",
+ "STSFLD0",
+ "LDSFLD0",
"DEC",
"DUP",
- "TOALTSTACK",
+ "STSFLD0",
"JMPIFNOT",
"0x04",
"CALL",
@@ -23,6 +25,7 @@
"steps": [
{
"actions": [
+ "stepInto",
"stepInto",
"stepInto",
"stepInto"
@@ -31,9 +34,9 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "FROMALTSTACK",
- "altStack": [
+ "instructionPointer": 8,
+ "nextInstruction": "LDSFLD0",
+ "staticFields": [
{
"type": "integer",
"value": 1025
@@ -54,7 +57,7 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 10,
+ "instructionPointer": 12,
"nextInstruction": "JMPIFNOT",
"evaluationStack": [
{
@@ -62,7 +65,7 @@
"value": 1024
}
],
- "altStack": [
+ "staticFields": [
{
"type": "integer",
"value": 1024
@@ -81,9 +84,9 @@
"state": "BREAK",
"invocationStack": [
{
- "instructionPointer": 6,
- "nextInstruction": "FROMALTSTACK",
- "altStack": [
+ "instructionPointer": 8,
+ "nextInstruction": "LDSFLD0",
+ "staticFields": [
{
"type": "integer",
"value": 1024
@@ -91,9 +94,9 @@
]
},
{
- "instructionPointer": 14,
+ "instructionPointer": 16,
"nextInstruction": "RET",
- "altStack": [
+ "staticFields": [
{
"type": "integer",
"value": 1024
@@ -114,4 +117,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/neo-vm.Tests/Types/VMUTExecutionContextState.cs b/tests/neo-vm.Tests/Types/VMUTExecutionContextState.cs
index f67f8412..b0d20ae2 100644
--- a/tests/neo-vm.Tests/Types/VMUTExecutionContextState.cs
+++ b/tests/neo-vm.Tests/Types/VMUTExecutionContextState.cs
@@ -17,7 +17,15 @@ public class VMUTExecutionContextState
[JsonProperty]
public VMUTStackItem[] EvaluationStack { get; set; }
+ // Slots
+
+ [JsonProperty]
+ public VMUTStackItem[] StaticFields { get; set; }
+
+ [JsonProperty]
+ public VMUTStackItem[] Arguments { get; set; }
+
[JsonProperty]
- public VMUTStackItem[] AltStack { get; set; }
+ public VMUTStackItem[] LocalVariables { get; set; }
}
}
diff --git a/tests/neo-vm.Tests/UtReferenceCounter.cs b/tests/neo-vm.Tests/UtReferenceCounter.cs
index 0cc41491..639e1473 100644
--- a/tests/neo-vm.Tests/UtReferenceCounter.cs
+++ b/tests/neo-vm.Tests/UtReferenceCounter.cs
@@ -10,18 +10,19 @@ public class UtReferenceCounter
public void TestCircularReferences()
{
using ScriptBuilder sb = new ScriptBuilder();
- sb.EmitPush(0); //{0}{}:1
- sb.Emit(OpCode.NEWARRAY); //{A[]}|{}:1
- sb.Emit(OpCode.DUP); //{A[],A[]}|{}:2
- sb.Emit(OpCode.DUP); //{A[],A[],A[]}|{}:3
- sb.Emit(OpCode.APPEND); //{A[A]}|{}:2
- sb.Emit(OpCode.DUP); //{A[A],A[A]}|{}:3
- sb.EmitPush(0); //{A[A],A[A],0}|{}:4
- sb.Emit(OpCode.NEWARRAY); //{A[A],A[A],B[]}|{}:4
- sb.Emit(OpCode.TOALTSTACK); //{A[A],A[A]}|{B[]}:4
- sb.Emit(OpCode.DUPFROMALTSTACK); //{A[A],A[A],B[]}|{B[]}:5
+ sb.Emit(OpCode.INITSSLOT, new byte[] { 1 }); //{}|{null}:1
+ sb.EmitPush(0); //{0}|{null}:2
+ sb.Emit(OpCode.NEWARRAY); //{A[]}|{null}:2
+ sb.Emit(OpCode.DUP); //{A[],A[]}|{null}:3
+ sb.Emit(OpCode.DUP); //{A[],A[],A[]}|{null}:4
+ sb.Emit(OpCode.APPEND); //{A[A]}|{null}:3
+ sb.Emit(OpCode.DUP); //{A[A],A[A]}|{null}:4
+ sb.EmitPush(0); //{A[A],A[A],0}|{null}:5
+ sb.Emit(OpCode.NEWARRAY); //{A[A],A[A],B[]}|{null}:5
+ sb.Emit(OpCode.STSFLD0); //{A[A],A[A]}|{B[]}:4
+ sb.Emit(OpCode.LDSFLD0); //{A[A],A[A],B[]}|{B[]}:5
sb.Emit(OpCode.APPEND); //{A[A,B]}|{B[]}:4
- sb.Emit(OpCode.DUPFROMALTSTACK); //{A[A,B],B[]}|{B[]}:5
+ sb.Emit(OpCode.LDSFLD0); //{A[A,B],B[]}|{B[]}:5
sb.EmitPush(0); //{A[A,B],B[],0}|{B[]}:6
sb.Emit(OpCode.NEWARRAY); //{A[A,B],B[],C[]}|{B[]}:6
sb.Emit(OpCode.TUCK); //{A[A,B],C[],B[],C[]}|{B[]}:7
@@ -30,14 +31,14 @@ public void TestCircularReferences()
sb.Emit(OpCode.NEWARRAY); //{A[A,B],C[],D[]}|{B[C]}:7
sb.Emit(OpCode.TUCK); //{A[A,B],D[],C[],D[]}|{B[C]}:8
sb.Emit(OpCode.APPEND); //{A[A,B],D[]}|{B[C[D]]}:7
- sb.Emit(OpCode.DUPFROMALTSTACK); //{A[A,B],D[],B[C]}|{B[C[D]]}:8
+ sb.Emit(OpCode.LDSFLD0); //{A[A,B],D[],B[C]}|{B[C[D]]}:8
sb.Emit(OpCode.APPEND); //{A[A,B]}|{B[C[D[B]]]}:7
- sb.Emit(OpCode.FROMALTSTACK); //{A[A,B],B[C[D[B]]]}|{}:7
- sb.Emit(OpCode.DROP); //{A[A,B[C[D[B]]]]}|{}:6
- sb.Emit(OpCode.DUP); //{A[A,B[C[D[B]]]],A[A,B]}|{}:7
- sb.EmitPush(1); //{A[A,B[C[D[B]]]],A[A,B],1}|{}:8
- sb.Emit(OpCode.REMOVE); //{A[A]}|{}:2
- sb.Emit(OpCode.TOALTSTACK); //{}|{A[A]}:2
+ sb.Emit(OpCode.PUSHNULL); //{A[A,B],null}|{B[C[D[B]]]}:8
+ sb.Emit(OpCode.STSFLD0); //{A[A,B[C[D[B]]]]}|{null}:7
+ sb.Emit(OpCode.DUP); //{A[A,B[C[D[B]]]],A[A,B]}|{null}:8
+ sb.EmitPush(1); //{A[A,B[C[D[B]]]],A[A,B],1}|{null}:9
+ sb.Emit(OpCode.REMOVE); //{A[A]}|{null}:3
+ sb.Emit(OpCode.STSFLD0); //{}|{A[A]}:2
sb.Emit(OpCode.RET); //{}:0
using ExecutionEngine engine = new ExecutionEngine();
Debugger debugger = new Debugger(engine);
@@ -45,19 +46,21 @@ public void TestCircularReferences()
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(1, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(1, engine.ReferenceCounter.Count);
+ Assert.AreEqual(2, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(2, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(3, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(2, engine.ReferenceCounter.Count);
+ Assert.AreEqual(4, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(3, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(4, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(4, engine.ReferenceCounter.Count);
+ Assert.AreEqual(5, engine.ReferenceCounter.Count);
+ Assert.AreEqual(VMState.BREAK, debugger.StepInto());
+ Assert.AreEqual(5, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(4, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
@@ -87,15 +90,15 @@ public void TestCircularReferences()
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(7, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(7, engine.ReferenceCounter.Count);
- Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(6, engine.ReferenceCounter.Count);
+ Assert.AreEqual(8, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(7, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(8, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(2, engine.ReferenceCounter.Count);
+ Assert.AreEqual(9, engine.ReferenceCounter.Count);
+ Assert.AreEqual(VMState.BREAK, debugger.StepInto());
+ Assert.AreEqual(3, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(2, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.HALT, debugger.Execute());
@@ -106,13 +109,14 @@ public void TestCircularReferences()
public void TestRemoveReferrer()
{
using ScriptBuilder sb = new ScriptBuilder();
- sb.EmitPush(0); //{0}{}:1
- sb.Emit(OpCode.NEWARRAY); //{A[]}|{}:1
- sb.Emit(OpCode.DUP); //{A[],A[]}|{}:2
- sb.EmitPush(0); //{A[],A[],0}|{}:3
- sb.Emit(OpCode.NEWARRAY); //{A[],A[],B[]}|{}:3
- sb.Emit(OpCode.TOALTSTACK); //{A[],A[]}|{B[]}:3
- sb.Emit(OpCode.DUPFROMALTSTACK); //{A[],A[],B[]}|{B[]}:4
+ sb.Emit(OpCode.INITSSLOT, new byte[] { 1 }); //{}|{null}:1
+ sb.EmitPush(0); //{0}|{null}:2
+ sb.Emit(OpCode.NEWARRAY); //{A[]}|{null}:2
+ sb.Emit(OpCode.DUP); //{A[],A[]}|{null}:3
+ sb.EmitPush(0); //{A[],A[],0}|{null}:4
+ sb.Emit(OpCode.NEWARRAY); //{A[],A[],B[]}|{null}:4
+ sb.Emit(OpCode.STSFLD0); //{A[],A[]}|{B[]}:3
+ sb.Emit(OpCode.LDSFLD0); //{A[],A[],B[]}|{B[]}:4
sb.Emit(OpCode.APPEND); //{A[B]}|{B[]}:3
sb.Emit(OpCode.DROP); //{}|{B[]}:1
sb.Emit(OpCode.RET); //{}:0
@@ -122,13 +126,15 @@ public void TestRemoveReferrer()
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(1, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(1, engine.ReferenceCounter.Count);
+ Assert.AreEqual(2, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(2, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(3, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
- Assert.AreEqual(3, engine.ReferenceCounter.Count);
+ Assert.AreEqual(4, engine.ReferenceCounter.Count);
+ Assert.AreEqual(VMState.BREAK, debugger.StepInto());
+ Assert.AreEqual(4, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
Assert.AreEqual(3, engine.ReferenceCounter.Count);
Assert.AreEqual(VMState.BREAK, debugger.StepInto());
diff --git a/tests/neo-vm.Tests/UtVMJson.cs b/tests/neo-vm.Tests/UtVMJson.cs
index eea8190e..17a0a67e 100644
--- a/tests/neo-vm.Tests/UtVMJson.cs
+++ b/tests/neo-vm.Tests/UtVMJson.cs
@@ -19,6 +19,9 @@ public class UtVMJson : VMJsonTestBase
[TestMethod]
public void TestOpCodesStack() => TestJson("./Tests/OpCodes/Stack");
+ [TestMethod]
+ public void TestOpCodesSlot() => TestJson("./Tests/OpCodes/Slot");
+
[TestMethod]
public void TestOpCodesSplice() => TestJson("./Tests/OpCodes/Splice");
@@ -57,7 +60,14 @@ private void TestJson(string path)
//File.WriteAllText(realFile, ut.ToJson().Replace("\r\n", "\n"), Encoding.UTF8);
}
- ExecuteTest(ut);
+ try
+ {
+ ExecuteTest(ut);
+ }
+ catch (Exception ex)
+ {
+ throw new AggregateException("Error in file: " + realFile, ex);
+ }
}
}
}
diff --git a/tests/neo-vm.Tests/VMJsonTestBase.cs b/tests/neo-vm.Tests/VMJsonTestBase.cs
index 948f3e84..27562021 100644
--- a/tests/neo-vm.Tests/VMJsonTestBase.cs
+++ b/tests/neo-vm.Tests/VMJsonTestBase.cs
@@ -91,8 +91,15 @@ private void AssertResult(VMUTExecutionContextState[] result, StackMessage
private void AssertResult(VMUTStackItem[] result, EvaluationStack stack, string message)
{
- AssertAreEqual(result == null ? 0 : result.Length, stack.Count, message + "Stack is different");
+ AssertAreEqual(stack.Count, result == null ? 0 : result.Length, message + "Stack is different");
for (int x = 0, max = stack.Count; x < max; x++)
{
- AssertAreEqual(PrepareJsonItem(result[x]).ToString(Formatting.None), ItemToJson(stack.Peek(x)).ToString(Formatting.None), message + "Stack item is different");
+ AssertAreEqual(ItemToJson(stack.Peek(x)).ToString(Formatting.None), PrepareJsonItem(result[x]).ToString(Formatting.None), message + "Stack item is different");
+ }
+ }
+
+ ///
+ /// Assert result slot
+ ///
+ /// Slot
+ /// Result
+ /// Message
+ private void AssertResult(VMUTStackItem[] result, Slot slot, string message)
+ {
+ AssertAreEqual(slot == null ? 0 : slot.Count, result == null ? 0 : result.Length, message + "Slot is different");
+
+ for (int x = 0, max = slot == null ? 0 : slot.Count; x < max; x++)
+ {
+ AssertAreEqual(ItemToJson(slot[x]).ToString(Formatting.None), PrepareJsonItem(result[x]).ToString(Formatting.None), message + "Stack item is different");
}
}