From 10c2d71405e20731b41d671472e0290b00d4aba3 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 17 Oct 2024 23:54:15 +0800 Subject: [PATCH 1/5] rename vm catchable and uncatchable exceptions --- src/Neo.VM/EvaluationStack.cs | 14 +++++------ src/Neo.VM/ExecutionEngine.cs | 4 ++-- src/Neo.VM/JumpTable/JumpTable.Compound.cs | 12 +++++----- src/Neo.VM/JumpTable/JumpTable.Control.cs | 12 +++++----- ...leException.cs => VMCatchableException.cs} | 6 +++-- src/Neo.VM/VMUncatchableException.cs | 23 +++++++++++++++++++ .../ApplicationEngine.Contract.cs | 12 +++++----- src/Neo/SmartContract/ApplicationEngine.cs | 20 ++++++++-------- 8 files changed, 64 insertions(+), 39 deletions(-) rename src/Neo.VM/{CatchableException.cs => VMCatchableException.cs} (65%) create mode 100644 src/Neo.VM/VMUncatchableException.cs diff --git a/src/Neo.VM/EvaluationStack.cs b/src/Neo.VM/EvaluationStack.cs index 463df8d12a..af585dd68d 100644 --- a/src/Neo.VM/EvaluationStack.cs +++ b/src/Neo.VM/EvaluationStack.cs @@ -69,7 +69,7 @@ IEnumerator IEnumerable.GetEnumerator() [MethodImpl(MethodImplOptions.AggressiveInlining)] internal void Insert(int index, StackItem item) { - if (index > innerList.Count) throw new InvalidOperationException($"Insert out of bounds: {index}/{innerList.Count}"); + if (index > innerList.Count) throw new VMUncatchableException($"Insert out of bounds: {index}/{innerList.Count}"); innerList.Insert(innerList.Count - index, item); referenceCounter.AddStackReference(item); } @@ -92,11 +92,11 @@ internal void MoveTo(EvaluationStack stack, int count = -1) [MethodImpl(MethodImplOptions.AggressiveInlining)] public StackItem Peek(int index = 0) { - if (index >= innerList.Count) throw new InvalidOperationException($"Peek out of bounds: {index}/{innerList.Count}"); + if (index >= innerList.Count) throw new VMUncatchableException($"Peek out of bounds: {index}/{innerList.Count}"); if (index < 0) { index += innerList.Count; - if (index < 0) throw new InvalidOperationException($"Peek out of bounds: {index}/{innerList.Count}"); + if (index < 0) throw new VMUncatchableException($"Peek out of bounds: {index}/{innerList.Count}"); } return innerList[innerList.Count - index - 1]; } @@ -118,7 +118,7 @@ public void Push(StackItem item) internal void Reverse(int n) { if (n < 0 || n > innerList.Count) - throw new ArgumentOutOfRangeException(nameof(n)); + throw new VMUncatchableException($"Reverse operation out of bounds: {n}/{innerList.Count}"); if (n <= 1) return; innerList.Reverse(innerList.Count - n, n); } @@ -147,16 +147,16 @@ public T Pop() where T : StackItem internal T Remove(int index) where T : StackItem { if (index >= innerList.Count) - throw new ArgumentOutOfRangeException(nameof(index)); + throw new VMUncatchableException($"Remove out of bounds: {index}/{innerList.Count}"); if (index < 0) { index += innerList.Count; if (index < 0) - throw new ArgumentOutOfRangeException(nameof(index)); + throw new VMUncatchableException($"Remove out of bounds: {index}/{innerList.Count}"); } index = innerList.Count - index - 1; if (innerList[index] is not T item) - throw new InvalidCastException($"The item can't be casted to type {typeof(T)}"); + throw new VMUncatchableException($"The item of type {innerList[index].Type} can't be casted to type {typeof(T)}"); innerList.RemoveAt(index); referenceCounter.RemoveStackReference(item); return item; diff --git a/src/Neo.VM/ExecutionEngine.cs b/src/Neo.VM/ExecutionEngine.cs index 8a3167b4c8..066bce2a87 100644 --- a/src/Neo.VM/ExecutionEngine.cs +++ b/src/Neo.VM/ExecutionEngine.cs @@ -59,7 +59,7 @@ public class ExecutionEngine : IDisposable /// /// The VM object representing the uncaught exception. /// - public StackItem? UncaughtException { get; internal set; } + public StackItem? UncaughtVMCatchableException { get; internal set; } /// /// The current state of the VM. @@ -148,7 +148,7 @@ protected internal void ExecuteNext() { JumpTable[instruction.OpCode](this, instruction); } - catch (CatchableException ex) when (Limits.CatchEngineExceptions) + catch (VMCatchableException ex) when (Limits.CatchEngineExceptions) { JumpTable.ExecuteThrow(this, ex.Message); } diff --git a/src/Neo.VM/JumpTable/JumpTable.Compound.cs b/src/Neo.VM/JumpTable/JumpTable.Compound.cs index 2a81b213fe..8df66e6eae 100644 --- a/src/Neo.VM/JumpTable/JumpTable.Compound.cs +++ b/src/Neo.VM/JumpTable/JumpTable.Compound.cs @@ -375,14 +375,14 @@ public virtual void PickItem(ExecutionEngine engine, Instruction instruction) { var index = (int)key.GetInteger(); if (index < 0 || index >= array.Count) - throw new CatchableException($"The value {index} is out of range."); + throw new VMCatchableException($"The value {index} is out of range."); engine.Push(array[index]); break; } case Map map: { if (!map.TryGetValue(key, out var value)) - throw new CatchableException($"Key not found in {nameof(Map)}"); + throw new VMCatchableException($"Key not found in {nameof(Map)}"); engine.Push(value); break; } @@ -391,7 +391,7 @@ public virtual void PickItem(ExecutionEngine engine, Instruction instruction) var byteArray = primitive.GetSpan(); var index = (int)key.GetInteger(); if (index < 0 || index >= byteArray.Length) - throw new CatchableException($"The value {index} is out of range."); + throw new VMCatchableException($"The value {index} is out of range."); engine.Push((BigInteger)byteArray[index]); break; } @@ -399,7 +399,7 @@ public virtual void PickItem(ExecutionEngine engine, Instruction instruction) { var index = (int)key.GetInteger(); if (index < 0 || index >= buffer.Size) - throw new CatchableException($"The value {index} is out of range."); + throw new VMCatchableException($"The value {index} is out of range."); engine.Push((BigInteger)buffer.InnerBuffer.Span[index]); break; } @@ -444,7 +444,7 @@ public virtual void SetItem(ExecutionEngine engine, Instruction instruction) { var index = (int)key.GetInteger(); if (index < 0 || index >= array.Count) - throw new CatchableException($"The value {index} is out of range."); + throw new VMCatchableException($"The value {index} is out of range."); array[index] = value; break; } @@ -457,7 +457,7 @@ public virtual void SetItem(ExecutionEngine engine, Instruction instruction) { var index = (int)key.GetInteger(); if (index < 0 || index >= buffer.Size) - throw new CatchableException($"The value {index} is out of range."); + throw new VMCatchableException($"The value {index} is out of range."); if (value is not PrimitiveType p) throw new InvalidOperationException($"Value must be a primitive type in {instruction.OpCode}"); var b = (int)p.GetInteger(); diff --git a/src/Neo.VM/JumpTable/JumpTable.Control.cs b/src/Neo.VM/JumpTable/JumpTable.Control.cs index 1ef74fe4a5..48b47373c3 100644 --- a/src/Neo.VM/JumpTable/JumpTable.Control.cs +++ b/src/Neo.VM/JumpTable/JumpTable.Control.cs @@ -517,10 +517,10 @@ public virtual void EndFinally(ExecutionEngine engine, Instruction instruction) if (!engine.CurrentContext.TryStack.TryPop(out var currentTry)) throw new InvalidOperationException($"The corresponding TRY block cannot be found."); - if (engine.UncaughtException is null) + if (engine.UncaughtVMCatchableException is null) engine.CurrentContext.InstructionPointer = currentTry.EndPointer; else - ExecuteThrow(engine, engine.UncaughtException); + ExecuteThrow(engine, engine.UncaughtVMCatchableException); engine.isJumping = true; } @@ -659,7 +659,7 @@ public virtual void ExecuteTry(ExecutionEngine engine, int catchOffset, int fina /// The exception to throw. public virtual void ExecuteThrow(ExecutionEngine engine, StackItem? ex) { - engine.UncaughtException = ex; + engine.UncaughtVMCatchableException = ex; var pop = 0; foreach (var executionContext in engine.InvocationStack) @@ -680,9 +680,9 @@ public virtual void ExecuteThrow(ExecutionEngine engine, StackItem? ex) if (tryContext.State == ExceptionHandlingState.Try && tryContext.HasCatch) { tryContext.State = ExceptionHandlingState.Catch; - engine.Push(engine.UncaughtException!); + engine.Push(engine.UncaughtVMCatchableException!); executionContext.InstructionPointer = tryContext.CatchPointer; - engine.UncaughtException = null; + engine.UncaughtVMCatchableException = null; } else { @@ -696,7 +696,7 @@ public virtual void ExecuteThrow(ExecutionEngine engine, StackItem? ex) ++pop; } - throw new VMUnhandledException(engine.UncaughtException!); + throw new VMUnhandledException(engine.UncaughtVMCatchableException!); } #endregion diff --git a/src/Neo.VM/CatchableException.cs b/src/Neo.VM/VMCatchableException.cs similarity index 65% rename from src/Neo.VM/CatchableException.cs rename to src/Neo.VM/VMCatchableException.cs index b4fd3f1655..422b5a7bf7 100644 --- a/src/Neo.VM/CatchableException.cs +++ b/src/Neo.VM/VMCatchableException.cs @@ -13,10 +13,12 @@ namespace Neo.VM { - public class CatchableException : Exception + public class VMCatchableException : Exception { - public CatchableException(string message) : base(message) + public VMCatchableException(string message) : base(message) { + if (string.IsNullOrEmpty(message)) + throw new ArgumentException("Message cannot be null or empty.", nameof(message)); } } } diff --git a/src/Neo.VM/VMUncatchableException.cs b/src/Neo.VM/VMUncatchableException.cs new file mode 100644 index 0000000000..b9421d92e6 --- /dev/null +++ b/src/Neo.VM/VMUncatchableException.cs @@ -0,0 +1,23 @@ +// Copyright (C) 2015-2024 The Neo Project. +// +// VMUncatchableException.cs file belongs to the neo project and is free +// software distributed under the MIT software license, see the +// accompanying file LICENSE in the main directory of the +// repository or http://www.opensource.org/licenses/mit-license.php +// for more details. +// +// Redistribution and use in source and binary forms with or without +// modifications are permitted. + +using System; + +namespace Neo.VM; + +public class VMUncatchableException:Exception +{ + public VMUncatchableException(string message) : base(message) + { + if (string.IsNullOrEmpty(message)) + throw new ArgumentException("Message cannot be null or empty.", nameof(message)); + } +} diff --git a/src/Neo/SmartContract/ApplicationEngine.Contract.cs b/src/Neo/SmartContract/ApplicationEngine.Contract.cs index 889ec0e07d..2d93bdf24e 100644 --- a/src/Neo/SmartContract/ApplicationEngine.Contract.cs +++ b/src/Neo/SmartContract/ApplicationEngine.Contract.cs @@ -77,9 +77,9 @@ protected internal void CallContract(UInt160 contractHash, string method, CallFl throw new ArgumentOutOfRangeException(nameof(callFlags)); ContractState contract = NativeContract.ContractManagement.GetContract(SnapshotCache, contractHash); - if (contract is null) throw new InvalidOperationException($"Called Contract Does Not Exist: {contractHash}.{method}"); + if (contract is null) throw new VMUncatchableException($"Called Contract Does Not Exist: {contractHash}.{method}"); ContractMethodDescriptor md = contract.Manifest.Abi.GetMethod(method, args.Count); - if (md is null) throw new InvalidOperationException($"Method \"{method}\" with {args.Count} parameter(s) doesn't exist in the contract {contractHash}."); + if (md is null) throw new VMUncatchableException($"Method \"{method}\" with {args.Count} parameter(s) doesn't exist in the contract {contractHash}."); bool hasReturnValue = md.ReturnType != ContractParameterType.Void; ExecutionContext context = CallContractInternal(contract, md, callFlags, hasReturnValue, args); @@ -95,9 +95,9 @@ protected internal void CallNativeContract(byte version) { NativeContract contract = NativeContract.GetContract(CurrentScriptHash); if (contract is null) - throw new InvalidOperationException("It is not allowed to use \"System.Contract.CallNative\" directly."); + throw new VMUncatchableException("It is not allowed to use \"System.Contract.CallNative\" directly."); if (!contract.IsActive(ProtocolSettings, NativeContract.Ledger.CurrentIndex(SnapshotCache))) - throw new InvalidOperationException($"The native contract {contract.Name} is not active."); + throw new VMUncatchableException($"The native contract {contract.Name} is not active."); contract.Invoke(this, version); } @@ -154,7 +154,7 @@ protected internal async void NativeOnPersistAsync() try { if (Trigger != TriggerType.OnPersist) - throw new InvalidOperationException(); + throw new VMUncatchableException("Trigger type must be 'OnPersist'."); foreach (NativeContract contract in NativeContract.Contracts) { if (contract.IsActive(ProtocolSettings, PersistingBlock.Index)) @@ -176,7 +176,7 @@ protected internal async void NativePostPersistAsync() try { if (Trigger != TriggerType.PostPersist) - throw new InvalidOperationException(); + throw new VMUncatchableException("Trigger type must be 'PostPersist'."); foreach (NativeContract contract in NativeContract.Contracts) { if (contract.IsActive(ProtocolSettings, PersistingBlock.Index)) diff --git a/src/Neo/SmartContract/ApplicationEngine.cs b/src/Neo/SmartContract/ApplicationEngine.cs index 38430f3632..0f826b5c4b 100644 --- a/src/Neo/SmartContract/ApplicationEngine.cs +++ b/src/Neo/SmartContract/ApplicationEngine.cs @@ -263,7 +263,7 @@ protected internal void AddFee(long datoshi) FeeConsumed = GasConsumed = checked(FeeConsumed + datoshi); #pragma warning restore CS0618 // Type or member is obsolete if (FeeConsumed > _feeAmount) - throw new InvalidOperationException("Insufficient GAS."); + throw new VMUncatchableException("Insufficient GAS."); } protected override void OnFault(Exception ex) @@ -281,16 +281,16 @@ internal void Throw(Exception ex) private ExecutionContext CallContractInternal(UInt160 contractHash, string method, CallFlags flags, bool hasReturnValue, StackItem[] args) { ContractState contract = NativeContract.ContractManagement.GetContract(SnapshotCache, contractHash); - if (contract is null) throw new InvalidOperationException($"Called Contract Does Not Exist: {contractHash}"); + if (contract is null) throw new VMUncatchableException($"Called Contract Does Not Exist: {contractHash}"); ContractMethodDescriptor md = contract.Manifest.Abi.GetMethod(method, args.Length); - if (md is null) throw new InvalidOperationException($"Method \"{method}\" with {args.Length} parameter(s) doesn't exist in the contract {contractHash}."); + if (md is null) throw new VMUncatchableException($"Method \"{method}\" with {args.Length} parameter(s) doesn't exist in the contract {contractHash}."); return CallContractInternal(contract, md, flags, hasReturnValue, args); } private ExecutionContext CallContractInternal(ContractState contract, ContractMethodDescriptor method, CallFlags flags, bool hasReturnValue, IReadOnlyList args) { if (NativeContract.Policy.IsBlocked(SnapshotCache, contract.Hash)) - throw new InvalidOperationException($"The contract {contract.Hash} has been blocked."); + throw new VMUncatchableException($"The contract {contract.Hash} has been blocked."); ExecutionContext currentContext = CurrentContext; ExecutionContextState state = currentContext.GetState(); @@ -304,7 +304,7 @@ private ExecutionContext CallContractInternal(ContractState contract, ContractMe ? state.Contract // use executing contract state to avoid possible contract update/destroy side-effects, ref. https://github.com/neo-project/neo/pull/3290. : NativeContract.ContractManagement.GetContract(SnapshotCache, CurrentScriptHash); if (executingContract?.CanCall(contract, method.Name) == false) - throw new InvalidOperationException($"Cannot Call Method {method.Name} Of Contract {contract.Hash} From Contract {CurrentScriptHash}"); + throw new VMUncatchableException($"Cannot Call Method {method.Name} Of Contract {contract.Hash} From Contract {CurrentScriptHash}"); } if (invocationCounter.TryGetValue(contract.Hash, out var counter)) @@ -356,7 +356,7 @@ internal override void UnloadContext(ExecutionContext context) if (context.Script != CurrentContext?.Script) { ExecutionContextState state = context.GetState(); - if (UncaughtException is null) + if (UncaughtVMCatchableException is null) { state.SnapshotCache?.Commit(); if (CurrentContext != null) @@ -368,7 +368,7 @@ internal override void UnloadContext(ExecutionContext context) if (context.EvaluationStack.Count == 0) Push(StackItem.Null); else if (context.EvaluationStack.Count > 1) - throw new NotSupportedException("Multiple return values are not allowed in cross-contract calls."); + throw new VMUncatchableException("Multiple return values are not allowed in cross-contract calls."); } } } @@ -381,8 +381,8 @@ internal override void UnloadContext(ExecutionContext context) Diagnostic?.ContextUnloaded(context); if (contractTasks.Remove(context, out var awaiter)) { - if (UncaughtException is not null) - throw new VMUnhandledException(UncaughtException); + if (UncaughtVMCatchableException is not null) + throw new VMUnhandledException(UncaughtVMCatchableException); awaiter.SetResult(this); } } @@ -568,7 +568,7 @@ internal protected void ValidateCallFlags(CallFlags requiredCallFlags) { ExecutionContextState state = CurrentContext.GetState(); if (!state.CallFlags.HasFlag(requiredCallFlags)) - throw new InvalidOperationException($"Cannot call this SYSCALL with the flag {state.CallFlags}."); + throw new VMUncatchableException($"Cannot call this SYSCALL with the flag {state.CallFlags}."); } /// From b59cc87d22c5cf6e4f8c2cd8ea71fd534039fbd5 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 17 Oct 2024 23:58:21 +0800 Subject: [PATCH 2/5] format --- src/Neo.VM/VMCatchableException.cs | 2 +- src/Neo.VM/VMUncatchableException.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Neo.VM/VMCatchableException.cs b/src/Neo.VM/VMCatchableException.cs index 422b5a7bf7..890e8443e6 100644 --- a/src/Neo.VM/VMCatchableException.cs +++ b/src/Neo.VM/VMCatchableException.cs @@ -1,6 +1,6 @@ // Copyright (C) 2015-2024 The Neo Project. // -// CatchableException.cs file belongs to the neo project and is free +// VMCatchableException.cs file belongs to the neo project and is free // software distributed under the MIT software license, see the // accompanying file LICENSE in the main directory of the // repository or http://www.opensource.org/licenses/mit-license.php diff --git a/src/Neo.VM/VMUncatchableException.cs b/src/Neo.VM/VMUncatchableException.cs index b9421d92e6..97032ed526 100644 --- a/src/Neo.VM/VMUncatchableException.cs +++ b/src/Neo.VM/VMUncatchableException.cs @@ -13,7 +13,7 @@ namespace Neo.VM; -public class VMUncatchableException:Exception +public class VMUncatchableException : Exception { public VMUncatchableException(string message) : base(message) { From 7e4e662739e05db179765605e3b01e61271b1326 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 18 Oct 2024 00:04:18 +0800 Subject: [PATCH 3/5] format --- src/Neo.VM/VMUncatchableException.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Neo.VM/VMUncatchableException.cs b/src/Neo.VM/VMUncatchableException.cs index 97032ed526..607ac60d85 100644 --- a/src/Neo.VM/VMUncatchableException.cs +++ b/src/Neo.VM/VMUncatchableException.cs @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2024 The Neo Project. +// Copyright (C) 2015-2024 The Neo Project. // // VMUncatchableException.cs file belongs to the neo project and is free // software distributed under the MIT software license, see the From 3d8c3572c06cfd9e4179410a147deb00d225ede9 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 18 Oct 2024 00:33:11 +0800 Subject: [PATCH 4/5] update exception --- tests/Neo.VM.Tests/UT_EvaluationStack.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/Neo.VM.Tests/UT_EvaluationStack.cs b/tests/Neo.VM.Tests/UT_EvaluationStack.cs index fb1f5e5813..55ac3f6e5e 100644 --- a/tests/Neo.VM.Tests/UT_EvaluationStack.cs +++ b/tests/Neo.VM.Tests/UT_EvaluationStack.cs @@ -132,7 +132,7 @@ public void TestInsertPeek() stack.Insert(1, 1); stack.Insert(1, 2); - Assert.ThrowsException(() => stack.Insert(4, 2)); + Assert.ThrowsException(() => stack.Insert(4, 2)); Assert.AreEqual(3, stack.Count); CollectionAssert.AreEqual(new Integer[] { 1, 2, 3 }, stack.ToArray()); @@ -141,7 +141,7 @@ public void TestInsertPeek() Assert.AreEqual(2, stack.Peek(1)); Assert.AreEqual(1, stack.Peek(-1)); - Assert.ThrowsException(() => stack.Peek(-4)); + Assert.ThrowsException(() => stack.Peek(-4)); } [TestMethod] @@ -153,7 +153,7 @@ public void TestPopPush() Assert.AreEqual(2, stack.Pop()); Assert.AreEqual(1, stack.Pop()); - Assert.ThrowsException(() => stack.Pop()); + Assert.ThrowsException(() => stack.Pop()); stack = CreateOrderedStack(3); @@ -161,7 +161,7 @@ public void TestPopPush() Assert.IsTrue(stack.Pop().Equals(2)); Assert.IsTrue(stack.Pop().Equals(1)); - Assert.ThrowsException(() => stack.Pop()); + Assert.ThrowsException(() => stack.Pop()); } [TestMethod] @@ -173,8 +173,8 @@ public void TestRemove() Assert.IsTrue(stack.Remove(0).Equals(2)); Assert.IsTrue(stack.Remove(-1).Equals(1)); - Assert.ThrowsException(() => stack.Remove(0)); - Assert.ThrowsException(() => stack.Remove(-1)); + Assert.ThrowsException(() => stack.Remove(0)); + Assert.ThrowsException(() => stack.Remove(-1)); } [TestMethod] @@ -186,18 +186,18 @@ public void TestReverse() Assert.IsTrue(stack.Pop().Equals(1)); Assert.IsTrue(stack.Pop().Equals(2)); Assert.IsTrue(stack.Pop().Equals(3)); - Assert.ThrowsException(() => stack.Pop().Equals(0)); + Assert.ThrowsException(() => stack.Pop().Equals(0)); stack = CreateOrderedStack(3); - Assert.ThrowsException(() => stack.Reverse(-1)); - Assert.ThrowsException(() => stack.Reverse(4)); + Assert.ThrowsException(() => stack.Reverse(-1)); + Assert.ThrowsException(() => stack.Reverse(4)); stack.Reverse(1); Assert.IsTrue(stack.Pop().Equals(3)); Assert.IsTrue(stack.Pop().Equals(2)); Assert.IsTrue(stack.Pop().Equals(1)); - Assert.ThrowsException(() => stack.Pop().Equals(0)); + Assert.ThrowsException(() => stack.Pop().Equals(0)); } [TestMethod] From 7fdc6310886c1e343390bc47fac324ba3a6e46cb Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 18 Oct 2024 00:35:02 +0800 Subject: [PATCH 5/5] update exception --- tests/Neo.UnitTests/SmartContract/UT_InteropService.NEO.cs | 2 +- tests/Neo.UnitTests/SmartContract/UT_InteropService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Neo.UnitTests/SmartContract/UT_InteropService.NEO.cs b/tests/Neo.UnitTests/SmartContract/UT_InteropService.NEO.cs index e0ccdd7dcc..d4b2d0b7c7 100644 --- a/tests/Neo.UnitTests/SmartContract/UT_InteropService.NEO.cs +++ b/tests/Neo.UnitTests/SmartContract/UT_InteropService.NEO.cs @@ -127,7 +127,7 @@ public void TestContract_Create() var manifest = TestUtils.CreateDefaultManifest(); Assert.ThrowsException(() => snapshotCache.DeployContract(null, nefFile, manifest.ToJson().ToByteArray(false))); Assert.ThrowsException(() => snapshotCache.DeployContract(UInt160.Zero, nefFile, new byte[ContractManifest.MaxLength + 1])); - Assert.ThrowsException(() => snapshotCache.DeployContract(UInt160.Zero, nefFile, manifest.ToJson().ToByteArray(true), 10000000)); + Assert.ThrowsException(() => snapshotCache.DeployContract(UInt160.Zero, nefFile, manifest.ToJson().ToByteArray(true), 10000000)); var script_exceedMaxLength = new NefFile() { diff --git a/tests/Neo.UnitTests/SmartContract/UT_InteropService.cs b/tests/Neo.UnitTests/SmartContract/UT_InteropService.cs index 35dd3dbe37..322c0cdbe0 100644 --- a/tests/Neo.UnitTests/SmartContract/UT_InteropService.cs +++ b/tests/Neo.UnitTests/SmartContract/UT_InteropService.cs @@ -714,7 +714,7 @@ public void TestContract_Call() state.Manifest.Permissions[0].Methods = WildcardContainer.Create("a"); engine.SnapshotCache.DeleteContract(state.Hash); engine.SnapshotCache.AddContract(state.Hash, state); - Assert.ThrowsException(() => engine.CallContract(state.Hash, method, CallFlags.All, args)); + Assert.ThrowsException(() => engine.CallContract(state.Hash, method, CallFlags.All, args)); state.Manifest.Permissions[0].Methods = WildcardContainer.CreateWildcard(); engine.SnapshotCache.DeleteContract(state.Hash); @@ -723,7 +723,7 @@ public void TestContract_Call() engine.SnapshotCache.DeleteContract(state.Hash); engine.SnapshotCache.AddContract(state.Hash, state); - Assert.ThrowsException(() => engine.CallContract(UInt160.Zero, method, CallFlags.All, args)); + Assert.ThrowsException(() => engine.CallContract(UInt160.Zero, method, CallFlags.All, args)); } [TestMethod]