Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove tx fee tracker #7237

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* [#6991](https://github.com/osmosis-labs/osmosis/pull/6991) Fix: total liquidity poolmanager grpc gateway query
* [#7149](https://github.com/osmosis-labs/osmosis/pull/7149) Fix double emitting CacheCtx events (e.g. Epoch, Superfluid, CL)
* [#7237](https://github.com/osmosis-labs/osmosis/pull/7237) Removes tx_fee_tracker from the proto rev tracker, no longer tracks in state.

### Features

Expand Down
2 changes: 0 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.EpochsKeeper,
appKeepers.PoolManagerKeeper,
appKeepers.ConcentratedLiquidityKeeper,
appKeepers.TxFeesKeeper,
)
appKeepers.ProtoRevKeeper = &protorevKeeper
appKeepers.PoolManagerKeeper.SetProtorevKeeper(appKeepers.ProtoRevKeeper)
Expand All @@ -407,7 +406,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
dataDir,
)
appKeepers.TxFeesKeeper = &txFeesKeeper
appKeepers.ProtoRevKeeper.SetTxFeesKeeper(appKeepers.TxFeesKeeper)

appKeepers.IncentivesKeeper = incentiveskeeper.NewKeeper(
appKeepers.keys[incentivestypes.StoreKey],
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v21/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func CreateUpgradeHandler(
// Since we are now tracking all protocol rev, we set the accounting height to the current block height for each module
// that generates protocol rev.
keepers.PoolManagerKeeper.SetTakerFeeTrackerStartHeight(ctx, ctx.BlockHeight())
keepers.TxFeesKeeper.SetTxFeesTrackerStartHeight(ctx, ctx.BlockHeight())
// keepers.TxFeesKeeper.SetTxFeesTrackerStartHeight(ctx, ctx.BlockHeight())
// We start the cyclic arb tracker from the value it currently is at since it has been tracking since inception (without a start height).
// This will allow us to display the amount of cyclic arb profits that have been generated from a certain block height.
allCyclicArbProfits := keepers.ProtoRevKeeper.GetAllProfits(ctx)
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v21/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func (s *UpgradeTestSuite) TestUpgrade() {
// Check all accounting start heights should be the same height as the upgrade
s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.CyclicArbTracker.HeightAccountingStartsFrom)
s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TakerFeesTracker.HeightAccountingStartsFrom)
s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TxFeesTracker.HeightAccountingStartsFrom)
// s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TxFeesTracker.HeightAccountingStartsFrom)
// All values should be nill except for the cyclic arb profits, which should start at the value it was at time of upgrade
s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TakerFeesTracker.TakerFeesToCommunityPool)
s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TakerFeesTracker.TakerFeesToStakers)
s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TxFeesTracker.TxFees)
// s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TxFeesTracker.TxFees)
s.Require().Equal(cyclicArbProfits, allProtocolRevenue.CyclicArbTracker.CyclicArb)

}
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1466,8 +1466,6 @@ github.com/osmosis-labs/cosmos-sdk v0.47.5-osmo-4 h1:RCd53Gnnn9yrjjdh8sBkhitqTz/
github.com/osmosis-labs/cosmos-sdk v0.47.5-osmo-4/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c=
github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3 h1:YlmchqTmlwdWSmrRmXKR+PcU96ntOd8u10vTaTZdcNY=
github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3/go.mod h1:lV6KnqXYD/ayTe7310MHtM3I2q8Z6bBfMAi+bhwPYtI=
github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231231215538-1a8c243520e9 h1:uv3HgeYw9QArhkO9YQGVfsnm/xS79ldMBJAMFZwXZno=
github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231231215538-1a8c243520e9/go.mod h1:FQ45vPTc2l+NUA/gk7wZTxUh/hrDRWrRwZj8Ua5cpSU=
github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231231222019-bcdabda4fc36 h1:UOpEx+lWFd9uX0goJMLaIvSjMCsWOmBzLOEVGZCi2Qk=
github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231231222019-bcdabda4fc36/go.mod h1:Ger7K14gEgLOF+4qHNqicrGkNP9Ubg2tBnKkIzvXABE=
github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231229191315-aff18520757d h1:VKMEmZBVt6VrrjBA9dMsxqWJlbrzqbMXX69iOjuevRc=
Expand Down
10 changes: 6 additions & 4 deletions proto/osmosis/protorev/v1beta1/protorev.proto
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,12 @@ message AllProtocolRevenue {
(gogoproto.moretags) = "yaml:\"taker_fees_tracker\"",
(gogoproto.nullable) = false
];
osmosis.txfees.v1beta1.TxFeesTracker tx_fees_tracker = 2 [
(gogoproto.moretags) = "yaml:\"tx_fees_tracker\"",
(gogoproto.nullable) = false
];
// osmosis.txfees.v1beta1.TxFeesTracker tx_fees_tracker = 2 [
// (gogoproto.moretags) = "yaml:\"tx_fees_tracker\"",
// (gogoproto.nullable) = false
// ];
reserved 2; // Reserve the field number
reserved "tx_fees_tracker"; // Reserve the field name
CyclicArbTracker cyclic_arb_tracker = 3 [
(gogoproto.moretags) = "yaml:\"cyclic_arb_tracker\"",
(gogoproto.nullable) = false
Expand Down
15 changes: 4 additions & 11 deletions proto/osmosis/txfees/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@ message GenesisState {
string basedenom = 1;
repeated FeeToken feetokens = 2 [ (gogoproto.nullable) = false ];

// KVStore state
TxFeesTracker txFeesTracker = 3;
// // KVStore state
// TxFeesTracker txFeesTracker = 3;
reserved 3;
reserved "txFeesTracker";
}

message TxFeesTracker {
repeated cosmos.base.v1beta1.Coin tx_fees = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
int64 height_accounting_starts_from = 2
[ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ];
}
2 changes: 0 additions & 2 deletions x/protorev/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenueGRPCQuery() {
res, err = s.queryClient.GetAllProtocolRevenue(sdk.WrapSDKContext(s.Ctx), req)
s.Require().NoError(err)
s.Require().Equal(cyclicArbProfits, res.AllProtocolRevenue.CyclicArbTracker.CyclicArb)
s.Require().Equal(txFeeCharged, res.AllProtocolRevenue.TxFeesTracker.TxFees)
s.Require().Equal(expectedTakerFeeToStakers, res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToStakers)
s.Require().Equal(expectedTakerFeeToCommunityPool, res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToCommunityPool)

Expand All @@ -442,7 +441,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenueGRPCQuery() {
res, err = s.queryClient.GetAllProtocolRevenue(sdk.WrapSDKContext(s.Ctx), req)
s.Require().NoError(err)
s.Require().Equal(cyclicArbProfits.Add(cyclicArbProfits...), res.AllProtocolRevenue.CyclicArbTracker.CyclicArb)
s.Require().Equal(txFeeCharged.Add(txFeeCharged...), res.AllProtocolRevenue.TxFeesTracker.TxFees)
s.Require().Equal(expectedTakerFeeToStakers.Add(expectedTakerFeeToStakers...), res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToStakers)
s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToCommunityPool)
}
7 changes: 0 additions & 7 deletions x/protorev/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type (
epochKeeper types.EpochKeeper
poolmanagerKeeper types.PoolManagerKeeper
concentratedLiquidityKeeper types.ConcentratedLiquidityKeeper
txfeesKeeper types.TxFeesKeeper
}
)

