Skip to content

Commit

Permalink
Merge branch 'master' into Standalone-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cschuchardt88 committed Apr 22, 2024
2 parents b4b39a9 + 629baf8 commit bac8c5a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/Neo/Cryptography/Helper.cs
Expand Up @@ -160,7 +160,9 @@ public static byte[] AES256Encrypt(this byte[] plainData, byte[] key, byte[] non
var cipherBytes = new byte[plainData.Length];
if (!IsOSX)
{
#pragma warning disable SYSLIB0053 // Type or member is obsolete
using var cipher = new AesGcm(key);
#pragma warning restore SYSLIB0053 // Type or member is obsolete
cipher.Encrypt(nonce, plainData, cipherBytes, tag, associatedData);
}
else
Expand Down Expand Up @@ -188,7 +190,9 @@ public static byte[] AES256Decrypt(this byte[] encryptedData, byte[] key, byte[]
var decryptedData = new byte[cipherBytes.Length];
if (!IsOSX)
{
#pragma warning disable SYSLIB0053 // Type or member is obsolete
using var cipher = new AesGcm(key);
#pragma warning restore SYSLIB0053 // Type or member is obsolete
cipher.Decrypt(nonce, cipherBytes, tag, decryptedData, associatedData);
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/Neo/NeoSystem.cs
Expand Up @@ -116,7 +116,7 @@ static NeoSystem()
/// <param name="settings">The protocol settings of the <see cref="NeoSystem"/>.</param>
/// <param name="storageProvider">The storage engine used to create the <see cref="IStoreProvider"/> objects. If this parameter is <see langword="null"/>, a default in-memory storage engine will be used.</param>
/// <param name="storagePath">The path of the storage. If <paramref name="storageProvider"/> is the default in-memory storage engine, this parameter is ignored.</param>
public NeoSystem(ProtocolSettings settings, string? storageProvider = null, string? storagePath = null) :
public NeoSystem(ProtocolSettings settings, string storageProvider = null, string storagePath = null) :
this(settings, StoreFactory.GetStoreProvider(storageProvider ?? nameof(MemoryStore))
?? throw new ArgumentException($"Can't find the storage provider {storageProvider}", nameof(storageProvider)), storagePath)
{
Expand All @@ -128,7 +128,7 @@ static NeoSystem()
/// <param name="settings">The protocol settings of the <see cref="NeoSystem"/>.</param>
/// <param name="storageProvider">The <see cref="IStoreProvider"/> to use.</param>
/// <param name="storagePath">The path of the storage. If <paramref name="storageProvider"/> is the default in-memory storage engine, this parameter is ignored.</param>
public NeoSystem(ProtocolSettings settings, IStoreProvider storageProvider, string? storagePath = null)
public NeoSystem(ProtocolSettings settings, IStoreProvider storageProvider, string storagePath = null)
{
this.Settings = settings;
this.GenesisBlock = CreateGenesisBlock(settings);
Expand Down
2 changes: 1 addition & 1 deletion src/Neo/Persistence/StoreFactory.cs
Expand Up @@ -36,7 +36,7 @@ public static void RegisterProvider(IStoreProvider provider)
/// </summary>
/// <param name="name">Name</param>
/// <returns>Store provider</returns>
public static IStoreProvider? GetStoreProvider(string name)
public static IStoreProvider GetStoreProvider(string name)
{
if (providers.TryGetValue(name, out var provider))
{
Expand Down
2 changes: 1 addition & 1 deletion src/Neo/ProtocolSettings.cs
Expand Up @@ -120,7 +120,7 @@ public record ProtocolSettings
Hardforks = EnsureOmmitedHardforks(new Dictionary<Hardfork, uint>()).ToImmutableDictionary()
};

public static ProtocolSettings? Custom { get; set; }
public static ProtocolSettings Custom { get; set; }

/// <summary>
/// Loads the <see cref="ProtocolSettings"/> at the specified path.
Expand Down
4 changes: 2 additions & 2 deletions src/Neo/SmartContract/ContractParametersContext.cs
Expand Up @@ -44,7 +44,7 @@ public ContextItem(Contract contract)

public ContextItem(JObject json)
{
this.Script = Convert.FromBase64String(json["script"].AsString());
this.Script = json["script"] is JToken.Null ? null : Convert.FromBase64String(json["script"].AsString());
this.Parameters = ((JArray)json["parameters"]).Select(p => ContractParameter.FromJson((JObject)p)).ToArray();
this.Signatures = ((JObject)json["signatures"]).Properties.Select(p => new
{
Expand All @@ -56,7 +56,7 @@ public ContextItem(JObject json)
public JObject ToJson()
{
JObject json = new();
json["script"] = Convert.ToBase64String(Script);
json["script"] = Script == null ? null : Convert.ToBase64String(Script);
json["parameters"] = new JArray(Parameters.Select(p => p.ToJson()));
json["signatures"] = new JObject();
foreach (var signature in Signatures)
Expand Down

0 comments on commit bac8c5a

Please sign in to comment.