Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions All.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
<Project Path="src/Neo.Localization/Neo.Localization.csproj" Id="cf344ed8-cbf9-4f00-a5d4-d0c7bac43145" />
<Project Path="src/Neo.Platform.CLI/Neo.Platform.CLI.csproj" Id="febe8581-30b0-4de6-8a3e-92dbad252849" />
<Project Path="src/Neo.Platform.Hosting/Neo.Platform.Hosting.csproj" Id="de3bb911-e4a4-40e5-ab44-667ac6f8fe5e" />
<Project Path="src/Neo.Platform.Storage/Neo.Platform.Storage.csproj" Id="3966bf95-57d3-428b-9a68-e06a09516578" />
<Project Path="src/Neo.VM/Neo.VM.csproj" Id="e38e01be-d9e4-4c1d-a0bc-b9a37250d446" />
<Project Path="src/Neo.Wallet/Neo.Wallet.csproj" Id="49b273b6-b9a6-402e-8ea6-db4e23a3fe40" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/Neo.Configuration.Tests/Neo.Configuration.Tests.csproj" Id="7217a313-c582-473a-9630-eb961137e665" />
<Project Path="tests/Neo.Core.Tests/Neo.Core.Tests.csproj" />
<Project Path="tests/Neo.IO.Tests/Neo.IO.Tests.csproj" Id="1941ba4a-93ce-432f-a9a7-e285846ebab7" />
<Project Path="tests/Neo.Platform.Storage.Tests/Neo.Platform.Storage.Tests.csproj" Id="2f88a159-541f-4c67-b9ac-fd3e62c20ae1" />
<Project Path="tests/Neo.VM.Tests/Neo.VM.Tests.csproj" Id="47c53794-838b-4c3c-bc6c-e216708dd709" />
<Project Path="tests/Neo.Wallet.Tests/Neo.Wallet.Tests.csproj" Id="86f0d22b-f832-4cc5-844f-eb7aeb8b7dfb" />
</Folder>
Expand Down
35 changes: 35 additions & 0 deletions src/Neo.Configuration/BlockchainStoreOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// BSD 2-Clause License
//
// Copyright (c) 2026, Rapid Loop
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES

using Neo.Configuration.Json;
using System;
using System.IO;

namespace Neo.Configuration
{
public class BlockchainStoreOptions : JsonModel
{
public string DatabasePath { get; init; } = Path.Combine(AppContext.BaseDirectory, "data", "chain");

public bool CreateIfMissing { get; init; } = true;
}
}
2 changes: 1 addition & 1 deletion src/Neo.Core/Extensions/ByteExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static byte[] Xor(this byte[] x, byte[] y)
/// <param name="data">The byte array to be converted.</param>
/// <param name="startIndex">The offset into the byte array from which to begin using data.</param>
/// <returns>The converted <see cref="INeoSerializable"/> object.</returns>
public static T? AsSerializable<T>(this byte[] data, int startIndex = 0)
public static T AsSerializable<T>(this byte[] data, int startIndex = 0)
where T : class?, INeoSerializable?
{
using var ms = new MemoryStream(data, false);
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.Core/Neo.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.10" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.10" />
</ItemGroup>

</Project>
75 changes: 19 additions & 56 deletions src/Neo.IO/Hashing/Murmur128.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public class Murmur128 : NonCryptographicHashAlgorithm

private Murmur128(uint seed = DefaultSeed) : base(16)
{
Reset();

_seed = seed;
_h1 = _h2 = _seed;
Reset();
}

public static byte[] Hash(byte[] data, uint seed = DefaultSeed) =>
Expand All @@ -65,22 +63,22 @@ public static byte[] Hash(string text, uint seed = DefaultSeed)
return Hash(bytes, seed);
}

public static ulong HashToUInt64(byte[] data, uint seed = DefaultSeed) =>
HashToUInt64(data.AsSpan(), seed);
public static UInt128 HashToUInt128(byte[] data, uint seed = DefaultSeed) =>
HashToUInt128(data.AsSpan(), seed);

public static ulong HashToUInt64(ReadOnlySpan<byte> data, uint seed = DefaultSeed) =>
BitConverter.ToUInt64(Hash(data, seed), 0);
public static UInt128 HashToUInt128(ReadOnlySpan<byte> data, uint seed = DefaultSeed) =>
BitConverter.ToUInt128(Hash(data, seed), 0);

