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

Remove net6.0 build, replace by 8.0 #1211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
37 changes: 11 additions & 26 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,47 @@ env:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
net60:
name: '6.0'
name: '8.0'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- run: ./Build/CI/tests.sh
env:
BUILD_ARGS: /p:AdditionalDefineConstants=SECP256K1_VERIFY
Framework: net6.0
dotnetcore31:
name: '3.1'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- run: ./Build/CI/tests.sh
env:
BUILD_ARGS: /p:AdditionalDefineConstants=SECP256K1_VERIFY
Framework: netcoreapp3.1
Framework: net8.0
dotnetcore60standard20:
name: '6.0 with netstandard2.0'
name: '8.0 with netstandard2.0'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- run: ./Build/CI/tests.sh
env:
BUILD_ARGS: /p:TargetFrameworkOverride=netstandard2.0
Framework: net6.0
Framework: net8.0
dotnetcore60macos:
name: '6.0 on Mac-OS'
name: '8.0 on Mac-OS'
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- run: ./Build/CI/tests.sh
env:
Framework: net6.0
Framework: net8.0
dotnetcore60winfx:
name: '6.0 on Windows NetFramework472'
name: '8.0 on Windows NetFramework472'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- run: dotnet clean -c Release ./NBitcoin.Tests/NBitcoin.Tests.csproj && dotnet nuget locals all --clear
- run: dotnet test -c Release -v n ./NBitcoin.Tests/NBitcoin.Tests.csproj --filter "RestClient=RestClient|RPCClient=RPCClient|Protocol=Protocol|Core=Core|UnitTest=UnitTest|Altcoins=Altcoins|PropertyTest=PropertyTest" -p:ParallelizeTestCollections=false -f net472
4 changes: 2 additions & 2 deletions NBitcoin.Altcoins/NBitcoin.Altcoins.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net6.0;net472;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net472;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(BuildingInsideVisualStudio)' == 'true'">netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetFrameworkOverride)' != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<NoWarn>1591;1573;1572;1584;1570;3021</NoWarn>
Expand All @@ -22,7 +22,7 @@
<ItemGroup>
<ProjectReference Include="..\NBitcoin\NBitcoin.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'net6.0'">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'net8.0'">
<DefineConstants>$(DefineConstants);HAS_SPAN</DefineConstants>
<RemoveBC>true</RemoveBC>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion NBitcoin.Bench/NBitcoin.Bench.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion NBitcoin.Secp256k1/NBitcoin.Secp256k1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;netstandard2.1</TargetFrameworks>
<Version Condition=" '$(Version)' == '' ">3.1.4</Version>
</PropertyGroup>
<PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions NBitcoin.Tests/NBitcoin.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="'$(BuildingInsideVisualStudio)' == 'true'">net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="'$(BuildingInsideVisualStudio)' == 'true'">net8.0</TargetFrameworks>
<!--<StartupObject>NBitcoin.Tests.Program</StartupObject>-->
<!--<TargetFrameworks Condition="'$(BuildingInsideVisualStudio)' == 'true' And '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.1</TargetFrameworks>-->
<!--<NoWarn>CS0618</NoWarn>-->
Expand All @@ -25,7 +25,7 @@
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);NETCORE;NOTRACESOURCE;NOCUSTOMSSLVALIDATION;NOHTTPSERVER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" ('$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'netcoreapp3.1') And ( '$(TargetFrameworkOverride)' != 'netstandard2.0' ) ">
<PropertyGroup Condition=" ('$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'netcoreapp3.1') And ( '$(TargetFrameworkOverride)' != 'netstandard2.0' ) ">
<DefineConstants>$(DefineConstants);NETCORE;HAS_SPAN;NO_BC</DefineConstants>
<RemoveBC>true</RemoveBC>
</PropertyGroup>
Expand Down
31 changes: 26 additions & 5 deletions NBitcoin.Tests/OutputDescriptorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,18 @@ private void CheckDescriptorCore(
Assert.Equal(spksInferred[0], spks[n]);
Assert.Equal(((flags & UNSOLVABLE) == 0), OutputDescriptor.InferFromScript(spksInferred[0], providerInferred, Network.RegTest).IsSolvable());

var originalKeyOrigins = scriptProvider.KeyOrigins;
var inferredKeyOrigins =
providerInferred.KeyOrigins;
Assert.Equal(originalKeyOrigins, inferredKeyOrigins);
AssertSameKeyOrigins(scriptProvider, providerInferred);
}

