Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master to neo-build branch #3747

Merged
merged 16 commits into from
Feb 13, 2025
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
15 changes: 8 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Set default behavior to automatically normalize line endings.
###############################################################################
* text eol=lf
*.cs eol=lf
*.csproj eol=lf
*.props eol=lf
*.json eol=lf
*.cs text eol=lf
*.csproj text eol=lf
*.props text eol=lf
*.json text eol=lf
*.targets text eol=lf

###############################################################################
# Set default behavior for command prompt diff.
Expand All @@ -21,7 +22,7 @@
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
Expand Down Expand Up @@ -52,9 +53,9 @@

###############################################################################
# diff behavior for common document formats
#
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ jobs:
docker build . \
--file ./.neo/docker/neo-cli/Dockerfile \
--tag ghcr.io/${{ github.repository_owner }}/neo-cli:latest \
--tag ghcr.io/${{ github.repository_owner }}/neo-cli:mainnet \
--tag ghcr.io/${{ github.repository_owner }}/neo-cli:${{ env.APP_VERSION }} \
--push
6 changes: 5 additions & 1 deletion .neo/docker/neo-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM debian:stable-slim

LABEL org.opencontainers.image.description "neo-cli -- full node, no plugins"

# Install the apt-get packages
RUN apt-get update
RUN apt-get install -y libicu-dev libleveldb-dev screen
RUN apt-get install -y libicu-dev libleveldb-dev screen sqlite3

COPY ./dist /opt/neo-cli
RUN ln -s /opt/neo-cli/neo-cli /usr/bin

CMD ["neo-cli"]
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</a>
</p>

<h3 align="center">Neo Blockchain</h3>
<h3 align="center">CSharp implementation of the neo blockchain protocol.</h3>

