diff --git a/src/Neo/VM/Helper.cs b/src/Neo/Extensions/SmartContract/ContractParameterExtensions.cs similarity index 91% rename from src/Neo/VM/Helper.cs rename to src/Neo/Extensions/SmartContract/ContractParameterExtensions.cs index 8a1bc2b01b..d60b61eaf2 100644 --- a/src/Neo/VM/Helper.cs +++ b/src/Neo/Extensions/SmartContract/ContractParameterExtensions.cs @@ -1,6 +1,6 @@ // Copyright (C) 2015-2024 The Neo Project. // -// Helper.cs file belongs to the neo project and is free +// ContractParameterExtensions.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 @@ -10,8 +10,6 @@ // modifications are permitted. using Neo.Cryptography.ECC; -using Neo.Extensions; -using Neo.Json; using Neo.SmartContract; using Neo.VM.Types; using System; @@ -20,12 +18,9 @@ using System.Numerics; using Array = Neo.VM.Types.Array; -namespace Neo.VM +namespace Neo.Extensions { - /// - /// A helper class related to NeoVM. - /// - public static class Helper + public static class ContractParameterExtensions { /// /// Converts the to a . @@ -46,7 +41,7 @@ private static StackItem ToStackItem(ContractParameter parameter, List<(StackIte { case ContractParameterType.Array: if (context is null) - context = new List<(StackItem, ContractParameter)>(); + context = []; else (stackItem, _) = context.FirstOrDefault(p => ReferenceEquals(p.Item2, parameter)); if (stackItem is null) @@ -57,7 +52,7 @@ private static StackItem ToStackItem(ContractParameter parameter, List<(StackIte break; case ContractParameterType.Map: if (context is null) - context = new List<(StackItem, ContractParameter)>(); + context = []; else (stackItem, _) = context.FirstOrDefault(p => ReferenceEquals(p.Item2, parameter)); if (stackItem is null) diff --git a/src/Neo/Persistence/ClonedCache.cs b/src/Neo/Persistence/ClonedCache.cs index e2629e385d..d89491e2b9 100644 --- a/src/Neo/Persistence/ClonedCache.cs +++ b/src/Neo/Persistence/ClonedCache.cs @@ -38,6 +38,7 @@ protected override bool ContainsInternal(StorageKey key) return innerCache.Contains(key); } + /// protected override StorageItem GetInternal(StorageKey key) { return innerCache[key].Clone(); diff --git a/src/Neo/Persistence/DataCache.cs b/src/Neo/Persistence/DataCache.cs index 37664bfa67..2f5138df9c 100644 --- a/src/Neo/Persistence/DataCache.cs +++ b/src/Neo/Persistence/DataCache.cs @@ -310,7 +310,8 @@ public bool Contains(StorageKey key) /// Reads a specified entry from the underlying storage. /// /// The key of the entry. - /// The data of the entry. Or if the entry doesn't exist. + /// The data of the entry. Or throw if the entry doesn't exist. + /// If the entry doesn't exist. protected abstract StorageItem GetInternal(StorageKey key); /// diff --git a/src/Neo/Persistence/SnapshotCache.cs b/src/Neo/Persistence/SnapshotCache.cs index 07afdccfab..3a83ad0171 100644 --- a/src/Neo/Persistence/SnapshotCache.cs +++ b/src/Neo/Persistence/SnapshotCache.cs @@ -61,6 +61,7 @@ public void Dispose() snapshot?.Dispose(); } + /// protected override StorageItem GetInternal(StorageKey key) { byte[] value = store.TryGet(key.ToArray());