From 274f21f2d31fcadf2c344e8e05d60ed2b1c03bf2 Mon Sep 17 00:00:00 2001 From: Shargon Date: Sun, 14 Nov 2021 09:09:37 +0100 Subject: [PATCH] Update NET 6.0 (#695) * Update * Fix version * Fix template * Update CompilationContext.cs * Downgrade Microsoft.CodeAnalysis.CSharp to 3.9.0 Co-authored-by: Erik Zhang --- .github/workflows/main.yml | 5 ++--- src/Directory.Build.props | 4 ++-- src/Neo.Compiler.CSharp/CompilationContext.cs | 1 + src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj | 2 +- src/Neo.SmartContract.Framework/OpCode.cs | 8 ++++++++ .../templates/neocontract/ProjectName.csproj | 4 ++-- .../Neo.Compiler.CSharp.UnitTests.csproj | 4 ++-- tests/Neo.Compiler.CSharp.UnitTests/Utils/TestEngine.cs | 4 ++-- .../Neo.SmartContract.Framework.UnitTests.csproj | 4 ++-- 9 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 57490a0e5..0cfcc2ef2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: pull_request: env: - DOTNET_VERSION: 5.0.100 + DOTNET_VERSION: 6.0.x jobs: @@ -21,8 +21,7 @@ jobs: dotnet-version: ${{ env.DOTNET_VERSION }} - name: Check format run: | - dotnet tool install --version 5.0.142902 --tool-path ./ dotnet-format --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json - ./dotnet-format . --check -v diagnostic + dotnet format --verify-no-changes --verbosity diagnostic - name: Add package coverlet.msbuild run: find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - name: Test Neo.Compiler.CSharp.UnitTests diff --git a/src/Directory.Build.props b/src/Directory.Build.props index cdb3c9fdf..4d411ecd3 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,8 +3,8 @@ 2015-2021 The Neo Project - 3.0.3 - net5.0 + 3.1.0 + net6.0 The Neo Project diff --git a/src/Neo.Compiler.CSharp/CompilationContext.cs b/src/Neo.Compiler.CSharp/CompilationContext.cs index 44b538ba9..4ad5d2909 100644 --- a/src/Neo.Compiler.CSharp/CompilationContext.cs +++ b/src/Neo.Compiler.CSharp/CompilationContext.cs @@ -26,6 +26,7 @@ using System.Reflection; using System.Text; using System.Xml.Linq; +using Diagnostic = Microsoft.CodeAnalysis.Diagnostic; namespace Neo.Compiler { diff --git a/src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj b/src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj index eed891ac9..9e5b23743 100644 --- a/src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj +++ b/src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Neo.SmartContract.Framework/OpCode.cs b/src/Neo.SmartContract.Framework/OpCode.cs index 18521f142..a9c7f5022 100644 --- a/src/Neo.SmartContract.Framework/OpCode.cs +++ b/src/Neo.SmartContract.Framework/OpCode.cs @@ -689,6 +689,14 @@ public enum OpCode : byte #region Compound-type + /// + /// A value n is taken from top of main stack. The next n*2 items on main stack are removed, put inside n-sized map and this map is put on top of the main stack. + /// + PACKMAP = 0xBE, + /// + /// A value n is taken from top of main stack. The next n items on main stack are removed, put inside n-sized struct and this struct is put on top of the main stack. + /// + PACKSTRUCT = 0xBF, /// /// A value n is taken from top of main stack. The next n items on main stack are removed, put inside n-sized array and this array is put on top of the main stack. /// diff --git a/src/Neo.SmartContract.Template/templates/neocontract/ProjectName.csproj b/src/Neo.SmartContract.Template/templates/neocontract/ProjectName.csproj index fbb175a25..72925033c 100644 --- a/src/Neo.SmartContract.Template/templates/neocontract/ProjectName.csproj +++ b/src/Neo.SmartContract.Template/templates/neocontract/ProjectName.csproj @@ -1,11 +1,11 @@ - net5.0 + net6.0 - + diff --git a/tests/Neo.Compiler.CSharp.UnitTests/Neo.Compiler.CSharp.UnitTests.csproj b/tests/Neo.Compiler.CSharp.UnitTests/Neo.Compiler.CSharp.UnitTests.csproj index 456126ffa..2602ee695 100644 --- a/tests/Neo.Compiler.CSharp.UnitTests/Neo.Compiler.CSharp.UnitTests.csproj +++ b/tests/Neo.Compiler.CSharp.UnitTests/Neo.Compiler.CSharp.UnitTests.csproj @@ -1,13 +1,13 @@ - net5.0 + net6.0 false Neo.Compiler.CSharp.UnitTests - + diff --git a/tests/Neo.Compiler.CSharp.UnitTests/Utils/TestEngine.cs b/tests/Neo.Compiler.CSharp.UnitTests/Utils/TestEngine.cs index 465010944..65f72c9ad 100644 --- a/tests/Neo.Compiler.CSharp.UnitTests/Utils/TestEngine.cs +++ b/tests/Neo.Compiler.CSharp.UnitTests/Utils/TestEngine.cs @@ -44,8 +44,8 @@ static TestEngine() references.Add(cr.ToMetadataReference()); } - public TestEngine(TriggerType trigger = TriggerType.Application, IVerifiable verificable = null, DataCache snapshot = null, Block persistingBlock = null) - : base(trigger, verificable, snapshot, persistingBlock, ProtocolSettings.Default, TestGas) + public TestEngine(TriggerType trigger = TriggerType.Application, IVerifiable verificable = null, DataCache snapshot = null, Block persistingBlock = null, SmartContract.Diagnostic diagnostic = null) + : base(trigger, verificable, snapshot, persistingBlock, ProtocolSettings.Default, TestGas, diagnostic) { } diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Neo.SmartContract.Framework.UnitTests.csproj b/tests/Neo.SmartContract.Framework.UnitTests/Neo.SmartContract.Framework.UnitTests.csproj index 5e8ec1e3d..d9a78ca76 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Neo.SmartContract.Framework.UnitTests.csproj +++ b/tests/Neo.SmartContract.Framework.UnitTests/Neo.SmartContract.Framework.UnitTests.csproj @@ -1,13 +1,13 @@ - net5.0 + net6.0 false Neo.SmartContract.Framework.UnitTests - +