Expand All @@ -39,7 +38,6 @@ func NewKeeper(
epochKeeper types.EpochKeeper,
poolmanagerKeeper types.PoolManagerKeeper,
concentratedLiquidityKeeper types.ConcentratedLiquidityKeeper,
txfeesKeeper types.TxFeesKeeper,
) Keeper {
// set KeyTable if it has not already been set
if !ps.HasKeyTable() {
Expand All @@ -56,14 +54,9 @@ func NewKeeper(
epochKeeper: epochKeeper,
poolmanagerKeeper: poolmanagerKeeper,
concentratedLiquidityKeeper: concentratedLiquidityKeeper,
txfeesKeeper: txfeesKeeper,
}
}

func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}

func (k *Keeper) SetTxFeesKeeper(txFeesKeeper types.TxFeesKeeper) {
k.txfeesKeeper = txFeesKeeper
}
7 changes: 0 additions & 7 deletions x/protorev/keeper/protorev.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

poolmanagertypes "github.com/osmosis-labs/osmosis/v21/x/poolmanager/types"
"github.com/osmosis-labs/osmosis/v21/x/protorev/types"
txfeestypes "github.com/osmosis-labs/osmosis/v21/x/txfees/types"

"github.com/cosmos/cosmos-sdk/store/prefix"