public static ulong HashToUInt64(string text, uint seed = DefaultSeed)
public static UInt128 HashToUInt128(string text, uint seed = DefaultSeed)
{
var bytes = Encoding.UTF8.GetBytes(text);
return HashToUInt64(bytes, seed);
return HashToUInt128(bytes, seed);
}

public override void Reset()
{
_h1 = 0;
_h2 = 0;
_h1 = _seed;
_h2 = _seed;
_length = 0;
}

Expand All @@ -91,20 +89,12 @@ public override void Append(ReadOnlySpan<byte> source)
var index = 0;
var bytesRemaining = source.Length;

while (bytesRemaining >= 16)
for (; bytesRemaining >= 16; index += 16, bytesRemaining -= 16)
{
unsafe
{
fixed (byte* ptr = &source[index])
{
var k1 = Unsafe.ReadUnaligned<ulong>(ptr);
var k2 = Unsafe.ReadUnaligned<ulong>(ptr + 8);

ProcessBlock(k1, k2);
}
}
index += 16;
bytesRemaining -= 16;
var k1 = Unsafe.ReadUnaligned<ulong>(in source[index]);
var k2 = Unsafe.ReadUnaligned<ulong>(in source[index + 8]);

ProcessBlock(k1, k2);
}

// Process leftover bytes if the source isn't an exact multiple of 16 bytes
Expand Down Expand Up @@ -150,40 +140,13 @@ protected override void GetCurrentHashCore(Span<byte> destination)
_h1 += _h2;
_h2 += _h1;

unsafe
{
fixed (byte* destPtr = destination)
{
Unsafe.WriteUnaligned(destPtr, _h1);
Unsafe.WriteUnaligned(destPtr + 8, _h2);
}
}
Unsafe.WriteUnaligned(ref destination[0], _h1);
Unsafe.WriteUnaligned(ref destination[8], _h2);
}

protected override void GetHashAndResetCore(Span<byte> destination)
{
// Finalization
_h1 ^= _length;
_h2 ^= _length;

_h1 += _h2;
_h2 += _h1;

_h1 = MixFinal(_h1);
_h2 = MixFinal(_h2);

_h1 += _h2;
_h2 += _h1;

unsafe
{
fixed (byte* destPtr = destination)
{
Unsafe.WriteUnaligned(destPtr, _h1);
Unsafe.WriteUnaligned(destPtr + 8, _h2);
}
}

GetCurrentHashCore(destination);
Reset(); // Reset after reading
}

Expand Down Expand Up @@ -227,9 +190,9 @@ private static ulong MixK2(ulong k2)
private static ulong MixFinal(ulong k)
{
k ^= k >> 33;
k *= 0xff51afd7ed558ccdUL;
k *= 0xff51afd7ed558ccdul;
k ^= k >> 33;
k *= 0xc4ceb9fe1a85ec53UL;
k *= 0xc4ceb9fe1a85ec53ul;
k ^= k >> 33;
return k;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.IO/Neo.IO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.IO.Hashing" Version="10.0.8" />
<PackageReference Include="System.IO.Hashing" Version="10.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.Localization/Neo.Localization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
<value>L{0:D4} {1,-11:G}{2}</value>
</data>
<data name="ExecuteStartupMessage" xml:space="preserve">
<value>Starting execution | HardFork: {0:G} | GasLimit: {1:N0}</value>
<value>Starting execution | HardFork: {0:G} | GasLimit: {1:N8}</value>
</data>
<data name="ExecuteSuccessfullyMessage" xml:space="preserve">
<value>Execution completed successfully | GasConsumed: {0:N0} | GasLeft: {1:N0} | State: {2:G}</value>
<value>Execution completed successfully | GasConsumed: {0:N8} | GasLeft: {1:N8} | State: {2:G}</value>
</data>
</root>
6 changes: 3 additions & 3 deletions src/Neo.Platform.CLI/Neo.Platform.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.9" />
<PackageReference Include="System.CommandLine" Version="2.0.9" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="10.0.10" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.10" />
<PackageReference Include="System.CommandLine" Version="2.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.Platform.Hosting/Neo.Platform.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.9" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.9" />
<PackageReference Include="System.CommandLine" Version="2.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.10" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
Loading