// Test whether the observed key path is present in the 'paths' variable (which contains expected,
// unobserved paths), and then removed it from the set.
if (pathIndex != null)
{
var rootedKPs = scriptProvider.KeyOrigins;
#if HAS_SPAN
var rootedKPs = scriptProvider.TaprootKeyOrigins.Values.Concat(scriptProvider.KeyIdToKeyOrigins.Values);
#else
var rootedKPs = scriptProvider.KeyIdToKeyOrigins.Values;
#endif
foreach (var rootedKP in rootedKPs)
{
Assert.Contains(pathIndex, p => p.SequenceEqual(rootedKP.KeyPath.Indexes));
Expand All @@ -443,6 +444,26 @@ private void CheckDescriptorCore(
}
}

private void AssertSameKeyOrigins(FlatSigningRepository expected, FlatSigningRepository actual)
{
#if HAS_SPAN
Assert.Equal(expected.TaprootKeyOrigins.Count, actual.TaprootKeyOrigins.Count);
foreach (var k in expected.TaprootKeyOrigins)
{
Assert.True(actual.TaprootKeyOrigins.TryGetValue(k.Key, out var v));
Assert.Equal(k.Value.KeyPath, v.KeyPath);
Assert.Equal(k.Value.MasterFingerprint, v.MasterFingerprint);
}
#endif
Assert.Equal(expected.KeyIdToKeyOrigins.Count, actual.KeyIdToKeyOrigins.Count);
foreach (var k in expected.KeyIdToKeyOrigins)
{
Assert.True(actual.KeyIdToKeyOrigins.TryGetValue(k.Key, out var v));
Assert.Equal(k.Value.KeyPath, v.KeyPath);
Assert.Equal(k.Value.MasterFingerprint, v.MasterFingerprint);
}
}

private void CheckUnparsable(Network network, string prv, string pub, string maybeErrorMsg = null)
{
var keysPrv = new FlatSigningRepository();
Expand Down
8 changes: 4 additions & 4 deletions NBitcoin/NBitcoin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net472;netstandard1.3;netstandard1.1;netstandard2.1;netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>net472;netstandard1.3;netstandard1.1;netstandard2.1;netstandard2.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetFrameworkOverride)' != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<NoWarn>1591;1573;1572;1584;1570;3021</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -33,10 +33,10 @@
<PropertyGroup Condition=" '$(TargetFramework)' == 'net472' ">
<DefineConstants>$(DefineConstants);CLASSICDOTNET;NO_ARRAY_FILL;NULLABLE_SHIMS;NO_SOCKETASYNC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net6.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net8.0'">
<DefineConstants>$(DefineConstants);NOCUSTOMSSLVALIDATION;NO_NATIVERIPEMD160</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'net6.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'net8.0'">
<DefineConstants>$(DefineConstants);NETCORE;HAS_SPAN;NO_BC</DefineConstants>
<RemoveBC>true</RemoveBC>
</PropertyGroup>
Expand All @@ -57,7 +57,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Buffers" Version="4.5.0" Condition="'$(TargetFramework)' != 'netstandard2.1' And '$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Buffers" Version="4.5.0" Condition="'$(TargetFramework)' != 'netstandard2.1' And '$(TargetFramework)' != 'net8.0'" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
Expand Down
3 changes: 2 additions & 1 deletion NBitcoin/Scripting/OutputDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ private bool ExpandPkHelper(
return false;
if (keyOrigin1 != null)
{
repo.SetKeyOrigin(pubkey1.Hash, keyOrigin1);
if (!isTaproot)
repo.SetKeyOrigin(pubkey1.Hash, keyOrigin1);
#if HAS_SPAN
repo.SetKeyOrigin(pubkey1.TaprootPubKey, keyOrigin1);
#endif
Expand Down
7 changes: 0 additions & 7 deletions NBitcoin/SigningRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ public class FlatSigningRepository : ISigningRepository
public ConcurrentDictionary<TaprootPubKey, ISecret> TaprootKeysToSecret { get; }
#endif

public RootedKeyPath [] KeyOrigins =>
KeyIdToKeyOrigins.Values.ToArray()
#if HAS_SPAN
.Concat(this.TaprootKeyOrigins.Values.ToArray()).ToArray()
#endif
;

public FlatSigningRepository()
{
Secrets = new ConcurrentDictionary<KeyId, ISecret>();
Expand Down
5 changes: 5 additions & 0 deletions NBitcoin/TaprootPubKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public bool CheckTapTweak(TaprootInternalPubKey internalPubKey, uint256? merkleR
TaprootFullPubKey.ComputeTapTweak(internalPubKey, merkleRoot, tweak32);
return this.pubkey.CheckIsTweakedWith(internalPubKey.pubkey, tweak32, parity);
}

public string ToHex()
{
return ToString();
}
#endif
}
}
Loading