Expand Down Expand Up @@ -503,14 +502,8 @@ func (k Keeper) GetAllProtocolRevenue(ctx sdk.Context) types.AllProtocolRevenue
HeightAccountingStartsFrom: k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx),
}

txFeesTracker := txfeestypes.TxFeesTracker{
TxFees: k.txfeesKeeper.GetTxFeesTrackerValue(ctx),
HeightAccountingStartsFrom: k.txfeesKeeper.GetTxFeesTrackerStartHeight(ctx),
}

return types.AllProtocolRevenue{
TakerFeesTracker: takerFeesTracker,
TxFeesTracker: txFeesTracker,
CyclicArbTracker: cyclicArbTracker,
}
}
7 changes: 0 additions & 7 deletions x/protorev/keeper/protorev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/osmosis-labs/osmosis/osmomath"
poolmanagertypes "github.com/osmosis-labs/osmosis/v21/x/poolmanager/types"
"github.com/osmosis-labs/osmosis/v21/x/protorev/types"
txfeestypes "github.com/osmosis-labs/osmosis/v21/x/txfees/types"
)

// TestGetTokenPairArbRoutes tests the GetTokenPairArbRoutes function.
Expand Down Expand Up @@ -338,10 +337,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenue() {
TakerFeesToCommunityPool: sdk.Coins(nil),
HeightAccountingStartsFrom: 0,
},
TxFeesTracker: txfeestypes.TxFeesTracker{
TxFees: sdk.Coins(nil),
HeightAccountingStartsFrom: 0,
},
CyclicArbTracker: types.CyclicArbTracker{
CyclicArb: sdk.NewCoins(),
HeightAccountingStartsFrom: 0,
Expand Down Expand Up @@ -374,7 +369,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenue() {
// Check protocol revenue
allProtoRev = s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx)
s.Require().Equal(cyclicArbProfits, allProtoRev.CyclicArbTracker.CyclicArb)
s.Require().Equal(txFeeCharged, allProtoRev.TxFeesTracker.TxFees)
s.Require().Equal(expectedTakerFeeToStakers, allProtoRev.TakerFeesTracker.TakerFeesToStakers)
s.Require().Equal(expectedTakerFeeToCommunityPool, allProtoRev.TakerFeesTracker.TakerFeesToCommunityPool)

Expand All @@ -396,7 +390,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenue() {
// Check protocol revenue
allProtoRev = s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx)
s.Require().Equal(cyclicArbProfits.Add(cyclicArbProfits...), allProtoRev.CyclicArbTracker.CyclicArb)
s.Require().Equal(txFeeCharged.Add(txFeeCharged...), allProtoRev.TxFeesTracker.TxFees)
s.Require().Equal(expectedTakerFeeToStakers.Add(expectedTakerFeeToStakers...), allProtoRev.TakerFeesTracker.TakerFeesToStakers)
s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), allProtoRev.TakerFeesTracker.TakerFeesToCommunityPool)
}
5 changes: 0 additions & 5 deletions x/protorev/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,3 @@ type ConcentratedLiquidityKeeper interface {
maxTicksCrossed uint64,
) (maxTokenIn, resultingTokenOut sdk.Coin, err error)
}

type TxFeesKeeper interface {
GetTxFeesTrackerValue(ctx sdk.Context) (currentTxFees sdk.Coins)
GetTxFeesTrackerStartHeight(ctx sdk.Context) int64
}
Loading