Skip to content

Commit

Permalink
Merge pull request #66 from Etherna/improve/BNET-131-dotnet-9
Browse files Browse the repository at this point in the history
update to dotnet 9
  • Loading branch information
tmm360 authored Nov 20, 2024
2 parents 0fc878b + 3486ae7 commit 263e310
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 42 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/myget-unstable-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
- name: Build with dotnet
run: dotnet build --configuration Release
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/nuget-stable-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
- name: Build with dotnet
run: dotnet build --configuration Release
Expand Down
4 changes: 0 additions & 4 deletions src/BeeNet.Client/BeeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,6 @@ public async Task<FileResponse> GetFileAsync(
string? swarmActHistoryAddress = null,
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(address, nameof(address));

if (!address.HasPath)
{
var response = await generatedClient.BzzGetAsync(
Expand Down Expand Up @@ -1246,8 +1244,6 @@ public async Task<string> TryConnectToPeerAsync(
string? swarmActHistoryAddress = null,
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(address, nameof(address));

return address.HasPath ?
await generatedClient.BzzHeadAsync(
address.Hash.ToString(),
Expand Down
3 changes: 1 addition & 2 deletions src/BeeNet.Client/BeeNet.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.BeeNet</RootNamespace>

<Authors>Etherna SA</Authors>
<Description>A .Net client to connect with Ethereum Swarm Bee</Description>

<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
Expand Down
3 changes: 1 addition & 2 deletions src/BeeNet.Core/BeeNet.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.BeeNet</RootNamespace>

<Authors>Etherna SA</Authors>
<Description>Core models to work with Ethereum Swarm in .Net</Description>

<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
Expand Down
29 changes: 9 additions & 20 deletions src/BeeNet.Core/Models/PostageStamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,30 @@

namespace Etherna.BeeNet.Models
{
public class PostageStamp
public class PostageStamp(
PostageBatchId batchId,
StampBucketIndex stampBucketIndex,
DateTimeOffset timeStamp,
byte[] signature)
{
// Constructor.
public PostageStamp(
PostageBatchId batchId,
StampBucketIndex stampBucketIndex,
DateTimeOffset timeStamp,
byte[] signature)
{
ArgumentNullException.ThrowIfNull(batchId, nameof(batchId));

BatchId = batchId;
StampBucketIndex = stampBucketIndex;
TimeStamp = timeStamp;
Signature = signature;
}

/// <summary>
/// Postage batch ID
/// </summary>
public PostageBatchId BatchId { get; }
public PostageBatchId BatchId { get; } = batchId;

/// <summary>
/// Index of the batch
/// </summary>
public StampBucketIndex StampBucketIndex { get; }
public StampBucketIndex StampBucketIndex { get; } = stampBucketIndex;

/// <summary>
/// To signal order when assigning the indexes to multiple chunks
/// </summary>
public DateTimeOffset TimeStamp { get; }
public DateTimeOffset TimeStamp { get; } = timeStamp;

/// <summary>
/// common r[32]s[32]v[1]-style 65 byte ECDSA signature of batchID|index|address by owner or grantee
/// </summary>
public ReadOnlyMemory<byte> Signature { get; }
public ReadOnlyMemory<byte> Signature { get; } = signature;
}
}
2 changes: 0 additions & 2 deletions src/BeeNet.Core/Models/SwarmChunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class SwarmChunk
// Constructors.
public SwarmChunk(SwarmHash hash, byte[] data)
{
ArgumentNullException.ThrowIfNull(hash, nameof(hash));
ArgumentNullException.ThrowIfNull(data, nameof(data));
if (data.Length > DataSize)
throw new ArgumentOutOfRangeException(nameof(data), $"Data can't be longer than {DataSize} bytes");
Expand All @@ -45,7 +44,6 @@ public SwarmChunk(SwarmHash hash, byte[] data)

public SwarmChunk(SwarmHash hash, byte[] span, byte[] data)
{
ArgumentNullException.ThrowIfNull(hash, nameof(hash));
ArgumentNullException.ThrowIfNull(span, nameof(span));
ArgumentNullException.ThrowIfNull(data, nameof(data));

Expand Down
3 changes: 1 addition & 2 deletions src/BeeNet.Util/BeeNet.Util.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.BeeNet</RootNamespace>

<Authors>Etherna SA</Authors>
<Description>Utility services to work with Ethereum Swarm in .Net</Description>

<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions test/BeeNet.Core.UnitTest/BeeNet.Core.UnitTest.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.BeeNet</RootNamespace>
<IsPackable>false</IsPackable>
Expand All @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down
4 changes: 2 additions & 2 deletions test/BeeNet.Util.UnitTest/BeeNet.Util.UnitTest.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.BeeNet</RootNamespace>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 263e310

Please sign in to comment.