From dcd2fa0fdee4a2bff04db5d6de958017cf02751e Mon Sep 17 00:00:00 2001 From: schwartz-concordium <132270889+schwartz-concordium@users.noreply.github.com> Date: Thu, 10 Aug 2023 21:54:30 +0200 Subject: [PATCH 1/4] Fix bug with wrong transaction count mapping --- src/Types/BlockInfo.cs | 2 +- tests/IntegrationTests/Client/GetBlockInfo.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Types/BlockInfo.cs b/src/Types/BlockInfo.cs index c0552e39..66dd9585 100644 --- a/src/Types/BlockInfo.cs +++ b/src/Types/BlockInfo.cs @@ -85,7 +85,7 @@ internal static BlockInfo From(Grpc.V2.BlockInfo blockInfo) => BlockSlotTime: blockInfo.SlotTime.ToDateTimeOffset(), BlockBaker: blockInfo.Baker != null ? BakerId.From(blockInfo.Baker) : null, Finalized: blockInfo.Finalized, - TransactionCount: blockInfo.TransactionsSize, + TransactionCount: blockInfo.TransactionCount, TransactionEnergyCost: new EnergyAmount(blockInfo.TransactionsEnergyCost.Value), TransactionSize: blockInfo.TransactionsSize, BlockStateHash: new StateHash(blockInfo.StateHash.Value), diff --git a/tests/IntegrationTests/Client/GetBlockInfo.cs b/tests/IntegrationTests/Client/GetBlockInfo.cs index 18ee01a6..67f7e26b 100644 --- a/tests/IntegrationTests/Client/GetBlockInfo.cs +++ b/tests/IntegrationTests/Client/GetBlockInfo.cs @@ -12,6 +12,20 @@ public GetBlockInfo(ITestOutputHelper output) : base(output) { } + [Fact] + public async Task GivenBlockWithOneTransaction_WhenGetBlockInfo_ThenTransactionCountOne() + { + // Arrange + var blochHashString = this.GetString("blockHashOneTransaction"); + + + // Act + var info = await this.Client.GetBlockInfoAsync(new Given(BlockHash.From(blochHashString))); + + // Assert + info.Response.TransactionCount.Should().Be(1); + } + [Fact] public async Task GivenAbsoluteHeightAboveBlockHeight_WhenCallGetBlockInfo_ThenThrowException() { From 0f9e0699e6b43e29171e7c5ada46ab2d319a081f Mon Sep 17 00:00:00 2001 From: schwartz-concordium <132270889+schwartz-concordium@users.noreply.github.com> Date: Thu, 10 Aug 2023 21:56:48 +0200 Subject: [PATCH 2/4] Prepare release and changelog --- CHANGELOG.md | 6 +++++- src/Concordium.Sdk.csproj | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25bd19e8..3aecc017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased changes +## 4.0.1 +- Bugfix + - `TransactionCount` in `BlockInfo` had wrong mapping and used `TransactionsSize` from node. + ## 4.0.0 - The SDK requires node version 6 or later. - Breaking changes @@ -45,4 +49,4 @@ earlier versions of the SDK. ## 1.0.0 -- Initial release. \ No newline at end of file +- Initial release. diff --git a/src/Concordium.Sdk.csproj b/src/Concordium.Sdk.csproj index d7c0c7e3..a5f4d3f1 100644 --- a/src/Concordium.Sdk.csproj +++ b/src/Concordium.Sdk.csproj @@ -3,7 +3,7 @@ net6.0 enable enable - 4.0.0 + 4.0.1 A .NET integration library written in C# which adds support for constructing and sending various transactions, as well as querying @@ -16,7 +16,7 @@ concordium;concordium-net-sdk;blockchain;sdk; Concordium ConcordiumNetSdk - 4.0.0 + 4.0.1 icon.png README.md MPL-2.0 From b61f58b6dbaeaa49515c5d753894050e2bb96535 Mon Sep 17 00:00:00 2001 From: schwartz-concordium <132270889+schwartz-concordium@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:05:48 +0200 Subject: [PATCH 3/4] Removed integration test --- tests/IntegrationTests/Client/GetBlockInfo.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/IntegrationTests/Client/GetBlockInfo.cs b/tests/IntegrationTests/Client/GetBlockInfo.cs index 67f7e26b..18ee01a6 100644 --- a/tests/IntegrationTests/Client/GetBlockInfo.cs +++ b/tests/IntegrationTests/Client/GetBlockInfo.cs @@ -12,20 +12,6 @@ public GetBlockInfo(ITestOutputHelper output) : base(output) { } - [Fact] - public async Task GivenBlockWithOneTransaction_WhenGetBlockInfo_ThenTransactionCountOne() - { - // Arrange - var blochHashString = this.GetString("blockHashOneTransaction"); - - - // Act - var info = await this.Client.GetBlockInfoAsync(new Given(BlockHash.From(blochHashString))); - - // Assert - info.Response.TransactionCount.Should().Be(1); - } - [Fact] public async Task GivenAbsoluteHeightAboveBlockHeight_WhenCallGetBlockInfo_ThenThrowException() { From 2b3b9475ac716b8ff50e5f7c0971c0b386a28770 Mon Sep 17 00:00:00 2001 From: schwartz-concordium <132270889+schwartz-concordium@users.noreply.github.com> Date: Sat, 12 Aug 2023 10:31:19 +0200 Subject: [PATCH 4/4] Fix BakerPoolInfo hardcoded open status. --- CHANGELOG.md | 1 + src/Types/BakerPoolInfo.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aecc017..92540c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 4.0.1 - Bugfix - `TransactionCount` in `BlockInfo` had wrong mapping and used `TransactionsSize` from node. + - `BakerPoolInfo` had `OpenStatus` hardcoded as `BakerPoolOpenStatus.OpenForAll`. ## 4.0.0 - The SDK requires node version 6 or later. diff --git a/src/Types/BakerPoolInfo.cs b/src/Types/BakerPoolInfo.cs index 7931032b..3f57fe1e 100644 --- a/src/Types/BakerPoolInfo.cs +++ b/src/Types/BakerPoolInfo.cs @@ -22,7 +22,7 @@ public sealed record BakerPoolInfo( return new BakerPoolInfo( CommissionRates: CommissionRates.From(poolInfo.CommissionRates), - OpenStatus: BakerPoolOpenStatus.OpenForAll, + OpenStatus: poolInfo.OpenStatus.Into(), MetadataUrl: poolInfo.Url ); }