From 9332c2bd2b2af13a68e6856d0bb45fb05f56f8d4 Mon Sep 17 00:00:00 2001 From: s2quake Date: Thu, 5 Dec 2024 10:55:08 +0900 Subject: [PATCH 1/3] fix: Change validatorPower type from BigInt to string --- tools/Libplanet.Explorer/GraphTypes/VoteType.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Libplanet.Explorer/GraphTypes/VoteType.cs b/tools/Libplanet.Explorer/GraphTypes/VoteType.cs index 2171c4717c6..9fc37788b7f 100644 --- a/tools/Libplanet.Explorer/GraphTypes/VoteType.cs +++ b/tools/Libplanet.Explorer/GraphTypes/VoteType.cs @@ -30,10 +30,10 @@ public VoteType() "ValidatorPublicKey", description: "Public key of the validator which is subject of the vote.", resolve: ctx => ctx.Source.ValidatorPublicKey); - Field( + Field( "ValidatorPower", description: "Power of the validator which is subject of the vote.", - resolve: ctx => ctx.Source.ValidatorPower); + resolve: ctx => ctx.Source.ValidatorPower?.ToString("N0")); Field>( "Flag", description: "Flag of the vote", From 2684327e8b4baf14e52dd8977cc66b9a0196a557 Mon Sep 17 00:00:00 2001 From: s2quake Date: Thu, 5 Dec 2024 10:55:14 +0900 Subject: [PATCH 2/3] test: Fix test failures --- test/Libplanet.Explorer.Tests/GraphTypes/BlockTypeTest.cs | 2 +- test/Libplanet.Explorer.Tests/GraphTypes/VoteTypeTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Libplanet.Explorer.Tests/GraphTypes/BlockTypeTest.cs b/test/Libplanet.Explorer.Tests/GraphTypes/BlockTypeTest.cs index 1c47d06289f..a485cfd3e5d 100644 --- a/test/Libplanet.Explorer.Tests/GraphTypes/BlockTypeTest.cs +++ b/test/Libplanet.Explorer.Tests/GraphTypes/BlockTypeTest.cs @@ -122,7 +122,7 @@ public async void Query() { "blockHash", lastVotes[0].BlockHash.ToString() }, { "timestamp", new DateTimeOffsetGraphType().Serialize(lastVotes[0].Timestamp) }, { "validatorPublicKey", lastVotes[0].ValidatorPublicKey.ToString() }, - { "validatorPower", lastVotes[0].ValidatorPower }, + { "validatorPower", lastVotes[0].ValidatorPower?.ToString("N0") }, { "flag", lastVotes[0].Flag.ToString() }, { "signature", ByteUtil.Hex(lastVotes[0].Signature) }, } diff --git a/test/Libplanet.Explorer.Tests/GraphTypes/VoteTypeTest.cs b/test/Libplanet.Explorer.Tests/GraphTypes/VoteTypeTest.cs index 475928c556f..d5c37d254f0 100644 --- a/test/Libplanet.Explorer.Tests/GraphTypes/VoteTypeTest.cs +++ b/test/Libplanet.Explorer.Tests/GraphTypes/VoteTypeTest.cs @@ -57,7 +57,7 @@ public async void Query() Assert.Equal(vote.BlockHash.ToString(), resultData["blockHash"]); Assert.Equal(new DateTimeOffsetGraphType().Serialize(vote.Timestamp), resultData["timestamp"]); Assert.Equal(vote.ValidatorPublicKey.ToString(), resultData["validatorPublicKey"]); - Assert.Equal(vote.ValidatorPower, resultData["validatorPower"]); + Assert.Equal(vote.ValidatorPower?.ToString("N0"), resultData["validatorPower"]); Assert.Equal(vote.Flag.ToString(), resultData["flag"]); Assert.Equal(ByteUtil.Hex(vote.Signature), resultData["signature"]); } From 62e3c800cf2602ad9b50ef88d4d6c70197d2e931 Mon Sep 17 00:00:00 2001 From: s2quake Date: Thu, 5 Dec 2024 11:03:36 +0900 Subject: [PATCH 3/3] chore: Changes --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 2d371370182..9afd4417385 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,11 @@ Version 5.4.2 To be released. + - (Libplanet.Explorer) Changed `ValidatorPower` type of `VoteType` from + `BigIntGraphType` to `StringGraphType`. [[#4005]] + +[#4005]: https://github.com/planetarium/libplanet/pull/4005 + Version 5.4.1 -------------