From 2bb6be9d546298c215c10a601c282de86593d539 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Mon, 18 Sep 2023 14:39:26 -0500 Subject: [PATCH] bug: send non osmo txfees to community pool instead of stakers (#6426) * fix non osmo txfees to community pool instead of stakers * update changelog * update fee decorator test * change version to alpine * add comment * uncomment test * fix script to pull alpine image * update README * Update empty_upgrade_handler_gen.sh --------- Co-authored-by: devbot-wizard <141283918+devbot-wizard@users.noreply.github.com> --- CHANGELOG.md | 1 + scripts/empty_upgrade_handler_gen.sh | 2 +- tests/e2e/README.md | 4 +++- tests/e2e/containers/config.go | 2 +- x/txfees/keeper/feedecorator.go | 4 ++-- x/txfees/keeper/feedecorator_test.go | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5990b89a86b..dfd8272dbdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#6334](https://github.com/osmosis-labs/osmosis/pull/6334) fix: enable taker fee cli * [#6352](https://github.com/osmosis-labs/osmosis/pull/6352) Reduce error blow-up in CalcAmount0Delta by changing the order of math operations. * [#6368](https://github.com/osmosis-labs/osmosis/pull/6368) Stricter rounding behavior in CL math's CalcAmount0Delta and GetNextSqrtPriceFromAmount0InRoundingUp +* [#6426](https://github.com/osmosis-labs/osmosis/pull/6426) bug: send non osmo txfees to community pool instead of stakers ### API Breaks diff --git a/scripts/empty_upgrade_handler_gen.sh b/scripts/empty_upgrade_handler_gen.sh index 8508ede253a..c705739c342 100755 --- a/scripts/empty_upgrade_handler_gen.sh +++ b/scripts/empty_upgrade_handler_gen.sh @@ -105,7 +105,7 @@ sed -i "s/E2E_UPGRADE_VERSION := ${bracks}v$latest_version$bracks/E2E_UPGRADE_VE # bumps up prev e2e version e2e_file=./tests/e2e/containers/config.go -PREV_OSMOSIS_DEV_TAG=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/osmolabs/osmosis-dev/tags?page=1&page_size=100' | jq -r '.results[] | .name | select(.|test("^(?:v|)[0-9]+\\.[0-9]+(?:$|\\.[0-9]+$)"))' | grep --max-count=1 "") +PREV_OSMOSIS_DEV_TAG=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/osmolabs/osmosis/tags?page=1&page_size=100' | jq -r '.results[] | .name | select(.|test("^(?:v|)[0-9]+\\.0\\.0-alpine$"))' | grep --max-count=1 "") PREV_OSMOSIS_E2E_TAG=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/osmolabs/osmosis-e2e-init-chain/tags?page=1&page_size=100' | jq -r '.results[] | .name | select(.|test("^(?:v|)[0-9]+\\.[0-9]+(?:$|\\.[0-9]+$)"))' | grep --max-count=1 "") # previousVersionOsmoTag = PREV_OSMOSIS_DEV_TAG diff --git a/tests/e2e/README.md b/tests/e2e/README.md index fb22a751c30..08fd4615170 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -47,7 +47,9 @@ Conceptually, we can split the e2e setup into 2 parts: If with the upgrade, the same `chain.Init(...)` function is run inside a Docker container of the previous Osmosis version, inside `configurer/upgrade.go`. This is needed to initialize chain configs and the genesis of the previous version that - we are upgrading from. + we are upgrading from. Note, we use the alpine image of the previous version, + as functionality such as copying mnemonics across containers in unavailable in the + stripped down images. The decision of what configuration type to use is decided by the `Configurer`. This is an interface that has `CurrentBranchConfigurer` and `UpgradeConfigurer` implementations. diff --git a/tests/e2e/containers/config.go b/tests/e2e/containers/config.go index b6676066fa7..c540d432792 100644 --- a/tests/e2e/containers/config.go +++ b/tests/e2e/containers/config.go @@ -24,7 +24,7 @@ const ( // It should be uploaded to Docker Hub. OSMOSIS_E2E_SKIP_UPGRADE should be unset // for this functionality to be used. previousVersionOsmoRepository = "osmolabs/osmosis" - previousVersionOsmoTag = "19.0" + previousVersionOsmoTag = "19.0.0-alpine" // Pre-upgrade repo/tag for osmosis initialization (this should be one version below upgradeVersion) previousVersionInitRepository = "osmolabs/osmosis-e2e-init-chain" previousVersionInitTag = "19.0.0" diff --git a/x/txfees/keeper/feedecorator.go b/x/txfees/keeper/feedecorator.go index 069dbcb7b4c..ee3253a8670 100644 --- a/x/txfees/keeper/feedecorator.go +++ b/x/txfees/keeper/feedecorator.go @@ -249,8 +249,8 @@ func DeductFees(txFeesKeeper types.TxFeesKeeper, bankKeeper types.BankKeeper, ct return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error()) } } else { - // sends to FeeCollectorForStakingRewardsName module account - err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorForStakingRewardsName, fees) + // sends to FeeCollectorForCommunityPoolName module account + err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorForCommunityPoolName, fees) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error()) } diff --git a/x/txfees/keeper/feedecorator_test.go b/x/txfees/keeper/feedecorator_test.go index 2e8d8ca6c8b..c89dc4d8432 100644 --- a/x/txfees/keeper/feedecorator_test.go +++ b/x/txfees/keeper/feedecorator_test.go @@ -209,7 +209,7 @@ func (s *KeeperTestSuite) TestFeeDecorator() { if !tc.txFee.IsZero() { moduleName := types.FeeCollectorName if tc.txFee[0].Denom != baseDenom { - moduleName = types.FeeCollectorForStakingRewardsName + moduleName = types.FeeCollectorForCommunityPoolName } moduleAddr := s.App.AccountKeeper.GetModuleAddress(moduleName) s.Require().Equal(tc.txFee[0], s.App.BankKeeper.GetBalance(s.Ctx, moduleAddr, tc.txFee[0].Denom), tc.name)