<p align="center">
A modern distributed network for the Smart Economy.
Expand Down Expand Up @@ -38,7 +38,7 @@
src=".github/images/nnt-logo.jpg"
width="23px">
</a>
&nbsp;
&nbsp;
<a href="https://t.me/NEO_EN">
<img
src=".github/images/telegram-logo.png"
Expand Down Expand Up @@ -99,13 +99,12 @@
1. [Overview](#overview)
2. [Project structure](#project-structure)
3. [Related projects](#related-projects)
4. [Opening a new issue](#opening-a-new-issue)
4. [Opening a new issue](#opening-a-new-issue)
5. [Bounty program](#bounty-program)
6. [License](#license)

## Overview
This repository contain main classes of the
[Neo](https://neo.org) blockchain.
This repository is a csharp implementation of the [neo](https://neo.org) blockchain. It is jointly maintained by the neo core developers and neo global development community.
Visit the [tutorials](https://docs.neo.org) to get started.


Expand All @@ -131,7 +130,7 @@ An overview of the project folders can be seen below.
|[/tests/](https://github.com/neo-project/neo/tree/master/tests)|All unit tests.|

## Related projects
Code references are provided for all platform building blocks. That includes the base library, the VM, a command line application and the compiler.
Code references are provided for all platform building blocks. That includes the base library, the VM, a command line application and the compiler.

* [neo:](https://github.com/neo-project/neo/) Included libraries are Neo, Neo-CLI, Neo-GUI, Neo-VM, test and plugin modules.
* [neo-express:](https://github.com/neo-project/neo-express/) A private net optimized for development scenarios.
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/Neo.Benchmarks/Persistence/Bechmarks_LevelDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Neo.Persistence;
using Neo.Plugins.Storage;
using Neo.SmartContract;
using System.Diagnostics;

namespace Neo.Benchmarks.Persistence.Benchmarks
{
Expand All @@ -26,7 +25,7 @@ public class Bechmarks_LevelDB
private const string PathLevelDB = "Data_LevelDB_Benchmarks";

private static readonly LevelDBStore levelDb = new();
private static ISnapshot snapshot;
private static IStoreSnapshot snapshot;

[GlobalSetup]
public void Setup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Cleanup()
[Benchmark]
public void ReadOnlyStoreView_LevelDB()
{
var view = new ReadOnlyStoreView(levelDbStore);
var view = (IReadOnlyStore)levelDbStore;
var ok = view.TryGet(key1, out var _);
Debug.Assert(ok);

Expand All @@ -61,7 +61,7 @@ public void ReadOnlyStoreView_LevelDB()
[Benchmark]
public void SnapshotCache_LevelDB()
{
var snapshot = new SnapshotCache(levelDbStore);
var snapshot = new StoreCache(levelDbStore);
var ok = snapshot.TryGet(key1, out var _);
Debug.Assert(ok);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private JToken[] ConvertToJTokenArray(JToken? token)
result.Add(token);
}

return [.. result]; // Converting a List to an Array of JTokens
return [.. result!]; // Converting a List to an Array of JTokens
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<Copyright>2015-2024 The Neo Project</Copyright>
<Copyright>2015-2025 The Neo Project</Copyright>
<LangVersion>latest</LangVersion>
<Authors>The Neo Project</Authors>
<IsPackable>true</IsPackable>
<PackageId>$(MSBuildProjectName)</PackageId>
<PackageIcon>neo.png</PackageIcon>
<PackageProjectUrl>https://github.com/neo-project/neo</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -20,6 +21,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<AnalysisLevel>latest</AnalysisLevel>
<OutputPath>../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.CLI/CLI/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static bool IsYes(this string input)
return input == "yes" || input == "y";
}

public static string ToBase64String(this byte[] input) => System.Convert.ToBase64String(input);
public static string ToBase64String(this byte[] input) => Convert.ToBase64String(input);

public static void IsScriptValid(this ReadOnlyMemory<byte> script, ContractAbi abi)
{
Expand Down
1 change: 0 additions & 1 deletion src/Neo.CLI/CLI/MainService.Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Neo.ConsoleService;
using Neo.Cryptography.ECC;
using Neo.Extensions;
using Neo.IO;
using Neo.SmartContract;
using Neo.VM;
using Neo.Wallets;
Expand Down
11 changes: 6 additions & 5 deletions src/Neo.CLI/CLI/MainService.Vote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Neo.Wallets;
using System;
using System.Numerics;
using Array = Neo.VM.Types.Array;

namespace Neo.CLI
{
Expand Down Expand Up @@ -141,7 +142,7 @@ private void OnGetCandidatesCommand()
{
if (!OnInvokeWithResult(NativeContract.NEO.Hash, "getCandidates", out StackItem result, null, null, false)) return;

var resJArray = (VM.Types.Array)result;
var resJArray = (Array)result;

if (resJArray.Count > 0)
{
Expand All @@ -150,7 +151,7 @@ private void OnGetCandidatesCommand()

foreach (var item in resJArray)
{
var value = (VM.Types.Array)item;
var value = (Array)item;
if (value is null) continue;

Console.Write(((ByteString)value[0])?.GetSpan().ToHexString() + "\t");
Expand All @@ -167,7 +168,7 @@ private void OnGetCommitteeCommand()
{
if (!OnInvokeWithResult(NativeContract.NEO.Hash, "getCommittee", out StackItem result, null, null, false)) return;

var resJArray = (VM.Types.Array)result;
var resJArray = (Array)result;

if (resJArray.Count > 0)
{
Expand All @@ -189,7 +190,7 @@ private void OnGetNextBlockValidatorsCommand()
{
if (!OnInvokeWithResult(NativeContract.NEO.Hash, "getNextBlockValidators", out StackItem result, null, null, false)) return;

var resJArray = (VM.Types.Array)result;
var resJArray = (Array)result;

if (resJArray.Count > 0)
{
Expand Down Expand Up @@ -223,7 +224,7 @@ private void OnGetAccountState(UInt160 address)
ConsoleHelper.Warning(notice);
return;
}
var resJArray = (VM.Types.Array)result;
var resJArray = (Array)result;
if (resJArray is null)
{
ConsoleHelper.Warning(notice);
Expand Down
7 changes: 4 additions & 3 deletions src/Neo.CLI/CLI/MainService.Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

using Akka.Actor;
using Neo.ConsoleService;
using Neo.Cryptography.ECC;
using Neo.Extensions;
using Neo.Json;
using Neo.Network.P2P.Payloads;
Expand All @@ -26,8 +25,10 @@
using System.IO;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Threading.Tasks;
using static Neo.SmartContract.Helper;
using ECPoint = Neo.Cryptography.ECC.ECPoint;

namespace Neo.CLI
{
Expand Down Expand Up @@ -55,7 +56,7 @@ private void OnOpenWallet(string path)
{
OpenWallet(path, password);
}
catch (System.Security.Cryptography.CryptographicException)
catch (CryptographicException)
{
ConsoleHelper.Error($"Failed to open file \"{path}\"");
}
Expand Down Expand Up @@ -634,7 +635,7 @@ private void OnCancelCommand(UInt256 txid, UInt160? sender = null, UInt160[]? si
return;
}
tx.NetworkFee += (long)decimalExtraFee.Value;
};
}

ConsoleHelper.Info("Network fee: ",
$"{new BigDecimal((BigInteger)tx.NetworkFee, NativeContract.GAS.Decimals)} GAS\t",
Expand Down
6 changes: 4 additions & 2 deletions src/Neo.CLI/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

using Akka.Actor;
using Neo.ConsoleService;
using Neo.Cryptography.ECC;
using Neo.Extensions;
using Neo.Json;
using Neo.Ledger;
Expand All @@ -33,10 +32,13 @@
using System.Net;
using System.Numerics;
using System.Reflection;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Array = System.Array;
using ECCurve = Neo.Cryptography.ECC.ECCurve;
using ECPoint = Neo.Cryptography.ECC.ECPoint;

namespace Neo.CLI
{
Expand Down Expand Up @@ -483,7 +485,7 @@ public async void Start(CommandLineOptions options)
{
ConsoleHelper.Warning($"wallet file \"{Settings.Default.UnlockWallet.Path}\" not found.");
}
catch (System.Security.Cryptography.CryptographicException)
catch (CryptographicException)
{
ConsoleHelper.Error($"Failed to open file \"{Settings.Default.UnlockWallet.Path}\"");
}
Expand Down
3 changes: 0 additions & 3 deletions src/Neo.CLI/Neo.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
<AssemblyTitle>Neo.CLI</AssemblyTitle>
<AssemblyName>neo-cli</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Neo.CLI</PackageId>
<RootNamespace>Neo</RootNamespace>
<Product>Neo.CLI</Product>
<ApplicationIcon>neo.ico</ApplicationIcon>
<Nullable>enable</Nullable>
<OutputPath>../../bin/$(AssemblyTitle)</OutputPath>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions src/Neo.CLI/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

using Microsoft.Extensions.Configuration;
using Neo.Network.P2P;
using Neo.Persistence;
using Neo.Persistence.Providers;
using System;
using System.Linq;
using System.Reflection;
using System.Threading;

Expand Down
2 changes: 0 additions & 2 deletions src/Neo.ConsoleService/Neo.ConsoleService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<PackageId>Neo.ConsoleService</PackageId>
<Nullable>enable</Nullable>
<OutputPath>../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.Cryptography.BLS12_381/Bls12.Adder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public static Fp12 One
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Fp12 IMillerLoopDriver<Fp12>.Square(in Fp12 f) => Adder.Square(f);
Fp12 IMillerLoopDriver<Fp12>.Square(in Fp12 f) => Square(f);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Fp12 IMillerLoopDriver<Fp12>.Conjugate(in Fp12 f) => Adder.Conjugate(f);
Fp12 IMillerLoopDriver<Fp12>.Conjugate(in Fp12 f) => Conjugate(f);
Fp12 IMillerLoopDriver<Fp12>.One
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => Adder.One;
get => One;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>Neo.Cryptography.BLS12_381</PackageId>
<OutputPath>../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Neo.Extensions/Collections/CollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System;
using System.Collections.Generic;


namespace Neo.Extensions
{
public static class CollectionExtensions
Expand Down
2 changes: 0 additions & 2 deletions src/Neo.Extensions/Neo.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>Neo.Extensions</PackageId>
<PackageTags>NEO;Blockchain;Extensions</PackageTags>
<OutputPath>../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
// modifications are permitted.

using System;
using System.Runtime.CompilerServices;
#if !NET9_0_OR_GREATER
using System.Globalization;
#endif
using System.Runtime.CompilerServices;

namespace Neo.Extensions
{
Expand Down
Loading
Loading