diff --git a/src/Neo/SmartContract/Manifest/ContractManifest.cs b/src/Neo/SmartContract/Manifest/ContractManifest.cs index e68c764800..341b369ab4 100644 --- a/src/Neo/SmartContract/Manifest/ContractManifest.cs +++ b/src/Neo/SmartContract/Manifest/ContractManifest.cs @@ -81,7 +81,7 @@ void IInteroperable.FromStackItem(StackItem stackItem) { Null _ => WildcardContainer.CreateWildcard(), // Array array when array.Any(p => ((ByteString)p).Size == 0) => WildcardContainer.CreateWildcard(), - Array array => WildcardContainer.Create(array.Select(p => new ContractPermissionDescriptor(p.GetSpan())).ToArray()), + Array array => WildcardContainer.Create(array.Select(ContractPermissionDescriptor.Create).ToArray()), _ => throw new ArgumentException(null, nameof(stackItem)) }; Extra = (JObject)JToken.Parse(@struct[7].GetSpan()); diff --git a/src/Neo/SmartContract/Manifest/ContractPermissionDescriptor.cs b/src/Neo/SmartContract/Manifest/ContractPermissionDescriptor.cs index 133c338c6c..41dc7ca816 100644 --- a/src/Neo/SmartContract/Manifest/ContractPermissionDescriptor.cs +++ b/src/Neo/SmartContract/Manifest/ContractPermissionDescriptor.cs @@ -11,6 +11,7 @@ using Neo.Cryptography.ECC; using Neo.IO; using Neo.Json; +using Neo.VM.Types; using System; namespace Neo.SmartContract.Manifest @@ -66,6 +67,11 @@ internal ContractPermissionDescriptor(ReadOnlySpan span) } } + public static ContractPermissionDescriptor Create(StackItem item) + { + return item.Equals(StackItem.Null) ? CreateWildcard() : new ContractPermissionDescriptor(item.GetSpan()); + } + /// /// Creates a new instance of the class with the specified contract hash. ///