From 170140a6e08e61c56849556d92b99898a216c359 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 9 Aug 2023 09:27:28 +0900 Subject: [PATCH 1/2] Revert "fix: revert #952 (#984)" This reverts commit ea50f75849674c137938d5a057480837df1ae267. --- client/grpc/tmservice/service_test.go | 2 +- x/foundation/keeper/internal/treasury.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/grpc/tmservice/service_test.go b/client/grpc/tmservice/service_test.go index 27e386c139..4af768ef83 100644 --- a/client/grpc/tmservice/service_test.go +++ b/client/grpc/tmservice/service_test.go @@ -152,7 +152,7 @@ func (s IntegrationTestSuite) TestQueryBlockResultsByHeight() { s.Require().Equal(0, len(txResult)) beginBlock := blockResultsRes.GetResBeginBlock() - s.Require().Equal(11, len(beginBlock.Events)) // coinbase event (6) + transfer mintModule to feeCollectorName(5) + s.Require().Equal(7, len(beginBlock.Events)) // coinbase event (6) + transfer mintModule to feeCollectorName(5) - foundation abci (4) endBlock := blockResultsRes.GetResEndBlock() s.Require().Equal(0, len(endBlock.Events)) diff --git a/x/foundation/keeper/internal/treasury.go b/x/foundation/keeper/internal/treasury.go index 95a26828fb..43f8c20cff 100644 --- a/x/foundation/keeper/internal/treasury.go +++ b/x/foundation/keeper/internal/treasury.go @@ -9,11 +9,17 @@ import ( func (k Keeper) CollectFoundationTax(ctx sdk.Context) error { feeCollector := k.authKeeper.GetModuleAccount(ctx, k.feeCollectorName).GetAddress() feesCollectedInt := k.bankKeeper.GetAllBalances(ctx, feeCollector) + if feesCollectedInt.Empty() { + return nil + } feesCollected := sdk.NewDecCoinsFromCoins(feesCollectedInt...) // calculate the tax taxRatio := k.GetFoundationTax(ctx) tax, _ := feesCollected.MulDecTruncate(taxRatio).TruncateDecimal() + if tax.Empty() { + return nil + } // collect the tax if err := k.FundTreasury(ctx, feeCollector, tax); err != nil { From 5021ce870e7dec61469eafb406e7359d300d1507 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Fri, 11 Aug 2023 12:13:07 +0900 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8623f045d4..764a98e4dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements * (third_party/proto) [\#1037](https://github.com/Finschia/finschia-sdk/pull/1037) change the proof.proto path to third_party/proto/confio * (ostracon) [\#1057](https://github.com/Finschia/finschia-sdk/pull/1057) Bump up Ostracon from to v1.1.1 +* (x/foundation) [\#1072](https://github.com/Finschia/finschia-sdk/pull/1072) Address generation of the empty coins in x/foundation (backport #952) ### Bug Fixes * (ledger) [\#1040](https://github.com/Finschia/finschia-sdk/pull/1040) fix a bug(unable to connect nano S plus ledger on ubuntu)