From 8afd659a09e4064c0d1229a429e4bedfa7169d4f Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 13:03:17 -0600 Subject: [PATCH 01/19] implement query to get protocol rev across all modules --- app/apptesting/txfees.go | 85 +++ app/keepers/keepers.go | 2 + app/upgrades/v21/upgrades.go | 11 + go.mod | 1 + go.sum | 4 +- osmoutils/coin_helper.go | 8 + osmoutils/coin_helper_test.go | 32 + .../osmosis/poolmanager/v1beta1/genesis.proto | 22 + proto/osmosis/protorev/v1beta1/genesis.proto | 4 +- proto/osmosis/protorev/v1beta1/protorev.proto | 34 +- proto/osmosis/protorev/v1beta1/query.proto | 16 + proto/osmosis/txfees/v1beta1/genesis.proto | 13 + x/poolmanager/keeper.go | 36 +- x/poolmanager/keeper_test.go | 29 +- x/poolmanager/protorev.go | 101 +++ x/poolmanager/protorev_test.go | 165 +++++ x/poolmanager/taker_fee.go | 31 +- x/poolmanager/taker_fee_test.go | 21 +- x/poolmanager/types/genesis.pb.go | 673 +++++++++++++++-- x/poolmanager/types/keys.go | 9 + x/protorev/keeper/genesis.go | 17 + x/protorev/keeper/genesis_test.go | 6 + x/protorev/keeper/grpc_query.go | 8 + x/protorev/keeper/grpc_query_test.go | 66 ++ x/protorev/keeper/keeper.go | 7 + x/protorev/keeper/protorev.go | 43 ++ x/protorev/keeper/protorev_test.go | 62 ++ x/protorev/keeper/statistics.go | 43 ++ x/protorev/keeper/statistics_test.go | 84 +++ x/protorev/types/expected_keepers.go | 8 + x/protorev/types/genesis.go | 5 + x/protorev/types/genesis.pb.go | 159 ++-- x/protorev/types/keys.go | 8 + x/protorev/types/protorev.pb.go | 691 ++++++++++++++++-- x/protorev/types/query.pb.go | 530 +++++++++++--- x/protorev/types/query.pb.gw.go | 65 ++ x/txfees/keeper/feedecorator.go | 2 + x/txfees/keeper/feedecorator_test.go | 60 +- x/txfees/keeper/genesis.go | 18 + x/txfees/keeper/hooks.go | 10 +- x/txfees/keeper/hooks_test.go | 13 + x/txfees/keeper/protorev.go | 63 ++ x/txfees/keeper/protorev_test.go | 121 +++ x/txfees/types/expected_keepers.go | 1 + x/txfees/types/genesis.pb.go | 322 +++++++- x/txfees/types/keys.go | 9 +- 46 files changed, 3354 insertions(+), 364 deletions(-) create mode 100644 app/apptesting/txfees.go create mode 100644 x/poolmanager/protorev.go create mode 100644 x/poolmanager/protorev_test.go create mode 100644 x/txfees/keeper/protorev.go create mode 100644 x/txfees/keeper/protorev_test.go diff --git a/app/apptesting/txfees.go b/app/apptesting/txfees.go new file mode 100644 index 00000000000..2ad2ac793e6 --- /dev/null +++ b/app/apptesting/txfees.go @@ -0,0 +1,85 @@ +package apptesting + +import ( + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + + "github.com/cosmos/cosmos-sdk/client" + + clienttx "github.com/cosmos/cosmos-sdk/client/tx" + + "github.com/osmosis-labs/osmosis/osmomath" + "github.com/osmosis-labs/osmosis/v20/x/txfees/keeper" + "github.com/osmosis-labs/osmosis/v20/x/txfees/types" +) + +var baseGas = uint64(10000) + +func (s *KeeperTestHelper) ExecuteUpgradeFeeTokenProposal(feeToken string, poolId uint64) error { + upgradeProp := types.NewUpdateFeeTokenProposal( + "Test Proposal", + "test", + []types.FeeToken{ + { + Denom: feeToken, + PoolID: poolId, + }, + }, + ) + return s.App.TxFeesKeeper.HandleUpdateFeeTokenProposal(s.Ctx, &upgradeProp) +} + +func (s *KeeperTestHelper) SetupTxFeeAnteHandlerAndChargeFee(clientCtx client.Context, minGasPrices sdk.DecCoins, gasRequested uint64, isCheckTx, isSimulate bool, txFee sdk.Coins) error { + mempoolFeeOpts := types.NewDefaultMempoolFeeOptions() + mempoolFeeOpts.MinGasPriceForHighGasTx = osmomath.MustNewDecFromStr("0.0025") + + uionPoolId := s.PrepareBalancerPoolWithCoins( + sdk.NewInt64Coin(sdk.DefaultBondDenom, 500), + sdk.NewInt64Coin("uion", 500), + ) + err := s.ExecuteUpgradeFeeTokenProposal("uion", uionPoolId) + s.Require().NoError(err) + + if gasRequested == 0 { + gasRequested = baseGas + } + s.Ctx = s.Ctx.WithIsCheckTx(isCheckTx).WithMinGasPrices(minGasPrices) + + // TODO: Cleanup this code. + // TxBuilder components reset for every test case + txBuilder := clientCtx.TxConfig.NewTxBuilder() + priv0, _, addr0 := testdata.KeyTestPubAddr() + acc1 := s.App.AccountKeeper.NewAccountWithAddress(s.Ctx, addr0) + s.App.AccountKeeper.SetAccount(s.Ctx, acc1) + msgs := []sdk.Msg{testdata.NewTestMsg(addr0)} + privs, accNums, accSeqs := []cryptotypes.PrivKey{priv0}, []uint64{0}, []uint64{0} + signerData := authsigning.SignerData{ + ChainID: s.Ctx.ChainID(), + AccountNumber: accNums[0], + Sequence: accSeqs[0], + } + + gasLimit := gasRequested + sigV2, _ := clienttx.SignWithPrivKey( + 1, + signerData, + txBuilder, + privs[0], + clientCtx.TxConfig, + accSeqs[0], + ) + + err = simapp.FundAccount(s.App.BankKeeper, s.Ctx, addr0, txFee) + s.Require().NoError(err) + + tx := s.BuildTx(txBuilder, msgs, sigV2, "", txFee, gasLimit) + + mfd := keeper.NewMempoolFeeDecorator(*s.App.TxFeesKeeper, mempoolFeeOpts) + dfd := keeper.NewDeductFeeDecorator(*s.App.TxFeesKeeper, *s.App.AccountKeeper, *s.App.BankKeeper, nil) + antehandlerMFD := sdk.ChainAnteDecorators(mfd, dfd) + _, err = antehandlerMFD(s.Ctx, tx, isSimulate) + return err +} diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index c065d93ff82..656ea489584 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -369,6 +369,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.EpochsKeeper, appKeepers.PoolManagerKeeper, appKeepers.ConcentratedLiquidityKeeper, + appKeepers.TxFeesKeeper, ) appKeepers.ProtoRevKeeper = &protorevKeeper appKeepers.PoolManagerKeeper.SetProtorevKeeper(appKeepers.ProtoRevKeeper) @@ -383,6 +384,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.DistrKeeper, ) appKeepers.TxFeesKeeper = &txFeesKeeper + appKeepers.ProtoRevKeeper.SetTxFeesKeeper(appKeepers.TxFeesKeeper) appKeepers.IncentivesKeeper = incentiveskeeper.NewKeeper( appKeepers.keys[incentivestypes.StoreKey], diff --git a/app/upgrades/v21/upgrades.go b/app/upgrades/v21/upgrades.go index 1ccfa242734..455a7f7fd88 100644 --- a/app/upgrades/v21/upgrades.go +++ b/app/upgrades/v21/upgrades.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/osmosis-labs/osmosis/osmoutils" "github.com/osmosis-labs/osmosis/v20/app/keepers" "github.com/osmosis-labs/osmosis/v20/app/upgrades" ) @@ -23,6 +24,16 @@ func CreateUpgradeHandler( return nil, err } + // 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, uint64(ctx.BlockHeight())) + keepers.TxFeesKeeper.SetTxFeesTrackerStartHeight(ctx, uint64(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). + allCyclicArbProfits := keepers.ProtoRevKeeper.GetAllProfits(ctx) + allCyclicArbProfitsCoins := osmoutils.ConvertCoinArrayToCoins(allCyclicArbProfits) + keepers.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(ctx, allCyclicArbProfitsCoins) + keepers.ProtoRevKeeper.SetCyclicArbProfitTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + return migrations, nil } } diff --git a/go.mod b/go.mod index a3424397c1a..b94dc102d56 100644 --- a/go.mod +++ b/go.mod @@ -95,6 +95,7 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/goleak v1.1.12 // indirect go.uber.org/zap v1.24.0 // indirect + golang.org/x/arch v0.5.0 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect ) diff --git a/go.sum b/go.sum index 5b0851711ad..3660c4a917d 100644 --- a/go.sum +++ b/go.sum @@ -966,11 +966,8 @@ github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3 h1:Ylmch 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.20231014001935-1946419d44eb h1:pXsC6vqGD+pbMGt+fVBHi9XBk/KDQuRZde2fh4s/1+k= github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231014001935-1946419d44eb/go.mod h1:jNZ952fypVNMzOsh31LAUS27JbF9naNJGtELxId6ZCg= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366 h1:EJDJ88w2Yv5LnlaJw5x53C0k/dp/fnEYOfBYOQiMsTc= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366/go.mod h1:Zmyx5zMUBN2KV94booSFn2v8KQcUKeCHqyWpKZ4PRMo= github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231017074304-84e27b5e2aad h1:UcQ/XLz0SqWMrA+BhgDXy9ukD4C+FlN4ULdazZmFOsE= github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231017074304-84e27b5e2aad/go.mod h1:16AXMzbTLkYE5If5VLTA07fV9JNcLFwgf/VoW5sHrtU= -github.com/osmosis-labs/osmosis/v19 v19.0.0 h1:gqcas/XfxtEuZXsWGTO9vNMHiY78Qs09FBQw73djIVM= github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231011004221-fd24b80f8366 h1:E6H0V3MKbSNwo1iXE9Kzatd2M02MgZpS5AiJ6CKK5us= github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231011004221-fd24b80f8366/go.mod h1:vU0IHK5W38dqMeux3MkSaT3MZU6whAkx7vNuxv1IzeU= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.9-0.20231014001935-1946419d44eb h1:6lYLEiJERdD+QK925XYyHkvNyvQTghVFufMH5VAQLpg= @@ -1340,6 +1337,7 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y= +golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/osmoutils/coin_helper.go b/osmoutils/coin_helper.go index 16fbb64df23..a99683c9d92 100644 --- a/osmoutils/coin_helper.go +++ b/osmoutils/coin_helper.go @@ -114,3 +114,11 @@ func MergeCoinMaps[T comparable](currentEpochExpectedDistributionsOne map[T]sdk. } return newMap } + +func ConvertCoinArrayToCoins(coinArray []sdk.Coin) sdk.Coins { + coins := sdk.Coins{} + for _, coin := range coinArray { + coins = append(coins, coin) + } + return coins +} diff --git a/osmoutils/coin_helper_test.go b/osmoutils/coin_helper_test.go index a8615127132..58b781ed29b 100644 --- a/osmoutils/coin_helper_test.go +++ b/osmoutils/coin_helper_test.go @@ -291,3 +291,35 @@ func TestMergeCoinMaps(t *testing.T) { } }) } + +func TestConvertCoinArrayToCoins(t *testing.T) { + tests := []struct { + name string + coinArray []sdk.Coin + expectedCoins sdk.Coins + }{ + { + name: "Empty input", + coinArray: []sdk.Coin{}, + expectedCoins: sdk.NewCoins(), + }, + { + name: "Single coin", + coinArray: []sdk.Coin{sdk.NewCoin("atom", osmomath.NewInt(100000000))}, + expectedCoins: sdk.NewCoins(sdk.NewCoin("atom", osmomath.NewInt(100000000))), + }, + { + name: "Multiple coins", + coinArray: []sdk.Coin{sdk.NewCoin("atom", osmomath.NewInt(100000000)), sdk.NewCoin("usdc", osmomath.NewInt(500000000))}, + expectedCoins: sdk.NewCoins(sdk.NewCoin("atom", osmomath.NewInt(100000000)), sdk.NewCoin("usdc", osmomath.NewInt(500000000))), + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := osmoutils.ConvertCoinArrayToCoins(test.coinArray) + require.Equal(t, result, test.expectedCoins) + + }) + } +} diff --git a/proto/osmosis/poolmanager/v1beta1/genesis.proto b/proto/osmosis/poolmanager/v1beta1/genesis.proto index 3b599e41b86..6bbaba6ec47 100644 --- a/proto/osmosis/poolmanager/v1beta1/genesis.proto +++ b/proto/osmosis/poolmanager/v1beta1/genesis.proto @@ -42,6 +42,10 @@ message GenesisState { Params params = 2 [ (gogoproto.nullable) = false ]; // pool_routes is the container of the mappings from pool id to pool type. repeated ModuleRoute pool_routes = 3 [ (gogoproto.nullable) = false ]; + + // KVStore state + TakerFeesToStakersTracker taker_fees_to_stakers_tracker = 4; + TakerFeesToCommunityPoolTracker taker_fees_to_community_pool_tracker = 5; } // TakerFeeParams consolidates the taker fee parameters for the poolmanager. @@ -117,3 +121,21 @@ message TakerFeeDistributionPercentage { (gogoproto.nullable) = false ]; } + +message TakerFeesToStakersTracker { + repeated cosmos.base.v1beta1.Coin taker_fees_to_stakers = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + uint64 height_accounting_starts_from = 2 + [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; +} + +message TakerFeesToCommunityPoolTracker { + repeated cosmos.base.v1beta1.Coin taker_fees_to_community_pool = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + uint64 height_accounting_starts_from = 2 + [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; +} \ No newline at end of file diff --git a/proto/osmosis/protorev/v1beta1/genesis.proto b/proto/osmosis/protorev/v1beta1/genesis.proto index fc3207d95f9..c258df05bc1 100644 --- a/proto/osmosis/protorev/v1beta1/genesis.proto +++ b/proto/osmosis/protorev/v1beta1/genesis.proto @@ -72,4 +72,6 @@ message GenesisState { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"info_by_pool_type\"" ]; -} \ No newline at end of file + CyclicArbTracker cyclic_arb_tracker = 14 + [ (gogoproto.moretags) = "yaml:\"cyclic_arb_tracker\"" ]; +} diff --git a/proto/osmosis/protorev/v1beta1/protorev.proto b/proto/osmosis/protorev/v1beta1/protorev.proto index 250ec36ef1e..10194e5237a 100644 --- a/proto/osmosis/protorev/v1beta1/protorev.proto +++ b/proto/osmosis/protorev/v1beta1/protorev.proto @@ -5,6 +5,8 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "osmosis/poolmanager/v1beta1/genesis.proto"; +import "osmosis/txfees/v1beta1/genesis.proto"; option go_package = "github.com/osmosis-labs/osmosis/v20/x/protorev/types"; @@ -179,4 +181,34 @@ message BaseDenom { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"step_size\"" ]; -} \ No newline at end of file +} + +message AllProtocolRevenue { + osmosis.poolmanager.v1beta1.TakerFeesToStakersTracker + taker_fees_to_stakers_tracker = 1 [ + (gogoproto.moretags) = "yaml:\"taker_fees_to_stakers_tracker\"", + (gogoproto.nullable) = false + ]; + osmosis.poolmanager.v1beta1.TakerFeesToCommunityPoolTracker + taker_fees_to_community_pool_tracker = 2 [ + (gogoproto.moretags) = "yaml:\"taker_fees_to_community_pool_tracker\"", + (gogoproto.nullable) = false + ]; + osmosis.txfees.v1beta1.TxFeesTracker tx_fees_tracker = 3 [ + (gogoproto.moretags) = "yaml:\"tx_fees_tracker\"", + (gogoproto.nullable) = false + ]; + CyclicArbTracker cyclic_arb_tracker = 4 [ + (gogoproto.moretags) = "yaml:\"cyclic_arb_tracker\"", + (gogoproto.nullable) = false + ]; +} + +message CyclicArbTracker { + repeated cosmos.base.v1beta1.Coin cyclic_arb = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + uint64 height_accounting_starts_from = 2 + [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; +} diff --git a/proto/osmosis/protorev/v1beta1/query.proto b/proto/osmosis/protorev/v1beta1/query.proto index f4e16cc7954..df67ece945b 100644 --- a/proto/osmosis/protorev/v1beta1/query.proto +++ b/proto/osmosis/protorev/v1beta1/query.proto @@ -113,6 +113,13 @@ service Query { returns (QueryGetProtoRevPoolResponse) { option (google.api.http).get = "/osmosis/protorev/pool"; } + + // GetAllProtocolRevenue queries all of the protocol revenue that has been + // accumulated by any module + rpc GetAllProtocolRevenue(QueryGetAllProtocolRevenueRequest) + returns (QueryGetAllProtocolRevenueResponse) { + option (google.api.http).get = "/osmosis/protorev/all_protocol_revenue"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -324,4 +331,13 @@ message QueryGetProtoRevPoolRequest { message QueryGetProtoRevPoolResponse { // pool_id is the pool_id stored for the denom pair uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; +} + +message QueryGetAllProtocolRevenueRequest {} + +message QueryGetAllProtocolRevenueResponse { + AllProtocolRevenue all_protocol_revenue = 1 [ + (gogoproto.moretags) = "yaml:\"all_protocol_revenue\"", + (gogoproto.nullable) = false + ]; } \ No newline at end of file diff --git a/proto/osmosis/txfees/v1beta1/genesis.proto b/proto/osmosis/txfees/v1beta1/genesis.proto index 5bfcf88bec8..7db6f6c460f 100644 --- a/proto/osmosis/txfees/v1beta1/genesis.proto +++ b/proto/osmosis/txfees/v1beta1/genesis.proto @@ -3,6 +3,7 @@ package osmosis.txfees.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/txfees/v1beta1/feetoken.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/osmosis-labs/osmosis/v20/x/txfees/types"; @@ -10,4 +11,16 @@ option go_package = "github.com/osmosis-labs/osmosis/v20/x/txfees/types"; message GenesisState { string basedenom = 1; repeated FeeToken feetokens = 2 [ (gogoproto.nullable) = false ]; + + // KVStore state + TxFeesTracker txFeesTracker = 3; } + +message TxFeesTracker { + repeated cosmos.base.v1beta1.Coin tx_fees = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + uint64 height_accounting_starts_from = 2 + [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; +} \ No newline at end of file diff --git a/x/poolmanager/keeper.go b/x/poolmanager/keeper.go index a05241822cf..4fdf214c2d7 100644 --- a/x/poolmanager/keeper.go +++ b/x/poolmanager/keeper.go @@ -97,14 +97,44 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { for _, poolRoute := range genState.PoolRoutes { k.SetPoolRoute(ctx, poolRoute.PoolId, poolRoute.PoolType) } + + // We track taker fees generated in the module's KVStore. + // If the values were exported, we set them here. + // If the values were not exported, we initialize the tracker to zero and set the accounting height to the current height. + if genState.TakerFeesToStakersTracker != nil { + k.SetTakerFeeTrackerForStakers(ctx, genState.TakerFeesToStakersTracker.TakerFeesToStakers) + k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesToStakersTracker.HeightAccountingStartsFrom) + } else { + k.SetTakerFeeTrackerForStakers(ctx, sdk.NewCoins()) + k.SetTakerFeeTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + } + if genState.TakerFeesToCommunityPoolTracker != nil { + k.SetTakerFeeTrackerForCommunityPool(ctx, genState.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) + } else { + k.SetTakerFeeTrackerForCommunityPool(ctx, sdk.NewCoins()) + k.SetTakerFeeTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + } } // ExportGenesis returns the poolmanager module's exported genesis. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + // Export KVStore values to the genesis state so they can be imported in init genesis. + takerFeesToStakersTracker := types.TakerFeesToStakersTracker{ + TakerFeesToStakers: k.GetTakerFeeTrackerForStakers(ctx), + HeightAccountingStartsFrom: k.GetTakerFeeTrackerStartHeight(ctx), + } + takerFeesToCommunityPoolTracker := types.TakerFeesToCommunityPoolTracker{ + TakerFeesToCommunityPool: k.GetTakerFeeTrackerForCommunityPool(ctx), + HeightAccountingStartsFrom: k.GetTakerFeeTrackerStartHeight(ctx), + } + return &types.GenesisState{ - Params: k.GetParams(ctx), - NextPoolId: k.GetNextPoolId(ctx), - PoolRoutes: k.getAllPoolRoutes(ctx), + Params: k.GetParams(ctx), + NextPoolId: k.GetNextPoolId(ctx), + PoolRoutes: k.getAllPoolRoutes(ctx), + TakerFeesToStakersTracker: &takerFeesToStakersTracker, + TakerFeesToCommunityPoolTracker: &takerFeesToCommunityPoolTracker, } } diff --git a/x/poolmanager/keeper_test.go b/x/poolmanager/keeper_test.go index 686a93742f0..81db4881d28 100644 --- a/x/poolmanager/keeper_test.go +++ b/x/poolmanager/keeper_test.go @@ -43,6 +43,15 @@ var ( PoolType: types.Stableswap, }, } + + testFeesToStakers = types.TakerFeesToStakersTracker{ + TakerFeesToStakers: sdk.Coins{sdk.NewCoin("uosmo", sdk.NewInt(1000))}, + HeightAccountingStartsFrom: 100, + } + testFeesToCommunityPool = types.TakerFeesToCommunityPoolTracker{ + TakerFeesToCommunityPool: sdk.Coins{sdk.NewCoin("uusdc", sdk.NewInt(1000))}, + HeightAccountingStartsFrom: 100, + } ) func TestKeeperTestSuite(t *testing.T) { @@ -101,8 +110,10 @@ func (s *KeeperTestSuite) TestInitGenesis() { }, AuthorizedQuoteDenoms: testAuthorizedQuoteDenoms, }, - NextPoolId: testExpectedPoolId, - PoolRoutes: testPoolRoute, + NextPoolId: testExpectedPoolId, + PoolRoutes: testPoolRoute, + TakerFeesToStakersTracker: &testFeesToStakers, + TakerFeesToCommunityPoolTracker: &testFeesToCommunityPool, }) params := s.App.PoolManagerKeeper.GetParams(s.Ctx) @@ -115,6 +126,10 @@ func (s *KeeperTestSuite) TestInitGenesis() { s.Require().Equal(testCommunityPoolDenomToSwapNonWhitelistedAssetsTo, params.TakerFeeParams.CommunityPoolDenomToSwapNonWhitelistedAssetsTo) s.Require().Equal(testAuthorizedQuoteDenoms, params.AuthorizedQuoteDenoms) s.Require().Equal(testPoolRoute, s.App.PoolManagerKeeper.GetAllPoolRoutes(s.Ctx)) + s.Require().Equal(testFeesToStakers.TakerFeesToStakers, s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx)) + s.Require().Equal(testFeesToCommunityPool.TakerFeesToCommunityPool, s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx)) + s.Require().Equal(testFeesToStakers.HeightAccountingStartsFrom, s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) + s.Require().Equal(testFeesToCommunityPool.HeightAccountingStartsFrom, s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) } func (s *KeeperTestSuite) TestExportGenesis() { @@ -130,8 +145,10 @@ func (s *KeeperTestSuite) TestExportGenesis() { }, AuthorizedQuoteDenoms: testAuthorizedQuoteDenoms, }, - NextPoolId: testExpectedPoolId, - PoolRoutes: testPoolRoute, + NextPoolId: testExpectedPoolId, + PoolRoutes: testPoolRoute, + TakerFeesToStakersTracker: &testFeesToStakers, + TakerFeesToCommunityPoolTracker: &testFeesToCommunityPool, }) genesis := s.App.PoolManagerKeeper.ExportGenesis(s.Ctx) @@ -144,4 +161,8 @@ func (s *KeeperTestSuite) TestExportGenesis() { s.Require().Equal(testCommunityPoolDenomToSwapNonWhitelistedAssetsTo, genesis.Params.TakerFeeParams.CommunityPoolDenomToSwapNonWhitelistedAssetsTo) s.Require().Equal(testAuthorizedQuoteDenoms, genesis.Params.AuthorizedQuoteDenoms) s.Require().Equal(testPoolRoute, genesis.PoolRoutes) + s.Require().Equal(testFeesToStakers.TakerFeesToStakers, genesis.TakerFeesToStakersTracker.TakerFeesToStakers) + s.Require().Equal(testFeesToCommunityPool.TakerFeesToCommunityPool, genesis.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + s.Require().Equal(testFeesToStakers.HeightAccountingStartsFrom, genesis.TakerFeesToStakersTracker.HeightAccountingStartsFrom) + s.Require().Equal(testFeesToCommunityPool.HeightAccountingStartsFrom, genesis.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) } diff --git a/x/poolmanager/protorev.go b/x/poolmanager/protorev.go new file mode 100644 index 00000000000..f287fe1505b --- /dev/null +++ b/x/poolmanager/protorev.go @@ -0,0 +1,101 @@ +package poolmanager + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + gogotypes "github.com/gogo/protobuf/types" + + "github.com/osmosis-labs/osmosis/osmoutils" + "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" +) + +// IncreaseTakerFeeTrackerForStakers gets the current value of the taker fee tracker for stakers, adds the given amount to it, and sets the new value. +func (k Keeper) IncreaseTakerFeeTrackerForStakers(ctx sdk.Context, takerFeeForStakers sdk.Coin) { + currentTakerFeeForStakers := k.GetTakerFeeTrackerForStakers(ctx) + if !takerFeeForStakers.IsZero() { + newTakerFeeForStakersCoins := currentTakerFeeForStakers.Add(takerFeeForStakers) + newTakerFeeForStakers := types.TrackedVolume{ + Amount: newTakerFeeForStakersCoins, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeStakersProtoRev, &newTakerFeeForStakers) + } +} + +// IncreaseTakerFeeTrackerForCommunityPool gets the current value of the taker fee tracker for the community pool, adds the given amount to it, and sets the new value. +func (k Keeper) IncreaseTakerFeeTrackerForCommunityPool(ctx sdk.Context, takerFeeForCommunityPool sdk.Coin) { + currentTakerFeeForCommunityPool := k.GetTakerFeeTrackerForCommunityPool(ctx) + if !takerFeeForCommunityPool.IsZero() { + newTakerFeeForCommunityPoolCoins := currentTakerFeeForCommunityPool.Add(takerFeeForCommunityPool) + newTakerFeeForCommunityPool := types.TrackedVolume{ + Amount: newTakerFeeForCommunityPoolCoins, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeCommunityPoolProtoRev, &newTakerFeeForCommunityPool) + } +} + +func (k Keeper) SetTakerFeeTrackerForStakers(ctx sdk.Context, takerFeeForStakers sdk.Coins) { + newTakerFeeForStakers := types.TrackedVolume{ + Amount: takerFeeForStakers, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeStakersProtoRev, &newTakerFeeForStakers) +} + +func (k Keeper) SetTakerFeeTrackerForCommunityPool(ctx sdk.Context, takerFeeForCommunityPool sdk.Coins) { + newTakerFeeForCommunityPool := types.TrackedVolume{ + Amount: takerFeeForCommunityPool, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeCommunityPoolProtoRev, &newTakerFeeForCommunityPool) +} + +func (k Keeper) GetTakerFeeTrackerForStakers(ctx sdk.Context) (currentTakerFeeForStakers sdk.Coins) { + var takerFeeForStakers types.TrackedVolume + takerFeeFound, err := osmoutils.Get(ctx.KVStore(k.storeKey), types.KeyTakerFeeStakersProtoRev, &takerFeeForStakers) + if err != nil { + // We can only encounter an error if a database or serialization errors occurs, so we panic here. + // Normally this would be handled by `osmoutils.MustGet`, but since we want to specifically use `osmoutils.Get`, + // we also have to manually panic here. + panic(err) + } + + // If no volume was found, we treat the existing volume as 0. + // While we can technically require volume to exist, we would need to store empty coins in state for each pool (past and present), + // which is a high storage cost to pay for a weak guardrail. + currentTakerFeeForStakers = sdk.NewCoins() + if takerFeeFound { + currentTakerFeeForStakers = takerFeeForStakers.Amount + } + + return currentTakerFeeForStakers +} + +func (k Keeper) GetTakerFeeTrackerForCommunityPool(ctx sdk.Context) (currentTakerFeeForCommunityPool sdk.Coins) { + var takerFeeForCommunityPool types.TrackedVolume + takerFeeFound, err := osmoutils.Get(ctx.KVStore(k.storeKey), types.KeyTakerFeeCommunityPoolProtoRev, &takerFeeForCommunityPool) + if err != nil { + // We can only encounter an error if a database or serialization errors occurs, so we panic here. + // Normally this would be handled by `osmoutils.MustGet`, but since we want to specifically use `osmoutils.Get`, + // we also have to manually panic here. + panic(err) + } + + // If no volume was found, we treat the existing volume as 0. + // While we can technically require volume to exist, we would need to store empty coins in state for each pool (past and present), + // which is a high storage cost to pay for a weak guardrail. + currentTakerFeeForCommunityPool = sdk.NewCoins() + if takerFeeFound { + currentTakerFeeForCommunityPool = takerFeeForCommunityPool.Amount + } + + return currentTakerFeeForCommunityPool +} + +// GetTakerFeeTrackerStartHeight gets the height from which we started accounting for taker fees. +func (k Keeper) GetTakerFeeTrackerStartHeight(ctx sdk.Context) uint64 { + startHeight := gogotypes.UInt64Value{} + osmoutils.MustGet(ctx.KVStore(k.storeKey), types.KeyTakerFeeProtoRevAccountingHeight, &startHeight) + return startHeight.Value +} + +// SetTakerFeeTrackerStartHeight sets the height from which we started accounting for taker fees. +func (k Keeper) SetTakerFeeTrackerStartHeight(ctx sdk.Context, startHeight uint64) { + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeProtoRevAccountingHeight, &gogotypes.UInt64Value{Value: startHeight}) +} diff --git a/x/poolmanager/protorev_test.go b/x/poolmanager/protorev_test.go new file mode 100644 index 00000000000..a03105c6293 --- /dev/null +++ b/x/poolmanager/protorev_test.go @@ -0,0 +1,165 @@ +package poolmanager_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (s *KeeperTestSuite) TestGetSetTakerFeeTrackerForStakersAndCommunityPool() { + tests := map[string]struct { + firstTakerFeeForStakers sdk.Coins + secondTakerFeeForStakers sdk.Coins + firstTakerFeeForCommunityPool sdk.Coins + secondTakerFeeForCommunityPool sdk.Coins + }{ + "happy path: replace single coin with increased single coin": { + firstTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(200))), + + firstTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + secondTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(200))), + }, + "replace single coin with decreased single coin": { + firstTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(50))), + + firstTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + secondTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(50))), + }, + "replace single coin with different denom": { + firstTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + + firstTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + secondTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + }, + "replace single coin with multiple coins": { + firstTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + + firstTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + secondTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100)), sdk.NewCoin("eth", sdk.NewInt(200))), + }, + "replace multiple coins with single coin": { + firstTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + secondTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(200))), + + firstTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100)), sdk.NewCoin("eth", sdk.NewInt(200))), + secondTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(50))), + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest() + + s.Require().Empty(s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) + s.Require().Empty(s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx)) + + s.App.PoolManagerKeeper.SetTakerFeeTrackerForStakers(s.Ctx, tc.firstTakerFeeForStakers) + s.App.PoolManagerKeeper.SetTakerFeeTrackerForCommunityPool(s.Ctx, tc.firstTakerFeeForCommunityPool) + + actualFirstTakerFeeForStakers := s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx) + actualFirstTakerFeeForCommunityPool := s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx) + + s.Require().Equal(tc.firstTakerFeeForStakers, actualFirstTakerFeeForStakers) + s.Require().Equal(tc.firstTakerFeeForCommunityPool, actualFirstTakerFeeForCommunityPool) + + s.App.PoolManagerKeeper.SetTakerFeeTrackerForStakers(s.Ctx, tc.secondTakerFeeForStakers) + s.App.PoolManagerKeeper.SetTakerFeeTrackerForCommunityPool(s.Ctx, tc.secondTakerFeeForCommunityPool) + + actualSecondTakerFeeForStakers := s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx) + actualSecondTakerFeeForCommunityPool := s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx) + + s.Require().Equal(tc.secondTakerFeeForStakers, actualSecondTakerFeeForStakers) + s.Require().Equal(tc.secondTakerFeeForCommunityPool, actualSecondTakerFeeForCommunityPool) + }) + } +} + +func (s *KeeperTestSuite) TestGetSetTakerFeeTrackerStartHeight() { + tests := map[string]struct { + firstTakerFeeTrackerStartHeight uint64 + secondTakerFeeTrackerStartHeight uint64 + }{ + "replace tracker height with a higher height": { + firstTakerFeeTrackerStartHeight: 100, + secondTakerFeeTrackerStartHeight: 5000, + }, + "replace tracker height with a lower height": { + firstTakerFeeTrackerStartHeight: 100, + secondTakerFeeTrackerStartHeight: 50, + }, + "replace tracker height back to zero": { + firstTakerFeeTrackerStartHeight: 100, + secondTakerFeeTrackerStartHeight: 0, + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest() + + s.Require().Empty(s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) + + s.App.PoolManagerKeeper.SetTakerFeeTrackerStartHeight(s.Ctx, tc.firstTakerFeeTrackerStartHeight) + actualFirstTakerFeeTrackerStartHeight := s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx) + s.Require().Equal(tc.firstTakerFeeTrackerStartHeight, actualFirstTakerFeeTrackerStartHeight) + + s.App.PoolManagerKeeper.SetTakerFeeTrackerStartHeight(s.Ctx, tc.secondTakerFeeTrackerStartHeight) + actualSecondTakerFeeTrackerStartHeight := s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx) + s.Require().Equal(tc.secondTakerFeeTrackerStartHeight, actualSecondTakerFeeTrackerStartHeight) + }) + } +} + +func (s *KeeperTestSuite) TestIncreaseTakerFeeTrackerForStakersAndCommunityPool() { + tests := map[string]struct { + initialTakerFeeForStakers sdk.Coins + initialTakerFeeForCommunityPool sdk.Coins + + increaseTakerFeeForStakersBy sdk.Coin + increaseTakerFeeForCommunityPoolBy sdk.Coin + }{ + "happy path: increase single denom tracker": { + initialTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + initialTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + + increaseTakerFeeForStakersBy: sdk.NewCoin("eth", sdk.NewInt(50)), + increaseTakerFeeForCommunityPoolBy: sdk.NewCoin("usdc", sdk.NewInt(50)), + }, + "increase multi denom tracker": { + initialTakerFeeForStakers: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + initialTakerFeeForCommunityPool: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + + increaseTakerFeeForStakersBy: sdk.NewCoin("eth", sdk.NewInt(50)), + increaseTakerFeeForCommunityPoolBy: sdk.NewCoin("usdc", sdk.NewInt(50)), + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest() + + s.Require().Empty(s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) + s.Require().Empty(s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx)) + + s.App.PoolManagerKeeper.SetTakerFeeTrackerForStakers(s.Ctx, tc.initialTakerFeeForStakers) + s.App.PoolManagerKeeper.SetTakerFeeTrackerForCommunityPool(s.Ctx, tc.initialTakerFeeForCommunityPool) + + actualInitialTakerFeeForStakers := s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx) + actualInitialTakerFeeForCommunityPool := s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx) + + s.Require().Equal(tc.initialTakerFeeForStakers, actualInitialTakerFeeForStakers) + s.Require().Equal(tc.initialTakerFeeForCommunityPool, actualInitialTakerFeeForCommunityPool) + + s.App.PoolManagerKeeper.IncreaseTakerFeeTrackerForStakers(s.Ctx, tc.increaseTakerFeeForStakersBy) + s.App.PoolManagerKeeper.IncreaseTakerFeeTrackerForCommunityPool(s.Ctx, tc.increaseTakerFeeForCommunityPoolBy) + + takerFeeForStakersAfterIncrease := s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx) + takerFeeForCommunityPoolAfterIncrease := s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx) + + s.Require().Equal(tc.initialTakerFeeForStakers.Add(sdk.NewCoins(tc.increaseTakerFeeForStakersBy)...), takerFeeForStakersAfterIncrease) + s.Require().Equal(tc.initialTakerFeeForCommunityPool.Add(sdk.NewCoins(tc.increaseTakerFeeForCommunityPoolBy)...), takerFeeForCommunityPoolAfterIncrease) + }) + } +} diff --git a/x/poolmanager/taker_fee.go b/x/poolmanager/taker_fee.go index bc1ee14be61..1850be5e3cb 100644 --- a/x/poolmanager/taker_fee.go +++ b/x/poolmanager/taker_fee.go @@ -116,22 +116,24 @@ func (k Keeper) chargeTakerFee(ctx sdk.Context, tokenIn sdk.Coin, tokenOutDenom if poolManagerParams.TakerFeeParams.OsmoTakerFeeDistribution.CommunityPool.GT(osmomath.ZeroDec()) { // Osmo community pool funds is a direct send osmoTakerFeeToCommunityPoolDec := takerFeeAmtRemaining.ToLegacyDec().Mul(poolManagerParams.TakerFeeParams.OsmoTakerFeeDistribution.CommunityPool) - osmoTakerFeeToCommunityPoolCoins := sdk.NewCoins(sdk.NewCoin(defaultTakerFeeDenom, osmoTakerFeeToCommunityPoolDec.TruncateInt())) - err := k.communityPoolKeeper.FundCommunityPool(ctx, osmoTakerFeeToCommunityPoolCoins, sender) + osmoTakerFeeToCommunityPoolCoin := sdk.NewCoin(defaultTakerFeeDenom, osmoTakerFeeToCommunityPoolDec.TruncateInt()) + err := k.communityPoolKeeper.FundCommunityPool(ctx, sdk.NewCoins(osmoTakerFeeToCommunityPoolCoin), sender) if err != nil { return sdk.Coin{}, err } - takerFeeAmtRemaining = takerFeeAmtRemaining.Sub(osmoTakerFeeToCommunityPoolCoins.AmountOf(defaultTakerFeeDenom)) + k.IncreaseTakerFeeTrackerForCommunityPool(ctx, osmoTakerFeeToCommunityPoolCoin) + takerFeeAmtRemaining = takerFeeAmtRemaining.Sub(osmoTakerFeeToCommunityPoolCoin.Amount) } // Staking Rewards: if poolManagerParams.TakerFeeParams.OsmoTakerFeeDistribution.StakingRewards.GT(osmomath.ZeroDec()) { // Osmo staking rewards funds are sent to the non native fee pool module account (even though its native, we want to distribute at the same time as the non native fee tokens) // We could stream these rewards via the fee collector account, but this is decision to be made by governance. - osmoTakerFeeToStakingRewardsCoins := sdk.NewCoins(sdk.NewCoin(defaultTakerFeeDenom, takerFeeAmtRemaining)) - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, feeCollectorForStakingRewardsName, osmoTakerFeeToStakingRewardsCoins) + osmoTakerFeeToStakingRewardsCoin := sdk.NewCoin(defaultTakerFeeDenom, takerFeeAmtRemaining) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, feeCollectorForStakingRewardsName, sdk.NewCoins(osmoTakerFeeToStakingRewardsCoin)) if err != nil { return sdk.Coin{}, err } + k.IncreaseTakerFeeTrackerForStakers(ctx, osmoTakerFeeToStakingRewardsCoin) } // If the denom is not the base denom: @@ -142,32 +144,35 @@ func (k Keeper) chargeTakerFee(ctx sdk.Context, tokenIn sdk.Coin, tokenOutDenom // If the non osmo denom is a whitelisted quote asset, we send to the community pool if denomIsWhitelisted { nonOsmoTakerFeeToCommunityPoolDec := takerFeeAmtRemaining.ToLegacyDec().Mul(poolManagerParams.TakerFeeParams.NonOsmoTakerFeeDistribution.CommunityPool) - nonOsmoTakerFeeToCommunityPoolCoins := sdk.NewCoins(sdk.NewCoin(tokenIn.Denom, nonOsmoTakerFeeToCommunityPoolDec.TruncateInt())) - err := k.communityPoolKeeper.FundCommunityPool(ctx, nonOsmoTakerFeeToCommunityPoolCoins, sender) + nonOsmoTakerFeeToCommunityPoolCoin := sdk.NewCoin(tokenIn.Denom, nonOsmoTakerFeeToCommunityPoolDec.TruncateInt()) + err := k.communityPoolKeeper.FundCommunityPool(ctx, sdk.NewCoins(nonOsmoTakerFeeToCommunityPoolCoin), sender) if err != nil { return sdk.Coin{}, err } - takerFeeAmtRemaining = takerFeeAmtRemaining.Sub(nonOsmoTakerFeeToCommunityPoolCoins.AmountOf(tokenIn.Denom)) + k.IncreaseTakerFeeTrackerForCommunityPool(ctx, nonOsmoTakerFeeToCommunityPoolCoin) + takerFeeAmtRemaining = takerFeeAmtRemaining.Sub(nonOsmoTakerFeeToCommunityPoolCoin.Amount) } else { // If the non osmo denom is not a whitelisted asset, we send to the non native fee pool for community pool module account. // At epoch, this account swaps the non native, non whitelisted assets for XXX and sends to the community pool. nonOsmoTakerFeeToCommunityPoolDec := takerFeeAmtRemaining.ToLegacyDec().Mul(poolManagerParams.TakerFeeParams.NonOsmoTakerFeeDistribution.CommunityPool) - nonOsmoTakerFeeToCommunityPoolCoins := sdk.NewCoins(sdk.NewCoin(tokenIn.Denom, nonOsmoTakerFeeToCommunityPoolDec.TruncateInt())) - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, feeCollectorForCommunityPoolName, nonOsmoTakerFeeToCommunityPoolCoins) + nonOsmoTakerFeeToCommunityPoolCoin := sdk.NewCoin(tokenIn.Denom, nonOsmoTakerFeeToCommunityPoolDec.TruncateInt()) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, feeCollectorForCommunityPoolName, sdk.NewCoins(nonOsmoTakerFeeToCommunityPoolCoin)) if err != nil { return sdk.Coin{}, err } - takerFeeAmtRemaining = takerFeeAmtRemaining.Sub(nonOsmoTakerFeeToCommunityPoolCoins.AmountOf(tokenIn.Denom)) + k.IncreaseTakerFeeTrackerForCommunityPool(ctx, nonOsmoTakerFeeToCommunityPoolCoin) + takerFeeAmtRemaining = takerFeeAmtRemaining.Sub(nonOsmoTakerFeeToCommunityPoolCoin.Amount) } } // Staking Rewards: if poolManagerParams.TakerFeeParams.NonOsmoTakerFeeDistribution.StakingRewards.GT(osmomath.ZeroDec()) { // Non Osmo staking rewards are sent to the non native fee pool module account - nonOsmoTakerFeeToStakingRewardsCoins := sdk.NewCoins(sdk.NewCoin(takerFeeCoin.Denom, takerFeeAmtRemaining)) - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, feeCollectorForStakingRewardsName, nonOsmoTakerFeeToStakingRewardsCoins) + nonOsmoTakerFeeToStakingRewardsCoin := sdk.NewCoin(takerFeeCoin.Denom, takerFeeAmtRemaining) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, feeCollectorForStakingRewardsName, sdk.NewCoins(nonOsmoTakerFeeToStakingRewardsCoin)) if err != nil { return sdk.Coin{}, err } + k.IncreaseTakerFeeTrackerForStakers(ctx, nonOsmoTakerFeeToStakingRewardsCoin) } } diff --git a/x/poolmanager/taker_fee_test.go b/x/poolmanager/taker_fee_test.go index 425c10522d0..c50776f55f8 100644 --- a/x/poolmanager/taker_fee_test.go +++ b/x/poolmanager/taker_fee_test.go @@ -19,7 +19,7 @@ func (s *KeeperTestSuite) TestChargeTakerFee() { var ( defaultTakerFee = osmomath.MustNewDecFromStr("0.01") - defaultAmount = sdk.NewInt(100) + defaultAmount = sdk.NewInt(10000000) ) tests := map[string]struct { @@ -89,17 +89,36 @@ func (s *KeeperTestSuite) TestChargeTakerFee() { // Pre-fund owner. s.FundAcc(s.TestAccs[tc.senderIndex], sdk.NewCoins(tc.tokenIn)) + // Check the taker fee tracker before the taker fee is charged. + takerFeeTrackerForStakersBefore := poolManager.GetTakerFeeTrackerForStakers(s.Ctx) + takerFeeTrackerForCommunityPoolBefore := poolManager.GetTakerFeeTrackerForCommunityPool(s.Ctx) + // System under test. tokenInAfterTakerFee, err := poolManager.ChargeTakerFee(s.Ctx, tc.tokenIn, tc.tokenOutDenom, s.TestAccs[tc.senderIndex], tc.exactIn) + // Check the taker fee tracker after the taker fee is charged. + takerFeeTrackerForStakersAfter := poolManager.GetTakerFeeTrackerForStakers(s.Ctx) + takerFeeTrackerForCommunityPoolAfter := poolManager.GetTakerFeeTrackerForCommunityPool(s.Ctx) + if tc.expectError != nil { s.Require().Error(err) + s.Require().Equal(takerFeeTrackerForStakersBefore, takerFeeTrackerForStakersAfter) + s.Require().Equal(takerFeeTrackerForCommunityPoolBefore, takerFeeTrackerForCommunityPoolAfter) return } s.Require().NoError(err) + params := s.App.PoolManagerKeeper.GetParams(s.Ctx) + expectedTotalTakerFee := defaultAmount.Sub(tc.expectedResult.Amount) + expectedTakerFeeToStakersAmount := expectedTotalTakerFee.ToLegacyDec().Mul(params.TakerFeeParams.NonOsmoTakerFeeDistribution.StakingRewards) + expectedTakerFeeToCommunityPoolAmount := expectedTotalTakerFee.ToLegacyDec().Mul(params.TakerFeeParams.NonOsmoTakerFeeDistribution.CommunityPool) + expectedTakerFeeToStakers := sdk.NewCoin(tc.expectedResult.Denom, expectedTakerFeeToStakersAmount.TruncateInt()) + expectedTakerFeeToCommunityPool := sdk.NewCoin(tc.expectedResult.Denom, expectedTakerFeeToCommunityPoolAmount.TruncateInt()) + // Validate results. s.Require().Equal(tc.expectedResult.String(), tokenInAfterTakerFee.String()) + s.Require().Equal(takerFeeTrackerForStakersBefore.Add(expectedTakerFeeToStakers), takerFeeTrackerForStakersAfter) + s.Require().Equal(takerFeeTrackerForCommunityPoolBefore.Add(expectedTakerFeeToCommunityPool), takerFeeTrackerForCommunityPoolAfter) }) } } diff --git a/x/poolmanager/types/genesis.pb.go b/x/poolmanager/types/genesis.pb.go index 8016a945a5d..d6b7d42afe5 100644 --- a/x/poolmanager/types/genesis.pb.go +++ b/x/poolmanager/types/genesis.pb.go @@ -107,6 +107,9 @@ type GenesisState struct { Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` // pool_routes is the container of the mappings from pool id to pool type. PoolRoutes []ModuleRoute `protobuf:"bytes,3,rep,name=pool_routes,json=poolRoutes,proto3" json:"pool_routes"` + // KVStore state + TakerFeesToStakersTracker *TakerFeesToStakersTracker `protobuf:"bytes,4,opt,name=taker_fees_to_stakers_tracker,json=takerFeesToStakersTracker,proto3" json:"taker_fees_to_stakers_tracker,omitempty"` + TakerFeesToCommunityPoolTracker *TakerFeesToCommunityPoolTracker `protobuf:"bytes,5,opt,name=taker_fees_to_community_pool_tracker,json=takerFeesToCommunityPoolTracker,proto3" json:"taker_fees_to_community_pool_tracker,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -163,6 +166,20 @@ func (m *GenesisState) GetPoolRoutes() []ModuleRoute { return nil } +func (m *GenesisState) GetTakerFeesToStakersTracker() *TakerFeesToStakersTracker { + if m != nil { + return m.TakerFeesToStakersTracker + } + return nil +} + +func (m *GenesisState) GetTakerFeesToCommunityPoolTracker() *TakerFeesToCommunityPoolTracker { + if m != nil { + return m.TakerFeesToCommunityPoolTracker + } + return nil +} + // TakerFeeParams consolidates the taker fee parameters for the poolmanager. type TakerFeeParams struct { // default_taker_fee is the fee used when creating a new pool that doesn't @@ -312,11 +329,117 @@ func (m *TakerFeeDistributionPercentage) XXX_DiscardUnknown() { var xxx_messageInfo_TakerFeeDistributionPercentage proto.InternalMessageInfo +type TakerFeesToStakersTracker struct { + TakerFeesToStakers github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=taker_fees_to_stakers,json=takerFeesToStakers,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_stakers"` + HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` +} + +func (m *TakerFeesToStakersTracker) Reset() { *m = TakerFeesToStakersTracker{} } +func (m *TakerFeesToStakersTracker) String() string { return proto.CompactTextString(m) } +func (*TakerFeesToStakersTracker) ProtoMessage() {} +func (*TakerFeesToStakersTracker) Descriptor() ([]byte, []int) { + return fileDescriptor_aa099d9fbdf68b35, []int{4} +} +func (m *TakerFeesToStakersTracker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TakerFeesToStakersTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TakerFeesToStakersTracker.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TakerFeesToStakersTracker) XXX_Merge(src proto.Message) { + xxx_messageInfo_TakerFeesToStakersTracker.Merge(m, src) +} +func (m *TakerFeesToStakersTracker) XXX_Size() int { + return m.Size() +} +func (m *TakerFeesToStakersTracker) XXX_DiscardUnknown() { + xxx_messageInfo_TakerFeesToStakersTracker.DiscardUnknown(m) +} + +var xxx_messageInfo_TakerFeesToStakersTracker proto.InternalMessageInfo + +func (m *TakerFeesToStakersTracker) GetTakerFeesToStakers() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.TakerFeesToStakers + } + return nil +} + +func (m *TakerFeesToStakersTracker) GetHeightAccountingStartsFrom() uint64 { + if m != nil { + return m.HeightAccountingStartsFrom + } + return 0 +} + +type TakerFeesToCommunityPoolTracker struct { + TakerFeesToCommunityPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=taker_fees_to_community_pool,json=takerFeesToCommunityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_community_pool"` + HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` +} + +func (m *TakerFeesToCommunityPoolTracker) Reset() { *m = TakerFeesToCommunityPoolTracker{} } +func (m *TakerFeesToCommunityPoolTracker) String() string { return proto.CompactTextString(m) } +func (*TakerFeesToCommunityPoolTracker) ProtoMessage() {} +func (*TakerFeesToCommunityPoolTracker) Descriptor() ([]byte, []int) { + return fileDescriptor_aa099d9fbdf68b35, []int{5} +} +func (m *TakerFeesToCommunityPoolTracker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TakerFeesToCommunityPoolTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TakerFeesToCommunityPoolTracker.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TakerFeesToCommunityPoolTracker) XXX_Merge(src proto.Message) { + xxx_messageInfo_TakerFeesToCommunityPoolTracker.Merge(m, src) +} +func (m *TakerFeesToCommunityPoolTracker) XXX_Size() int { + return m.Size() +} +func (m *TakerFeesToCommunityPoolTracker) XXX_DiscardUnknown() { + xxx_messageInfo_TakerFeesToCommunityPoolTracker.DiscardUnknown(m) +} + +var xxx_messageInfo_TakerFeesToCommunityPoolTracker proto.InternalMessageInfo + +func (m *TakerFeesToCommunityPoolTracker) GetTakerFeesToCommunityPool() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.TakerFeesToCommunityPool + } + return nil +} + +func (m *TakerFeesToCommunityPoolTracker) GetHeightAccountingStartsFrom() uint64 { + if m != nil { + return m.HeightAccountingStartsFrom + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "osmosis.poolmanager.v1beta1.Params") proto.RegisterType((*GenesisState)(nil), "osmosis.poolmanager.v1beta1.GenesisState") proto.RegisterType((*TakerFeeParams)(nil), "osmosis.poolmanager.v1beta1.TakerFeeParams") proto.RegisterType((*TakerFeeDistributionPercentage)(nil), "osmosis.poolmanager.v1beta1.TakerFeeDistributionPercentage") + proto.RegisterType((*TakerFeesToStakersTracker)(nil), "osmosis.poolmanager.v1beta1.TakerFeesToStakersTracker") + proto.RegisterType((*TakerFeesToCommunityPoolTracker)(nil), "osmosis.poolmanager.v1beta1.TakerFeesToCommunityPoolTracker") } func init() { @@ -324,61 +447,71 @@ func init() { } var fileDescriptor_aa099d9fbdf68b35 = []byte{ - // 855 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0xdc, 0x44, - 0x14, 0x8f, 0x9b, 0xb0, 0x52, 0x26, 0x65, 0x97, 0x1a, 0x42, 0xdd, 0x04, 0xd9, 0x2b, 0xf7, 0xb2, - 0x08, 0xd5, 0xa6, 0x41, 0x2a, 0x12, 0xd0, 0x43, 0x36, 0x51, 0x10, 0x52, 0x69, 0x53, 0x37, 0x12, - 0x52, 0x2f, 0xa3, 0x59, 0xcf, 0x8b, 0x63, 0x65, 0xed, 0xb7, 0x78, 0xc6, 0x49, 0x97, 0xaf, 0xc0, - 0x05, 0x89, 0x2b, 0x67, 0x0e, 0xdc, 0xf8, 0x0e, 0x1c, 0x7a, 0xec, 0x11, 0x71, 0x30, 0x68, 0x73, - 0xe6, 0xb2, 0x9f, 0x00, 0x79, 0x66, 0x76, 0x13, 0x87, 0x64, 0x15, 0xc1, 0x69, 0x77, 0xde, 0x7b, - 0xbf, 0xdf, 0xbc, 0xdf, 0xfb, 0xe3, 0x21, 0x1f, 0xa2, 0xc8, 0x50, 0xa4, 0x22, 0x1c, 0x21, 0x0e, - 0x33, 0x96, 0xb3, 0x04, 0x8a, 0xf0, 0xe4, 0xe1, 0x00, 0x24, 0x7b, 0x18, 0x26, 0x90, 0x83, 0x48, - 0x45, 0x30, 0x2a, 0x50, 0xa2, 0xbd, 0x69, 0x42, 0x83, 0x0b, 0xa1, 0x81, 0x09, 0xdd, 0x78, 0x2f, - 0xc1, 0x04, 0x55, 0x5c, 0x58, 0xff, 0xd3, 0x90, 0x8d, 0x7b, 0x09, 0x62, 0x32, 0x84, 0x50, 0x9d, - 0x06, 0xe5, 0x61, 0xc8, 0xf2, 0xf1, 0xcc, 0x15, 0x2b, 0x3a, 0xaa, 0x31, 0xfa, 0x60, 0x5c, 0xee, - 0x65, 0x14, 0x2f, 0x0b, 0x26, 0x53, 0xcc, 0x67, 0x7e, 0x1d, 0x1d, 0x0e, 0x98, 0x80, 0x79, 0xae, - 0x31, 0xa6, 0x33, 0x7f, 0xb0, 0x48, 0x53, 0x86, 0xbc, 0x1c, 0x02, 0x2d, 0xb0, 0x94, 0xa0, 0xe3, - 0xfd, 0xe9, 0x2d, 0xd2, 0xda, 0x67, 0x05, 0xcb, 0x84, 0xfd, 0xa3, 0x45, 0xee, 0xd4, 0x28, 0x1a, - 0x17, 0xa0, 0xae, 0xa4, 0x87, 0x00, 0x8e, 0xd5, 0x5d, 0xee, 0xad, 0x6d, 0xdd, 0x0b, 0x4c, 0x96, - 0xf5, 0xbd, 0x33, 0xe1, 0xc1, 0x0e, 0xa6, 0x79, 0xff, 0xc9, 0xeb, 0xca, 0x5b, 0x9a, 0x56, 0x9e, - 0x33, 0x66, 0xd9, 0xf0, 0x33, 0xff, 0x5f, 0x0c, 0xfe, 0x2f, 0x7f, 0x7a, 0xbd, 0x24, 0x95, 0x47, - 0xe5, 0x20, 0x88, 0x31, 0x33, 0x72, 0xcd, 0xcf, 0x03, 0xc1, 0x8f, 0x43, 0x39, 0x1e, 0x81, 0x50, - 0x64, 0x22, 0xea, 0x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83, 0x96, 0x7a, 0x93, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7d, - 0x1e, 0x36, 0xaf, 0x99, 0x07, 0x00, 0x00, + // 1021 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x26, 0x21, 0x52, 0x26, 0x25, 0xa1, 0x03, 0xa1, 0x9b, 0xa4, 0xf5, 0x5a, 0xdb, 0x1e, + 0x8c, 0x50, 0x77, 0xdb, 0x20, 0x05, 0x09, 0xda, 0x43, 0x9c, 0x28, 0x08, 0xa9, 0xb4, 0xe9, 0xc6, + 0x12, 0x52, 0x2f, 0xa3, 0xf1, 0xee, 0xf3, 0x7a, 0x65, 0xef, 0x8e, 0xd9, 0x99, 0x4d, 0x62, 0x0e, + 0x9c, 0x91, 0x7a, 0x41, 0xe2, 0xda, 0x33, 0x07, 0x6e, 0xfc, 0x8b, 0x1e, 0x38, 0xf4, 0x88, 0x38, + 0x2c, 0xc8, 0x39, 0x73, 0xf1, 0x2f, 0x40, 0x33, 0xb3, 0xeb, 0xc4, 0x69, 0xec, 0x1a, 0x10, 0x3d, + 0x25, 0xf3, 0xde, 0xfb, 0xbe, 0xf9, 0xde, 0x9b, 0xf7, 0x9e, 0x17, 0x7d, 0xc4, 0x78, 0xcc, 0x78, + 0xc4, 0xdd, 0x1e, 0x63, 0xdd, 0x98, 0x26, 0x34, 0x84, 0xd4, 0x3d, 0xbe, 0xdf, 0x04, 0x41, 0xef, + 0xbb, 0x21, 0x24, 0xc0, 0x23, 0xee, 0xf4, 0x52, 0x26, 0x18, 0xde, 0x2a, 0x42, 0x9d, 0x0b, 0xa1, + 0x4e, 0x11, 0xba, 0xf9, 0x41, 0xc8, 0x42, 0xa6, 0xe2, 0x5c, 0xf9, 0x9f, 0x86, 0x6c, 0x6e, 0x84, + 0x8c, 0x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5b, 0x10, 0xea, 0xfb, 0x2c, 0x4b, + 0x84, 0x2c, 0x18, 0x17, 0x34, 0x15, 0x9c, 0xb4, 0x52, 0x16, 0xab, 0x8a, 0x2c, 0xd6, 0x6b, 0xc3, + 0xdc, 0xba, 0xa3, 0xd3, 0x9d, 0x1a, 0x6e, 0x7b, 0x9b, 0xda, 0xbf, 0x3b, 0x72, 0x1f, 0x29, 0xef, + 0x81, 0x74, 0xbe, 0x98, 0x47, 0xd6, 0x1b, 0xb6, 0xa9, 0x5c, 0xdd, 0x37, 0xa7, 0xad, 0xee, 0xff, + 0xa3, 0x30, 0xe6, 0xa4, 0x0d, 0xfe, 0x56, 0xcb, 0x53, 0x7f, 0xfa, 0x72, 0x50, 0x31, 0x5e, 0x0d, + 0x2a, 0xc6, 0x9f, 0x83, 0x8a, 0xf1, 0xc3, 0x59, 0x65, 0xee, 0xd5, 0x59, 0x65, 0xee, 0xb7, 0xb3, + 0xca, 0xdc, 0xb3, 0x4f, 0x2f, 0xa4, 0x52, 0xec, 0xc2, 0xbb, 0x5d, 0xda, 0xe4, 0xe5, 0xc1, 0x3d, + 0xde, 0xbe, 0xe7, 0x9e, 0x8e, 0x7d, 0xd3, 0xa9, 0xfc, 0x9a, 0x4b, 0xea, 0x2b, 0xee, 0x93, 0xbf, + 0x03, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x07, 0xe9, 0x1d, 0xcb, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -457,6 +590,30 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.TakerFeesToCommunityPoolTracker != nil { + { + size, err := m.TakerFeesToCommunityPoolTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.TakerFeesToStakersTracker != nil { + { + size, err := m.TakerFeesToStakersTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if len(m.PoolRoutes) > 0 { for iNdEx := len(m.PoolRoutes) - 1; iNdEx >= 0; iNdEx-- { { @@ -610,6 +767,90 @@ func (m *TakerFeeDistributionPercentage) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *TakerFeesToStakersTracker) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TakerFeesToStakersTracker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TakerFeesToStakersTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HeightAccountingStartsFrom != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.HeightAccountingStartsFrom)) + i-- + dAtA[i] = 0x10 + } + if len(m.TakerFeesToStakers) > 0 { + for iNdEx := len(m.TakerFeesToStakers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TakerFeesToStakers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *TakerFeesToCommunityPoolTracker) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TakerFeesToCommunityPoolTracker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TakerFeesToCommunityPoolTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HeightAccountingStartsFrom != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.HeightAccountingStartsFrom)) + i-- + dAtA[i] = 0x10 + } + if len(m.TakerFeesToCommunityPool) > 0 { + for iNdEx := len(m.TakerFeesToCommunityPool) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TakerFeesToCommunityPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -661,6 +902,14 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if m.TakerFeesToStakersTracker != nil { + l = m.TakerFeesToStakersTracker.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.TakerFeesToCommunityPoolTracker != nil { + l = m.TakerFeesToCommunityPoolTracker.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -708,6 +957,42 @@ func (m *TakerFeeDistributionPercentage) Size() (n int) { return n } +func (m *TakerFeesToStakersTracker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TakerFeesToStakers) > 0 { + for _, e := range m.TakerFeesToStakers { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.HeightAccountingStartsFrom != 0 { + n += 1 + sovGenesis(uint64(m.HeightAccountingStartsFrom)) + } + return n +} + +func (m *TakerFeesToCommunityPoolTracker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TakerFeesToCommunityPool) > 0 { + for _, e := range m.TakerFeesToCommunityPool { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.HeightAccountingStartsFrom != 0 { + n += 1 + sovGenesis(uint64(m.HeightAccountingStartsFrom)) + } + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -978,6 +1263,78 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToStakersTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TakerFeesToStakersTracker == nil { + m.TakerFeesToStakersTracker = &TakerFeesToStakersTracker{} + } + if err := m.TakerFeesToStakersTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToCommunityPoolTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TakerFeesToCommunityPoolTracker == nil { + m.TakerFeesToCommunityPoolTracker = &TakerFeesToCommunityPoolTracker{} + } + if err := m.TakerFeesToCommunityPoolTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -1363,6 +1720,212 @@ func (m *TakerFeeDistributionPercentage) Unmarshal(dAtA []byte) error { } return nil } +func (m *TakerFeesToStakersTracker) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TakerFeesToStakersTracker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TakerFeesToStakersTracker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToStakers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TakerFeesToStakers = append(m.TakerFeesToStakers, types.Coin{}) + if err := m.TakerFeesToStakers[len(m.TakerFeesToStakers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeightAccountingStartsFrom", wireType) + } + m.HeightAccountingStartsFrom = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TakerFeesToCommunityPoolTracker) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TakerFeesToCommunityPoolTracker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TakerFeesToCommunityPoolTracker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToCommunityPool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TakerFeesToCommunityPool = append(m.TakerFeesToCommunityPool, types.Coin{}) + if err := m.TakerFeesToCommunityPool[len(m.TakerFeesToCommunityPool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeightAccountingStartsFrom", wireType) + } + m.HeightAccountingStartsFrom = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/poolmanager/types/keys.go b/x/poolmanager/types/keys.go index 41a76bbf631..93b0e17890b 100644 --- a/x/poolmanager/types/keys.go +++ b/x/poolmanager/types/keys.go @@ -28,6 +28,15 @@ var ( // DenomTradePairPrefix defines prefix to store denom trade pair for taker fee. DenomTradePairPrefix = []byte{0x04} + + // KeyTakerFeeStakersProtoRev defines key to store the taker fee for stakers tracker. + KeyTakerFeeStakersProtoRev = []byte{0x05} + + // KeyTakerFeeCommunityPoolProtoRev defines key to store the taker fee for community pool tracker. + KeyTakerFeeCommunityPoolProtoRev = []byte{0x06} + + // KeyTakerFeeProtoRevAccountingHeight defines key to store the accounting height for the above taker fee trackers. + KeyTakerFeeProtoRevAccountingHeight = []byte{0x07} ) // ModuleRouteToBytes serializes moduleRoute to bytes. diff --git a/x/protorev/keeper/genesis.go b/x/protorev/keeper/genesis.go index 2f013e8c9e8..6d4b9c81498 100644 --- a/x/protorev/keeper/genesis.go +++ b/x/protorev/keeper/genesis.go @@ -86,6 +86,16 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { panic(err) } } + + // Since we now track all aspects of protocol revenue, we need to take a snapshot of cyclic arb profits from this module at a certain block height. + // This allows us to display how much protocol revenue has been generated since block "X" instead of just since the module was initialized. + if genState.CyclicArbTracker != nil { + k.SetCyclicArbProfitTrackerValue(ctx, genState.CyclicArbTracker.CyclicArb) + k.SetCyclicArbProfitTrackerStartHeight(ctx, genState.CyclicArbTracker.HeightAccountingStartsFrom) + } else { + k.SetCyclicArbProfitTrackerValue(ctx, genState.Profits) + k.SetCyclicArbProfitTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + } } // ExportGenesis returns the module's exported genesis. ExportGenesis intentionally ignores a few of the errors thrown @@ -155,5 +165,12 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // Export the profits that have been collected by Protorev. genesis.Profits = k.GetAllProfits(ctx) + // Export the profits that have been collected by Protorev since a certain block height. + cyclicArbTracker := types.CyclicArbTracker{ + CyclicArb: k.GetCyclicArbProfitTrackerValue(ctx), + HeightAccountingStartsFrom: k.GetCyclicArbProfitTrackerStartHeight(ctx), + } + genesis.CyclicArbTracker = &cyclicArbTracker + return genesis } diff --git a/x/protorev/keeper/genesis_test.go b/x/protorev/keeper/genesis_test.go index 3ddba2cfd88..5555d249aba 100644 --- a/x/protorev/keeper/genesis_test.go +++ b/x/protorev/keeper/genesis_test.go @@ -60,4 +60,10 @@ func (s *KeeperTestSuite) TestInitGenesis() { profits := s.App.ProtoRevKeeper.GetAllProfits(s.Ctx) s.Require().Equal(len(profits), len(exportedGenesis.Profits)) s.Require().Equal(profits, exportedGenesis.Profits) + + cyclicArbProfit := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx) + s.Require().Equal(cyclicArbProfit, exportedGenesis.CyclicArbTracker.CyclicArb) + + cyclicArbProfitAccountingHeight := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerStartHeight(s.Ctx) + s.Require().Equal(cyclicArbProfitAccountingHeight, exportedGenesis.CyclicArbTracker.HeightAccountingStartsFrom) } diff --git a/x/protorev/keeper/grpc_query.go b/x/protorev/keeper/grpc_query.go index fa9d636588c..00edbebd38a 100644 --- a/x/protorev/keeper/grpc_query.go +++ b/x/protorev/keeper/grpc_query.go @@ -246,3 +246,11 @@ func (q Querier) GetProtoRevPool(c context.Context, req *types.QueryGetProtoRevP return &types.QueryGetProtoRevPoolResponse{PoolId: poolId}, nil } + +// GetAllProtocolRevenue queries all types of protocol revenue (txfees, taker fees, and cyclic arbitrage profits) +func (q Querier) GetAllProtocolRevenue(c context.Context, req *types.QueryGetAllProtocolRevenueRequest) (*types.QueryGetAllProtocolRevenueResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + allProtocolRevenue := q.Keeper.GetAllProtocolRevenue(ctx) + + return &types.QueryGetAllProtocolRevenueResponse{AllProtocolRevenue: allProtocolRevenue}, nil +} diff --git a/x/protorev/keeper/grpc_query_test.go b/x/protorev/keeper/grpc_query_test.go index 9107a379569..2da9c8f67dc 100644 --- a/x/protorev/keeper/grpc_query_test.go +++ b/x/protorev/keeper/grpc_query_test.go @@ -380,3 +380,69 @@ func (s *KeeperTestSuite) TestGetProtoRevPool() { s.Require().NoError(err) s.Require().Equal(res.PoolId, uint64(1)) } + +// TestGetAllProtocolRevenue tests the query for all protocol revenue profits +func (s *KeeperTestSuite) TestGetAllProtocolRevenueGRPCQuery() { + poolManagerParams := s.App.PoolManagerKeeper.GetParams(s.Ctx) + poolManagerParams.TakerFeeParams.DefaultTakerFee = sdk.MustNewDecFromStr("0.02") + s.App.PoolManagerKeeper.SetParams(s.Ctx, poolManagerParams) + + req := &types.QueryGetAllProtocolRevenueRequest{} + res, err := s.queryClient.GetAllProtocolRevenue(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err) + s.Require().Empty(res.AllProtocolRevenue) + + // Swap on a pool to charge taker fee + swapInCoin := sdk.NewCoin("Atom", osmomath.NewInt(1000)) + s.FundAcc(s.TestAccs[0], sdk.NewCoins(sdk.NewCoin("Atom", osmomath.NewInt(10000)))) + poolId := s.PrepareBalancerPoolWithCoins(sdk.NewCoins(sdk.NewCoin("Atom", osmomath.NewInt(10000)), sdk.NewCoin("Akash", osmomath.NewInt(10000)))...) + _, err = s.App.PoolManagerKeeper.SwapExactAmountIn(s.Ctx, s.TestAccs[0], poolId, swapInCoin, "Akash", sdk.ZeroInt()) + s.Require().NoError(err) + expectedTakerFeeFromInput := swapInCoin.Amount.ToLegacyDec().Mul(poolManagerParams.TakerFeeParams.DefaultTakerFee) + expectedTakerFeeToCommunityPoolAmt := expectedTakerFeeFromInput.Mul(poolManagerParams.TakerFeeParams.NonOsmoTakerFeeDistribution.CommunityPool).TruncateInt() + expectedTakerFeeToStakersAmt := expectedTakerFeeFromInput.Sub(expectedTakerFeeToCommunityPoolAmt.ToLegacyDec()).TruncateInt() + expectedTakerFeeToStakers := sdk.NewCoins(sdk.NewCoin("Atom", expectedTakerFeeToStakersAmt)) + expectedTakerFeeToCommunityPool := sdk.NewCoins(sdk.NewCoin("Atom", expectedTakerFeeToCommunityPoolAmt)) + + // Charge txfee of 1000 uion + txFeeCharged := sdk.NewCoins(sdk.NewCoin("uion", osmomath.NewInt(1000))) + s.SetupTxFeeAnteHandlerAndChargeFee(s.clientCtx, sdk.NewDecCoins(sdk.NewInt64DecCoin("uion", 1000000)), 0, true, false, txFeeCharged) + + // Psuedo collect cyclic arb profits + cyclicArbProfits := sdk.NewCoins(sdk.NewCoin(types.OsmosisDenomination, osmomath.NewInt(9000)), sdk.NewCoin("Atom", osmomath.NewInt(3000))) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[0].Denom, cyclicArbProfits[0].Amount) + s.Require().NoError(err) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[1].Denom, cyclicArbProfits[1].Amount) + s.Require().NoError(err) + + // Check protocol revenue + 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.TakerFeesToStakersTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool, res.AllProtocolRevenue.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + + // A second round of the same thing + // Swap on a pool to charge taker fee + s.FundAcc(s.TestAccs[0], sdk.NewCoins(sdk.NewCoin("Atom", osmomath.NewInt(10000)))) + _, err = s.App.PoolManagerKeeper.SwapExactAmountIn(s.Ctx, s.TestAccs[0], poolId, swapInCoin, "Akash", sdk.ZeroInt()) + s.Require().NoError(err) + + // Charge txfee of 1000 uion + s.SetupTxFeeAnteHandlerAndChargeFee(s.clientCtx, sdk.NewDecCoins(sdk.NewInt64DecCoin("uion", 1000000)), 0, true, false, txFeeCharged) + + // Psuedo collect cyclic arb profits + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[0].Denom, cyclicArbProfits[0].Amount) + s.Require().NoError(err) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[1].Denom, cyclicArbProfits[1].Amount) + s.Require().NoError(err) + + // Check protocol revenue + 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.TakerFeesToStakersTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), res.AllProtocolRevenue.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) +} diff --git a/x/protorev/keeper/keeper.go b/x/protorev/keeper/keeper.go index b01b1ce09ef..5c2abe4e37e 100644 --- a/x/protorev/keeper/keeper.go +++ b/x/protorev/keeper/keeper.go @@ -25,6 +25,7 @@ type ( epochKeeper types.EpochKeeper poolmanagerKeeper types.PoolManagerKeeper concentratedLiquidityKeeper types.ConcentratedLiquidityKeeper + txfeesKeeper types.TxFeesKeeper } ) @@ -38,6 +39,7 @@ 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() { @@ -54,9 +56,14 @@ 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 +} diff --git a/x/protorev/keeper/protorev.go b/x/protorev/keeper/protorev.go index 36d9af18551..947e4f549c6 100644 --- a/x/protorev/keeper/protorev.go +++ b/x/protorev/keeper/protorev.go @@ -4,7 +4,9 @@ import ( "errors" "fmt" + poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" "github.com/osmosis-labs/osmosis/v20/x/protorev/types" + txfeestypes "github.com/osmosis-labs/osmosis/v20/x/txfees/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -483,3 +485,44 @@ func (k Keeper) SetInfoByPoolType(ctx sdk.Context, poolWeights types.InfoByPoolT store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixInfoByPoolType) osmoutils.MustSet(store, types.KeyPrefixInfoByPoolType, &poolWeights) } + +// GetAllProtocolRevenue returns all types of protocol revenue (txfees, taker fees, and cyclic arb profits), as well as the block height from which we started accounting +// for each of these revenue sources. +func (k Keeper) GetAllProtocolRevenue(ctx sdk.Context) types.AllProtocolRevenue { + takerFeesToStakers := k.poolmanagerKeeper.GetTakerFeeTrackerForStakers(ctx) + takerFeesToCommunityPool := k.poolmanagerKeeper.GetTakerFeeTrackerForCommunityPool(ctx) + takerFeesAccountingHeight := k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx) + + txFees := k.txfeesKeeper.GetTxFeesTrackerValue(ctx) + txFeesAccountingHeight := k.txfeesKeeper.GetTxFeesTrackerStartHeight(ctx) + + currentCyclicArb := k.GetAllProfits(ctx) + currentCyclicArbCoins := osmoutils.ConvertCoinArrayToCoins(currentCyclicArb) + + cyclicArbTracker := types.CyclicArbTracker{ + CyclicArb: currentCyclicArbCoins.Sub(k.GetCyclicArbProfitTrackerValue(ctx)), + HeightAccountingStartsFrom: k.GetCyclicArbProfitTrackerStartHeight(ctx), + } + + takerFeesToStakersTracker := poolmanagertypes.TakerFeesToStakersTracker{ + TakerFeesToStakers: takerFeesToStakers, + HeightAccountingStartsFrom: takerFeesAccountingHeight, + } + + takerFeesToCommunityPoolTracker := poolmanagertypes.TakerFeesToCommunityPoolTracker{ + TakerFeesToCommunityPool: takerFeesToCommunityPool, + HeightAccountingStartsFrom: takerFeesAccountingHeight, + } + + txFeesTracker := txfeestypes.TxFeesTracker{ + TxFees: txFees, + HeightAccountingStartsFrom: txFeesAccountingHeight, + } + + return types.AllProtocolRevenue{ + TakerFeesToStakersTracker: takerFeesToStakersTracker, + TakerFeesToCommunityPoolTracker: takerFeesToCommunityPoolTracker, + TxFeesTracker: txFeesTracker, + CyclicArbTracker: cyclicArbTracker, + } +} diff --git a/x/protorev/keeper/protorev_test.go b/x/protorev/keeper/protorev_test.go index f3817ee3517..ba0e0824fe0 100644 --- a/x/protorev/keeper/protorev_test.go +++ b/x/protorev/keeper/protorev_test.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/osmosis-labs/osmosis/osmomath" + poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" "github.com/osmosis-labs/osmosis/v20/x/protorev/types" ) @@ -323,3 +324,64 @@ func (s *KeeperTestSuite) TestGetInfoByPoolType() { poolWeights := s.App.ProtoRevKeeper.GetInfoByPoolType(s.Ctx) s.Require().Equal(newRouteWeights, poolWeights) } + +func (s *KeeperTestSuite) TestGetAllProtocolRevenue() { + poolManagerParams := s.App.PoolManagerKeeper.GetParams(s.Ctx) + poolManagerParams.TakerFeeParams.DefaultTakerFee = sdk.MustNewDecFromStr("0.02") + s.App.PoolManagerKeeper.SetParams(s.Ctx, poolManagerParams) + + allProtoRev := s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx) + s.Require().Empty(allProtoRev) + + // Swap on a pool to charge taker fee + swapInCoin := sdk.NewCoin("Atom", osmomath.NewInt(1000)) + s.FundAcc(s.TestAccs[0], sdk.NewCoins(sdk.NewCoin("Atom", osmomath.NewInt(10000)))) + poolId := s.PrepareBalancerPoolWithCoins(sdk.NewCoins(sdk.NewCoin("Atom", osmomath.NewInt(10000)), sdk.NewCoin("Akash", osmomath.NewInt(10000)))...) + _, err := s.App.PoolManagerKeeper.SwapExactAmountIn(s.Ctx, s.TestAccs[0], poolId, swapInCoin, "Akash", sdk.ZeroInt()) + s.Require().NoError(err) + expectedTakerFeeFromInput := swapInCoin.Amount.ToLegacyDec().Mul(poolManagerParams.TakerFeeParams.DefaultTakerFee) + expectedTakerFeeToCommunityPoolAmt := expectedTakerFeeFromInput.Mul(poolManagerParams.TakerFeeParams.NonOsmoTakerFeeDistribution.CommunityPool).TruncateInt() + expectedTakerFeeToStakersAmt := expectedTakerFeeFromInput.Sub(expectedTakerFeeToCommunityPoolAmt.ToLegacyDec()).TruncateInt() + expectedTakerFeeToStakers := sdk.NewCoins(sdk.NewCoin("Atom", expectedTakerFeeToStakersAmt)) + expectedTakerFeeToCommunityPool := sdk.NewCoins(sdk.NewCoin("Atom", expectedTakerFeeToCommunityPoolAmt)) + + // Charge txfee of 1000 uion + txFeeCharged := sdk.NewCoins(sdk.NewCoin("uion", osmomath.NewInt(1000))) + s.SetupTxFeeAnteHandlerAndChargeFee(s.clientCtx, sdk.NewDecCoins(sdk.NewInt64DecCoin("uion", 1000000)), 0, true, false, txFeeCharged) + + // Psuedo collect cyclic arb profits + cyclicArbProfits := sdk.NewCoins(sdk.NewCoin(types.OsmosisDenomination, osmomath.NewInt(9000)), sdk.NewCoin("Atom", osmomath.NewInt(3000))) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[0].Denom, cyclicArbProfits[0].Amount) + s.Require().NoError(err) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[1].Denom, cyclicArbProfits[1].Amount) + s.Require().NoError(err) + + // 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.TakerFeesToStakersTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool, allProtoRev.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + + // A second round of the same thing + // Swap on a pool to charge taker fee + s.FundAcc(s.TestAccs[0], sdk.NewCoins(sdk.NewCoin("Atom", osmomath.NewInt(10000)))) + _, err = s.App.PoolManagerKeeper.SwapExactAmountIn(s.Ctx, s.TestAccs[0], poolId, swapInCoin, "Akash", sdk.ZeroInt()) + s.Require().NoError(err) + + // Charge txfee of 1000 uion + s.SetupTxFeeAnteHandlerAndChargeFee(s.clientCtx, sdk.NewDecCoins(sdk.NewInt64DecCoin("uion", 1000000)), 0, true, false, txFeeCharged) + + // Psuedo collect cyclic arb profits + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[0].Denom, cyclicArbProfits[0].Amount) + s.Require().NoError(err) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[1].Denom, cyclicArbProfits[1].Amount) + s.Require().NoError(err) + + // 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.TakerFeesToStakersTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), allProtoRev.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) +} diff --git a/x/protorev/keeper/statistics.go b/x/protorev/keeper/statistics.go index 82fc5304bc4..d03950c743f 100644 --- a/x/protorev/keeper/statistics.go +++ b/x/protorev/keeper/statistics.go @@ -7,7 +7,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + gogotypes "github.com/gogo/protobuf/types" + "github.com/osmosis-labs/osmosis/osmomath" + "github.com/osmosis-labs/osmosis/osmoutils" poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" "github.com/osmosis-labs/osmosis/v20/x/protorev/types" ) @@ -83,6 +86,46 @@ func (k Keeper) GetAllProfits(ctx sdk.Context) []sdk.Coin { return profits } +func (k Keeper) SetCyclicArbProfitTrackerValue(ctx sdk.Context, cyclicArbProfits sdk.Coins) { + newCyclicArbProfits := poolmanagertypes.TrackedVolume{ + Amount: cyclicArbProfits, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyCyclicArbTracker, &newCyclicArbProfits) +} + +func (k Keeper) GetCyclicArbProfitTrackerValue(ctx sdk.Context) (currentCyclicArbProfits sdk.Coins) { + var cyclicArbProfits poolmanagertypes.TrackedVolume + cyclicArbProfitsFound, err := osmoutils.Get(ctx.KVStore(k.storeKey), types.KeyCyclicArbTracker, &cyclicArbProfits) + if err != nil { + // We can only encounter an error if a database or serialization errors occurs, so we panic here. + // Normally this would be handled by `osmoutils.MustGet`, but since we want to specifically use `osmoutils.Get`, + // we also have to manually panic here. + panic(err) + } + + // If no volume was found, we treat the existing volume as 0. + // While we can technically require volume to exist, we would need to store empty coins in state for each pool (past and present), + // which is a high storage cost to pay for a weak guardrail. + currentCyclicArbProfits = sdk.NewCoins() + if cyclicArbProfitsFound { + currentCyclicArbProfits = cyclicArbProfits.Amount + } + + return currentCyclicArbProfits +} + +// GetCyclicArbProfitTrackerStartHeight gets the height from which we started accounting for cyclic arb profits. +func (k Keeper) GetCyclicArbProfitTrackerStartHeight(ctx sdk.Context) uint64 { + startHeight := gogotypes.UInt64Value{} + osmoutils.MustGet(ctx.KVStore(k.storeKey), types.KeyCyclicArbTrackerStartHeight, &startHeight) + return startHeight.Value +} + +// SetCyclicArbProfitTrackerStartHeight sets the height from which we started accounting for cyclic arb profits. +func (k Keeper) SetCyclicArbProfitTrackerStartHeight(ctx sdk.Context, startHeight uint64) { + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyCyclicArbTrackerStartHeight, &gogotypes.UInt64Value{Value: startHeight}) +} + // UpdateProfitsByDenom updates the profits made by the ProtoRev module for the given denom func (k Keeper) UpdateProfitsByDenom(ctx sdk.Context, denom string, tradeProfit osmomath.Int) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixProfitByDenom) diff --git a/x/protorev/keeper/statistics_test.go b/x/protorev/keeper/statistics_test.go index a56bbdd98e1..b1b8ae57b35 100644 --- a/x/protorev/keeper/statistics_test.go +++ b/x/protorev/keeper/statistics_test.go @@ -193,3 +193,87 @@ func (s *KeeperTestSuite) TestUpdateStatistics() { s.Require().NoError(err) s.Require().Equal(2, len(routes)) } + +func (s *KeeperTestSuite) TestGetSetCyclicArbProfitTrackerValue() { + tests := map[string]struct { + firstCyclicArbValue sdk.Coins + secondCyclicArbValue sdk.Coins + }{ + "happy path: replace single coin with increased single coin": { + firstCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(200))), + }, + "replace single coin with decreased single coin": { + firstCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(50))), + }, + "replace single coin with different denom": { + firstCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondCyclicArbValue: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + }, + "replace single coin with multiple coins": { + firstCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + }, + "replace multiple coins with single coin": { + firstCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + secondCyclicArbValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(200))), + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest() + + s.Require().Empty(s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx)) + + s.App.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(s.Ctx, tc.firstCyclicArbValue) + + actualFirstCyclicArbValue := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx) + + s.Require().Equal(tc.firstCyclicArbValue, actualFirstCyclicArbValue) + + s.App.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(s.Ctx, tc.secondCyclicArbValue) + + actualSecondCyclicArbValue := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx) + + s.Require().Equal(tc.secondCyclicArbValue, actualSecondCyclicArbValue) + }) + } +} + +func (s *KeeperTestSuite) TestGetSetCyclicArbProfitTrackerStartHeight() { + tests := map[string]struct { + firstCyclicArbStartHeight uint64 + secondCyclicArbStartHeight uint64 + }{ + "replace tracker height with a higher height": { + firstCyclicArbStartHeight: 100, + secondCyclicArbStartHeight: 5000, + }, + "replace tracker height with a lower height": { + firstCyclicArbStartHeight: 100, + secondCyclicArbStartHeight: 50, + }, + "replace tracker height back to zero": { + firstCyclicArbStartHeight: 100, + secondCyclicArbStartHeight: 0, + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest() + + s.Require().Empty(s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerStartHeight(s.Ctx)) + + s.App.ProtoRevKeeper.SetCyclicArbProfitTrackerStartHeight(s.Ctx, tc.firstCyclicArbStartHeight) + actualFirstCyclicArbStartHeight := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerStartHeight(s.Ctx) + s.Require().Equal(tc.firstCyclicArbStartHeight, actualFirstCyclicArbStartHeight) + + s.App.ProtoRevKeeper.SetCyclicArbProfitTrackerStartHeight(s.Ctx, tc.secondCyclicArbStartHeight) + actualSecondCyclicArbStartHeight := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerStartHeight(s.Ctx) + s.Require().Equal(tc.secondCyclicArbStartHeight, actualSecondCyclicArbStartHeight) + }) + } +} diff --git a/x/protorev/types/expected_keepers.go b/x/protorev/types/expected_keepers.go index 0dd170e2b9e..eef551587bb 100644 --- a/x/protorev/types/expected_keepers.go +++ b/x/protorev/types/expected_keepers.go @@ -60,6 +60,9 @@ type PoolManagerKeeper interface { GetPoolModule(ctx sdk.Context, poolId uint64) (poolmanagertypes.PoolModuleI, error) GetTotalPoolLiquidity(ctx sdk.Context, poolId uint64) (sdk.Coins, error) RouteGetPoolDenoms(ctx sdk.Context, poolId uint64) ([]string, error) + GetTakerFeeTrackerForStakers(ctx sdk.Context) sdk.Coins + GetTakerFeeTrackerForCommunityPool(ctx sdk.Context) sdk.Coins + GetTakerFeeTrackerStartHeight(ctx sdk.Context) uint64 } // EpochKeeper defines the Epoch contract that must be fulfilled when @@ -78,3 +81,8 @@ 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) uint64 +} diff --git a/x/protorev/types/genesis.go b/x/protorev/types/genesis.go index f1a81b654cb..9655408d492 100644 --- a/x/protorev/types/genesis.go +++ b/x/protorev/types/genesis.go @@ -39,6 +39,10 @@ var ( DefaultMaxPoolPointsPerTx = uint64(18) DefaultPoolPointsConsumedInBlock = uint64(0) DefaultProfits = []sdk.Coin{} + DefaultCyclicArbTracker = CyclicArbTracker{ + CyclicArb: sdk.Coins(nil), + HeightAccountingStartsFrom: 0, + } ) // DefaultGenesis returns the default genesis state @@ -56,6 +60,7 @@ func DefaultGenesis() *GenesisState { MaxPoolPointsPerTx: DefaultMaxPoolPointsPerTx, PointCountForBlock: DefaultPoolPointsConsumedInBlock, Profits: DefaultProfits, + CyclicArbTracker: &DefaultCyclicArbTracker, } } diff --git a/x/protorev/types/genesis.pb.go b/x/protorev/types/genesis.pb.go index fdb8297bfc5..a86665c46f4 100644 --- a/x/protorev/types/genesis.pb.go +++ b/x/protorev/types/genesis.pb.go @@ -60,7 +60,8 @@ type GenesisState struct { Profits []types.Coin `protobuf:"bytes,12,rep,name=profits,proto3" json:"profits" yaml:"profits"` // Information that is used to estimate execution time / gas // consumption of a swap on a given pool type. - InfoByPoolType InfoByPoolType `protobuf:"bytes,13,opt,name=info_by_pool_type,json=infoByPoolType,proto3" json:"info_by_pool_type" yaml:"info_by_pool_type"` + InfoByPoolType InfoByPoolType `protobuf:"bytes,13,opt,name=info_by_pool_type,json=infoByPoolType,proto3" json:"info_by_pool_type" yaml:"info_by_pool_type"` + CyclicArbTracker *CyclicArbTracker `protobuf:"bytes,14,opt,name=cyclic_arb_tracker,json=cyclicArbTracker,proto3" json:"cyclic_arb_tracker,omitempty" yaml:"cyclic_arb_tracker"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -187,6 +188,13 @@ func (m *GenesisState) GetInfoByPoolType() InfoByPoolType { return InfoByPoolType{} } +func (m *GenesisState) GetCyclicArbTracker() *CyclicArbTracker { + if m != nil { + return m.CyclicArbTracker + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "osmosis.protorev.v1beta1.GenesisState") } @@ -196,53 +204,56 @@ func init() { } var fileDescriptor_3c77fc2da5752af2 = []byte{ - // 727 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0xc7, 0xe3, 0xdb, 0xde, 0xf6, 0x76, 0xd2, 0x46, 0xb7, 0xd3, 0x9b, 0xca, 0xc9, 0xa5, 0x8e, - 0x31, 0x2d, 0x64, 0x41, 0x6d, 0x5a, 0x58, 0xb1, 0x40, 0xaa, 0x8b, 0x0a, 0x08, 0x51, 0x45, 0x6e, - 0x11, 0x12, 0x48, 0x0c, 0xe3, 0x64, 0x92, 0x5a, 0xb5, 0x3d, 0x96, 0x67, 0x12, 0x92, 0x07, 0x60, - 0xcf, 0xc3, 0xf0, 0x10, 0x5d, 0x56, 0xac, 0x58, 0x45, 0xa8, 0x7d, 0x83, 0x3c, 0x01, 0xf2, 0xcc, - 0x24, 0xe9, 0x47, 0x0c, 0x3b, 0xcf, 0x39, 0xbf, 0xf3, 0xff, 0x9f, 0x33, 0x1f, 0x06, 0xf7, 0x29, - 0x8b, 0x28, 0x0b, 0x98, 0x93, 0xa4, 0x94, 0xd3, 0x94, 0xf4, 0x9c, 0xde, 0x8e, 0x4f, 0x38, 0xde, - 0x71, 0x3a, 0x24, 0x26, 0x2c, 0x60, 0xb6, 0x48, 0x40, 0x5d, 0x71, 0xf6, 0x98, 0xb3, 0x15, 0x57, - 0xfd, 0xaf, 0x43, 0x3b, 0x54, 0x44, 0x9d, 0xec, 0x4b, 0x02, 0xd5, 0x07, 0xb9, 0xba, 0x13, 0x01, - 0x09, 0x6e, 0xe5, 0x83, 0x38, 0xc5, 0x91, 0x32, 0xac, 0x56, 0x9a, 0x82, 0x43, 0xd2, 0x48, 0x2e, - 0x54, 0xca, 0x90, 0x2b, 0xc7, 0xc7, 0x8c, 0x4c, 0x8a, 0x9b, 0x34, 0x88, 0x65, 0xde, 0x1a, 0x2e, - 0x81, 0xe5, 0x17, 0x72, 0x98, 0x23, 0x8e, 0x39, 0x81, 0xcf, 0xc0, 0x82, 0xd4, 0xd6, 0x35, 0x53, - 0xab, 0x17, 0x77, 0x4d, 0x3b, 0x6f, 0x38, 0xbb, 0x21, 0x38, 0x77, 0xfe, 0x6c, 0x58, 0x2b, 0x78, - 0xaa, 0x0a, 0x7e, 0xd1, 0x40, 0x99, 0xd3, 0x53, 0x12, 0xa3, 0x04, 0x07, 0x29, 0xc2, 0xa9, 0x8f, - 0x52, 0xda, 0xe5, 0x84, 0xe9, 0x7f, 0x99, 0x73, 0xf5, 0xe2, 0xee, 0xc3, 0x7c, 0xbd, 0xe3, 0xac, - 0xac, 0x81, 0x83, 0x74, 0x2f, 0xf5, 0x3d, 0x51, 0xe3, 0x6e, 0x66, 0xda, 0xa3, 0x61, 0xed, 0xce, - 0x00, 0x47, 0xe1, 0x53, 0x6b, 0xa6, 0xb0, 0xe5, 0x41, 0x7e, 0xab, 0x12, 0x7e, 0x02, 0xc5, 0x6c, - 0x66, 0xd4, 0x22, 0x31, 0x8d, 0x98, 0x3e, 0x27, 0xcc, 0xef, 0xe5, 0x9b, 0xbb, 0x98, 0x91, 0xe7, - 0x19, 0xeb, 0x56, 0x95, 0x27, 0x94, 0x9e, 0x57, 0x54, 0x2c, 0x0f, 0xf8, 0x63, 0x8c, 0x41, 0x02, - 0x96, 0x13, 0x4a, 0x43, 0xf4, 0x99, 0x04, 0x9d, 0x13, 0xce, 0xf4, 0x79, 0xb1, 0x5f, 0x5b, 0xbf, - 0xd9, 0x2f, 0x4a, 0xc3, 0x77, 0x12, 0x76, 0xff, 0x57, 0x26, 0x6b, 0xd2, 0xe4, 0xaa, 0x90, 0xe5, - 0x15, 0x93, 0x29, 0x09, 0x11, 0xa8, 0xb4, 0xf0, 0x80, 0x21, 0x16, 0xc4, 0x4d, 0x82, 0x22, 0xda, - 0xea, 0x86, 0x04, 0xa9, 0xfb, 0xa7, 0xff, 0x6d, 0x6a, 0xf5, 0x79, 0x77, 0x73, 0x34, 0xac, 0x99, - 0x52, 0x28, 0x17, 0xb5, 0xbc, 0xf5, 0x2c, 0x77, 0x94, 0xa5, 0xde, 0x88, 0x8c, 0x3a, 0x76, 0x88, - 0x40, 0xa9, 0x45, 0x7a, 0x24, 0xa4, 0x09, 0x49, 0x51, 0x9b, 0x10, 0xa6, 0x2f, 0x88, 0xcd, 0xaa, - 0xd8, 0xea, 0x26, 0x65, 0x33, 0x4f, 0x86, 0xd8, 0xa7, 0x41, 0xec, 0x6e, 0xa8, 0xee, 0xcb, 0xca, - 0xf4, 0x5a, 0xb9, 0xe5, 0xad, 0x4c, 0x02, 0x07, 0x84, 0x30, 0x78, 0x08, 0xd6, 0x42, 0xcc, 0x09, - 0xe3, 0xc8, 0x0f, 0x69, 0xf3, 0x14, 0x9d, 0x88, 0xc9, 0xf4, 0x45, 0xd1, 0xbb, 0x31, 0x1a, 0xd6, - 0xaa, 0x52, 0x66, 0x06, 0x64, 0x79, 0xab, 0x32, 0xea, 0x66, 0xc1, 0x97, 0x22, 0x06, 0x3f, 0x80, - 0xd5, 0xa9, 0x23, 0x6e, 0xb5, 0x52, 0xc2, 0x98, 0xfe, 0x8f, 0xa9, 0xd5, 0x97, 0x5c, 0x7b, 0x34, - 0xac, 0xe9, 0x37, 0x9b, 0x52, 0x88, 0xf5, 0xfd, 0xdb, 0x76, 0x49, 0x8d, 0xb4, 0x27, 0x43, 0xde, - 0xbf, 0x13, 0x4a, 0x45, 0xe0, 0x47, 0x50, 0x89, 0x70, 0x1f, 0x89, 0x03, 0x49, 0x68, 0x10, 0x73, - 0x86, 0x32, 0x0d, 0xd1, 0x94, 0xbe, 0x74, 0x73, 0xbb, 0x73, 0x51, 0xcb, 0x2b, 0x47, 0xb8, 0x9f, - 0x9d, 0x78, 0x43, 0x64, 0x1a, 0x24, 0x15, 0x23, 0xc0, 0xb7, 0x60, 0x7d, 0x56, 0x11, 0xef, 0xeb, - 0x40, 0x88, 0xdf, 0x1d, 0x0d, 0x6b, 0x1b, 0xf9, 0xe2, 0xbc, 0x6f, 0x79, 0xf0, 0xa6, 0xf2, 0x71, - 0x1f, 0x1e, 0x81, 0xb2, 0xa0, 0x50, 0x93, 0x76, 0x63, 0x8e, 0xda, 0x74, 0xdc, 0x72, 0x51, 0xa8, - 0x9a, 0xd3, 0x37, 0x34, 0x13, 0xb3, 0x3c, 0x28, 0xe2, 0xfb, 0x59, 0xf8, 0x80, 0xaa, 0x5e, 0x5f, - 0x83, 0xc5, 0x24, 0xa5, 0xed, 0x80, 0x33, 0x7d, 0xf9, 0x4f, 0x57, 0x62, 0x5d, 0x5d, 0x89, 0x92, - 0x72, 0x91, 0x75, 0x96, 0x37, 0x56, 0x80, 0x5d, 0xb0, 0x1a, 0xc4, 0x6d, 0x8a, 0xfc, 0x81, 0x1c, - 0x8a, 0x0f, 0x12, 0xa2, 0xaf, 0x88, 0x37, 0x53, 0xcf, 0x7f, 0x33, 0xaf, 0xe2, 0x36, 0x75, 0x07, - 0xd9, 0xb4, 0xc7, 0x83, 0x84, 0xb8, 0xa6, 0x72, 0x51, 0x67, 0x7c, 0x4b, 0xd0, 0xf2, 0x4a, 0xc1, - 0xf5, 0x8a, 0xc3, 0xb3, 0x0b, 0x43, 0x3b, 0xbf, 0x30, 0xb4, 0x9f, 0x17, 0x86, 0xf6, 0xf5, 0xd2, - 0x28, 0x9c, 0x5f, 0x1a, 0x85, 0x1f, 0x97, 0x46, 0xe1, 0xfd, 0x93, 0x4e, 0xc0, 0x4f, 0xba, 0xbe, - 0xdd, 0xa4, 0x91, 0xa3, 0xfc, 0xb7, 0x43, 0xec, 0xb3, 0xf1, 0xc2, 0xe9, 0xed, 0x3e, 0x72, 0xfa, - 0xd3, 0x5f, 0x6f, 0xa6, 0xcf, 0xfc, 0x05, 0xb1, 0x7e, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe1, - 0xfb, 0x5d, 0x7a, 0x1c, 0x06, 0x00, 0x00, + // 771 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcf, 0x4e, 0xe3, 0x46, + 0x18, 0x8f, 0x0b, 0x85, 0x32, 0x81, 0x08, 0x86, 0x06, 0x39, 0x69, 0x71, 0x5c, 0x17, 0xda, 0xa8, + 0x2a, 0x76, 0xa1, 0x3d, 0xf5, 0x50, 0x09, 0x53, 0xd1, 0x56, 0x55, 0x51, 0x64, 0x52, 0x55, 0x6a, + 0xa5, 0x4e, 0xc7, 0xce, 0x24, 0x58, 0xd8, 0x1e, 0xcb, 0x33, 0x09, 0xc9, 0x03, 0xf4, 0xbe, 0x0f, + 0xb3, 0x0f, 0xc1, 0x11, 0xed, 0x65, 0xf7, 0x14, 0xad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 0x29, 0xf2, 0x47, 0x32, + 0x14, 0x1f, 0xa5, 0x44, 0xdf, 0x12, 0x6f, 0xa6, 0x59, 0xfc, 0x66, 0x7e, 0x4b, 0xba, 0xd4, 0x1d, + 0xe5, 0x69, 0xdb, 0xa3, 0x94, 0xb8, 0xa6, 0x72, 0x51, 0x67, 0xfc, 0x4c, 0xd0, 0xf2, 0x2a, 0xe1, + 0x13, 0x06, 0xbc, 0x01, 0x30, 0x18, 0x05, 0x51, 0x18, 0x88, 0x3f, 0x06, 0xcf, 0x70, 0x70, 0x4d, + 0x32, 0xbd, 0x22, 0x7c, 0xbf, 0x29, 0xf6, 0x3d, 0x13, 0x9c, 0xd3, 0xcc, 0x6f, 0x4b, 0x86, 0xbb, + 0x3f, 0x19, 0x37, 0x6a, 0xd2, 0xf5, 0xb9, 0x9e, 0xe5, 0x6d, 0x07, 0x8b, 0x84, 0x8b, 0xdb, 0x7b, + 0x43, 0xbb, 0xbb, 0x37, 0xb4, 0xb7, 0xf7, 0x86, 0xf6, 0xe2, 0xc1, 0x28, 0xdd, 0x3d, 0x18, 0xa5, + 0x37, 0x0f, 0x46, 0xe9, 0xef, 0x1f, 0x7a, 0x21, 0xbf, 0xea, 0xfb, 0x76, 0x40, 0x63, 0x47, 0x0d, + 0x70, 0x14, 0x61, 0x9f, 0x4d, 0x17, 0xce, 0xe0, 0xe4, 0x3b, 0x67, 0x38, 0xff, 0xe7, 0xe7, 0xc1, + 0x98, 0xbf, 0x26, 0xd6, 0xdf, 0xbf, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x47, 0xce, 0x94, 0x95, + 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -265,6 +276,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.CyclicArbTracker != nil { + { + size, err := m.CyclicArbTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } { size, err := m.InfoByPoolType.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -452,6 +475,10 @@ func (m *GenesisState) Size() (n int) { } l = m.InfoByPoolType.Size() n += 1 + l + sovGenesis(uint64(l)) + if m.CyclicArbTracker != nil { + l = m.CyclicArbTracker.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -852,6 +879,42 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CyclicArbTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CyclicArbTracker == nil { + m.CyclicArbTracker = &CyclicArbTracker{} + } + if err := m.CyclicArbTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/protorev/types/keys.go b/x/protorev/types/keys.go index cb5c906f289..a1d78808335 100644 --- a/x/protorev/types/keys.go +++ b/x/protorev/types/keys.go @@ -36,6 +36,8 @@ const ( prefixLatestBlockHeight prefixInfoByPoolType prefixSwapsToBackrun + prefixcyclicArbTracker + prefixcyclicArbTrackerStartHeight ) var ( @@ -89,6 +91,12 @@ var ( // KeyPrefixSwapsToBackrun is the prefix for store that keeps track of the swaps that need to be backrun for a given tx KeyPrefixSwapsToBackrun = []byte{prefixSwapsToBackrun} + + // KeyCyclicArbTracker is the prefix for store that keeps track of the profits made by cyclic arbitrage + KeyCyclicArbTracker = []byte{prefixcyclicArbTracker} + + // KeyCyclicArbTracker is the prefix for store that keeps track of the height we began tracking cyclic arbitrage + KeyCyclicArbTrackerStartHeight = []byte{prefixcyclicArbTrackerStartHeight} ) // Returns the key needed to fetch the pool id for a given denom diff --git a/x/protorev/types/protorev.pb.go b/x/protorev/types/protorev.pb.go index 3180a152619..11a54ac43b0 100644 --- a/x/protorev/types/protorev.pb.go +++ b/x/protorev/types/protorev.pb.go @@ -7,9 +7,12 @@ import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + types1 "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" + types2 "github.com/osmosis-labs/osmosis/v20/x/txfees/types" io "io" math "math" math_bits "math/bits" @@ -720,6 +723,126 @@ func (m *BaseDenom) GetDenom() string { return "" } +type AllProtocolRevenue struct { + TakerFeesToStakersTracker types1.TakerFeesToStakersTracker `protobuf:"bytes,1,opt,name=taker_fees_to_stakers_tracker,json=takerFeesToStakersTracker,proto3" json:"taker_fees_to_stakers_tracker" yaml:"taker_fees_to_stakers_tracker"` + TakerFeesToCommunityPoolTracker types1.TakerFeesToCommunityPoolTracker `protobuf:"bytes,2,opt,name=taker_fees_to_community_pool_tracker,json=takerFeesToCommunityPoolTracker,proto3" json:"taker_fees_to_community_pool_tracker" yaml:"taker_fees_to_community_pool_tracker"` + TxFeesTracker types2.TxFeesTracker `protobuf:"bytes,3,opt,name=tx_fees_tracker,json=txFeesTracker,proto3" json:"tx_fees_tracker" yaml:"tx_fees_tracker"` + CyclicArbTracker CyclicArbTracker `protobuf:"bytes,4,opt,name=cyclic_arb_tracker,json=cyclicArbTracker,proto3" json:"cyclic_arb_tracker" yaml:"cyclic_arb_tracker"` +} + +func (m *AllProtocolRevenue) Reset() { *m = AllProtocolRevenue{} } +func (m *AllProtocolRevenue) String() string { return proto.CompactTextString(m) } +func (*AllProtocolRevenue) ProtoMessage() {} +func (*AllProtocolRevenue) Descriptor() ([]byte, []int) { + return fileDescriptor_1e9f2391fd9fec01, []int{12} +} +func (m *AllProtocolRevenue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllProtocolRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllProtocolRevenue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AllProtocolRevenue) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllProtocolRevenue.Merge(m, src) +} +func (m *AllProtocolRevenue) XXX_Size() int { + return m.Size() +} +func (m *AllProtocolRevenue) XXX_DiscardUnknown() { + xxx_messageInfo_AllProtocolRevenue.DiscardUnknown(m) +} + +var xxx_messageInfo_AllProtocolRevenue proto.InternalMessageInfo + +func (m *AllProtocolRevenue) GetTakerFeesToStakersTracker() types1.TakerFeesToStakersTracker { + if m != nil { + return m.TakerFeesToStakersTracker + } + return types1.TakerFeesToStakersTracker{} +} + +func (m *AllProtocolRevenue) GetTakerFeesToCommunityPoolTracker() types1.TakerFeesToCommunityPoolTracker { + if m != nil { + return m.TakerFeesToCommunityPoolTracker + } + return types1.TakerFeesToCommunityPoolTracker{} +} + +func (m *AllProtocolRevenue) GetTxFeesTracker() types2.TxFeesTracker { + if m != nil { + return m.TxFeesTracker + } + return types2.TxFeesTracker{} +} + +func (m *AllProtocolRevenue) GetCyclicArbTracker() CyclicArbTracker { + if m != nil { + return m.CyclicArbTracker + } + return CyclicArbTracker{} +} + +type CyclicArbTracker struct { + CyclicArb github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=cyclic_arb,json=cyclicArb,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"cyclic_arb"` + HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` +} + +func (m *CyclicArbTracker) Reset() { *m = CyclicArbTracker{} } +func (m *CyclicArbTracker) String() string { return proto.CompactTextString(m) } +func (*CyclicArbTracker) ProtoMessage() {} +func (*CyclicArbTracker) Descriptor() ([]byte, []int) { + return fileDescriptor_1e9f2391fd9fec01, []int{13} +} +func (m *CyclicArbTracker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CyclicArbTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CyclicArbTracker.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CyclicArbTracker) XXX_Merge(src proto.Message) { + xxx_messageInfo_CyclicArbTracker.Merge(m, src) +} +func (m *CyclicArbTracker) XXX_Size() int { + return m.Size() +} +func (m *CyclicArbTracker) XXX_DiscardUnknown() { + xxx_messageInfo_CyclicArbTracker.DiscardUnknown(m) +} + +var xxx_messageInfo_CyclicArbTracker proto.InternalMessageInfo + +func (m *CyclicArbTracker) GetCyclicArb() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.CyclicArb + } + return nil +} + +func (m *CyclicArbTracker) GetHeightAccountingStartsFrom() uint64 { + if m != nil { + return m.HeightAccountingStartsFrom + } + return 0 +} + func init() { proto.RegisterType((*TokenPairArbRoutes)(nil), "osmosis.protorev.v1beta1.TokenPairArbRoutes") proto.RegisterType((*Route)(nil), "osmosis.protorev.v1beta1.Route") @@ -733,6 +856,8 @@ func init() { proto.RegisterType((*CosmwasmPoolInfo)(nil), "osmosis.protorev.v1beta1.CosmwasmPoolInfo") proto.RegisterType((*WeightMap)(nil), "osmosis.protorev.v1beta1.WeightMap") proto.RegisterType((*BaseDenom)(nil), "osmosis.protorev.v1beta1.BaseDenom") + proto.RegisterType((*AllProtocolRevenue)(nil), "osmosis.protorev.v1beta1.AllProtocolRevenue") + proto.RegisterType((*CyclicArbTracker)(nil), "osmosis.protorev.v1beta1.CyclicArbTracker") } func init() { @@ -740,67 +865,86 @@ func init() { } var fileDescriptor_1e9f2391fd9fec01 = []byte{ - // 949 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x1c, 0xcd, 0xd6, 0x4e, 0x1a, 0x8f, 0x53, 0xdb, 0x99, 0xa4, 0xad, 0xe3, 0x22, 0x6f, 0x34, 0x95, - 0xc0, 0x20, 0xb1, 0x26, 0x86, 0x03, 0x2a, 0xea, 0xa1, 0x6b, 0x84, 0x88, 0x10, 0x49, 0x35, 0xb1, - 0x54, 0xc1, 0x65, 0x99, 0x5d, 0x4f, 0x92, 0x55, 0xbc, 0x3b, 0xd6, 0xce, 0x38, 0x7f, 0x7a, 0xe0, - 0xc2, 0x91, 0x0b, 0x17, 0x6e, 0x1c, 0xb8, 0x71, 0xe2, 0x7b, 0xf4, 0xd8, 0x63, 0xc5, 0x61, 0x85, - 0x92, 0x0b, 0xe2, 0xb8, 0x9f, 0x00, 0xed, 0xfc, 0x59, 0x3b, 0x6e, 0x0d, 0x44, 0x42, 0xdc, 0x66, - 0xde, 0xbc, 0xf7, 0x7e, 0xf3, 0x7b, 0x33, 0x3b, 0x36, 0x78, 0x87, 0xf1, 0x88, 0xf1, 0x90, 0x77, - 0xc7, 0x09, 0x13, 0x2c, 0xa1, 0xa7, 0xdd, 0xd3, 0x1d, 0x9f, 0x0a, 0xb2, 0x53, 0x00, 0x8e, 0x1c, - 0xc0, 0xa6, 0x26, 0x3a, 0x05, 0xae, 0x89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xd9, - 0xe7, 0x4f, 0xc2, 0x08, 0xab, 0xe5, 0xff, 0xfa, 0x97, 0xcd, 0xdd, 0x7b, 0x71, 0xd9, 0xb6, 0x5e, - 0x5e, 0xb6, 0xad, 0xdf, 0x2f, 0xdb, 0xd6, 0x0f, 0x57, 0xed, 0xa5, 0x97, 0x57, 0xed, 0xa5, 0x57, - 0x57, 0xed, 0xa5, 0xaf, 0x3f, 0x3a, 0x0a, 0xc5, 0xf1, 0xc4, 0x77, 0x02, 0x16, 0x75, 0x75, 0xec, - 0xef, 0x8f, 0x88, 0xcf, 0xcd, 0xa4, 0x7b, 0xda, 0xfb, 0xa0, 0x7b, 0x3e, 0xfd, 0xab, 0x24, 0x2e, - 0xc6, 0x94, 0xfb, 0x2b, 0x72, 0xfe, 0xe1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7d, 0xee, 0x8f, - 0xfb, 0x4b, 0x09, 0x00, 0x00, + // 1259 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x36, 0x69, 0x5a, 0x8f, 0x5b, 0xdb, 0x9d, 0xa6, 0xad, 0xe3, 0x52, 0x6f, 0x98, 0x16, + 0x70, 0x81, 0xda, 0x4d, 0x8a, 0x10, 0x2a, 0xf4, 0x90, 0x35, 0xaa, 0xa8, 0x10, 0x6d, 0x35, 0xb1, + 0x54, 0xc1, 0x65, 0x99, 0x5d, 0x8f, 0x9d, 0xc5, 0xde, 0x1d, 0x6b, 0x67, 0x9c, 0xda, 0x45, 0xe2, + 0xc2, 0x91, 0x0b, 0x17, 0x6e, 0x1c, 0x38, 0x81, 0x84, 0xc4, 0xff, 0xc0, 0xb1, 0xc7, 0x1e, 0x2b, + 0x0e, 0x06, 0xb5, 0x17, 0x04, 0x9c, 0xfc, 0x17, 0xa0, 0xf9, 0xb1, 0xbb, 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0x66, 0xcc, 0x42, 0xe7, 0xf6, 0xc3, 0x27, 0x55, 0xeb, 0xd1, 0x93, 0xaa, + 0xf5, 0xc7, 0x93, 0xaa, 0xf5, 0xed, 0xd3, 0xea, 0xd2, 0xa3, 0xa7, 0xd5, 0xa5, 0xc7, 0x4f, 0xab, + 0x4b, 0x9f, 0xbd, 0x33, 0x53, 0xbb, 0x91, 0xfc, 0x4a, 0x9f, 0x78, 0x3c, 0x79, 0x69, 0xec, 0x6d, + 0x5d, 0x6d, 0x8c, 0xb2, 0x7f, 0x6c, 0x54, 0x37, 0xde, 0xaa, 0x7a, 0xbf, 0xf6, 0x6f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x37, 0x0d, 0xd3, 0x57, 0xf9, 0x0c, 0x00, 0x00, } func (this *TokenPairArbRoutes) Equal(that interface{}) bool { @@ -1412,6 +1556,111 @@ func (m *BaseDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AllProtocolRevenue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AllProtocolRevenue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllProtocolRevenue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.CyclicArbTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProtorev(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.TxFeesTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProtorev(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.TakerFeesToCommunityPoolTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProtorev(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.TakerFeesToStakersTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProtorev(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CyclicArbTracker) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CyclicArbTracker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CyclicArbTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HeightAccountingStartsFrom != 0 { + i = encodeVarintProtorev(dAtA, i, uint64(m.HeightAccountingStartsFrom)) + i-- + dAtA[i] = 0x10 + } + if len(m.CyclicArb) > 0 { + for iNdEx := len(m.CyclicArb) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CyclicArb[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProtorev(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintProtorev(dAtA []byte, offset int, v uint64) int { offset -= sovProtorev(v) base := offset @@ -1630,6 +1879,41 @@ func (m *BaseDenom) Size() (n int) { return n } +func (m *AllProtocolRevenue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TakerFeesToStakersTracker.Size() + n += 1 + l + sovProtorev(uint64(l)) + l = m.TakerFeesToCommunityPoolTracker.Size() + n += 1 + l + sovProtorev(uint64(l)) + l = m.TxFeesTracker.Size() + n += 1 + l + sovProtorev(uint64(l)) + l = m.CyclicArbTracker.Size() + n += 1 + l + sovProtorev(uint64(l)) + return n +} + +func (m *CyclicArbTracker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CyclicArb) > 0 { + for _, e := range m.CyclicArb { + l = e.Size() + n += 1 + l + sovProtorev(uint64(l)) + } + } + if m.HeightAccountingStartsFrom != 0 { + n += 1 + sovProtorev(uint64(m.HeightAccountingStartsFrom)) + } + return n +} + func sovProtorev(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3064,6 +3348,291 @@ func (m *BaseDenom) Unmarshal(dAtA []byte) error { } return nil } +func (m *AllProtocolRevenue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AllProtocolRevenue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllProtocolRevenue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToStakersTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtorev + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProtorev + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TakerFeesToStakersTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToCommunityPoolTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtorev + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProtorev + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TakerFeesToCommunityPoolTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxFeesTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtorev + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProtorev + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TxFeesTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CyclicArbTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtorev + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProtorev + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CyclicArbTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProtorev(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProtorev + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CyclicArbTracker) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CyclicArbTracker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CyclicArbTracker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CyclicArb", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtorev + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProtorev + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CyclicArb = append(m.CyclicArb, types.Coin{}) + if err := m.CyclicArb[len(m.CyclicArb)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeightAccountingStartsFrom", wireType) + } + m.HeightAccountingStartsFrom = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtorev + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipProtorev(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProtorev + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipProtorev(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/protorev/types/query.pb.go b/x/protorev/types/query.pb.go index 0a289eaa4dd..f9b8eba739d 100644 --- a/x/protorev/types/query.pb.go +++ b/x/protorev/types/query.pb.go @@ -1389,6 +1389,86 @@ func (m *QueryGetProtoRevPoolResponse) GetPoolId() uint64 { return 0 } +type QueryGetAllProtocolRevenueRequest struct { +} + +func (m *QueryGetAllProtocolRevenueRequest) Reset() { *m = QueryGetAllProtocolRevenueRequest{} } +func (m *QueryGetAllProtocolRevenueRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetAllProtocolRevenueRequest) ProtoMessage() {} +func (*QueryGetAllProtocolRevenueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f5e7ac9973cce389, []int{30} +} +func (m *QueryGetAllProtocolRevenueRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAllProtocolRevenueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAllProtocolRevenueRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetAllProtocolRevenueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAllProtocolRevenueRequest.Merge(m, src) +} +func (m *QueryGetAllProtocolRevenueRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAllProtocolRevenueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAllProtocolRevenueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAllProtocolRevenueRequest proto.InternalMessageInfo + +type QueryGetAllProtocolRevenueResponse struct { + AllProtocolRevenue AllProtocolRevenue `protobuf:"bytes,1,opt,name=all_protocol_revenue,json=allProtocolRevenue,proto3" json:"all_protocol_revenue" yaml:"all_protocol_revenue"` +} + +func (m *QueryGetAllProtocolRevenueResponse) Reset() { *m = QueryGetAllProtocolRevenueResponse{} } +func (m *QueryGetAllProtocolRevenueResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetAllProtocolRevenueResponse) ProtoMessage() {} +func (*QueryGetAllProtocolRevenueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f5e7ac9973cce389, []int{31} +} +func (m *QueryGetAllProtocolRevenueResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAllProtocolRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAllProtocolRevenueResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetAllProtocolRevenueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAllProtocolRevenueResponse.Merge(m, src) +} +func (m *QueryGetAllProtocolRevenueResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAllProtocolRevenueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAllProtocolRevenueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAllProtocolRevenueResponse proto.InternalMessageInfo + +func (m *QueryGetAllProtocolRevenueResponse) GetAllProtocolRevenue() AllProtocolRevenue { + if m != nil { + return m.AllProtocolRevenue + } + return AllProtocolRevenue{} +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.protorev.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.protorev.v1beta1.QueryParamsResponse") @@ -1420,6 +1500,8 @@ func init() { proto.RegisterType((*QueryGetProtoRevEnabledResponse)(nil), "osmosis.protorev.v1beta1.QueryGetProtoRevEnabledResponse") proto.RegisterType((*QueryGetProtoRevPoolRequest)(nil), "osmosis.protorev.v1beta1.QueryGetProtoRevPoolRequest") proto.RegisterType((*QueryGetProtoRevPoolResponse)(nil), "osmosis.protorev.v1beta1.QueryGetProtoRevPoolResponse") + proto.RegisterType((*QueryGetAllProtocolRevenueRequest)(nil), "osmosis.protorev.v1beta1.QueryGetAllProtocolRevenueRequest") + proto.RegisterType((*QueryGetAllProtocolRevenueResponse)(nil), "osmosis.protorev.v1beta1.QueryGetAllProtocolRevenueResponse") } func init() { @@ -1427,103 +1509,108 @@ func init() { } var fileDescriptor_f5e7ac9973cce389 = []byte{ - // 1527 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5b, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xf6, 0x92, 0xfc, 0x3b, 0xbd, 0xfc, 0x9b, 0xa1, 0x49, 0x93, 0x6d, 0x6a, 0x3b, 0x93, - 0xa4, 0xb9, 0x35, 0x76, 0x6f, 0x40, 0xb9, 0x14, 0xc8, 0x36, 0x50, 0x45, 0x15, 0x8d, 0x59, 0xc2, - 0x0b, 0x48, 0x98, 0xb5, 0x3d, 0x49, 0x57, 0x5d, 0xef, 0xb8, 0xbb, 0xeb, 0x28, 0x7e, 0x05, 0x09, - 0x84, 0x84, 0xc4, 0xed, 0x03, 0xc0, 0x07, 0xe0, 0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, + // 1607 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4b, 0x6f, 0x1b, 0x55, + 0x1b, 0xce, 0xf4, 0x92, 0x7c, 0x3d, 0xbd, 0x7c, 0xcd, 0xf9, 0x92, 0xd4, 0x99, 0xa4, 0xb6, 0x73, + 0x92, 0x34, 0xb7, 0xc6, 0xee, 0xed, 0x83, 0x72, 0x29, 0x90, 0x69, 0xa0, 0x8a, 0x2a, 0x1a, 0x33, + 0x84, 0x0d, 0x48, 0x98, 0xb1, 0x3d, 0x49, 0x47, 0x1d, 0xcf, 0x99, 0xce, 0x8c, 0xa3, 0x78, 0x4b, + 0x25, 0x10, 0x12, 0x12, 0xb7, 0x1f, 0x00, 0x6b, 0xc4, 0x1f, 0x60, 0x09, 0xab, 0x0a, 0x36, 0x45, + 0x48, 0x08, 0x15, 0x64, 0xa1, 0x96, 0x05, 0x6b, 0xff, 0x00, 0x84, 0xe6, 0x9c, 0x77, 0xec, 0xf1, + 0x9c, 0x19, 0xc7, 0x93, 0x48, 0xec, 0xec, 0x39, 0xef, 0xfb, 0xbc, 0xcf, 0x73, 0xae, 0xcf, 0x8b, + 0xe6, 0xa8, 0x5b, 0xa7, 0xae, 0xe1, 0x16, 0x6d, 0x87, 0x7a, 0xd4, 0xd1, 0x77, 0x8b, 0xbb, 0x97, + 0x2b, 0xba, 0xa7, 0x5d, 0x2e, 0xde, 0x6f, 0xe8, 0x4e, 0xb3, 0xc0, 0x3e, 0xe3, 0x0c, 0x44, 0x15, + 0x82, 0xa8, 0x02, 0x44, 0xc9, 0x63, 0x3b, 0x74, 0x87, 0xb2, 0xaf, 0x45, 0xff, 0x17, 0x0f, 0x90, + 0xa7, 0x77, 0x28, 0xdd, 0x31, 0xf5, 0xa2, 0x66, 0x1b, 0x45, 0xcd, 0xb2, 0xa8, 0xa7, 0x79, 0x06, + 0xb5, 0x20, 0x5d, 0x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ea, 0x19, 0xab, 0xa7, 0x16, 0xd9, 0x14, + 0x79, 0x97, 0x1c, 0xba, 0x6d, 0x78, 0xae, 0xd2, 0x5c, 0xd7, 0x2d, 0x5a, 0x07, 0xde, 0xf8, 0x02, + 0x3a, 0x5e, 0xf3, 0xff, 0x03, 0x83, 0xb3, 0xed, 0x56, 0xee, 0x14, 0x2f, 0xc2, 0x3e, 0x13, 0x95, + 0x0f, 0x13, 0x4b, 0x94, 0x17, 0x05, 0x04, 0x79, 0xeb, 0x68, 0xd8, 0x66, 0x23, 0xb0, 0x06, 0x93, + 0x05, 0xae, 0xa6, 0xe0, 0xaf, 0x70, 0x67, 0xfa, 0x6f, 0x52, 0xc3, 0x52, 0x46, 0x43, 0x13, 0xcf, + 0x52, 0xfc, 0x89, 0xe7, 0x3f, 0x66, 0xd1, 0x4c, 0xb4, 0xde, 0x9a, 0x69, 0x42, 0xc9, 0x60, 0xd2, + 0xef, 0x23, 0xd2, 0x2f, 0x08, 0x08, 0xdd, 0x46, 0x23, 0x1c, 0xd4, 0x9f, 0xe6, 0xa3, 0xfd, 0x19, + 0x4d, 0xc0, 0x76, 0x38, 0x13, 0x66, 0xe5, 0x12, 0x75, 0xa4, 0xf3, 0x0b, 0x2d, 0x46, 0x4b, 0xbe, + 0xe9, 0x1f, 0x26, 0xd7, 0x33, 0xaa, 0xae, 0xd2, 0x54, 0x69, 0xc3, 0xd3, 0x43, 0x73, 0xeb, 0xf8, + 0xff, 0x59, 0xd9, 0x63, 0xe1, 0xb9, 0x65, 0x9f, 0x89, 0xca, 0x87, 0xc9, 0x67, 0x12, 0x5a, 0x1a, + 0x00, 0x14, 0xe4, 0xd4, 0x10, 0x72, 0x3b, 0x83, 0x30, 0xc7, 0x4b, 0xc9, 0xfb, 0x9c, 0x25, 0x87, + 0xd0, 0x26, 0x41, 0xe1, 0x28, 0x67, 0xd2, 0x85, 0x22, 0x6a, 0x08, 0x97, 0xac, 0x88, 0x94, 0xd6, + 0x4c, 0x33, 0x02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 0x07, 0xaf, 0xdd, 0xdb, 0xb9, 0xc8, 0xcf, 0x1d, 0x20, 0x13, 0x28, 0xcf, 0x30, + 0xca, 0x53, 0x78, 0x52, 0xa4, 0x0c, 0x6d, 0x0c, 0xfe, 0x4a, 0x42, 0xff, 0x8d, 0xf4, 0x0c, 0xf8, + 0xff, 0x29, 0xcc, 0x56, 0xb7, 0xe3, 0x91, 0x9f, 0x49, 0x9b, 0x06, 0x2c, 0xb3, 0x8c, 0x65, 0x06, + 0x4f, 0xc4, 0x38, 0x33, 0x9f, 0xce, 0xf7, 0x7c, 0x37, 0x88, 0xed, 0xc0, 0x20, 0xbb, 0x21, 0xb1, + 0x7f, 0x19, 0x64, 0x37, 0x24, 0xb7, 0x35, 0xfb, 0x3d, 0xf0, 0xd1, 0xae, 0x44, 0xb9, 0xf3, 0xf0, + 0x49, 0x56, 0x7a, 0xf4, 0x24, 0x2b, 0xfd, 0xf1, 0x24, 0x2b, 0x7d, 0xfa, 0x34, 0x3b, 0xf4, 0xe8, + 0x69, 0x76, 0xe8, 0xd7, 0xa7, 0xd9, 0xa1, 0xb7, 0xaf, 0xed, 0x18, 0xde, 0xdd, 0x46, 0xa5, 0x50, + 0xa5, 0xf5, 0x00, 0x6b, 0xd5, 0xd4, 0x2a, 0x6e, 0x07, 0x78, 0xf7, 0xca, 0xa5, 0xe2, 0x5e, 0xe8, + 0x89, 0x6d, 0xda, 0xba, 0x5b, 0x19, 0x66, 0xff, 0xaf, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x2b, + 0x75, 0xac, 0xbd, 0x1a, 0x19, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1578,6 +1665,9 @@ type QueryClient interface { // GetProtoRevPool queries the pool id used via the highest liquidity method // for arbitrage route building given a pair of denominations GetProtoRevPool(ctx context.Context, in *QueryGetProtoRevPoolRequest, opts ...grpc.CallOption) (*QueryGetProtoRevPoolResponse, error) + // GetAllProtocolRevenue queries all of the protocol revenue that has been + // accumulated by any module + GetAllProtocolRevenue(ctx context.Context, in *QueryGetAllProtocolRevenueRequest, opts ...grpc.CallOption) (*QueryGetAllProtocolRevenueResponse, error) } type queryClient struct { @@ -1723,6 +1813,15 @@ func (c *queryClient) GetProtoRevPool(ctx context.Context, in *QueryGetProtoRevP return out, nil } +func (c *queryClient) GetAllProtocolRevenue(ctx context.Context, in *QueryGetAllProtocolRevenueRequest, opts ...grpc.CallOption) (*QueryGetAllProtocolRevenueResponse, error) { + out := new(QueryGetAllProtocolRevenueResponse) + err := c.cc.Invoke(ctx, "/osmosis.protorev.v1beta1.Query/GetAllProtocolRevenue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Params queries the parameters of the module. @@ -1765,6 +1864,9 @@ type QueryServer interface { // GetProtoRevPool queries the pool id used via the highest liquidity method // for arbitrage route building given a pair of denominations GetProtoRevPool(context.Context, *QueryGetProtoRevPoolRequest) (*QueryGetProtoRevPoolResponse, error) + // GetAllProtocolRevenue queries all of the protocol revenue that has been + // accumulated by any module + GetAllProtocolRevenue(context.Context, *QueryGetAllProtocolRevenueRequest) (*QueryGetAllProtocolRevenueResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1816,6 +1918,9 @@ func (*UnimplementedQueryServer) GetProtoRevEnabled(ctx context.Context, req *Qu func (*UnimplementedQueryServer) GetProtoRevPool(ctx context.Context, req *QueryGetProtoRevPoolRequest) (*QueryGetProtoRevPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetProtoRevPool not implemented") } +func (*UnimplementedQueryServer) GetAllProtocolRevenue(ctx context.Context, req *QueryGetAllProtocolRevenueRequest) (*QueryGetAllProtocolRevenueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllProtocolRevenue not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2091,6 +2196,24 @@ func _Query_GetProtoRevPool_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Query_GetAllProtocolRevenue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetAllProtocolRevenueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAllProtocolRevenue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.protorev.v1beta1.Query/GetAllProtocolRevenue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAllProtocolRevenue(ctx, req.(*QueryGetAllProtocolRevenueRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.protorev.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -2155,6 +2278,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetProtoRevPool", Handler: _Query_GetProtoRevPool_Handler, }, + { + MethodName: "GetAllProtocolRevenue", + Handler: _Query_GetAllProtocolRevenue_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/protorev/v1beta1/query.proto", @@ -3036,6 +3163,62 @@ func (m *QueryGetProtoRevPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *QueryGetAllProtocolRevenueRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetAllProtocolRevenueRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAllProtocolRevenueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetAllProtocolRevenueResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetAllProtocolRevenueResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAllProtocolRevenueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.AllProtocolRevenue.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -3392,6 +3575,26 @@ func (m *QueryGetProtoRevPoolResponse) Size() (n int) { return n } +func (m *QueryGetAllProtocolRevenueRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetAllProtocolRevenueResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.AllProtocolRevenue.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5516,6 +5719,139 @@ func (m *QueryGetProtoRevPoolResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetAllProtocolRevenueRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetAllProtocolRevenueRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAllProtocolRevenueRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetAllProtocolRevenueResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetAllProtocolRevenueResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAllProtocolRevenueResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllProtocolRevenue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AllProtocolRevenue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/protorev/types/query.pb.gw.go b/x/protorev/types/query.pb.gw.go index 0aab022797c..3116d8aede1 100644 --- a/x/protorev/types/query.pb.gw.go +++ b/x/protorev/types/query.pb.gw.go @@ -357,6 +357,24 @@ func local_request_Query_GetProtoRevPool_0(ctx context.Context, marshaler runtim } +func request_Query_GetAllProtocolRevenue_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAllProtocolRevenueRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetAllProtocolRevenue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAllProtocolRevenue_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAllProtocolRevenueRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetAllProtocolRevenue(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -708,6 +726,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetAllProtocolRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAllProtocolRevenue_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAllProtocolRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1049,6 +1090,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetAllProtocolRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetAllProtocolRevenue_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAllProtocolRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1082,6 +1143,8 @@ var ( pattern_Query_GetProtoRevEnabled_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"osmosis", "protorev", "enabled"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GetProtoRevPool_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"osmosis", "protorev", "pool"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetAllProtocolRevenue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"osmosis", "protorev", "all_protocol_revenue"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1114,4 +1177,6 @@ var ( forward_Query_GetProtoRevEnabled_0 = runtime.ForwardResponseMessage forward_Query_GetProtoRevPool_0 = runtime.ForwardResponseMessage + + forward_Query_GetAllProtocolRevenue_0 = runtime.ForwardResponseMessage ) diff --git a/x/txfees/keeper/feedecorator.go b/x/txfees/keeper/feedecorator.go index 7c29bec41d4..a7047dee9d4 100644 --- a/x/txfees/keeper/feedecorator.go +++ b/x/txfees/keeper/feedecorator.go @@ -256,5 +256,7 @@ func DeductFees(txFeesKeeper types.TxFeesKeeper, bankKeeper types.BankKeeper, ct } } + txFeesKeeper.IncreaseTxFeesTracker(ctx, fees[0]) + return nil } diff --git a/x/txfees/keeper/feedecorator_test.go b/x/txfees/keeper/feedecorator_test.go index 35ad1c4ed00..4897c85bfc8 100644 --- a/x/txfees/keeper/feedecorator_test.go +++ b/x/txfees/keeper/feedecorator_test.go @@ -3,16 +3,9 @@ package keeper_test import ( "fmt" - clienttx "github.com/cosmos/cosmos-sdk/client/tx" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" - "github.com/osmosis-labs/osmosis/osmomath" - "github.com/osmosis-labs/osmosis/v20/x/txfees/keeper" "github.com/osmosis-labs/osmosis/v20/x/txfees/types" ) @@ -22,7 +15,6 @@ func (s *KeeperTestSuite) TestFeeDecorator() { mempoolFeeOpts := types.NewDefaultMempoolFeeOptions() mempoolFeeOpts.MinGasPriceForHighGasTx = osmomath.MustNewDecFromStr("0.0025") baseDenom, _ := s.App.TxFeesKeeper.GetBaseDenom(s.Ctx) - baseGas := uint64(10000) consensusMinFeeAmt := int64(25) point1BaseDenomMinGasPrices := sdk.NewDecCoins(sdk.NewDecCoinFromDec(baseDenom, osmomath.MustNewDecFromStr("0.1"))) @@ -154,56 +146,9 @@ func (s *KeeperTestSuite) TestFeeDecorator() { // reset pool and accounts for each test s.SetupTest(false) s.Run(tc.name, func() { - // setup uion with 1:1 fee - uionPoolId := s.PrepareBalancerPoolWithCoins( - sdk.NewInt64Coin(sdk.DefaultBondDenom, 500), - sdk.NewInt64Coin(uion, 500), - ) - err := s.ExecuteUpgradeFeeTokenProposal(uion, uionPoolId) - s.Require().NoError(err) - - if tc.minGasPrices == nil { - tc.minGasPrices = sdk.NewDecCoins() - } - if tc.gasRequested == 0 { - tc.gasRequested = baseGas - } - s.Ctx = s.Ctx.WithIsCheckTx(tc.isCheckTx).WithMinGasPrices(tc.minGasPrices) - - // TODO: Cleanup this code. - // TxBuilder components reset for every test case - txBuilder := s.clientCtx.TxConfig.NewTxBuilder() - priv0, _, addr0 := testdata.KeyTestPubAddr() - acc1 := s.App.AccountKeeper.NewAccountWithAddress(s.Ctx, addr0) - s.App.AccountKeeper.SetAccount(s.Ctx, acc1) - msgs := []sdk.Msg{testdata.NewTestMsg(addr0)} - privs, accNums, accSeqs := []cryptotypes.PrivKey{priv0}, []uint64{0}, []uint64{0} - signerData := authsigning.SignerData{ - ChainID: s.Ctx.ChainID(), - AccountNumber: accNums[0], - Sequence: accSeqs[0], - } - - gasLimit := tc.gasRequested - sigV2, _ := clienttx.SignWithPrivKey( - 1, - signerData, - txBuilder, - privs[0], - s.clientCtx.TxConfig, - accSeqs[0], - ) - - err = simapp.FundAccount(s.App.BankKeeper, s.Ctx, addr0, tc.txFee) - s.Require().NoError(err) - - tx := s.BuildTx(txBuilder, msgs, sigV2, "", tc.txFee, gasLimit) - - mfd := keeper.NewMempoolFeeDecorator(*s.App.TxFeesKeeper, mempoolFeeOpts) - dfd := keeper.NewDeductFeeDecorator(*s.App.TxFeesKeeper, *s.App.AccountKeeper, *s.App.BankKeeper, nil) - antehandlerMFD := sdk.ChainAnteDecorators(mfd, dfd) - _, err = antehandlerMFD(s.Ctx, tx, tc.isSimulate) + preFeeDecoratorTxFeeTrackerValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + err := s.SetupTxFeeAnteHandlerAndChargeFee(s.clientCtx, tc.minGasPrices, tc.gasRequested, tc.isCheckTx, tc.isSimulate, tc.txFee) if tc.expectPass { // ensure fee was collected if !tc.txFee.IsZero() { @@ -213,6 +158,7 @@ func (s *KeeperTestSuite) TestFeeDecorator() { } 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) + s.Require().Equal(preFeeDecoratorTxFeeTrackerValue.Add(tc.txFee[0]), s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx)) } s.Require().NoError(err, "test: %s", tc.name) } else { diff --git a/x/txfees/keeper/genesis.go b/x/txfees/keeper/genesis.go index d4eac7a1d6a..bec5f1e6bc5 100644 --- a/x/txfees/keeper/genesis.go +++ b/x/txfees/keeper/genesis.go @@ -17,12 +17,30 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { if err != nil { panic(err) } + + // We track the txfees generated in the KVStore. + // If the values were exported, we set them here. + // If the values were not exported, we initialize them to zero as well as use the current block height. + if genState.TxFeesTracker != nil { + k.SetTxFeesTrackerValue(ctx, genState.TxFeesTracker.TxFees) + k.SetTxFeesTrackerStartHeight(ctx, genState.TxFeesTracker.HeightAccountingStartsFrom) + } else { + k.SetTxFeesTrackerValue(ctx, sdk.NewCoins()) + k.SetTxFeesTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + } } // ExportGenesis returns the txfees module's exported genesis. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + // Export KVStore values to the genesis state so they can be imported in init genesis. + txFeesTracker := types.TxFeesTracker{ + TxFees: k.GetTxFeesTrackerValue(ctx), + HeightAccountingStartsFrom: k.GetTxFeesTrackerStartHeight(ctx), + } + genesis := types.DefaultGenesis() genesis.Basedenom, _ = k.GetBaseDenom(ctx) genesis.Feetokens = k.GetFeeTokens(ctx) + genesis.TxFeesTracker = &txFeesTracker return genesis } diff --git a/x/txfees/keeper/hooks.go b/x/txfees/keeper/hooks.go index 130acead24e..9d148b71fbd 100644 --- a/x/txfees/keeper/hooks.go +++ b/x/txfees/keeper/hooks.go @@ -113,7 +113,15 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f // We swap without charging a taker fee / sending to the non native fee collector, since these are funds that // are accruing from the taker fee itself. - _, err := k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) + tokenOutAmt, err := k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) + // If the swap goes through, update the tx fees tracker value. + if err == nil { + currentTxFeesTrackerValue := k.GetTxFeesTrackerValue(ctx) + // Subtract the amount swapped in and add the amount received from the current tx fees tracker value. + newTxFeesTrackerValue := currentTxFeesTrackerValue.Sub(sdk.NewCoins(coin)).Add(sdk.NewCoin(denomToSwapTo, tokenOutAmt)) + // Set the new tx fees tracker value. + k.SetTxFeesTrackerValue(ctx, newTxFeesTrackerValue) + } return err }) } diff --git a/x/txfees/keeper/hooks_test.go b/x/txfees/keeper/hooks_test.go index e7fb771fbd9..44524c22652 100644 --- a/x/txfees/keeper/hooks_test.go +++ b/x/txfees/keeper/hooks_test.go @@ -151,6 +151,12 @@ func (s *KeeperTestSuite) TestSwapNonNativeFeeToDenom() { poolCoins: defaultPoolCoins, preFundCoins: defaultBalanceToSwap, }, + { + name: "same denom to swap to", + denomToSwapTo: defaultBalanceToSwap[0].Denom, + poolCoins: defaultPoolCoins, + preFundCoins: defaultBalanceToSwap, + }, // TODO: add more test cases // - pool does not exist for denom pair but protorev has it set for a pair @@ -183,12 +189,19 @@ func (s *KeeperTestSuite) TestSwapNonNativeFeeToDenom() { // Fund the account with the preFundCoins s.FundAcc(testAccount, tc.preFundCoins) + // Set and check the txfees tracker before swap + s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, tc.preFundCoins) + s.Require().Equal(s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx), tc.preFundCoins) + s.App.TxFeesKeeper.SwapNonNativeFeeToDenom(s.Ctx, tc.denomToSwapTo, testAccount) // Check balance balances := s.App.BankKeeper.GetAllBalances(s.Ctx, testAccount) s.Require().Len(balances, 1) + // Check the txfees tracker after swap + s.Require().Equal(balances, s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx)) + // Check that the denomToSwapTo is the denom of the balance s.Require().Equal(balances[0].Denom, tc.denomToSwapTo) }) diff --git a/x/txfees/keeper/protorev.go b/x/txfees/keeper/protorev.go new file mode 100644 index 00000000000..81c23afcd66 --- /dev/null +++ b/x/txfees/keeper/protorev.go @@ -0,0 +1,63 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + gogotypes "github.com/gogo/protobuf/types" + + "github.com/osmosis-labs/osmosis/osmoutils" + poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" + "github.com/osmosis-labs/osmosis/v20/x/txfees/types" +) + +// IncreaseTxFeesTracker gets the current value of the txfees tracker, adds the given amount to it, and sets the new value. +func (k Keeper) IncreaseTxFeesTracker(ctx sdk.Context, txFees sdk.Coin) { + currentTxFees := k.GetTxFeesTrackerValue(ctx) + if !txFees.IsZero() { + newnewTxFeesCoins := currentTxFees.Add(txFees) + newTxFees := poolmanagertypes.TrackedVolume{ + Amount: newnewTxFeesCoins, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTracker, &newTxFees) + } +} + +func (k Keeper) SetTxFeesTrackerValue(ctx sdk.Context, txFees sdk.Coins) { + newtxFees := poolmanagertypes.TrackedVolume{ + Amount: txFees, + } + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTracker, &newtxFees) +} + +func (k Keeper) GetTxFeesTrackerValue(ctx sdk.Context) (currentTxFees sdk.Coins) { + var txFees poolmanagertypes.TrackedVolume + txFeesFound, err := osmoutils.Get(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTracker, &txFees) + if err != nil { + // We can only encounter an error if a database or serialization errors occurs, so we panic here. + // Normally this would be handled by `osmoutils.MustGet`, but since we want to specifically use `osmoutils.Get`, + // we also have to manually panic here. + panic(err) + } + + // If no volume was found, we treat the existing volume as 0. + // While we can technically require volume to exist, we would need to store empty coins in state for each pool (past and present), + // which is a high storage cost to pay for a weak guardrail. + currentTxFees = sdk.NewCoins() + if txFeesFound { + currentTxFees = txFees.Amount + } + + return currentTxFees +} + +// GetTxFeesTrackerStartHeight gets the height from which we started accounting for txfees. +func (k Keeper) GetTxFeesTrackerStartHeight(ctx sdk.Context) uint64 { + startHeight := gogotypes.UInt64Value{} + osmoutils.MustGet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTrackerStartHeight, &startHeight) + return startHeight.Value +} + +// SetTxFeesTrackerStartHeight sets the height from which we started accounting for txfees. +func (k Keeper) SetTxFeesTrackerStartHeight(ctx sdk.Context, startHeight uint64) { + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTrackerStartHeight, &gogotypes.UInt64Value{Value: startHeight}) +} diff --git a/x/txfees/keeper/protorev_test.go b/x/txfees/keeper/protorev_test.go new file mode 100644 index 00000000000..0aed1beffa1 --- /dev/null +++ b/x/txfees/keeper/protorev_test.go @@ -0,0 +1,121 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (s *KeeperTestSuite) TestGetSetTxFeesTrackerValue() { + tests := map[string]struct { + firstTxFeesValue sdk.Coins + secondTxFeesValue sdk.Coins + }{ + "happy path: replace single coin with increased single coin": { + firstTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(200))), + }, + "replace single coin with decreased single coin": { + firstTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(50))), + }, + "replace single coin with different denom": { + firstTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTxFeesValue: sdk.NewCoins(sdk.NewCoin("usdc", sdk.NewInt(100))), + }, + "replace single coin with multiple coins": { + firstTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + secondTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + }, + "replace multiple coins with single coin": { + firstTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + secondTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(200))), + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest(false) + + s.Require().Empty(s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx)) + + s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, tc.firstTxFeesValue) + + actualFirstTxFeesValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + + s.Require().Equal(tc.firstTxFeesValue, actualFirstTxFeesValue) + + s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, tc.secondTxFeesValue) + + actualSecondTxFeesValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + + s.Require().Equal(tc.secondTxFeesValue, actualSecondTxFeesValue) + }) + } +} + +func (s *KeeperTestSuite) TestGetSetTxFeesTrackerStartHeight() { + tests := map[string]struct { + firstTxFeesTrackerStartHeight uint64 + secondTxFeesTrackerStartHeight uint64 + }{ + "replace tracker height with a higher height": { + firstTxFeesTrackerStartHeight: 100, + secondTxFeesTrackerStartHeight: 5000, + }, + "replace tracker height with a lower height": { + firstTxFeesTrackerStartHeight: 100, + secondTxFeesTrackerStartHeight: 50, + }, + "replace tracker height back to zero": { + firstTxFeesTrackerStartHeight: 100, + secondTxFeesTrackerStartHeight: 0, + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest(false) + + s.Require().Empty(s.App.TxFeesKeeper.GetTxFeesTrackerStartHeight(s.Ctx)) + + s.App.TxFeesKeeper.SetTxFeesTrackerStartHeight(s.Ctx, tc.firstTxFeesTrackerStartHeight) + actualFirstTxFeesTrackerStartHeight := s.App.TxFeesKeeper.GetTxFeesTrackerStartHeight(s.Ctx) + s.Require().Equal(tc.firstTxFeesTrackerStartHeight, actualFirstTxFeesTrackerStartHeight) + + s.App.TxFeesKeeper.SetTxFeesTrackerStartHeight(s.Ctx, tc.secondTxFeesTrackerStartHeight) + actualSecondTxFeesTrackerStartHeight := s.App.TxFeesKeeper.GetTxFeesTrackerStartHeight(s.Ctx) + s.Require().Equal(tc.secondTxFeesTrackerStartHeight, actualSecondTxFeesTrackerStartHeight) + }) + } +} + +func (s *KeeperTestSuite) TestIncreaseTxFeesTracker() { + tests := map[string]struct { + initialTxFeesValue sdk.Coins + increaseTxFeesValueBy sdk.Coin + }{ + "happy path: increase single denom tracker": { + initialTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100))), + increaseTxFeesValueBy: sdk.NewCoin("eth", sdk.NewInt(50)), + }, + "increase multi denom tracker": { + initialTxFeesValue: sdk.NewCoins(sdk.NewCoin("eth", sdk.NewInt(100)), sdk.NewCoin("usdc", sdk.NewInt(200))), + increaseTxFeesValueBy: sdk.NewCoin("eth", sdk.NewInt(50)), + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest(false) + + s.Require().Empty(s.App.TxFeesKeeper.GetTxFeesTrackerStartHeight(s.Ctx)) + + s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, tc.initialTxFeesValue) + actualInitialTxFeesValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + s.Require().Equal(tc.initialTxFeesValue, actualInitialTxFeesValue) + + s.App.TxFeesKeeper.IncreaseTxFeesTracker(s.Ctx, tc.increaseTxFeesValueBy) + txFeesValueAfterIncrease := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + s.Require().Equal(tc.initialTxFeesValue.Add(sdk.NewCoins(tc.increaseTxFeesValueBy)...), txFeesValueAfterIncrease) + }) + } +} diff --git a/x/txfees/types/expected_keepers.go b/x/txfees/types/expected_keepers.go index f27071fe5f6..e08ea930c63 100644 --- a/x/txfees/types/expected_keepers.go +++ b/x/txfees/types/expected_keepers.go @@ -69,6 +69,7 @@ type TxFeesKeeper interface { ConvertToBaseToken(ctx sdk.Context, inputFee sdk.Coin) (sdk.Coin, error) GetBaseDenom(ctx sdk.Context) (denom string, err error) GetFeeToken(ctx sdk.Context, denom string) (FeeToken, error) + IncreaseTxFeesTracker(ctx sdk.Context, txFees sdk.Coin) } type ProtorevKeeper interface { diff --git a/x/txfees/types/genesis.pb.go b/x/txfees/types/genesis.pb.go index 4e3f95823a7..5cdb102a040 100644 --- a/x/txfees/types/genesis.pb.go +++ b/x/txfees/types/genesis.pb.go @@ -5,6 +5,8 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -27,6 +29,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Basedenom string `protobuf:"bytes,1,opt,name=basedenom,proto3" json:"basedenom,omitempty"` Feetokens []FeeToken `protobuf:"bytes,2,rep,name=feetokens,proto3" json:"feetokens"` + // KVStore state + TxFeesTracker *TxFeesTracker `protobuf:"bytes,3,opt,name=txFeesTracker,proto3" json:"txFeesTracker,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -76,8 +80,68 @@ func (m *GenesisState) GetFeetokens() []FeeToken { return nil } +func (m *GenesisState) GetTxFeesTracker() *TxFeesTracker { + if m != nil { + return m.TxFeesTracker + } + return nil +} + +type TxFeesTracker struct { + TxFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=tx_fees,json=txFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tx_fees"` + HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` +} + +func (m *TxFeesTracker) Reset() { *m = TxFeesTracker{} } +func (m *TxFeesTracker) String() string { return proto.CompactTextString(m) } +func (*TxFeesTracker) ProtoMessage() {} +func (*TxFeesTracker) Descriptor() ([]byte, []int) { + return fileDescriptor_4423c18e3d020b37, []int{1} +} +func (m *TxFeesTracker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxFeesTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxFeesTracker.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TxFeesTracker) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxFeesTracker.Merge(m, src) +} +func (m *TxFeesTracker) XXX_Size() int { + return m.Size() +} +func (m *TxFeesTracker) XXX_DiscardUnknown() { + xxx_messageInfo_TxFeesTracker.DiscardUnknown(m) +} + +var xxx_messageInfo_TxFeesTracker proto.InternalMessageInfo + +func (m *TxFeesTracker) GetTxFees() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.TxFees + } + return nil +} + +func (m *TxFeesTracker) GetHeightAccountingStartsFrom() uint64 { + if m != nil { + return m.HeightAccountingStartsFrom + } + return 0 +} + func init() { proto.RegisterType((*GenesisState)(nil), "osmosis.txfees.v1beta1.GenesisState") + proto.RegisterType((*TxFeesTracker)(nil), "osmosis.txfees.v1beta1.TxFeesTracker") } func init() { @@ -85,22 +149,33 @@ func init() { } var fileDescriptor_4423c18e3d020b37 = []byte{ - // 236 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc9, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xa9, 0x48, 0x4b, 0x4d, 0x2d, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, - 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x12, 0x83, 0xaa, 0xd2, 0x83, 0xa8, 0xd2, 0x83, 0xaa, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, - 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x54, 0x71, 0x98, 0x99, 0x96, 0x9a, 0x5a, 0x92, - 0x9f, 0x9d, 0x9a, 0x07, 0x51, 0xa6, 0x54, 0xc4, 0xc5, 0xe3, 0x0e, 0xb1, 0x25, 0xb8, 0x24, 0xb1, - 0x24, 0x55, 0x48, 0x86, 0x8b, 0x33, 0x29, 0xb1, 0x38, 0x35, 0x25, 0x35, 0x2f, 0x3f, 0x57, 0x82, - 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0x21, 0x20, 0xe4, 0xc2, 0xc5, 0x09, 0xd3, 0x5f, 0x2c, 0xc1, - 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa0, 0x87, 0xdd, 0x59, 0x7a, 0x6e, 0xa9, 0xa9, 0x21, 0x20, - 0x85, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x21, 0x34, 0x3a, 0xf9, 0x9c, 0x78, 0x24, 0xc7, - 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, - 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x51, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, - 0x7e, 0xae, 0x3e, 0xd4, 0x58, 0xdd, 0x9c, 0xc4, 0xa4, 0x62, 0x18, 0x47, 0xbf, 0xcc, 0xc8, 0x40, - 0xbf, 0x02, 0xe6, 0xa5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x47, 0x8c, 0x01, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xc6, 0xe5, 0xce, 0xf8, 0x45, 0x01, 0x00, 0x00, + // 405 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xbb, 0x8e, 0xd3, 0x40, + 0x14, 0x86, 0x3d, 0xbb, 0xab, 0x45, 0x99, 0x65, 0x1b, 0x0b, 0x21, 0x13, 0x81, 0x63, 0x59, 0x1b, + 0xc9, 0x4d, 0x66, 0x12, 0xd3, 0xd1, 0x61, 0x50, 0x28, 0xa0, 0x72, 0x52, 0xd1, 0x58, 0x63, 0xe7, + 0xc4, 0xb1, 0x1c, 0x7b, 0x22, 0xcf, 0x24, 0x72, 0xde, 0x82, 0xe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0x4a, 0x07, 0x0d, 0x55, 0x11, 0x5f, 0x91, 0x7a, 0x0b, 0xa4, 0x1c, 0xe4, 0xe8, 0xfa, 0x81, + 0x47, 0xa9, 0xd3, 0x2f, 0xb3, 0x7d, 0xff, 0xd5, 0xb1, 0xc2, 0x48, 0xce, 0x96, 0x3e, 0x09, 0x78, + 0x42, 0x9b, 0x95, 0xd5, 0x8f, 0x9e, 0x98, 0xc4, 0x54, 0xae, 0x17, 0x20, 0xaa, 0x02, 0xe1, 0xde, + 0xd7, 0xed, 0xd5, 0x18, 0xbf, 0x99, 0x41, 0x14, 0xce, 0xa4, 0xc7, 0x82, 0x80, 0x2f, 0x53, 0x19, + 0xa5, 0xa1, 0x27, 0x24, 0xcb, 0xa4, 0xf0, 0xa6, 0x19, 0x4f, 0xb4, 0x1b, 0x03, 0x59, 0x77, 0x8e, + 0xf5, 0x67, 0xd7, 0x79, 0x5a, 0xb3, 0x64, 0xfe, 0xce, 0xfc, 0x2f, 0x6e, 0xba, 0xed, 0x5a, 0x7f, + 0x7f, 0x94, 0x47, 0x95, 0x3a, 0xcc, 0x78, 0xe2, 0x7c, 0xd9, 0x14, 0x3a, 0xda, 0x16, 0x3a, 0xfa, + 0x5d, 0xe8, 0xe8, 0xdb, 0x5e, 0x57, 0xb6, 0x7b, 0x5d, 0xf9, 0xb9, 0xd7, 0x95, 0xaf, 0xf6, 0x59, + 0xf0, 0x66, 0x7d, 0xbd, 0x39, 0xf3, 0xc5, 0xe1, 0x83, 0xae, 0xec, 0x3e, 0xcd, 0x0f, 0xb7, 0xa4, + 0x1a, 0xc4, 0xbf, 0xaf, 0xce, 0xfe, 0xed, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xad, 0x2c, 0x38, + 0xcd, 0x98, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -123,6 +198,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.TxFeesTracker != nil { + { + size, err := m.TxFeesTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if len(m.Feetokens) > 0 { for iNdEx := len(m.Feetokens) - 1; iNdEx >= 0; iNdEx-- { { @@ -147,6 +234,48 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TxFeesTracker) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TxFeesTracker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxFeesTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HeightAccountingStartsFrom != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.HeightAccountingStartsFrom)) + i-- + dAtA[i] = 0x10 + } + if len(m.TxFees) > 0 { + for iNdEx := len(m.TxFees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TxFees[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -174,6 +303,28 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if m.TxFeesTracker != nil { + l = m.TxFeesTracker.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *TxFeesTracker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TxFees) > 0 { + for _, e := range m.TxFees { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.HeightAccountingStartsFrom != 0 { + n += 1 + sovGenesis(uint64(m.HeightAccountingStartsFrom)) + } return n } @@ -278,6 +429,145 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxFeesTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TxFeesTracker == nil { + m.TxFeesTracker = &TxFeesTracker{} + } + if err := m.TxFeesTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxFeesTracker) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxFeesTracker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxFeesTracker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxFees", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxFees = append(m.TxFees, types.Coin{}) + if err := m.TxFees[len(m.TxFees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeightAccountingStartsFrom", wireType) + } + m.HeightAccountingStartsFrom = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/txfees/types/keys.go b/x/txfees/types/keys.go index 13a39b957bc..8b75b853493 100644 --- a/x/txfees/types/keys.go +++ b/x/txfees/types/keys.go @@ -2,7 +2,8 @@ package types const ( // ModuleName defines the module name. - ModuleName = "txfees" + ModuleName = "txfees" + KeySeparator = "|" // StoreKey defines the primary module store key. StoreKey = ModuleName @@ -26,6 +27,8 @@ const ( ) var ( - BaseDenomKey = []byte("base_denom") - FeeTokensStorePrefix = []byte("fee_tokens") + BaseDenomKey = []byte("base_denom") + FeeTokensStorePrefix = []byte("fee_tokens") + KeyTxFeeProtorevTracker = []byte("txfee_protorev_tracker") + KeyTxFeeProtorevTrackerStartHeight = []byte("txfee_protorev_tracker_start_height") ) From 69ab6f769afc350d9a4b9fdf3e2f6c9e57716d0d Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 13:05:19 -0600 Subject: [PATCH 02/19] add cli cmd --- x/protorev/client/cli/query.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/x/protorev/client/cli/query.go b/x/protorev/client/cli/query.go index 3e45a57dc01..41ede1e0fc5 100644 --- a/x/protorev/client/cli/query.go +++ b/x/protorev/client/cli/query.go @@ -30,6 +30,7 @@ func NewCmdQuery() *cobra.Command { osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryEnabledCmd) osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryInfoByPoolTypeCmd) osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryPoolCmd) + osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryAllProtocolRevenueCmd) return cmd } @@ -157,6 +158,14 @@ func NewQueryPoolCmd() (*osmocli.QueryDescriptor, *types.QueryGetProtoRevPoolReq }, &types.QueryGetProtoRevPoolRequest{} } +// NewQueryAllProtocolRevenueCmd returns the command to query protocol revenue across all modules +func NewQueryAllProtocolRevenueCmd() (*osmocli.QueryDescriptor, *types.QueryGetAllProtocolRevenueRequest) { + return &osmocli.QueryDescriptor{ + Use: "all-proto-rev", + Short: "Query protocol revenue across all modules", + }, &types.QueryGetAllProtocolRevenueRequest{} +} + // convert a string array "[1,2,3]" to []uint64 // //nolint:unparam From 8a502b1bdb8741d01616606863a426afff0f1bfb Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 1 Nov 2023 19:13:59 +0000 Subject: [PATCH 03/19] Auto: update go.mod after push to adam/all-protocol-rev-query that modified dependencies locally --- go.mod | 2 +- go.sum | 4 ++-- x/epochs/go.mod | 5 +++-- x/epochs/go.sum | 13 +++++++------ x/ibc-hooks/go.mod | 9 ++++++--- x/ibc-hooks/go.sum | 24 +++++++++++++++++------- 6 files changed, 36 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index b94dc102d56..34d06588721 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/ory/dockertest/v3 v3.10.0 github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3 github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231014001935-1946419d44eb - github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231017074304-84e27b5e2aad + github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41 github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231011004221-fd24b80f8366 github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.9-0.20231014001935-1946419d44eb github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 3660c4a917d..4dcacd88250 100644 --- a/go.sum +++ b/go.sum @@ -966,8 +966,8 @@ github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3 h1:Ylmch 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.20231014001935-1946419d44eb h1:pXsC6vqGD+pbMGt+fVBHi9XBk/KDQuRZde2fh4s/1+k= github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231014001935-1946419d44eb/go.mod h1:jNZ952fypVNMzOsh31LAUS27JbF9naNJGtELxId6ZCg= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231017074304-84e27b5e2aad h1:UcQ/XLz0SqWMrA+BhgDXy9ukD4C+FlN4ULdazZmFOsE= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231017074304-84e27b5e2aad/go.mod h1:16AXMzbTLkYE5If5VLTA07fV9JNcLFwgf/VoW5sHrtU= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41 h1:XrXYbkR3i8P8dlWRsmd+16qzfky2yCGdIAeg13JcpyE= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41/go.mod h1:16AXMzbTLkYE5If5VLTA07fV9JNcLFwgf/VoW5sHrtU= github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231011004221-fd24b80f8366 h1:E6H0V3MKbSNwo1iXE9Kzatd2M02MgZpS5AiJ6CKK5us= github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231011004221-fd24b80f8366/go.mod h1:vU0IHK5W38dqMeux3MkSaT3MZU6whAkx7vNuxv1IzeU= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.9-0.20231014001935-1946419d44eb h1:6lYLEiJERdD+QK925XYyHkvNyvQTghVFufMH5VAQLpg= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index ae0ba7c0ecf..7e3ebc6bddb 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -8,7 +8,7 @@ require ( github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366 + github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41 github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.4 github.com/tendermint/tendermint v0.37.0-rc1 @@ -89,7 +89,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/opencontainers/runc v1.1.5 // indirect - github.com/osmosis-labs/osmosis/osmomath v0.0.6 // indirect + github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231011004221-fd24b80f8366 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -124,6 +124,7 @@ require ( go.etcd.io/bbolt v1.3.6 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/crypto v0.13.0 // indirect golang.org/x/net v0.15.0 // indirect golang.org/x/sys v0.12.0 // indirect diff --git a/x/epochs/go.sum b/x/epochs/go.sum index 676a72c43a3..7a1ba44f58d 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -496,6 +496,7 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -720,11 +721,11 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/osmosis-labs/cosmos-sdk v0.45.0-rc1.0.20230922030206-734f99fba785 h1:noyO/2kXPRafPfuOQQW3z1SYIvX5R+HogBH8t+ncwZQ= github.com/osmosis-labs/cosmos-sdk v0.45.0-rc1.0.20230922030206-734f99fba785/go.mod h1:toI9Pf+e5C4TuWAFpXfkxnkpr1RVFMK2qr7QMdkFrY8= -github.com/osmosis-labs/osmosis/osmomath v0.0.6 h1:WNkVmeeudAqRFk5a4CChWsdxfiY/XLClT1i845L78ss= -github.com/osmosis-labs/osmosis/osmomath v0.0.6/go.mod h1:UlftwozB+QObT3o0YfkuuyL9fsVdgoWt0dm6J7MLYnU= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366 h1:EJDJ88w2Yv5LnlaJw5x53C0k/dp/fnEYOfBYOQiMsTc= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366/go.mod h1:Zmyx5zMUBN2KV94booSFn2v8KQcUKeCHqyWpKZ4PRMo= -github.com/osmosis-labs/osmosis/v20 v19.0.0 h1:gqcas/XfxtEuZXsWGTO9vNMHiY78Qs09FBQw73djIVM= +github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231011004221-fd24b80f8366 h1:E/6Yk1f+8evOyi6xKHurjhPQrWKuW/KFoWJ8cfGT6I8= +github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231011004221-fd24b80f8366/go.mod h1:YEMUPuI9gBUATC4tp2MiW0oWRlShli0K95JqgNKJh9c= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41 h1:XrXYbkR3i8P8dlWRsmd+16qzfky2yCGdIAeg13JcpyE= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41/go.mod h1:16AXMzbTLkYE5If5VLTA07fV9JNcLFwgf/VoW5sHrtU= +github.com/osmosis-labs/osmosis/v20 v20.0.0 h1:r38aRP+iZVD0XfhgFlK+NUP2ALeMec0uAPv2dJvFAQ8= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -968,8 +969,8 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/x/ibc-hooks/go.mod b/x/ibc-hooks/go.mod index 93c2a72f17d..971b446ff82 100644 --- a/x/ibc-hooks/go.mod +++ b/x/ibc-hooks/go.mod @@ -7,12 +7,12 @@ require ( github.com/CosmWasm/wasmd v0.31.0 github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.47.5 - github.com/cosmos/ibc-go/v4 v4.5.0 + github.com/cosmos/ibc-go/v4 v4.5.1 github.com/gogo/protobuf v1.3.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/osmosis-labs/osmosis/osmomath v0.0.6 - github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366 + github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231011004221-fd24b80f8366 + github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41 github.com/spf13/cobra v1.7.0 github.com/tendermint/tendermint v0.37.0-rc1 google.golang.org/grpc v1.58.2 @@ -31,6 +31,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd v0.22.3 // indirect + github.com/bufbuild/protocompile v0.5.1 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -83,6 +84,7 @@ require ( github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jhump/protoreflect v1.15.1 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -132,6 +134,7 @@ require ( go.etcd.io/bbolt v1.3.6 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/arch v0.5.0 // indirect golang.org/x/crypto v0.13.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/net v0.15.0 // indirect diff --git a/x/ibc-hooks/go.sum b/x/ibc-hooks/go.sum index 9af5aea4a28..31298dd3a53 100644 --- a/x/ibc-hooks/go.sum +++ b/x/ibc-hooks/go.sum @@ -56,6 +56,7 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3 github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= @@ -146,6 +147,7 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= @@ -216,8 +218,7 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.7 h1:ij32FaEnwxfEurtK0QKDNhTWFnz6NUmrI5gky/WnoY0= github.com/cosmos/iavl v0.19.7/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v4 v4.5.0 h1:pjYO0/PbqbRxcRyptwjA6M4hUSnzxEoGp5G56/VVQoQ= -github.com/cosmos/ibc-go/v4 v4.5.0/go.mod h1:2EOi40Bx/j6rJrtP1ui8k8yUAMpGybmL1EjakYqYv5U= +github.com/cosmos/ibc-go/v4 v4.5.1 h1:+P73X7aIikGAXBUJ9vP9rEbvdSuekt3KGXmAWCSYets= github.com/cosmos/interchain-accounts v0.2.6 h1:TV2M2g1/Rb9MCNw1YePdBKE0rcEczNj1RGHT+2iRYas= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= @@ -254,6 +255,7 @@ github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KP github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -274,6 +276,7 @@ github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -334,6 +337,7 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -505,6 +509,7 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -550,7 +555,7 @@ github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+ github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.13.1-0.20220928232736-101791cb1b4c h1:XImQJfpJLmGEEd8ll5yPVyL/aEvmgGHW4WYTyNseLOM= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= @@ -730,10 +735,10 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/osmosis-labs/cosmos-sdk v0.45.0-rc1.0.20230922030206-734f99fba785 h1:noyO/2kXPRafPfuOQQW3z1SYIvX5R+HogBH8t+ncwZQ= github.com/osmosis-labs/cosmos-sdk v0.45.0-rc1.0.20230922030206-734f99fba785/go.mod h1:toI9Pf+e5C4TuWAFpXfkxnkpr1RVFMK2qr7QMdkFrY8= -github.com/osmosis-labs/osmosis/osmomath v0.0.6 h1:WNkVmeeudAqRFk5a4CChWsdxfiY/XLClT1i845L78ss= -github.com/osmosis-labs/osmosis/osmomath v0.0.6/go.mod h1:UlftwozB+QObT3o0YfkuuyL9fsVdgoWt0dm6J7MLYnU= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366 h1:EJDJ88w2Yv5LnlaJw5x53C0k/dp/fnEYOfBYOQiMsTc= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231011004221-fd24b80f8366/go.mod h1:Zmyx5zMUBN2KV94booSFn2v8KQcUKeCHqyWpKZ4PRMo= +github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231011004221-fd24b80f8366 h1:E/6Yk1f+8evOyi6xKHurjhPQrWKuW/KFoWJ8cfGT6I8= +github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231011004221-fd24b80f8366/go.mod h1:YEMUPuI9gBUATC4tp2MiW0oWRlShli0K95JqgNKJh9c= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41 h1:XrXYbkR3i8P8dlWRsmd+16qzfky2yCGdIAeg13JcpyE= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231101190541-d45713e67d41/go.mod h1:16AXMzbTLkYE5If5VLTA07fV9JNcLFwgf/VoW5sHrtU= github.com/osmosis-labs/wasmd v0.31.0-osmo-v16 h1:X747cZYdnqc/+RV48iPVeGprpVb/fUWSaKGsZUWrdbg= github.com/osmosis-labs/wasmd v0.31.0-osmo-v16/go.mod h1:Rf8zW/GgBQyFRRB4s62VQHWA6sTlMFSjoDQQpoq64iI= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= @@ -818,7 +823,10 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= +github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1190,6 +1198,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1202,6 +1211,7 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From e03b23d4a286603a354b9a7b0837d670ac7615e9 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 13:14:28 -0600 Subject: [PATCH 04/19] add changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08acd78a1cb..d2a16686046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Features + +* [#6804](https://github.com/osmosis-labs/osmosis/pull/6804) feat: track and query protocol rev across all modules + ### State Breaks * [#6758](https://github.com/osmosis-labs/osmosis/pull/6758) Add codec for MsgUndelegateFromRebalancedValidatorSet @@ -58,7 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#6420](https://github.com/osmosis-labs/osmosis/pull/6420) feat[CL]: Creates a governance set whitelist of addresses that can bypass the normal pool creation restrictions on concentrated liquidity pools * [#6623](https://github.com/osmosis-labs/osmosis/pull/6420) feat: transfer cl positions to new owner * [#6632](https://github.com/osmosis-labs/osmosis/pull/6632) Taker fee bypass whitelist -* [#6709](https://github.com/osmosis-labs/osmosis/pull/6709) CLI: Add list-env, all Environment for CLI +* [#6709](https://github.com/osmosis-labs/osmosis/pull/6709) CLI: Add list-env, all Environment for CL ### State Breaking From 7e6479c7e36b07635a3826b55eed7d1297158731 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 14:54:30 -0600 Subject: [PATCH 05/19] fix txfees tests --- CHANGELOG.md | 2 +- x/txfees/keeper/hooks.go | 31 +++++++++++++++++++++---------- x/txfees/keeper/hooks_test.go | 8 ++++++++ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a16686046..3c606c21092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#6420](https://github.com/osmosis-labs/osmosis/pull/6420) feat[CL]: Creates a governance set whitelist of addresses that can bypass the normal pool creation restrictions on concentrated liquidity pools * [#6623](https://github.com/osmosis-labs/osmosis/pull/6420) feat: transfer cl positions to new owner * [#6632](https://github.com/osmosis-labs/osmosis/pull/6632) Taker fee bypass whitelist -* [#6709](https://github.com/osmosis-labs/osmosis/pull/6709) CLI: Add list-env, all Environment for CL +* [#6709](https://github.com/osmosis-labs/osmosis/pull/6709) CLI: Add list-env, all Environment for CLI ### State Breaking diff --git a/x/txfees/keeper/hooks.go b/x/txfees/keeper/hooks.go index 9d148b71fbd..e63544e6e64 100644 --- a/x/txfees/keeper/hooks.go +++ b/x/txfees/keeper/hooks.go @@ -104,7 +104,8 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f } // Do the swap of this fee token denom to base denom. - _ = osmoutils.ApplyFuncIfNoError(ctx, func(cacheCtx sdk.Context) error { + var tokenOutAmt osmomath.Int + err = osmoutils.ApplyFuncIfNoError(ctx, func(cacheCtx sdk.Context) error { // We allow full slippage. Theres not really an effective way to bound slippage until TWAP's land, // but even then the point is a bit moot. // The only thing that could be done is a costly griefing attack to reduce the amount of osmo given as tx fees. @@ -113,16 +114,26 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f // We swap without charging a taker fee / sending to the non native fee collector, since these are funds that // are accruing from the taker fee itself. - tokenOutAmt, err := k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) - // If the swap goes through, update the tx fees tracker value. - if err == nil { - currentTxFeesTrackerValue := k.GetTxFeesTrackerValue(ctx) - // Subtract the amount swapped in and add the amount received from the current tx fees tracker value. - newTxFeesTrackerValue := currentTxFeesTrackerValue.Sub(sdk.NewCoins(coin)).Add(sdk.NewCoin(denomToSwapTo, tokenOutAmt)) - // Set the new tx fees tracker value. - k.SetTxFeesTrackerValue(ctx, newTxFeesTrackerValue) - } + tokenOutAmt, err = k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) return err }) + + // If the swap was successful, subtract the amount swapped in from the tx fees tracker value. + // We do this outside of the ApplyFuncIfNoError since we don't want to halt all hooks from executing + // in the event on chain accounting is bugged. + if err != nil { + currentTxFeesTrackerValue := k.GetTxFeesTrackerValue(ctx) + // Add the amount received from the swap to the current tx fees tracker value. + txFeesTrackerInterim := currentTxFeesTrackerValue.Add(sdk.NewCoin(denomToSwapTo, tokenOutAmt)) + // Subtract the amount swapped in from the current tx fees tracker value. + newTxFeesTrackerValue, ok := txFeesTrackerInterim.SafeSub(sdk.NewCoins(coin)) + if !ok { + // If for some reason the accounting fails, just continue, we don't want + // to halt all hooks from executing. + continue + } + // Set the new tx fees tracker value. + k.SetTxFeesTrackerValue(ctx, newTxFeesTrackerValue) + } } } diff --git a/x/txfees/keeper/hooks_test.go b/x/txfees/keeper/hooks_test.go index 44524c22652..d3359eb72d7 100644 --- a/x/txfees/keeper/hooks_test.go +++ b/x/txfees/keeper/hooks_test.go @@ -104,6 +104,11 @@ func (s *KeeperTestSuite) TestTxFeesAfterEpochEnd() { s.NoError(err) err = s.App.BankKeeper.SendCoinsFromAccountToModule(s.Ctx, addr0, types.FeeCollectorForStakingRewardsName, sdk.Coins{coin}) s.NoError(err) + + // Update the tx fee tracker + currentTxFeesTrackerValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + newTxFeesTrackerValue := currentTxFeesTrackerValue.Add(sdk.NewCoins(coin)...) + s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, newTxFeesTrackerValue) } // checks the balance of the non-native denom in module account @@ -412,6 +417,9 @@ func (s *KeeperTestSuite) TestAfterEpochEnd() { preFundCollectorCoins := prepareCoinsForSwapToDenomTest(denomToSwapTo) s.FundModuleAcc(collectorName, preFundCollectorCoins) + currentTxFeesTrackerValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) + s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, currentTxFeesTrackerValue.Add(preFundCollectorCoins...)) + // Prepare pools. s.preparePoolsForSwappingToDenom(otherPreSwapDenom, preSwapDenom, denomToSwapTo) From 103fede6eacb44830c7da6bc9197b39629f5a4d7 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 17:20:41 -0600 Subject: [PATCH 06/19] add upgrade test --- app/upgrades/v21/upgrades_test.go | 70 +++++++++++++++++++++++++++++++ x/protorev/keeper/genesis.go | 8 +++- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v21/upgrades_test.go diff --git a/app/upgrades/v21/upgrades_test.go b/app/upgrades/v21/upgrades_test.go new file mode 100644 index 00000000000..8633d605690 --- /dev/null +++ b/app/upgrades/v21/upgrades_test.go @@ -0,0 +1,70 @@ +package v21_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/osmosis-labs/osmosis/osmomath" + "github.com/osmosis-labs/osmosis/v20/app/apptesting" + "github.com/osmosis-labs/osmosis/v20/x/protorev/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + + poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" +) + +const ( + v21UpgradeHeight = 10 +) + +type UpgradeTestSuite struct { + apptesting.KeeperTestHelper +} + +func TestUpgradeTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} + +func (s *UpgradeTestSuite) TestUpgrade() { + s.Setup() + dummyUpgrade(s) + s.Require().NotPanics(func() { + s.App.BeginBlocker(s.Ctx, abci.RequestBeginBlock{}) + }) + + // Psuedo collect cyclic arb profits + cyclicArbProfits := sdk.NewCoins(sdk.NewCoin(types.OsmosisDenomination, osmomath.NewInt(9000)), sdk.NewCoin("Atom", osmomath.NewInt(3000))) + err := s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[0].Denom, cyclicArbProfits[0].Amount) + s.Require().NoError(err) + err = s.App.AppKeepers.ProtoRevKeeper.UpdateStatistics(s.Ctx, poolmanagertypes.SwapAmountInRoutes{}, cyclicArbProfits[1].Denom, cyclicArbProfits[1].Amount) + s.Require().NoError(err) + + allProtocolRevenue := s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx) + // Check all accounting start heights should be the same height as the upgrade + s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.CyclicArbTracker.HeightAccountingStartsFrom) + s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) + s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.TakerFeesToStakersTracker.HeightAccountingStartsFrom) + s.Require().Equal(uint64(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.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TakerFeesToStakersTracker.TakerFeesToStakers) + s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TxFeesTracker.TxFees) + s.Require().Equal(cyclicArbProfits, allProtocolRevenue.CyclicArbTracker.CyclicArb) + +} + +func dummyUpgrade(s *UpgradeTestSuite) { + s.Ctx = s.Ctx.WithBlockHeight(v21UpgradeHeight - 1) + plan := upgradetypes.Plan{Name: "v21", Height: v21UpgradeHeight} + err := s.App.UpgradeKeeper.ScheduleUpgrade(s.Ctx, plan) + s.Require().NoError(err) + _, exists := s.App.UpgradeKeeper.GetUpgradePlan(s.Ctx) + s.Require().True(exists) + + s.Ctx = s.Ctx.WithBlockHeight(v21UpgradeHeight) +} diff --git a/x/protorev/keeper/genesis.go b/x/protorev/keeper/genesis.go index 6d4b9c81498..6e3a67c9858 100644 --- a/x/protorev/keeper/genesis.go +++ b/x/protorev/keeper/genesis.go @@ -89,11 +89,15 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { // Since we now track all aspects of protocol revenue, we need to take a snapshot of cyclic arb profits from this module at a certain block height. // This allows us to display how much protocol revenue has been generated since block "X" instead of just since the module was initialized. - if genState.CyclicArbTracker != nil { + if !genState.CyclicArbTracker.CyclicArb.IsZero() { k.SetCyclicArbProfitTrackerValue(ctx, genState.CyclicArbTracker.CyclicArb) - k.SetCyclicArbProfitTrackerStartHeight(ctx, genState.CyclicArbTracker.HeightAccountingStartsFrom) } else { k.SetCyclicArbProfitTrackerValue(ctx, genState.Profits) + } + + if genState.CyclicArbTracker.HeightAccountingStartsFrom != 0 { + k.SetCyclicArbProfitTrackerStartHeight(ctx, genState.CyclicArbTracker.HeightAccountingStartsFrom) + } else { k.SetCyclicArbProfitTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) } } From fc897aafe31bc07b72f3e82f833897ccca1fb0cf Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 17:50:28 -0600 Subject: [PATCH 07/19] fix remaining test --- x/txfees/keeper/hooks.go | 17 ++++------------- x/txfees/keeper/hooks_test.go | 15 ++++++++------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/x/txfees/keeper/hooks.go b/x/txfees/keeper/hooks.go index e63544e6e64..bf207e627d6 100644 --- a/x/txfees/keeper/hooks.go +++ b/x/txfees/keeper/hooks.go @@ -115,25 +115,16 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f // We swap without charging a taker fee / sending to the non native fee collector, since these are funds that // are accruing from the taker fee itself. tokenOutAmt, err = k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) - return err - }) - // If the swap was successful, subtract the amount swapped in from the tx fees tracker value. - // We do this outside of the ApplyFuncIfNoError since we don't want to halt all hooks from executing - // in the event on chain accounting is bugged. - if err != nil { currentTxFeesTrackerValue := k.GetTxFeesTrackerValue(ctx) // Add the amount received from the swap to the current tx fees tracker value. txFeesTrackerInterim := currentTxFeesTrackerValue.Add(sdk.NewCoin(denomToSwapTo, tokenOutAmt)) // Subtract the amount swapped in from the current tx fees tracker value. - newTxFeesTrackerValue, ok := txFeesTrackerInterim.SafeSub(sdk.NewCoins(coin)) - if !ok { - // If for some reason the accounting fails, just continue, we don't want - // to halt all hooks from executing. - continue - } + newTxFeesTrackerValue := txFeesTrackerInterim.Sub(sdk.NewCoins(coin)) // Set the new tx fees tracker value. k.SetTxFeesTrackerValue(ctx, newTxFeesTrackerValue) - } + + return err + }) } } diff --git a/x/txfees/keeper/hooks_test.go b/x/txfees/keeper/hooks_test.go index d3359eb72d7..f5258a7836b 100644 --- a/x/txfees/keeper/hooks_test.go +++ b/x/txfees/keeper/hooks_test.go @@ -137,9 +137,10 @@ func (s *KeeperTestSuite) TestSwapNonNativeFeeToDenom() { s.Setup() var ( - defaultTxFeesDenom, _ = s.App.TxFeesKeeper.GetBaseDenom(s.Ctx) - defaultPoolCoins = sdk.NewCoins(sdk.NewCoin("foo", osmomath.NewInt(100)), sdk.NewCoin(defaultTxFeesDenom, osmomath.NewInt(100))) - defaultBalanceToSwap = sdk.NewCoins(sdk.NewCoin("foo", osmomath.NewInt(100))) + defaultTxFeesDenom, _ = s.App.TxFeesKeeper.GetBaseDenom(s.Ctx) + defaultPoolCoins = sdk.NewCoins(sdk.NewCoin("foo", osmomath.NewInt(100)), sdk.NewCoin(defaultTxFeesDenom, osmomath.NewInt(100))) + balanceToSwapFoo = sdk.NewCoins(sdk.NewCoin("foo", osmomath.NewInt(50))) + balanceToSwapBaseDenom = sdk.NewCoins(sdk.NewCoin(defaultTxFeesDenom, osmomath.NewInt(50))) ) tests := []struct { @@ -152,15 +153,15 @@ func (s *KeeperTestSuite) TestSwapNonNativeFeeToDenom() { }{ { name: "happy path", - denomToSwapTo: defaultTxFeesDenom, + denomToSwapTo: balanceToSwapBaseDenom[0].Denom, poolCoins: defaultPoolCoins, - preFundCoins: defaultBalanceToSwap, + preFundCoins: balanceToSwapFoo, }, { name: "same denom to swap to", - denomToSwapTo: defaultBalanceToSwap[0].Denom, + denomToSwapTo: balanceToSwapFoo[0].Denom, poolCoins: defaultPoolCoins, - preFundCoins: defaultBalanceToSwap, + preFundCoins: balanceToSwapFoo, }, // TODO: add more test cases From adf563538b18a73a2d7d03af6db09fdbe57b4165 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 18:09:19 -0600 Subject: [PATCH 08/19] change from uint to int --- .../osmosis/poolmanager/v1beta1/genesis.proto | 4 +- proto/osmosis/protorev/v1beta1/protorev.proto | 2 +- proto/osmosis/txfees/v1beta1/genesis.proto | 2 +- x/poolmanager/keeper.go | 4 +- x/poolmanager/protorev.go | 8 +- x/poolmanager/protorev_test.go | 4 +- x/poolmanager/types/genesis.pb.go | 130 +++++++++--------- x/protorev/keeper/genesis.go | 2 +- x/protorev/keeper/statistics.go | 8 +- x/protorev/keeper/statistics_test.go | 4 +- x/protorev/types/expected_keepers.go | 4 +- x/protorev/types/protorev.pb.go | 100 +++++++------- x/txfees/keeper/genesis.go | 2 +- x/txfees/keeper/protorev.go | 8 +- x/txfees/keeper/protorev_test.go | 4 +- x/txfees/types/genesis.pb.go | 56 ++++---- 16 files changed, 171 insertions(+), 171 deletions(-) diff --git a/proto/osmosis/poolmanager/v1beta1/genesis.proto b/proto/osmosis/poolmanager/v1beta1/genesis.proto index 6bbaba6ec47..6955ac65afc 100644 --- a/proto/osmosis/poolmanager/v1beta1/genesis.proto +++ b/proto/osmosis/poolmanager/v1beta1/genesis.proto @@ -127,7 +127,7 @@ message TakerFeesToStakersTracker { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - uint64 height_accounting_starts_from = 2 + int64 height_accounting_starts_from = 2 [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; } @@ -136,6 +136,6 @@ message TakerFeesToCommunityPoolTracker { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - uint64 height_accounting_starts_from = 2 + int64 height_accounting_starts_from = 2 [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; } \ No newline at end of file diff --git a/proto/osmosis/protorev/v1beta1/protorev.proto b/proto/osmosis/protorev/v1beta1/protorev.proto index 10194e5237a..da5ce1cc877 100644 --- a/proto/osmosis/protorev/v1beta1/protorev.proto +++ b/proto/osmosis/protorev/v1beta1/protorev.proto @@ -209,6 +209,6 @@ message CyclicArbTracker { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - uint64 height_accounting_starts_from = 2 + int64 height_accounting_starts_from = 2 [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; } diff --git a/proto/osmosis/txfees/v1beta1/genesis.proto b/proto/osmosis/txfees/v1beta1/genesis.proto index 7db6f6c460f..62aede6c35b 100644 --- a/proto/osmosis/txfees/v1beta1/genesis.proto +++ b/proto/osmosis/txfees/v1beta1/genesis.proto @@ -21,6 +21,6 @@ message TxFeesTracker { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - uint64 height_accounting_starts_from = 2 + int64 height_accounting_starts_from = 2 [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; } \ No newline at end of file diff --git a/x/poolmanager/keeper.go b/x/poolmanager/keeper.go index 4fdf214c2d7..698e10d81d4 100644 --- a/x/poolmanager/keeper.go +++ b/x/poolmanager/keeper.go @@ -106,14 +106,14 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesToStakersTracker.HeightAccountingStartsFrom) } else { k.SetTakerFeeTrackerForStakers(ctx, sdk.NewCoins()) - k.SetTakerFeeTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + k.SetTakerFeeTrackerStartHeight(ctx, ctx.BlockHeight()) } if genState.TakerFeesToCommunityPoolTracker != nil { k.SetTakerFeeTrackerForCommunityPool(ctx, genState.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) } else { k.SetTakerFeeTrackerForCommunityPool(ctx, sdk.NewCoins()) - k.SetTakerFeeTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + k.SetTakerFeeTrackerStartHeight(ctx, ctx.BlockHeight()) } } diff --git a/x/poolmanager/protorev.go b/x/poolmanager/protorev.go index f287fe1505b..be53248a702 100644 --- a/x/poolmanager/protorev.go +++ b/x/poolmanager/protorev.go @@ -89,13 +89,13 @@ func (k Keeper) GetTakerFeeTrackerForCommunityPool(ctx sdk.Context) (currentTake } // GetTakerFeeTrackerStartHeight gets the height from which we started accounting for taker fees. -func (k Keeper) GetTakerFeeTrackerStartHeight(ctx sdk.Context) uint64 { - startHeight := gogotypes.UInt64Value{} +func (k Keeper) GetTakerFeeTrackerStartHeight(ctx sdk.Context) int64 { + startHeight := gogotypes.Int64Value{} osmoutils.MustGet(ctx.KVStore(k.storeKey), types.KeyTakerFeeProtoRevAccountingHeight, &startHeight) return startHeight.Value } // SetTakerFeeTrackerStartHeight sets the height from which we started accounting for taker fees. -func (k Keeper) SetTakerFeeTrackerStartHeight(ctx sdk.Context, startHeight uint64) { - osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeProtoRevAccountingHeight, &gogotypes.UInt64Value{Value: startHeight}) +func (k Keeper) SetTakerFeeTrackerStartHeight(ctx sdk.Context, startHeight int64) { + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTakerFeeProtoRevAccountingHeight, &gogotypes.Int64Value{Value: startHeight}) } diff --git a/x/poolmanager/protorev_test.go b/x/poolmanager/protorev_test.go index a03105c6293..a7f828f4774 100644 --- a/x/poolmanager/protorev_test.go +++ b/x/poolmanager/protorev_test.go @@ -78,8 +78,8 @@ func (s *KeeperTestSuite) TestGetSetTakerFeeTrackerForStakersAndCommunityPool() func (s *KeeperTestSuite) TestGetSetTakerFeeTrackerStartHeight() { tests := map[string]struct { - firstTakerFeeTrackerStartHeight uint64 - secondTakerFeeTrackerStartHeight uint64 + firstTakerFeeTrackerStartHeight int64 + secondTakerFeeTrackerStartHeight int64 }{ "replace tracker height with a higher height": { firstTakerFeeTrackerStartHeight: 100, diff --git a/x/poolmanager/types/genesis.pb.go b/x/poolmanager/types/genesis.pb.go index d6b7d42afe5..7138c645afb 100644 --- a/x/poolmanager/types/genesis.pb.go +++ b/x/poolmanager/types/genesis.pb.go @@ -331,7 +331,7 @@ var xxx_messageInfo_TakerFeeDistributionPercentage proto.InternalMessageInfo type TakerFeesToStakersTracker struct { TakerFeesToStakers github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=taker_fees_to_stakers,json=takerFeesToStakers,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_stakers"` - HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` + HeightAccountingStartsFrom int64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` } func (m *TakerFeesToStakersTracker) Reset() { *m = TakerFeesToStakersTracker{} } @@ -374,7 +374,7 @@ func (m *TakerFeesToStakersTracker) GetTakerFeesToStakers() github_com_cosmos_co return nil } -func (m *TakerFeesToStakersTracker) GetHeightAccountingStartsFrom() uint64 { +func (m *TakerFeesToStakersTracker) GetHeightAccountingStartsFrom() int64 { if m != nil { return m.HeightAccountingStartsFrom } @@ -383,7 +383,7 @@ func (m *TakerFeesToStakersTracker) GetHeightAccountingStartsFrom() uint64 { type TakerFeesToCommunityPoolTracker struct { TakerFeesToCommunityPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=taker_fees_to_community_pool,json=takerFeesToCommunityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_community_pool"` - HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` + HeightAccountingStartsFrom int64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` } func (m *TakerFeesToCommunityPoolTracker) Reset() { *m = TakerFeesToCommunityPoolTracker{} } @@ -426,7 +426,7 @@ func (m *TakerFeesToCommunityPoolTracker) GetTakerFeesToCommunityPool() github_c return nil } -func (m *TakerFeesToCommunityPoolTracker) GetHeightAccountingStartsFrom() uint64 { +func (m *TakerFeesToCommunityPoolTracker) GetHeightAccountingStartsFrom() int64 { if m != nil { return m.HeightAccountingStartsFrom } @@ -449,69 +449,69 @@ func init() { var fileDescriptor_aa099d9fbdf68b35 = []byte{ // 1021 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x26, 0x21, 0x52, 0x26, 0x25, 0xa1, 0x03, 0xa1, 0x9b, 0xa4, 0xf5, 0x5a, 0xdb, 0x1e, + 0x14, 0xce, 0xc6, 0x21, 0x52, 0x26, 0x25, 0xa1, 0x03, 0xa1, 0x9b, 0xa4, 0xf5, 0x5a, 0xdb, 0x1e, 0x8c, 0x50, 0x77, 0xdb, 0x20, 0x05, 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xd0, 0x71, 0x22, 0xe6, 0xc6, 0x54, 0xb4, 0x9d, 0x47, - 0x10, 0x52, 0xbf, 0xbf, 0x0f, 0xfe, 0x20, 0xb7, 0xd6, 0xf6, 0x35, 0xbe, 0x24, 0xf6, 0xd6, 0x82, - 0x71, 0x03, 0x7e, 0x61, 0x20, 0xb5, 0x96, 0xce, 0x6f, 0x20, 0x41, 0xc4, 0x45, 0x1a, 0x35, 0x33, - 0x39, 0x3c, 0x45, 0xa3, 0x7c, 0x3e, 0x53, 0xee, 0xfb, 0x17, 0x80, 0x87, 0x90, 0xfa, 0x90, 0x08, - 0x1a, 0x42, 0xbd, 0x2a, 0xb5, 0x0e, 0x72, 0xcb, 0x7c, 0xc2, 0x63, 0x76, 0x55, 0xac, 0x67, 0xb2, - 0x09, 0x1e, 0xfc, 0x93, 0x81, 0xac, 0x84, 0x25, 0x64, 0x9a, 0xc4, 0x85, 0xff, 0x2e, 0xf1, 0x76, - 0x21, 0x71, 0xeb, 0x31, 0x4b, 0x26, 0xaa, 0xdc, 0x4a, 0x26, 0x3b, 0xf1, 0x1e, 0x5a, 0xa3, 0x41, - 0x1c, 0x25, 0x84, 0x06, 0x41, 0x0a, 0x9c, 0x03, 0x37, 0x17, 0xd5, 0x84, 0x6f, 0x0e, 0x73, 0xeb, - 0xc3, 0x62, 0xc2, 0xc7, 0x03, 0x6c, 0x6f, 0x55, 0x59, 0x76, 0x4b, 0x03, 0xfe, 0xc5, 0x40, 0x3b, - 0x97, 0x7a, 0x50, 0x2d, 0x01, 0x35, 0x16, 0x27, 0xb4, 0x47, 0x64, 0x29, 0x4e, 0xda, 0x91, 0x80, - 0x6e, 0xc4, 0x05, 0x04, 0x84, 0x72, 0x0e, 0x42, 0xb6, 0xae, 0xea, 0xd1, 0xe5, 0xfa, 0xee, 0x30, - 0xb7, 0x1e, 0xea, 0xcb, 0xfe, 0x1d, 0x8f, 0xed, 0x39, 0xfe, 0xc5, 0xee, 0x54, 0xbb, 0xa6, 0xc1, -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x54, 0xae, 0xee, 0x9b, 0xd3, 0x56, 0xf7, 0xff, + 0x51, 0x18, 0x73, 0xd2, 0x06, 0x7f, 0xab, 0xe5, 0x69, 0x3c, 0x7d, 0x39, 0xa8, 0x1a, 0xaf, 0x06, + 0x55, 0xe3, 0xcf, 0x41, 0xd5, 0xf8, 0xe1, 0xac, 0x3a, 0xf7, 0xea, 0xac, 0x3a, 0xf7, 0xdb, 0x59, + 0x75, 0xee, 0xd9, 0xa7, 0x17, 0x52, 0x29, 0x76, 0xe1, 0xdd, 0x2e, 0x6d, 0xf1, 0xf2, 0xe0, 0x1e, + 0x6f, 0xdd, 0x73, 0x4f, 0xc7, 0xbe, 0xe9, 0x54, 0x7e, 0xad, 0x45, 0xf5, 0x15, 0xf7, 0xc9, 0xdf, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, 0xff, 0x7f, 0x05, 0xcb, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1797,7 +1797,7 @@ func (m *TakerFeesToStakersTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + m.HeightAccountingStartsFrom |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -1900,7 +1900,7 @@ func (m *TakerFeesToCommunityPoolTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + m.HeightAccountingStartsFrom |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/protorev/keeper/genesis.go b/x/protorev/keeper/genesis.go index 6e3a67c9858..83653ba9b8e 100644 --- a/x/protorev/keeper/genesis.go +++ b/x/protorev/keeper/genesis.go @@ -98,7 +98,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { if genState.CyclicArbTracker.HeightAccountingStartsFrom != 0 { k.SetCyclicArbProfitTrackerStartHeight(ctx, genState.CyclicArbTracker.HeightAccountingStartsFrom) } else { - k.SetCyclicArbProfitTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + k.SetCyclicArbProfitTrackerStartHeight(ctx, ctx.BlockHeight()) } } diff --git a/x/protorev/keeper/statistics.go b/x/protorev/keeper/statistics.go index d03950c743f..b1771e85c14 100644 --- a/x/protorev/keeper/statistics.go +++ b/x/protorev/keeper/statistics.go @@ -115,15 +115,15 @@ func (k Keeper) GetCyclicArbProfitTrackerValue(ctx sdk.Context) (currentCyclicAr } // GetCyclicArbProfitTrackerStartHeight gets the height from which we started accounting for cyclic arb profits. -func (k Keeper) GetCyclicArbProfitTrackerStartHeight(ctx sdk.Context) uint64 { - startHeight := gogotypes.UInt64Value{} +func (k Keeper) GetCyclicArbProfitTrackerStartHeight(ctx sdk.Context) int64 { + startHeight := gogotypes.Int64Value{} osmoutils.MustGet(ctx.KVStore(k.storeKey), types.KeyCyclicArbTrackerStartHeight, &startHeight) return startHeight.Value } // SetCyclicArbProfitTrackerStartHeight sets the height from which we started accounting for cyclic arb profits. -func (k Keeper) SetCyclicArbProfitTrackerStartHeight(ctx sdk.Context, startHeight uint64) { - osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyCyclicArbTrackerStartHeight, &gogotypes.UInt64Value{Value: startHeight}) +func (k Keeper) SetCyclicArbProfitTrackerStartHeight(ctx sdk.Context, startHeight int64) { + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyCyclicArbTrackerStartHeight, &gogotypes.Int64Value{Value: startHeight}) } // UpdateProfitsByDenom updates the profits made by the ProtoRev module for the given denom diff --git a/x/protorev/keeper/statistics_test.go b/x/protorev/keeper/statistics_test.go index b1b8ae57b35..aaf821e5aff 100644 --- a/x/protorev/keeper/statistics_test.go +++ b/x/protorev/keeper/statistics_test.go @@ -244,8 +244,8 @@ func (s *KeeperTestSuite) TestGetSetCyclicArbProfitTrackerValue() { func (s *KeeperTestSuite) TestGetSetCyclicArbProfitTrackerStartHeight() { tests := map[string]struct { - firstCyclicArbStartHeight uint64 - secondCyclicArbStartHeight uint64 + firstCyclicArbStartHeight int64 + secondCyclicArbStartHeight int64 }{ "replace tracker height with a higher height": { firstCyclicArbStartHeight: 100, diff --git a/x/protorev/types/expected_keepers.go b/x/protorev/types/expected_keepers.go index eef551587bb..fd4a4086047 100644 --- a/x/protorev/types/expected_keepers.go +++ b/x/protorev/types/expected_keepers.go @@ -62,7 +62,7 @@ type PoolManagerKeeper interface { RouteGetPoolDenoms(ctx sdk.Context, poolId uint64) ([]string, error) GetTakerFeeTrackerForStakers(ctx sdk.Context) sdk.Coins GetTakerFeeTrackerForCommunityPool(ctx sdk.Context) sdk.Coins - GetTakerFeeTrackerStartHeight(ctx sdk.Context) uint64 + GetTakerFeeTrackerStartHeight(ctx sdk.Context) int64 } // EpochKeeper defines the Epoch contract that must be fulfilled when @@ -84,5 +84,5 @@ type ConcentratedLiquidityKeeper interface { type TxFeesKeeper interface { GetTxFeesTrackerValue(ctx sdk.Context) (currentTxFees sdk.Coins) - GetTxFeesTrackerStartHeight(ctx sdk.Context) uint64 + GetTxFeesTrackerStartHeight(ctx sdk.Context) int64 } diff --git a/x/protorev/types/protorev.pb.go b/x/protorev/types/protorev.pb.go index 11a54ac43b0..f410d60db8a 100644 --- a/x/protorev/types/protorev.pb.go +++ b/x/protorev/types/protorev.pb.go @@ -793,7 +793,7 @@ func (m *AllProtocolRevenue) GetCyclicArbTracker() CyclicArbTracker { type CyclicArbTracker struct { CyclicArb github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=cyclic_arb,json=cyclicArb,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"cyclic_arb"` - HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` + HeightAccountingStartsFrom int64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` } func (m *CyclicArbTracker) Reset() { *m = CyclicArbTracker{} } @@ -836,7 +836,7 @@ func (m *CyclicArbTracker) GetCyclicArb() github_com_cosmos_cosmos_sdk_types.Coi return nil } -func (m *CyclicArbTracker) GetHeightAccountingStartsFrom() uint64 { +func (m *CyclicArbTracker) GetHeightAccountingStartsFrom() int64 { if m != nil { return m.HeightAccountingStartsFrom } @@ -865,9 +865,9 @@ func init() { } var fileDescriptor_1e9f2391fd9fec01 = []byte{ - // 1259 bytes of a gzipped FileDescriptorProto + // 1260 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x36, 0x69, 0x5a, 0x8f, 0x5b, 0xdb, 0x9d, 0xa6, 0xad, 0xe3, 0x52, 0x6f, 0x98, 0x16, + 0x14, 0xce, 0xd6, 0x69, 0x5a, 0x8f, 0xdb, 0xd8, 0x9d, 0xa6, 0xad, 0xe3, 0x52, 0x6f, 0x98, 0x16, 0x70, 0x81, 0xda, 0x4d, 0x8a, 0x10, 0x2a, 0xf4, 0x90, 0x35, 0xaa, 0xa8, 0x10, 0x6d, 0x35, 0xb1, 0x54, 0xc1, 0x65, 0x99, 0x5d, 0x8f, 0x9d, 0xc5, 0xde, 0x1d, 0x6b, 0x67, 0x9c, 0xda, 0x45, 0xe2, 0xc2, 0x91, 0x0b, 0x17, 0x6e, 0x1c, 0x38, 0x81, 0x84, 0xc4, 0xff, 0xc0, 0xb1, 0xc7, 0x1e, 0x2b, @@ -880,50 +880,50 @@ var fileDescriptor_1e9f2391fd9fec01 = []byte{ 0xb1, 0x7e, 0x48, 0x22, 0xd2, 0xa5, 0x71, 0x1a, 0xd7, 0xa5, 0x11, 0x4d, 0xcb, 0xa8, 0x5c, 0x4a, 0x42, 0xc5, 0xa8, 0x43,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x48, 0x9f, 0x44, 0x3e, 0x8d, 0x13, 0x82, 0x23, 0x8a, 0xa0, 0x32, 0x9d, 0xd8, 0x67, 0x35, - 0xc1, 0x5c, 0x00, 0xc2, 0x85, 0xc4, 0x62, 0x48, 0xee, 0x80, 0xd3, 0x3e, 0x8b, 0x7c, 0x1a, 0x89, - 0x98, 0x08, 0xda, 0x4e, 0x88, 0x96, 0x15, 0x51, 0x75, 0x3a, 0xb1, 0x2b, 0x9a, 0xe8, 0x80, 0x20, - 0x84, 0xe1, 0xac, 0x35, 0xab, 0x4a, 0x0a, 0x7a, 0x9f, 0xf0, 0x30, 0x21, 0x5b, 0x99, 0xaf, 0x6a, - 0x2e, 0x00, 0xe1, 0x42, 0x62, 0xd1, 0x24, 0xe8, 0xfb, 0x65, 0x50, 0xb8, 0x15, 0x75, 0x98, 0x33, - 0x96, 0x7a, 0xb5, 0xc6, 0x03, 0x0a, 0xef, 0x81, 0x55, 0xdd, 0xbd, 0x52, 0x29, 0xbf, 0x55, 0x5b, - 0xfc, 0x3b, 0xdb, 0x51, 0x71, 0x12, 0xa9, 0x38, 0xe6, 0x7e, 0x70, 0x9a, 0x05, 0x61, 0x43, 0x07, - 0x5d, 0x70, 0x3c, 0xd1, 0x44, 0xe9, 0x97, 0xdf, 0x7a, 0x73, 0x31, 0xb5, 0x63, 0x22, 0x53, 0xf2, - 0x73, 0x86, 0xbc, 0xb8, 0x5f, 0x6f, 0x84, 0x53, 0x52, 0xc8, 0xc0, 0x89, 0x59, 0x9d, 0x94, 0xb6, - 0xf9, 0xad, 0xfa, 0xe2, 0x24, 0xcd, 0x99, 0xe8, 0x34, 0xd1, 0x79, 0x93, 0xe8, 0xf4, 0xb3, 0xf3, - 0x40, 0x78, 0x5f, 0x02, 0xd9, 0x51, 0xa2, 0xa7, 0xd2, 0xfe, 0xd0, 0x8e, 0x9a, 0x26, 0x72, 0x51, - 0x47, 0x09, 0x13, 0xc2, 0x29, 0x29, 0x7a, 0x1f, 0x14, 0xf6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x8f, 0x27, 0x2f, 0x8d, + 0xbd, 0xad, 0xab, 0x8d, 0x51, 0xf6, 0x8f, 0x8d, 0xea, 0xc6, 0x5b, 0x51, 0xef, 0xd7, 0xfe, 0x0d, + 0x00, 0x00, 0xff, 0xff, 0x8f, 0xd0, 0x41, 0xd2, 0xf9, 0x0c, 0x00, 0x00, } func (this *TokenPairArbRoutes) Equal(that interface{}) bool { @@ -3607,7 +3607,7 @@ func (m *CyclicArbTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + m.HeightAccountingStartsFrom |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/txfees/keeper/genesis.go b/x/txfees/keeper/genesis.go index bec5f1e6bc5..0a0ee4f9080 100644 --- a/x/txfees/keeper/genesis.go +++ b/x/txfees/keeper/genesis.go @@ -26,7 +26,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { k.SetTxFeesTrackerStartHeight(ctx, genState.TxFeesTracker.HeightAccountingStartsFrom) } else { k.SetTxFeesTrackerValue(ctx, sdk.NewCoins()) - k.SetTxFeesTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + k.SetTxFeesTrackerStartHeight(ctx, ctx.BlockHeight()) } } diff --git a/x/txfees/keeper/protorev.go b/x/txfees/keeper/protorev.go index 81c23afcd66..6a6c8e80bb1 100644 --- a/x/txfees/keeper/protorev.go +++ b/x/txfees/keeper/protorev.go @@ -51,13 +51,13 @@ func (k Keeper) GetTxFeesTrackerValue(ctx sdk.Context) (currentTxFees sdk.Coins) } // GetTxFeesTrackerStartHeight gets the height from which we started accounting for txfees. -func (k Keeper) GetTxFeesTrackerStartHeight(ctx sdk.Context) uint64 { - startHeight := gogotypes.UInt64Value{} +func (k Keeper) GetTxFeesTrackerStartHeight(ctx sdk.Context) int64 { + startHeight := gogotypes.Int64Value{} osmoutils.MustGet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTrackerStartHeight, &startHeight) return startHeight.Value } // SetTxFeesTrackerStartHeight sets the height from which we started accounting for txfees. -func (k Keeper) SetTxFeesTrackerStartHeight(ctx sdk.Context, startHeight uint64) { - osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTrackerStartHeight, &gogotypes.UInt64Value{Value: startHeight}) +func (k Keeper) SetTxFeesTrackerStartHeight(ctx sdk.Context, startHeight int64) { + osmoutils.MustSet(ctx.KVStore(k.storeKey), types.KeyTxFeeProtorevTrackerStartHeight, &gogotypes.Int64Value{Value: startHeight}) } diff --git a/x/txfees/keeper/protorev_test.go b/x/txfees/keeper/protorev_test.go index 0aed1beffa1..39474bff71a 100644 --- a/x/txfees/keeper/protorev_test.go +++ b/x/txfees/keeper/protorev_test.go @@ -54,8 +54,8 @@ func (s *KeeperTestSuite) TestGetSetTxFeesTrackerValue() { func (s *KeeperTestSuite) TestGetSetTxFeesTrackerStartHeight() { tests := map[string]struct { - firstTxFeesTrackerStartHeight uint64 - secondTxFeesTrackerStartHeight uint64 + firstTxFeesTrackerStartHeight int64 + secondTxFeesTrackerStartHeight int64 }{ "replace tracker height with a higher height": { firstTxFeesTrackerStartHeight: 100, diff --git a/x/txfees/types/genesis.pb.go b/x/txfees/types/genesis.pb.go index 5cdb102a040..2a23c8c288c 100644 --- a/x/txfees/types/genesis.pb.go +++ b/x/txfees/types/genesis.pb.go @@ -89,7 +89,7 @@ func (m *GenesisState) GetTxFeesTracker() *TxFeesTracker { type TxFeesTracker struct { TxFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=tx_fees,json=txFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tx_fees"` - HeightAccountingStartsFrom uint64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` + HeightAccountingStartsFrom int64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` } func (m *TxFeesTracker) Reset() { *m = TxFeesTracker{} } @@ -132,7 +132,7 @@ func (m *TxFeesTracker) GetTxFees() github_com_cosmos_cosmos_sdk_types.Coins { return nil } -func (m *TxFeesTracker) GetHeightAccountingStartsFrom() uint64 { +func (m *TxFeesTracker) GetHeightAccountingStartsFrom() int64 { if m != nil { return m.HeightAccountingStartsFrom } @@ -151,31 +151,31 @@ func init() { var fileDescriptor_4423c18e3d020b37 = []byte{ // 405 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xbb, 0x8e, 0xd3, 0x40, - 0x14, 0x86, 0x3d, 0xbb, 0xab, 0x45, 0x99, 0x65, 0x1b, 0x0b, 0x21, 0x13, 0x81, 0x63, 0x59, 0x1b, - 0xc9, 0x4d, 0x66, 0x12, 0xd3, 0xd1, 0x61, 0x50, 0x28, 0xa0, 0x72, 0x52, 0xd1, 0x58, 0x63, 0xe7, - 0xc4, 0xb1, 0x1c, 0x7b, 0x22, 0xcf, 0x24, 0x72, 0xde, 0x82, 0xe7, 0xe0, 0x25, 0x68, 0x53, 0xa6, - 0xa4, 0x0a, 0xc8, 0x79, 0x03, 0x9e, 0x00, 0xf9, 0x92, 0x9b, 0x44, 0xa8, 0x7c, 0xf9, 0xbf, 0xf3, - 0x9f, 0xff, 0x9c, 0x19, 0xfc, 0xc4, 0x45, 0xc2, 0x45, 0x24, 0xa8, 0xcc, 0xa7, 0x00, 0x82, 0xae, - 0x06, 0x3e, 0x48, 0x36, 0xa0, 0x21, 0xa4, 0x20, 0x22, 0x41, 0x16, 0x19, 0x97, 0x5c, 0x7d, 0xd9, - 0x50, 0xa4, 0xa6, 0x48, 0x43, 0xb5, 0x5f, 0x84, 0x3c, 0xe4, 0x15, 0x42, 0xcb, 0xb7, 0x9a, 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d, + 0xad, 0xdb, 0xab, 0x31, 0x7e, 0x3b, 0x83, 0x28, 0x9c, 0x49, 0x8f, 0x05, 0x01, 0x5f, 0xa6, 0x32, + 0x4a, 0x43, 0x4f, 0x48, 0x96, 0x49, 0xe1, 0x4d, 0x33, 0x9e, 0x68, 0x37, 0x06, 0xb2, 0x5a, 0x8e, + 0xf5, 0x77, 0xd7, 0x7d, 0x58, 0xb3, 0x64, 0xfe, 0xde, 0x7c, 0x12, 0x37, 0xdd, 0x4e, 0xad, 0x7f, + 0x38, 0xca, 0xa3, 0x4a, 0x1d, 0x66, 0x3c, 0x71, 0xbe, 0x6e, 0x0a, 0x1d, 0x6d, 0x0b, 0x1d, 0xfd, + 0x29, 0x74, 0xf4, 0x7d, 0xaf, 0x2b, 0xdb, 0xbd, 0xae, 0xfc, 0xda, 0xeb, 0xca, 0x37, 0xfb, 0x2c, + 0x78, 0xb3, 0xbe, 0xde, 0x9c, 0xf9, 0xe2, 0xf0, 0x41, 0x57, 0x76, 0x9f, 0xe6, 0x87, 0x5b, 0x52, + 0x0d, 0xe2, 0xdf, 0x56, 0x67, 0xff, 0xee, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0x23, 0x0f, + 0x42, 0x98, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -563,7 +563,7 @@ func (m *TxFeesTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.HeightAccountingStartsFrom |= uint64(b&0x7F) << shift + m.HeightAccountingStartsFrom |= int64(b&0x7F) << shift if b < 0x80 { break } From d37589c2384e7b2d7908626a672373089483f3ea Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 18:15:43 -0600 Subject: [PATCH 09/19] int --- app/upgrades/v21/upgrades.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v21/upgrades.go b/app/upgrades/v21/upgrades.go index 455a7f7fd88..e639a3b3847 100644 --- a/app/upgrades/v21/upgrades.go +++ b/app/upgrades/v21/upgrades.go @@ -26,13 +26,13 @@ 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, uint64(ctx.BlockHeight())) - keepers.TxFeesKeeper.SetTxFeesTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + keepers.PoolManagerKeeper.SetTakerFeeTrackerStartHeight(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). allCyclicArbProfits := keepers.ProtoRevKeeper.GetAllProfits(ctx) allCyclicArbProfitsCoins := osmoutils.ConvertCoinArrayToCoins(allCyclicArbProfits) keepers.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(ctx, allCyclicArbProfitsCoins) - keepers.ProtoRevKeeper.SetCyclicArbProfitTrackerStartHeight(ctx, uint64(ctx.BlockHeight())) + keepers.ProtoRevKeeper.SetCyclicArbProfitTrackerStartHeight(ctx, ctx.BlockHeight()) return migrations, nil } From 6561349974b4b641746a9561e3c21203c0f6adbb Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 20:02:57 -0600 Subject: [PATCH 10/19] dont recalc values at epoch hook call --- x/txfees/keeper/hooks.go | 14 ++------------ x/txfees/keeper/hooks_test.go | 7 ------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/x/txfees/keeper/hooks.go b/x/txfees/keeper/hooks.go index bf207e627d6..130acead24e 100644 --- a/x/txfees/keeper/hooks.go +++ b/x/txfees/keeper/hooks.go @@ -104,8 +104,7 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f } // Do the swap of this fee token denom to base denom. - var tokenOutAmt osmomath.Int - err = osmoutils.ApplyFuncIfNoError(ctx, func(cacheCtx sdk.Context) error { + _ = osmoutils.ApplyFuncIfNoError(ctx, func(cacheCtx sdk.Context) error { // We allow full slippage. Theres not really an effective way to bound slippage until TWAP's land, // but even then the point is a bit moot. // The only thing that could be done is a costly griefing attack to reduce the amount of osmo given as tx fees. @@ -114,16 +113,7 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f // We swap without charging a taker fee / sending to the non native fee collector, since these are funds that // are accruing from the taker fee itself. - tokenOutAmt, err = k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) - - currentTxFeesTrackerValue := k.GetTxFeesTrackerValue(ctx) - // Add the amount received from the swap to the current tx fees tracker value. - txFeesTrackerInterim := currentTxFeesTrackerValue.Add(sdk.NewCoin(denomToSwapTo, tokenOutAmt)) - // Subtract the amount swapped in from the current tx fees tracker value. - newTxFeesTrackerValue := txFeesTrackerInterim.Sub(sdk.NewCoins(coin)) - // Set the new tx fees tracker value. - k.SetTxFeesTrackerValue(ctx, newTxFeesTrackerValue) - + _, err := k.poolManager.SwapExactAmountInNoTakerFee(cacheCtx, feeCollectorAddress, poolId, coin, denomToSwapTo, minAmountOut) return err }) } diff --git a/x/txfees/keeper/hooks_test.go b/x/txfees/keeper/hooks_test.go index f5258a7836b..b3fcc529e7b 100644 --- a/x/txfees/keeper/hooks_test.go +++ b/x/txfees/keeper/hooks_test.go @@ -195,19 +195,12 @@ func (s *KeeperTestSuite) TestSwapNonNativeFeeToDenom() { // Fund the account with the preFundCoins s.FundAcc(testAccount, tc.preFundCoins) - // Set and check the txfees tracker before swap - s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, tc.preFundCoins) - s.Require().Equal(s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx), tc.preFundCoins) - s.App.TxFeesKeeper.SwapNonNativeFeeToDenom(s.Ctx, tc.denomToSwapTo, testAccount) // Check balance balances := s.App.BankKeeper.GetAllBalances(s.Ctx, testAccount) s.Require().Len(balances, 1) - // Check the txfees tracker after swap - s.Require().Equal(balances, s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx)) - // Check that the denomToSwapTo is the denom of the balance s.Require().Equal(balances[0].Denom, tc.denomToSwapTo) }) From 4b0a209d73b7665ba278405b6657a032e5b5a36a Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 20:55:53 -0600 Subject: [PATCH 11/19] fix upgrade test --- app/upgrades/v21/upgrades_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/upgrades/v21/upgrades_test.go b/app/upgrades/v21/upgrades_test.go index 8633d605690..c6b94b773cb 100644 --- a/app/upgrades/v21/upgrades_test.go +++ b/app/upgrades/v21/upgrades_test.go @@ -19,7 +19,7 @@ import ( ) const ( - v21UpgradeHeight = 10 + v21UpgradeHeight = int64(10) ) type UpgradeTestSuite struct { @@ -46,10 +46,10 @@ func (s *UpgradeTestSuite) TestUpgrade() { allProtocolRevenue := s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx) // Check all accounting start heights should be the same height as the upgrade - s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.CyclicArbTracker.HeightAccountingStartsFrom) - s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) - s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.TakerFeesToStakersTracker.HeightAccountingStartsFrom) - s.Require().Equal(uint64(v21UpgradeHeight), allProtocolRevenue.TxFeesTracker.HeightAccountingStartsFrom) + s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.CyclicArbTracker.HeightAccountingStartsFrom) + s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) + s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TakerFeesToStakersTracker.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.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TakerFeesToStakersTracker.TakerFeesToStakers) From 252add7bb467b70088c72fb4a5a1b0fe58f93410 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 1 Nov 2023 22:22:51 -0600 Subject: [PATCH 12/19] clean up --- app/upgrades/v21/upgrades.go | 1 + x/protorev/keeper/protorev.go | 19 ++++++------------- x/protorev/keeper/statistics_test.go | 4 ---- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/app/upgrades/v21/upgrades.go b/app/upgrades/v21/upgrades.go index e639a3b3847..1019d74e6b5 100644 --- a/app/upgrades/v21/upgrades.go +++ b/app/upgrades/v21/upgrades.go @@ -29,6 +29,7 @@ func CreateUpgradeHandler( keepers.PoolManagerKeeper.SetTakerFeeTrackerStartHeight(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) allCyclicArbProfitsCoins := osmoutils.ConvertCoinArrayToCoins(allCyclicArbProfits) keepers.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(ctx, allCyclicArbProfitsCoins) diff --git a/x/protorev/keeper/protorev.go b/x/protorev/keeper/protorev.go index 947e4f549c6..a580ee582b2 100644 --- a/x/protorev/keeper/protorev.go +++ b/x/protorev/keeper/protorev.go @@ -489,13 +489,6 @@ func (k Keeper) SetInfoByPoolType(ctx sdk.Context, poolWeights types.InfoByPoolT // GetAllProtocolRevenue returns all types of protocol revenue (txfees, taker fees, and cyclic arb profits), as well as the block height from which we started accounting // for each of these revenue sources. func (k Keeper) GetAllProtocolRevenue(ctx sdk.Context) types.AllProtocolRevenue { - takerFeesToStakers := k.poolmanagerKeeper.GetTakerFeeTrackerForStakers(ctx) - takerFeesToCommunityPool := k.poolmanagerKeeper.GetTakerFeeTrackerForCommunityPool(ctx) - takerFeesAccountingHeight := k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx) - - txFees := k.txfeesKeeper.GetTxFeesTrackerValue(ctx) - txFeesAccountingHeight := k.txfeesKeeper.GetTxFeesTrackerStartHeight(ctx) - currentCyclicArb := k.GetAllProfits(ctx) currentCyclicArbCoins := osmoutils.ConvertCoinArrayToCoins(currentCyclicArb) @@ -505,18 +498,18 @@ func (k Keeper) GetAllProtocolRevenue(ctx sdk.Context) types.AllProtocolRevenue } takerFeesToStakersTracker := poolmanagertypes.TakerFeesToStakersTracker{ - TakerFeesToStakers: takerFeesToStakers, - HeightAccountingStartsFrom: takerFeesAccountingHeight, + TakerFeesToStakers: k.poolmanagerKeeper.GetTakerFeeTrackerForStakers(ctx), + HeightAccountingStartsFrom: k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx), } takerFeesToCommunityPoolTracker := poolmanagertypes.TakerFeesToCommunityPoolTracker{ - TakerFeesToCommunityPool: takerFeesToCommunityPool, - HeightAccountingStartsFrom: takerFeesAccountingHeight, + TakerFeesToCommunityPool: k.poolmanagerKeeper.GetTakerFeeTrackerForCommunityPool(ctx), + HeightAccountingStartsFrom: k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx), } txFeesTracker := txfeestypes.TxFeesTracker{ - TxFees: txFees, - HeightAccountingStartsFrom: txFeesAccountingHeight, + TxFees: k.txfeesKeeper.GetTxFeesTrackerValue(ctx), + HeightAccountingStartsFrom: k.txfeesKeeper.GetTxFeesTrackerStartHeight(ctx), } return types.AllProtocolRevenue{ diff --git a/x/protorev/keeper/statistics_test.go b/x/protorev/keeper/statistics_test.go index aaf821e5aff..fd6fd4be757 100644 --- a/x/protorev/keeper/statistics_test.go +++ b/x/protorev/keeper/statistics_test.go @@ -228,15 +228,11 @@ func (s *KeeperTestSuite) TestGetSetCyclicArbProfitTrackerValue() { s.Require().Empty(s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx)) s.App.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(s.Ctx, tc.firstCyclicArbValue) - actualFirstCyclicArbValue := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx) - s.Require().Equal(tc.firstCyclicArbValue, actualFirstCyclicArbValue) s.App.ProtoRevKeeper.SetCyclicArbProfitTrackerValue(s.Ctx, tc.secondCyclicArbValue) - actualSecondCyclicArbValue := s.App.ProtoRevKeeper.GetCyclicArbProfitTrackerValue(s.Ctx) - s.Require().Equal(tc.secondCyclicArbValue, actualSecondCyclicArbValue) }) } From b49fc97fd6886d01324cd1a6806e089d96c61442 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Thu, 2 Nov 2023 11:29:15 -0600 Subject: [PATCH 13/19] merge taker fees into single struct --- app/upgrades/v21/upgrades_test.go | 7 +- .../osmosis/poolmanager/v1beta1/genesis.proto | 16 +- proto/osmosis/protorev/v1beta1/protorev.proto | 14 +- x/poolmanager/keeper.go | 30 +- x/poolmanager/keeper_test.go | 33 +- x/poolmanager/types/genesis.pb.go | 436 +++++------------- x/protorev/keeper/grpc_query_test.go | 8 +- x/protorev/keeper/protorev.go | 13 +- x/protorev/keeper/protorev_test.go | 8 +- x/protorev/types/protorev.pb.go | 233 ++++------ 10 files changed, 248 insertions(+), 550 deletions(-) diff --git a/app/upgrades/v21/upgrades_test.go b/app/upgrades/v21/upgrades_test.go index c6b94b773cb..aed7dff1c7c 100644 --- a/app/upgrades/v21/upgrades_test.go +++ b/app/upgrades/v21/upgrades_test.go @@ -47,12 +47,11 @@ func (s *UpgradeTestSuite) TestUpgrade() { allProtocolRevenue := s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx) // 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.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) - s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TakerFeesToStakersTracker.HeightAccountingStartsFrom) + s.Require().Equal(v21UpgradeHeight, allProtocolRevenue.TakerFeesTracker.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.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) - s.Require().Equal(sdk.Coins(nil), allProtocolRevenue.TakerFeesToStakersTracker.TakerFeesToStakers) + 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(cyclicArbProfits, allProtocolRevenue.CyclicArbTracker.CyclicArb) diff --git a/proto/osmosis/poolmanager/v1beta1/genesis.proto b/proto/osmosis/poolmanager/v1beta1/genesis.proto index 6955ac65afc..a73f3d406e2 100644 --- a/proto/osmosis/poolmanager/v1beta1/genesis.proto +++ b/proto/osmosis/poolmanager/v1beta1/genesis.proto @@ -44,8 +44,7 @@ message GenesisState { repeated ModuleRoute pool_routes = 3 [ (gogoproto.nullable) = false ]; // KVStore state - TakerFeesToStakersTracker taker_fees_to_stakers_tracker = 4; - TakerFeesToCommunityPoolTracker taker_fees_to_community_pool_tracker = 5; + TakerFeesTracker taker_fees_tracker = 4; } // TakerFeeParams consolidates the taker fee parameters for the poolmanager. @@ -122,20 +121,15 @@ message TakerFeeDistributionPercentage { ]; } -message TakerFeesToStakersTracker { +message TakerFeesTracker { repeated cosmos.base.v1beta1.Coin taker_fees_to_stakers = 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\"" ]; -} - -message TakerFeesToCommunityPoolTracker { - repeated cosmos.base.v1beta1.Coin taker_fees_to_community_pool = 1 [ + repeated cosmos.base.v1beta1.Coin taker_fees_to_community_pool = 2 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - int64 height_accounting_starts_from = 2 + int64 height_accounting_starts_from = 3 [ (gogoproto.moretags) = "yaml:\"height_accounting_starts_from\"" ]; -} \ No newline at end of file +} diff --git a/proto/osmosis/protorev/v1beta1/protorev.proto b/proto/osmosis/protorev/v1beta1/protorev.proto index da5ce1cc877..12e9aed17e9 100644 --- a/proto/osmosis/protorev/v1beta1/protorev.proto +++ b/proto/osmosis/protorev/v1beta1/protorev.proto @@ -184,21 +184,15 @@ message BaseDenom { } message AllProtocolRevenue { - osmosis.poolmanager.v1beta1.TakerFeesToStakersTracker - taker_fees_to_stakers_tracker = 1 [ - (gogoproto.moretags) = "yaml:\"taker_fees_to_stakers_tracker\"", + osmosis.poolmanager.v1beta1.TakerFeesTracker taker_fees_tracker = 1 [ + (gogoproto.moretags) = "yaml:\"taker_fees_tracker\"", (gogoproto.nullable) = false ]; - osmosis.poolmanager.v1beta1.TakerFeesToCommunityPoolTracker - taker_fees_to_community_pool_tracker = 2 [ - (gogoproto.moretags) = "yaml:\"taker_fees_to_community_pool_tracker\"", - (gogoproto.nullable) = false - ]; - osmosis.txfees.v1beta1.TxFeesTracker tx_fees_tracker = 3 [ + osmosis.txfees.v1beta1.TxFeesTracker tx_fees_tracker = 2 [ (gogoproto.moretags) = "yaml:\"tx_fees_tracker\"", (gogoproto.nullable) = false ]; - CyclicArbTracker cyclic_arb_tracker = 4 [ + CyclicArbTracker cyclic_arb_tracker = 3 [ (gogoproto.moretags) = "yaml:\"cyclic_arb_tracker\"", (gogoproto.nullable) = false ]; diff --git a/x/poolmanager/keeper.go b/x/poolmanager/keeper.go index 698e10d81d4..4377257baf7 100644 --- a/x/poolmanager/keeper.go +++ b/x/poolmanager/keeper.go @@ -101,18 +101,19 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { // We track taker fees generated in the module's KVStore. // If the values were exported, we set them here. // If the values were not exported, we initialize the tracker to zero and set the accounting height to the current height. - if genState.TakerFeesToStakersTracker != nil { - k.SetTakerFeeTrackerForStakers(ctx, genState.TakerFeesToStakersTracker.TakerFeesToStakers) - k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesToStakersTracker.HeightAccountingStartsFrom) + if !genState.TakerFeesTracker.TakerFeesToStakers.Empty() { + k.SetTakerFeeTrackerForStakers(ctx, genState.TakerFeesTracker.TakerFeesToStakers) } else { k.SetTakerFeeTrackerForStakers(ctx, sdk.NewCoins()) - k.SetTakerFeeTrackerStartHeight(ctx, ctx.BlockHeight()) } - if genState.TakerFeesToCommunityPoolTracker != nil { - k.SetTakerFeeTrackerForCommunityPool(ctx, genState.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) - k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) + if !genState.TakerFeesTracker.TakerFeesToCommunityPool.Empty() { + k.SetTakerFeeTrackerForCommunityPool(ctx, genState.TakerFeesTracker.TakerFeesToCommunityPool) } else { k.SetTakerFeeTrackerForCommunityPool(ctx, sdk.NewCoins()) + } + if genState.TakerFeesTracker.HeightAccountingStartsFrom != 0 { + k.SetTakerFeeTrackerStartHeight(ctx, genState.TakerFeesTracker.HeightAccountingStartsFrom) + } else { k.SetTakerFeeTrackerStartHeight(ctx, ctx.BlockHeight()) } } @@ -120,21 +121,16 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { // ExportGenesis returns the poolmanager module's exported genesis. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // Export KVStore values to the genesis state so they can be imported in init genesis. - takerFeesToStakersTracker := types.TakerFeesToStakersTracker{ + takerFeesTracker := types.TakerFeesTracker{ TakerFeesToStakers: k.GetTakerFeeTrackerForStakers(ctx), - HeightAccountingStartsFrom: k.GetTakerFeeTrackerStartHeight(ctx), - } - takerFeesToCommunityPoolTracker := types.TakerFeesToCommunityPoolTracker{ TakerFeesToCommunityPool: k.GetTakerFeeTrackerForCommunityPool(ctx), HeightAccountingStartsFrom: k.GetTakerFeeTrackerStartHeight(ctx), } - return &types.GenesisState{ - Params: k.GetParams(ctx), - NextPoolId: k.GetNextPoolId(ctx), - PoolRoutes: k.getAllPoolRoutes(ctx), - TakerFeesToStakersTracker: &takerFeesToStakersTracker, - TakerFeesToCommunityPoolTracker: &takerFeesToCommunityPoolTracker, + Params: k.GetParams(ctx), + NextPoolId: k.GetNextPoolId(ctx), + PoolRoutes: k.getAllPoolRoutes(ctx), + TakerFeesTracker: &takerFeesTracker, } } diff --git a/x/poolmanager/keeper_test.go b/x/poolmanager/keeper_test.go index 81db4881d28..97fc51fcf1d 100644 --- a/x/poolmanager/keeper_test.go +++ b/x/poolmanager/keeper_test.go @@ -44,11 +44,8 @@ var ( }, } - testFeesToStakers = types.TakerFeesToStakersTracker{ + testTakerFeesTracker = types.TakerFeesTracker{ TakerFeesToStakers: sdk.Coins{sdk.NewCoin("uosmo", sdk.NewInt(1000))}, - HeightAccountingStartsFrom: 100, - } - testFeesToCommunityPool = types.TakerFeesToCommunityPoolTracker{ TakerFeesToCommunityPool: sdk.Coins{sdk.NewCoin("uusdc", sdk.NewInt(1000))}, HeightAccountingStartsFrom: 100, } @@ -110,10 +107,9 @@ func (s *KeeperTestSuite) TestInitGenesis() { }, AuthorizedQuoteDenoms: testAuthorizedQuoteDenoms, }, - NextPoolId: testExpectedPoolId, - PoolRoutes: testPoolRoute, - TakerFeesToStakersTracker: &testFeesToStakers, - TakerFeesToCommunityPoolTracker: &testFeesToCommunityPool, + NextPoolId: testExpectedPoolId, + PoolRoutes: testPoolRoute, + TakerFeesTracker: &testTakerFeesTracker, }) params := s.App.PoolManagerKeeper.GetParams(s.Ctx) @@ -126,10 +122,9 @@ func (s *KeeperTestSuite) TestInitGenesis() { s.Require().Equal(testCommunityPoolDenomToSwapNonWhitelistedAssetsTo, params.TakerFeeParams.CommunityPoolDenomToSwapNonWhitelistedAssetsTo) s.Require().Equal(testAuthorizedQuoteDenoms, params.AuthorizedQuoteDenoms) s.Require().Equal(testPoolRoute, s.App.PoolManagerKeeper.GetAllPoolRoutes(s.Ctx)) - s.Require().Equal(testFeesToStakers.TakerFeesToStakers, s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx)) - s.Require().Equal(testFeesToCommunityPool.TakerFeesToCommunityPool, s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx)) - s.Require().Equal(testFeesToStakers.HeightAccountingStartsFrom, s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) - s.Require().Equal(testFeesToCommunityPool.HeightAccountingStartsFrom, s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) + s.Require().Equal(testTakerFeesTracker.TakerFeesToStakers, s.App.PoolManagerKeeper.GetTakerFeeTrackerForStakers(s.Ctx)) + s.Require().Equal(testTakerFeesTracker.TakerFeesToCommunityPool, s.App.PoolManagerKeeper.GetTakerFeeTrackerForCommunityPool(s.Ctx)) + s.Require().Equal(testTakerFeesTracker.HeightAccountingStartsFrom, s.App.PoolManagerKeeper.GetTakerFeeTrackerStartHeight(s.Ctx)) } func (s *KeeperTestSuite) TestExportGenesis() { @@ -145,10 +140,9 @@ func (s *KeeperTestSuite) TestExportGenesis() { }, AuthorizedQuoteDenoms: testAuthorizedQuoteDenoms, }, - NextPoolId: testExpectedPoolId, - PoolRoutes: testPoolRoute, - TakerFeesToStakersTracker: &testFeesToStakers, - TakerFeesToCommunityPoolTracker: &testFeesToCommunityPool, + NextPoolId: testExpectedPoolId, + PoolRoutes: testPoolRoute, + TakerFeesTracker: &testTakerFeesTracker, }) genesis := s.App.PoolManagerKeeper.ExportGenesis(s.Ctx) @@ -161,8 +155,7 @@ func (s *KeeperTestSuite) TestExportGenesis() { s.Require().Equal(testCommunityPoolDenomToSwapNonWhitelistedAssetsTo, genesis.Params.TakerFeeParams.CommunityPoolDenomToSwapNonWhitelistedAssetsTo) s.Require().Equal(testAuthorizedQuoteDenoms, genesis.Params.AuthorizedQuoteDenoms) s.Require().Equal(testPoolRoute, genesis.PoolRoutes) - s.Require().Equal(testFeesToStakers.TakerFeesToStakers, genesis.TakerFeesToStakersTracker.TakerFeesToStakers) - s.Require().Equal(testFeesToCommunityPool.TakerFeesToCommunityPool, genesis.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) - s.Require().Equal(testFeesToStakers.HeightAccountingStartsFrom, genesis.TakerFeesToStakersTracker.HeightAccountingStartsFrom) - s.Require().Equal(testFeesToCommunityPool.HeightAccountingStartsFrom, genesis.TakerFeesToCommunityPoolTracker.HeightAccountingStartsFrom) + s.Require().Equal(testTakerFeesTracker.TakerFeesToStakers, genesis.TakerFeesTracker.TakerFeesToStakers) + s.Require().Equal(testTakerFeesTracker.TakerFeesToCommunityPool, genesis.TakerFeesTracker.TakerFeesToCommunityPool) + s.Require().Equal(testTakerFeesTracker.HeightAccountingStartsFrom, genesis.TakerFeesTracker.HeightAccountingStartsFrom) } diff --git a/x/poolmanager/types/genesis.pb.go b/x/poolmanager/types/genesis.pb.go index 7138c645afb..cd193d1f72c 100644 --- a/x/poolmanager/types/genesis.pb.go +++ b/x/poolmanager/types/genesis.pb.go @@ -108,8 +108,7 @@ type GenesisState struct { // pool_routes is the container of the mappings from pool id to pool type. PoolRoutes []ModuleRoute `protobuf:"bytes,3,rep,name=pool_routes,json=poolRoutes,proto3" json:"pool_routes"` // KVStore state - TakerFeesToStakersTracker *TakerFeesToStakersTracker `protobuf:"bytes,4,opt,name=taker_fees_to_stakers_tracker,json=takerFeesToStakersTracker,proto3" json:"taker_fees_to_stakers_tracker,omitempty"` - TakerFeesToCommunityPoolTracker *TakerFeesToCommunityPoolTracker `protobuf:"bytes,5,opt,name=taker_fees_to_community_pool_tracker,json=takerFeesToCommunityPoolTracker,proto3" json:"taker_fees_to_community_pool_tracker,omitempty"` + TakerFeesTracker *TakerFeesTracker `protobuf:"bytes,4,opt,name=taker_fees_tracker,json=takerFeesTracker,proto3" json:"taker_fees_tracker,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -166,16 +165,9 @@ func (m *GenesisState) GetPoolRoutes() []ModuleRoute { return nil } -func (m *GenesisState) GetTakerFeesToStakersTracker() *TakerFeesToStakersTracker { +func (m *GenesisState) GetTakerFeesTracker() *TakerFeesTracker { if m != nil { - return m.TakerFeesToStakersTracker - } - return nil -} - -func (m *GenesisState) GetTakerFeesToCommunityPoolTracker() *TakerFeesToCommunityPoolTracker { - if m != nil { - return m.TakerFeesToCommunityPoolTracker + return m.TakerFeesTracker } return nil } @@ -329,23 +321,24 @@ func (m *TakerFeeDistributionPercentage) XXX_DiscardUnknown() { var xxx_messageInfo_TakerFeeDistributionPercentage proto.InternalMessageInfo -type TakerFeesToStakersTracker struct { +type TakerFeesTracker struct { TakerFeesToStakers github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=taker_fees_to_stakers,json=takerFeesToStakers,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_stakers"` - HeightAccountingStartsFrom int64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` + TakerFeesToCommunityPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=taker_fees_to_community_pool,json=takerFeesToCommunityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_community_pool"` + HeightAccountingStartsFrom int64 `protobuf:"varint,3,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` } -func (m *TakerFeesToStakersTracker) Reset() { *m = TakerFeesToStakersTracker{} } -func (m *TakerFeesToStakersTracker) String() string { return proto.CompactTextString(m) } -func (*TakerFeesToStakersTracker) ProtoMessage() {} -func (*TakerFeesToStakersTracker) Descriptor() ([]byte, []int) { +func (m *TakerFeesTracker) Reset() { *m = TakerFeesTracker{} } +func (m *TakerFeesTracker) String() string { return proto.CompactTextString(m) } +func (*TakerFeesTracker) ProtoMessage() {} +func (*TakerFeesTracker) Descriptor() ([]byte, []int) { return fileDescriptor_aa099d9fbdf68b35, []int{4} } -func (m *TakerFeesToStakersTracker) XXX_Unmarshal(b []byte) error { +func (m *TakerFeesTracker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TakerFeesToStakersTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *TakerFeesTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TakerFeesToStakersTracker.Marshal(b, m, deterministic) + return xxx_messageInfo_TakerFeesTracker.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -355,78 +348,33 @@ func (m *TakerFeesToStakersTracker) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *TakerFeesToStakersTracker) XXX_Merge(src proto.Message) { - xxx_messageInfo_TakerFeesToStakersTracker.Merge(m, src) +func (m *TakerFeesTracker) XXX_Merge(src proto.Message) { + xxx_messageInfo_TakerFeesTracker.Merge(m, src) } -func (m *TakerFeesToStakersTracker) XXX_Size() int { +func (m *TakerFeesTracker) XXX_Size() int { return m.Size() } -func (m *TakerFeesToStakersTracker) XXX_DiscardUnknown() { - xxx_messageInfo_TakerFeesToStakersTracker.DiscardUnknown(m) +func (m *TakerFeesTracker) XXX_DiscardUnknown() { + xxx_messageInfo_TakerFeesTracker.DiscardUnknown(m) } -var xxx_messageInfo_TakerFeesToStakersTracker proto.InternalMessageInfo +var xxx_messageInfo_TakerFeesTracker proto.InternalMessageInfo -func (m *TakerFeesToStakersTracker) GetTakerFeesToStakers() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *TakerFeesTracker) GetTakerFeesToStakers() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.TakerFeesToStakers } return nil } -func (m *TakerFeesToStakersTracker) GetHeightAccountingStartsFrom() int64 { - if m != nil { - return m.HeightAccountingStartsFrom - } - return 0 -} - -type TakerFeesToCommunityPoolTracker struct { - TakerFeesToCommunityPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=taker_fees_to_community_pool,json=takerFeesToCommunityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"taker_fees_to_community_pool"` - HeightAccountingStartsFrom int64 `protobuf:"varint,2,opt,name=height_accounting_starts_from,json=heightAccountingStartsFrom,proto3" json:"height_accounting_starts_from,omitempty" yaml:"height_accounting_starts_from"` -} - -func (m *TakerFeesToCommunityPoolTracker) Reset() { *m = TakerFeesToCommunityPoolTracker{} } -func (m *TakerFeesToCommunityPoolTracker) String() string { return proto.CompactTextString(m) } -func (*TakerFeesToCommunityPoolTracker) ProtoMessage() {} -func (*TakerFeesToCommunityPoolTracker) Descriptor() ([]byte, []int) { - return fileDescriptor_aa099d9fbdf68b35, []int{5} -} -func (m *TakerFeesToCommunityPoolTracker) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TakerFeesToCommunityPoolTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TakerFeesToCommunityPoolTracker.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TakerFeesToCommunityPoolTracker) XXX_Merge(src proto.Message) { - xxx_messageInfo_TakerFeesToCommunityPoolTracker.Merge(m, src) -} -func (m *TakerFeesToCommunityPoolTracker) XXX_Size() int { - return m.Size() -} -func (m *TakerFeesToCommunityPoolTracker) XXX_DiscardUnknown() { - xxx_messageInfo_TakerFeesToCommunityPoolTracker.DiscardUnknown(m) -} - -var xxx_messageInfo_TakerFeesToCommunityPoolTracker proto.InternalMessageInfo - -func (m *TakerFeesToCommunityPoolTracker) GetTakerFeesToCommunityPool() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *TakerFeesTracker) GetTakerFeesToCommunityPool() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.TakerFeesToCommunityPool } return nil } -func (m *TakerFeesToCommunityPoolTracker) GetHeightAccountingStartsFrom() int64 { +func (m *TakerFeesTracker) GetHeightAccountingStartsFrom() int64 { if m != nil { return m.HeightAccountingStartsFrom } @@ -438,8 +386,7 @@ func init() { proto.RegisterType((*GenesisState)(nil), "osmosis.poolmanager.v1beta1.GenesisState") proto.RegisterType((*TakerFeeParams)(nil), "osmosis.poolmanager.v1beta1.TakerFeeParams") proto.RegisterType((*TakerFeeDistributionPercentage)(nil), "osmosis.poolmanager.v1beta1.TakerFeeDistributionPercentage") - proto.RegisterType((*TakerFeesToStakersTracker)(nil), "osmosis.poolmanager.v1beta1.TakerFeesToStakersTracker") - proto.RegisterType((*TakerFeesToCommunityPoolTracker)(nil), "osmosis.poolmanager.v1beta1.TakerFeesToCommunityPoolTracker") + proto.RegisterType((*TakerFeesTracker)(nil), "osmosis.poolmanager.v1beta1.TakerFeesTracker") } func init() { @@ -447,71 +394,69 @@ func init() { } var fileDescriptor_aa099d9fbdf68b35 = []byte{ - // 1021 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0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, 0x2d, 0xca, 0x61, 0xa4, 0xd5, 0x67, 0x51, 0xe9, 0x77, 0xa6, 0xe5, 0x14, 0xb3, 0x20, 0xeb, - 0x02, 0x49, 0x59, 0x26, 0x40, 0xc7, 0xdb, 0xc3, 0x79, 0xb4, 0x78, 0x40, 0x53, 0x1a, 0x73, 0xfc, - 0xa3, 0x81, 0xae, 0x4b, 0x14, 0xf1, 0x53, 0x50, 0x57, 0x92, 0x23, 0x00, 0xd3, 0xa8, 0x55, 0xea, - 0xcb, 0x5b, 0xeb, 0x4e, 0xa1, 0x52, 0xde, 0x5b, 0x26, 0xee, 0xec, 0xb2, 0x28, 0x69, 0x3c, 0x7a, - 0x99, 0x5b, 0x73, 0xc3, 0xdc, 0x32, 0xfb, 0x34, 0xee, 0x7e, 0x66, 0xbf, 0xc6, 0x60, 0xff, 0xfc, - 0x87, 0x55, 0x0f, 0x23, 0xd1, 0xce, 0x5a, 0x8e, 0xcf, 0xe2, 0x22, 0xdd, 0xe2, 0xcf, 0x5d, 0x1e, - 0x74, 0x5c, 0xd1, 0xef, 0x01, 0x57, 0x64, 0xdc, 0x5b, 0x95, 0xf8, 0xdd, 0x02, 0xbe, 0x0f, 0x80, - 0x8f, 0xd1, 0x7b, 0x82, 0x76, 0x20, 0x95, 0x54, 0xa4, 0xa7, 0x94, 0x9a, 0xf3, 0x35, 0xa3, 0xbe, - 0xbc, 0xf5, 0xb1, 0x33, 0xe5, 0x51, 0x9c, 0xa6, 0x04, 0xed, 0x03, 0xe8, 0xe4, 0x1a, 0x56, 0xa1, - 0xf2, 0x86, 0x56, 0x79, 0x99, 0xd2, 0xf6, 0x56, 0xc4, 0x18, 0x00, 0x3f, 0x43, 0x37, 0x68, 0x26, - 0xda, 0x2c, 0x8d, 0xbe, 0x85, 0x80, 0x7c, 0x93, 0x31, 0x01, 0x24, 0x80, 0x84, 0xc5, 0xdc, 0xac, - 0xd4, 0x2a, 0xf5, 0xa5, 0x86, 0x3d, 0xcc, 0xad, 0xaa,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x19, 0xb9, 0x0f, 0x95, 0x77, - 0x5f, 0x3a, 0x5f, 0xcc, 0x23, 0xeb, 0x0d, 0xdb, 0x54, 0xae, 0xee, 0x9b, 0xd3, 0x56, 0xf7, 0xff, - 0x51, 0x18, 0x73, 0xd2, 0x06, 0x7f, 0xab, 0xe5, 0x69, 0x3c, 0x7d, 0x39, 0xa8, 0x1a, 0xaf, 0x06, - 0x55, 0xe3, 0xcf, 0x41, 0xd5, 0xf8, 0xe1, 0xac, 0x3a, 0xf7, 0xea, 0xac, 0x3a, 0xf7, 0xdb, 0x59, - 0x75, 0xee, 0xd9, 0xa7, 0x17, 0x52, 0x29, 0x76, 0xe1, 0xdd, 0x2e, 0x6d, 0xf1, 0xf2, 0xe0, 0x1e, - 0x6f, 0xdd, 0x73, 0x4f, 0xc7, 0xbe, 0xe9, 0x54, 0x7e, 0xad, 0x45, 0xf5, 0x15, 0xf7, 0xc9, 0xdf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, 0xff, 0x7f, 0x05, 0xcb, 0x0a, 0x00, 0x00, + // 989 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0xdb, 0x46, + 0x13, 0x36, 0x2d, 0xbf, 0x06, 0xbc, 0xce, 0x6b, 0x39, 0xdb, 0xba, 0x61, 0xec, 0x54, 0x14, 0x98, + 0x1e, 0x54, 0x14, 0x26, 0x13, 0x17, 0x48, 0x81, 0xb6, 0x39, 0x48, 0x36, 0x5c, 0x14, 0x48, 0x13, + 0x87, 0x16, 0x50, 0x20, 0x3d, 0x2c, 0x56, 0xe4, 0x88, 0x22, 0x24, 0x72, 0xd5, 0xdd, 0xa5, 0x1d, + 0xf5, 0xd0, 0x3f, 0x10, 0x14, 0x28, 0xd0, 0x6b, 0x2f, 0xbd, 0xf4, 0xd0, 0x5b, 0xff, 0x45, 0x8e, + 0x39, 0x16, 0x3d,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, 0xd9, 0x38, 0x6c, + 0xef, 0xff, 0x73, 0x6d, 0xb6, 0xbf, 0x29, 0xa1, 0xed, 0xc5, 0x47, 0x02, 0x7f, 0x8d, 0x76, 0x66, + 0xdf, 0x1b, 0x46, 0x84, 0x3a, 0x8a, 0xbf, 0xfe, 0x8d, 0xba, 0x97, 0x6b, 0xfb, 0x5b, 0xbf, 0x43, + 0x78, 0xfa, 0x20, 0xb1, 0x53, 0x9d, 0x06, 0xbf, 0x30, 0xd0, 0x9d, 0x79, 0x01, 0xaf, 0x35, 0xe2, + 0x3f, 0xd7, 0x61, 0xce, 0xe8, 0x38, 0x9c, 0x6d, 0x11, 0xee, 0xa2, 0xb7, 0x3b, 0x10, 0x85, 0x1d, + 0x49, 0xa8, 0xef, 0xb3, 0x34, 0x91, 0xf9, 0xd4, 0x84, 0xa4, 0x5c, 0x0a, 0xd2, 0xe6, 0x2c, 0x56, + 0xef, 0x40, 0xa9, 0x51, 0x1b, 0x65, 0xd6, 0x3b, 0xba, 0xe7, 0x4b, 0xc3, 0x6d, 0x6f, 0x57, 0xfb, + 0xeb, 0x13, 0xf7, 0xa9, 0xf2, 0x1e, 0x73, 0x16, 0x37, 0x9e, 0xbe, 0x1c, 0x56, 0x8c, 0x57, 0xc3, + 0x8a, 0xf1, 0xfb, 0xb0, 0x62, 0x7c, 0x7b, 0x51, 0x59, 0x79, 0x75, 0x51, 0x59, 0xf9, 0xe5, 0xa2, + 0xb2, 0xf2, 0xec, 0x83, 0x99, 0x52, 0x8a, 0x17, 0x67, 0xbf, 0x47, 0x5b, 0x62, 0x7c, 0x70, 0xcf, + 0x0e, 0xee, 0xb9, 0xcf, 0xe7, 0x3e, 0x47, 0x54, 0x7d, 0xad, 0x75, 0xf5, 0x01, 0xf2, 0xfe, 0x9f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x44, 0xa8, 0x64, 0x7e, 0x86, 0x09, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -590,21 +535,9 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TakerFeesToCommunityPoolTracker != nil { - { - size, err := m.TakerFeesToCommunityPoolTracker.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.TakerFeesToStakersTracker != nil { + if m.TakerFeesTracker != nil { { - size, err := m.TakerFeesToStakersTracker.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TakerFeesTracker.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -767,7 +700,7 @@ func (m *TakerFeeDistributionPercentage) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *TakerFeesToStakersTracker) Marshal() (dAtA []byte, err error) { +func (m *TakerFeesTracker) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -777,12 +710,12 @@ func (m *TakerFeesToStakersTracker) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TakerFeesToStakersTracker) MarshalTo(dAtA []byte) (int, error) { +func (m *TakerFeesTracker) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TakerFeesToStakersTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TakerFeesTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -790,12 +723,12 @@ func (m *TakerFeesToStakersTracker) MarshalToSizedBuffer(dAtA []byte) (int, erro if m.HeightAccountingStartsFrom != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.HeightAccountingStartsFrom)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } - if len(m.TakerFeesToStakers) > 0 { - for iNdEx := len(m.TakerFeesToStakers) - 1; iNdEx >= 0; iNdEx-- { + if len(m.TakerFeesToCommunityPool) > 0 { + for iNdEx := len(m.TakerFeesToCommunityPool) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.TakerFeesToStakers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TakerFeesToCommunityPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -803,41 +736,13 @@ func (m *TakerFeesToStakersTracker) MarshalToSizedBuffer(dAtA []byte) (int, erro i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } } - return len(dAtA) - i, nil -} - -func (m *TakerFeesToCommunityPoolTracker) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TakerFeesToCommunityPoolTracker) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TakerFeesToCommunityPoolTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.HeightAccountingStartsFrom != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.HeightAccountingStartsFrom)) - i-- - dAtA[i] = 0x10 - } - if len(m.TakerFeesToCommunityPool) > 0 { - for iNdEx := len(m.TakerFeesToCommunityPool) - 1; iNdEx >= 0; iNdEx-- { + if len(m.TakerFeesToStakers) > 0 { + for iNdEx := len(m.TakerFeesToStakers) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.TakerFeesToCommunityPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TakerFeesToStakers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -902,12 +807,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.TakerFeesToStakersTracker != nil { - l = m.TakerFeesToStakersTracker.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.TakerFeesToCommunityPoolTracker != nil { - l = m.TakerFeesToCommunityPoolTracker.Size() + if m.TakerFeesTracker != nil { + l = m.TakerFeesTracker.Size() n += 1 + l + sovGenesis(uint64(l)) } return n @@ -957,7 +858,7 @@ func (m *TakerFeeDistributionPercentage) Size() (n int) { return n } -func (m *TakerFeesToStakersTracker) Size() (n int) { +func (m *TakerFeesTracker) Size() (n int) { if m == nil { return 0 } @@ -969,18 +870,6 @@ func (m *TakerFeesToStakersTracker) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.HeightAccountingStartsFrom != 0 { - n += 1 + sovGenesis(uint64(m.HeightAccountingStartsFrom)) - } - return n -} - -func (m *TakerFeesToCommunityPoolTracker) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l if len(m.TakerFeesToCommunityPool) > 0 { for _, e := range m.TakerFeesToCommunityPool { l = e.Size() @@ -1265,43 +1154,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToStakersTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TakerFeesToStakersTracker == nil { - m.TakerFeesToStakersTracker = &TakerFeesToStakersTracker{} - } - if err := m.TakerFeesToStakersTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToCommunityPoolTracker", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesTracker", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1328,10 +1181,10 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.TakerFeesToCommunityPoolTracker == nil { - m.TakerFeesToCommunityPoolTracker = &TakerFeesToCommunityPoolTracker{} + if m.TakerFeesTracker == nil { + m.TakerFeesTracker = &TakerFeesTracker{} } - if err := m.TakerFeesToCommunityPoolTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TakerFeesTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1720,7 +1573,7 @@ func (m *TakerFeeDistributionPercentage) Unmarshal(dAtA []byte) error { } return nil } -func (m *TakerFeesToStakersTracker) Unmarshal(dAtA []byte) error { +func (m *TakerFeesTracker) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1743,10 +1596,10 @@ func (m *TakerFeesToStakersTracker) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TakerFeesToStakersTracker: wiretype end group for non-group") + return fmt.Errorf("proto: TakerFeesTracker: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TakerFeesToStakersTracker: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TakerFeesTracker: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1784,75 +1637,6 @@ func (m *TakerFeesToStakersTracker) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HeightAccountingStartsFrom", wireType) - } - m.HeightAccountingStartsFrom = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HeightAccountingStartsFrom |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TakerFeesToCommunityPoolTracker) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TakerFeesToCommunityPoolTracker: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TakerFeesToCommunityPoolTracker: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToCommunityPool", wireType) } @@ -1886,7 +1670,7 @@ func (m *TakerFeesToCommunityPoolTracker) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field HeightAccountingStartsFrom", wireType) } diff --git a/x/protorev/keeper/grpc_query_test.go b/x/protorev/keeper/grpc_query_test.go index 2da9c8f67dc..0d92d2556d5 100644 --- a/x/protorev/keeper/grpc_query_test.go +++ b/x/protorev/keeper/grpc_query_test.go @@ -420,8 +420,8 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenueGRPCQuery() { 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.TakerFeesToStakersTracker.TakerFeesToStakers) - s.Require().Equal(expectedTakerFeeToCommunityPool, res.AllProtocolRevenue.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + s.Require().Equal(expectedTakerFeeToStakers, res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool, res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToCommunityPool) // A second round of the same thing // Swap on a pool to charge taker fee @@ -443,6 +443,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenueGRPCQuery() { 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.TakerFeesToStakersTracker.TakerFeesToStakers) - s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), res.AllProtocolRevenue.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + s.Require().Equal(expectedTakerFeeToStakers.Add(expectedTakerFeeToStakers...), res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), res.AllProtocolRevenue.TakerFeesTracker.TakerFeesToCommunityPool) } diff --git a/x/protorev/keeper/protorev.go b/x/protorev/keeper/protorev.go index a580ee582b2..2072bf42a23 100644 --- a/x/protorev/keeper/protorev.go +++ b/x/protorev/keeper/protorev.go @@ -497,12 +497,8 @@ func (k Keeper) GetAllProtocolRevenue(ctx sdk.Context) types.AllProtocolRevenue HeightAccountingStartsFrom: k.GetCyclicArbProfitTrackerStartHeight(ctx), } - takerFeesToStakersTracker := poolmanagertypes.TakerFeesToStakersTracker{ + takerFeesTracker := poolmanagertypes.TakerFeesTracker{ TakerFeesToStakers: k.poolmanagerKeeper.GetTakerFeeTrackerForStakers(ctx), - HeightAccountingStartsFrom: k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx), - } - - takerFeesToCommunityPoolTracker := poolmanagertypes.TakerFeesToCommunityPoolTracker{ TakerFeesToCommunityPool: k.poolmanagerKeeper.GetTakerFeeTrackerForCommunityPool(ctx), HeightAccountingStartsFrom: k.poolmanagerKeeper.GetTakerFeeTrackerStartHeight(ctx), } @@ -513,9 +509,8 @@ func (k Keeper) GetAllProtocolRevenue(ctx sdk.Context) types.AllProtocolRevenue } return types.AllProtocolRevenue{ - TakerFeesToStakersTracker: takerFeesToStakersTracker, - TakerFeesToCommunityPoolTracker: takerFeesToCommunityPoolTracker, - TxFeesTracker: txFeesTracker, - CyclicArbTracker: cyclicArbTracker, + TakerFeesTracker: takerFeesTracker, + TxFeesTracker: txFeesTracker, + CyclicArbTracker: cyclicArbTracker, } } diff --git a/x/protorev/keeper/protorev_test.go b/x/protorev/keeper/protorev_test.go index ba0e0824fe0..cfcf7cdc533 100644 --- a/x/protorev/keeper/protorev_test.go +++ b/x/protorev/keeper/protorev_test.go @@ -360,8 +360,8 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenue() { 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.TakerFeesToStakersTracker.TakerFeesToStakers) - s.Require().Equal(expectedTakerFeeToCommunityPool, allProtoRev.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + s.Require().Equal(expectedTakerFeeToStakers, allProtoRev.TakerFeesTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool, allProtoRev.TakerFeesTracker.TakerFeesToCommunityPool) // A second round of the same thing // Swap on a pool to charge taker fee @@ -382,6 +382,6 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenue() { 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.TakerFeesToStakersTracker.TakerFeesToStakers) - s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), allProtoRev.TakerFeesToCommunityPoolTracker.TakerFeesToCommunityPool) + s.Require().Equal(expectedTakerFeeToStakers.Add(expectedTakerFeeToStakers...), allProtoRev.TakerFeesTracker.TakerFeesToStakers) + s.Require().Equal(expectedTakerFeeToCommunityPool.Add(expectedTakerFeeToCommunityPool...), allProtoRev.TakerFeesTracker.TakerFeesToCommunityPool) } diff --git a/x/protorev/types/protorev.pb.go b/x/protorev/types/protorev.pb.go index f410d60db8a..7aed1d46dfe 100644 --- a/x/protorev/types/protorev.pb.go +++ b/x/protorev/types/protorev.pb.go @@ -724,10 +724,9 @@ func (m *BaseDenom) GetDenom() string { } type AllProtocolRevenue struct { - TakerFeesToStakersTracker types1.TakerFeesToStakersTracker `protobuf:"bytes,1,opt,name=taker_fees_to_stakers_tracker,json=takerFeesToStakersTracker,proto3" json:"taker_fees_to_stakers_tracker" yaml:"taker_fees_to_stakers_tracker"` - TakerFeesToCommunityPoolTracker types1.TakerFeesToCommunityPoolTracker `protobuf:"bytes,2,opt,name=taker_fees_to_community_pool_tracker,json=takerFeesToCommunityPoolTracker,proto3" json:"taker_fees_to_community_pool_tracker" yaml:"taker_fees_to_community_pool_tracker"` - TxFeesTracker types2.TxFeesTracker `protobuf:"bytes,3,opt,name=tx_fees_tracker,json=txFeesTracker,proto3" json:"tx_fees_tracker" yaml:"tx_fees_tracker"` - CyclicArbTracker CyclicArbTracker `protobuf:"bytes,4,opt,name=cyclic_arb_tracker,json=cyclicArbTracker,proto3" json:"cyclic_arb_tracker" yaml:"cyclic_arb_tracker"` + TakerFeesTracker types1.TakerFeesTracker `protobuf:"bytes,1,opt,name=taker_fees_tracker,json=takerFeesTracker,proto3" json:"taker_fees_tracker" yaml:"taker_fees_tracker"` + TxFeesTracker types2.TxFeesTracker `protobuf:"bytes,2,opt,name=tx_fees_tracker,json=txFeesTracker,proto3" json:"tx_fees_tracker" yaml:"tx_fees_tracker"` + CyclicArbTracker CyclicArbTracker `protobuf:"bytes,3,opt,name=cyclic_arb_tracker,json=cyclicArbTracker,proto3" json:"cyclic_arb_tracker" yaml:"cyclic_arb_tracker"` } func (m *AllProtocolRevenue) Reset() { *m = AllProtocolRevenue{} } @@ -763,18 +762,11 @@ func (m *AllProtocolRevenue) XXX_DiscardUnknown() { var xxx_messageInfo_AllProtocolRevenue proto.InternalMessageInfo -func (m *AllProtocolRevenue) GetTakerFeesToStakersTracker() types1.TakerFeesToStakersTracker { +func (m *AllProtocolRevenue) GetTakerFeesTracker() types1.TakerFeesTracker { if m != nil { - return m.TakerFeesToStakersTracker + return m.TakerFeesTracker } - return types1.TakerFeesToStakersTracker{} -} - -func (m *AllProtocolRevenue) GetTakerFeesToCommunityPoolTracker() types1.TakerFeesToCommunityPoolTracker { - if m != nil { - return m.TakerFeesToCommunityPoolTracker - } - return types1.TakerFeesToCommunityPoolTracker{} + return types1.TakerFeesTracker{} } func (m *AllProtocolRevenue) GetTxFeesTracker() types2.TxFeesTracker { @@ -865,86 +857,82 @@ func init() { } var fileDescriptor_1e9f2391fd9fec01 = []byte{ - // 1260 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc,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b, 0xa0, 0x34, 0xcf, 0x04, 0xbf, 0x00, 0x20, 0x43, 0x3f, 0xff, 0xba, 0x72, 0x55, 0x26, 0xfe, - 0xf9, 0x77, 0xbb, 0xd6, 0x0d, 0xc4, 0xee, 0xd0, 0xab, 0xfb, 0x2c, 0x34, 0x37, 0x77, 0xf3, 0xe7, - 0x0a, 0x6f, 0xf7, 0x1a, 0x62, 0x3c, 0xa0, 0x5c, 0x01, 0x38, 0xce, 0xa7, 0x75, 0xc0, 0x1e, 0xb8, - 0xb0, 0xab, 0x37, 0x02, 0xf1, 0x7d, 0x36, 0x8c, 0x44, 0x10, 0x75, 0xe5, 0x81, 0x8b, 0x05, 0x77, - 0x3b, 0x31, 0x0b, 0xd5, 0x39, 0xc9, 0x39, 0xb5, 0xec, 0x6c, 0x1e, 0x1a, 0x8e, 0x70, 0x45, 0xfb, - 0xb7, 0x53, 0xf7, 0x8e, 0xf2, 0xde, 0x8c, 0x59, 0xe8, 0xdc, 0x7e, 0xf8, 0xa4, 0x6a, 0x3d, 0x7a, - 0x52, 0xb5, 0xfe, 0x78, 0x52, 0xb5, 0xbe, 0x7d, 0x5a, 0x5d, 0x7a, 0xf4, 0xb4, 0xba, 0xf4, 0xf8, - 0x69, 0x75, 0xe9, 0xb3, 0x77, 0x66, 0x6a, 0x37, 0x92, 0x5f, 0xe9, 0x13, 0x8f, 0x27, 0x2f, 0x8d, - 0xbd, 0xad, 0xab, 0x8d, 0x51, 0xf6, 0x8f, 0x8d, 0xea, 0xc6, 0x5b, 0x51, 0xef, 0xd7, 0xfe, 0x0d, - 0x00, 0x00, 0xff, 0xff, 0x8f, 0xd0, 0x41, 0xd2, 0xf9, 0x0c, 0x00, 0x00, + // 1195 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xd6, 0x69, 0x5a, 0x8f, 0x5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x64, 0xde, 0x56, 0x02, 0x19, 0x00, + 0xc2, 0xc5, 0x24, 0xa2, 0x45, 0xb6, 0xc1, 0x4d, 0x97, 0x05, 0x2e, 0x0d, 0x44, 0x48, 0x04, 0x6d, + 0x27, 0x42, 0x39, 0x29, 0x54, 0x1b, 0x47, 0x66, 0x55, 0x09, 0x9d, 0x01, 0x42, 0x18, 0x4e, 0x47, + 0x27, 0xab, 0x8a, 0x0d, 0x3d, 0x20, 0xdc, 0x4f, 0xc4, 0xe6, 0xb3, 0xab, 0xca, 0x00, 0x10, 0x2e, + 0x26, 0x11, 0x25, 0x82, 0x7e, 0xcc, 0x81, 0xe2, 0x66, 0xd0, 0x61, 0xd6, 0x61, 0xec, 0x57, 0xeb, + 0x70, 0x40, 0xe1, 0x53, 0xb0, 0xa0, 0xba, 0x97, 0x2e, 0x15, 0x56, 0xeb, 0xb3, 0xf7, 0xd9, 0xae, + 0xc4, 0xc5, 0x4c, 0xa9, 0x91, 0xd9, 0x70, 0x4a, 0x05, 0x61, 0x2d, 0x07, 0x6d, 0x70, 0x35, 0xf1, + 0x44, 0xfa, 0x57, 0x58, 0x7d, 0x6f, 0xb6, 0xb4, 0xa5, 0x91, 0xa9, 0xf8, 0x1d, 0x2d, 0x5e, 0x3a, + 0xe9, 0x37, 0xc2, 0xa9, 0x28, 0x64, 0xe0, 0xda, 0xb4, 0x4f, 0xd2, 0xdb, 0xc2, 0x6a, 0x63, 0x76, + 0x91, 0xf5, 0x29, 0x74, 0x5a, 0xe8, 0xae, 0x2e, 0x74, 0xf3, 0xf4, 0x3c, 0x10, 0x3e, 0x51, 0x20, + 0xee, 0x28, 0xf1, 0x53, 0x7a, 0xff, 0xda, 0x8e, 0xd6, 0x35, 0x72, 0x56, 0x47, 0x89, 0x12, 0xc2, + 0xa9, 0x28, 0xfa, 0x08, 0x14, 0x4f, 0x7a, 0x0c, 0x1f, 0x80, 0x85, 0x13, 0xdf, 0xf0, 0x8d, 0x89, + 0xdf, 0xc9, 0x8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f, + 0x96, 0xa6, 0x77, 0x65, 0x76, 0x23, 0x64, 0xbe, 0xb5, 0xf5, 0xe2, 0xa8, 0x66, 0xbc, 0x3c, 0xaa, + 0x19, 0x7f, 0x1c, 0xd5, 0x8c, 0xef, 0x8f, 0x6b, 0x73, 0x2f, 0x8f, 0x6b, 0x73, 0xaf, 0x8e, 0x6b, + 0x73, 0x5f, 0x7c, 0x30, 0xb5, 0x76, 0x6d, 0xf9, 0xc3, 0x3e, 0x71, 0x78, 0xf2, 0xd2, 0xdc, 0x5f, + 0x7d, 0xd4, 0x1c, 0x4d, 0x2e, 0xfb, 0xb2, 0x1b, 0x67, 0x41, 0xbe, 0xbf, 0xff, 0x4f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xd0, 0xf4, 0x6f, 0x6c, 0x0d, 0x0c, 0x00, 0x00, } func (this *TokenPairArbRoutes) Equal(that interface{}) bool { @@ -1585,19 +1573,9 @@ func (m *AllProtocolRevenue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintProtorev(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - { - size, err := m.TxFeesTracker.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProtorev(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x1a { - size, err := m.TakerFeesToCommunityPoolTracker.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TxFeesTracker.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1607,7 +1585,7 @@ func (m *AllProtocolRevenue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 { - size, err := m.TakerFeesToStakersTracker.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TakerFeesTracker.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1885,9 +1863,7 @@ func (m *AllProtocolRevenue) Size() (n int) { } var l int _ = l - l = m.TakerFeesToStakersTracker.Size() - n += 1 + l + sovProtorev(uint64(l)) - l = m.TakerFeesToCommunityPoolTracker.Size() + l = m.TakerFeesTracker.Size() n += 1 + l + sovProtorev(uint64(l)) l = m.TxFeesTracker.Size() n += 1 + l + sovProtorev(uint64(l)) @@ -3379,7 +3355,7 @@ func (m *AllProtocolRevenue) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToStakersTracker", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesTracker", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3406,44 +3382,11 @@ func (m *AllProtocolRevenue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TakerFeesToStakersTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TakerFeesTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TakerFeesToCommunityPoolTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProtorev - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProtorev - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProtorev - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TakerFeesToCommunityPoolTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TxFeesTracker", wireType) } @@ -3476,7 +3419,7 @@ func (m *AllProtocolRevenue) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CyclicArbTracker", wireType) } From 60f5b760b786b6bb2f53ba55c6e722ed45be775d Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Thu, 2 Nov 2023 22:12:09 -0600 Subject: [PATCH 14/19] add default value for tests --- x/poolmanager/types/genesis.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x/poolmanager/types/genesis.go b/x/poolmanager/types/genesis.go index dc3cb4f8682..c4e8b1aa9bf 100644 --- a/x/poolmanager/types/genesis.go +++ b/x/poolmanager/types/genesis.go @@ -1,12 +1,21 @@ package types -import "errors" +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" +) // DefaultGenesis returns the default poolmanager genesis state. func DefaultGenesis() *GenesisState { return &GenesisState{ Params: DefaultParams(), NextPoolId: 1, + TakerFeesTracker: &TakerFeesTracker{ + TakerFeesToStakers: sdk.NewCoins(), + TakerFeesToCommunityPool: sdk.NewCoins(), + HeightAccountingStartsFrom: 0, + }, } } From b7447b901c1deadaca91b447e65608dd82e7d3e6 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Thu, 2 Nov 2023 22:54:20 -0600 Subject: [PATCH 15/19] add genesis test --- x/txfees/keeper/genesis_test.go | 64 +++++++++++++++++++++++++++++++++ x/txfees/types/genesis.go | 4 +++ 2 files changed, 68 insertions(+) create mode 100644 x/txfees/keeper/genesis_test.go diff --git a/x/txfees/keeper/genesis_test.go b/x/txfees/keeper/genesis_test.go new file mode 100644 index 00000000000..71c09bc081f --- /dev/null +++ b/x/txfees/keeper/genesis_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/osmosis-labs/osmosis/v20/x/txfees/types" +) + +var ( + testBaseDenom = "uosmo" + testFeeTokens = []types.FeeToken{ + { + Denom: "uion", + PoolID: 1, + }, + { + Denom: "wbtc", + PoolID: 2, + }, + } + + testTxFeesTracker = types.TxFeesTracker{ + TxFees: sdk.Coins{sdk.NewCoin("uosmo", sdk.NewInt(1000))}, + HeightAccountingStartsFrom: 100, + } +) + +func (s *KeeperTestSuite) TestInitGenesis() { + s.SetupTest(false) + s.PrepareBalancerPoolWithCoins(sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(1000000000000000000)), sdk.NewCoin("uion", sdk.NewInt(1000000000000000000)))...) + s.PrepareBalancerPoolWithCoins(sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(1000000000000000000)), sdk.NewCoin("wbtc", sdk.NewInt(1000000000000000000)))...) + + s.App.TxFeesKeeper.InitGenesis(s.Ctx, types.GenesisState{ + Basedenom: testBaseDenom, + Feetokens: testFeeTokens, + TxFeesTracker: &testTxFeesTracker, + }) + + actualBaseDenom, err := s.App.TxFeesKeeper.GetBaseDenom(s.Ctx) + s.Require().NoError(err) + + s.Require().Equal(testBaseDenom, actualBaseDenom) + s.Require().Equal(testFeeTokens, s.App.TxFeesKeeper.GetFeeTokens(s.Ctx)) + s.Require().Equal(testTxFeesTracker.TxFees, s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx)) + s.Require().Equal(testTxFeesTracker.HeightAccountingStartsFrom, s.App.TxFeesKeeper.GetTxFeesTrackerStartHeight(s.Ctx)) +} + +func (s *KeeperTestSuite) TestExportGenesis() { + s.SetupTest(false) + s.PrepareBalancerPoolWithCoins(sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(1000000000000000000)), sdk.NewCoin("uion", sdk.NewInt(1000000000000000000)))...) + s.PrepareBalancerPoolWithCoins(sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(1000000000000000000)), sdk.NewCoin("wbtc", sdk.NewInt(1000000000000000000)))...) + + s.App.TxFeesKeeper.InitGenesis(s.Ctx, types.GenesisState{ + Basedenom: testBaseDenom, + Feetokens: testFeeTokens, + TxFeesTracker: &testTxFeesTracker, + }) + + genesis := s.App.TxFeesKeeper.ExportGenesis(s.Ctx) + s.Require().Equal(testBaseDenom, genesis.Basedenom) + s.Require().Equal(testFeeTokens, genesis.Feetokens) + s.Require().Equal(testTxFeesTracker.TxFees, genesis.TxFeesTracker.TxFees) + s.Require().Equal(testTxFeesTracker.HeightAccountingStartsFrom, genesis.TxFeesTracker.HeightAccountingStartsFrom) +} diff --git a/x/txfees/types/genesis.go b/x/txfees/types/genesis.go index 8f874dddbae..e39fa74ac73 100644 --- a/x/txfees/types/genesis.go +++ b/x/txfees/types/genesis.go @@ -7,6 +7,10 @@ func DefaultGenesis() *GenesisState { return &GenesisState{ Basedenom: sdk.DefaultBondDenom, Feetokens: []FeeToken{}, + TxFeesTracker: &TxFeesTracker{ + TxFees: sdk.NewCoins(), + HeightAccountingStartsFrom: 0, + }, } } From bc3ddee9c75b3384d42bee5165ae2bc63b1abf4b Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Thu, 2 Nov 2023 22:55:42 -0600 Subject: [PATCH 16/19] remove old portion of test --- x/txfees/keeper/hooks_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/x/txfees/keeper/hooks_test.go b/x/txfees/keeper/hooks_test.go index b3fcc529e7b..4bf05a36392 100644 --- a/x/txfees/keeper/hooks_test.go +++ b/x/txfees/keeper/hooks_test.go @@ -104,11 +104,6 @@ func (s *KeeperTestSuite) TestTxFeesAfterEpochEnd() { s.NoError(err) err = s.App.BankKeeper.SendCoinsFromAccountToModule(s.Ctx, addr0, types.FeeCollectorForStakingRewardsName, sdk.Coins{coin}) s.NoError(err) - - // Update the tx fee tracker - currentTxFeesTrackerValue := s.App.TxFeesKeeper.GetTxFeesTrackerValue(s.Ctx) - newTxFeesTrackerValue := currentTxFeesTrackerValue.Add(sdk.NewCoins(coin)...) - s.App.TxFeesKeeper.SetTxFeesTrackerValue(s.Ctx, newTxFeesTrackerValue) } // checks the balance of the non-native denom in module account From a61bebfb393cf189fb4aa98897a1ab47b20eeb46 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Thu, 9 Nov 2023 21:05:43 -0700 Subject: [PATCH 17/19] fix test --- app/apptesting/test_suite.go | 42 +++++++++++++++++++++++++++++++ app/test_helpers.go | 23 +++++++++++++++++ app/upgrades/v21/constants.go | 5 +++- app/upgrades/v21/upgrades.go | 13 ++++++++-- app/upgrades/v21/upgrades_test.go | 4 ++- 5 files changed, 83 insertions(+), 4 deletions(-) diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index 8490e1ed31e..2d63997e8ee 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -117,6 +117,31 @@ func (s *KeeperTestHelper) Setup() { } } +func (s *KeeperTestHelper) SetupWithCustomChainId(chainId string) { + dir, err := os.MkdirTemp("", "osmosisd-test-home") + if err != nil { + panic(fmt.Sprintf("failed creating temporary directory: %v", err)) + } + s.T().Cleanup(func() { os.RemoveAll(dir); s.withCaching = false }) + s.App = app.SetupWithCustomHomeAndChainId(false, dir, chainId) + s.setupGeneralCustomChainId(chainId) + + // Manually set validator signing info, otherwise we panic + vals := s.App.StakingKeeper.GetAllValidators(s.Ctx) + for _, val := range vals { + consAddr, _ := val.GetConsAddr() + signingInfo := slashingtypes.NewValidatorSigningInfo( + consAddr, + s.Ctx.BlockHeight(), + 0, + time.Unix(0, 0), + false, + 0, + ) + s.App.SlashingKeeper.SetValidatorSigningInfo(s.Ctx, consAddr, signingInfo) + } +} + // PrepareAllSupportedPools creates all supported pools and returns their IDs. // Additionally, attaches an internal gauge ID for each pool. func (s *KeeperTestHelper) PrepareAllSupportedPools() SupportedPoolAndGaugeInfo { @@ -192,6 +217,23 @@ func (s *KeeperTestHelper) setupGeneral() { s.hasUsedAbci = false } +func (s *KeeperTestHelper) setupGeneralCustomChainId(chainId string) { + s.Ctx = s.App.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: chainId, Time: defaultTestStartTime}) + if s.withCaching { + s.Ctx, _ = s.Ctx.CacheContext() + } + s.QueryHelper = &baseapp.QueryServiceTestHelper{ + GRPCQueryRouter: s.App.GRPCQueryRouter(), + Ctx: s.Ctx, + } + + s.SetEpochStartTime() + s.TestAccs = []sdk.AccAddress{} + s.TestAccs = append(s.TestAccs, baseTestAccts...) + s.SetupConcentratedLiquidityDenomsAndPoolCreation() + s.hasUsedAbci = false +} + func (s *KeeperTestHelper) SetupTestForInitGenesis() { // Setting to True, leads to init genesis not running s.App = app.Setup(true) diff --git a/app/test_helpers.go b/app/test_helpers.go index d565c047ba8..c0ef47f5e39 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -136,6 +136,29 @@ func SetupWithCustomHome(isCheckTx bool, dir string) *OsmosisApp { return app } +func SetupWithCustomHomeAndChainId(isCheckTx bool, dir, chainId string) *OsmosisApp { + db := cometbftdb.NewMemDB() + app := NewOsmosisApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, dir, 0, sims.EmptyAppOptions{}, EmptyWasmOpts, baseapp.SetChainID(chainId)) + if !isCheckTx { + genesisState := GenesisStateWithValSet(app) + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + if err != nil { + panic(err) + } + + app.InitChain( + abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: sims.DefaultConsensusParams, + AppStateBytes: stateBytes, + ChainId: chainId, + }, + ) + } + + return app +} + // Setup initializes a new OsmosisApp. func Setup(isCheckTx bool) *OsmosisApp { return SetupWithCustomHome(isCheckTx, DefaultNodeHome) diff --git a/app/upgrades/v21/constants.go b/app/upgrades/v21/constants.go index 9806adb42b1..bdfe9737368 100644 --- a/app/upgrades/v21/constants.go +++ b/app/upgrades/v21/constants.go @@ -11,7 +11,10 @@ import ( ) // UpgradeName defines the on-chain upgrade name for the Osmosis v21 upgrade. -const UpgradeName = "v21" +const ( + UpgradeName = "v21" + TestingChainId = "testing-chain-id" +) var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, diff --git a/app/upgrades/v21/upgrades.go b/app/upgrades/v21/upgrades.go index 9aaa791e70a..2f6c02608b2 100644 --- a/app/upgrades/v21/upgrades.go +++ b/app/upgrades/v21/upgrades.go @@ -49,8 +49,17 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - // UNFORKINGNOTE: If we don't manually set this to 2, the gov modules doesn't go through its necessary migrations to version 4 - fromVM[govtypes.ModuleName] = 2 + // I spent a very long time trying to figure out how to test this in a non hacky way. + // TL;DR, on mainnet, we run a fork of v0.43, so we should be starting at version 2. + // Without this change, since we unfork to the primary repo, we start at version 5, which + // wouldn't allow us to run each migration. + // + // Now, starting from 2 only works on mainnet because the legacysubspace is set. + // Because the legacysubspace is not set in the gotest, we cant simply run these migrations without setting the legacysubspace. + // This legacysubspace can only be set at the initChain level, so it isn't clear to me how to directly set this in the test. + if ctx.ChainID() != TestingChainId { + fromVM[govtypes.ModuleName] = 2 + } baseAppLegacySS := keepers.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) // https://github.com/cosmos/cosmos-sdk/pull/12363/files diff --git a/app/upgrades/v21/upgrades_test.go b/app/upgrades/v21/upgrades_test.go index ddd8abf8e56..172f05d9971 100644 --- a/app/upgrades/v21/upgrades_test.go +++ b/app/upgrades/v21/upgrades_test.go @@ -7,6 +7,8 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + v21 "github.com/osmosis-labs/osmosis/v20/app/upgrades/v21" + abci "github.com/cometbft/cometbft/abci/types" "github.com/osmosis-labs/osmosis/osmomath" @@ -31,7 +33,7 @@ func TestUpgradeTestSuite(t *testing.T) { } func (s *UpgradeTestSuite) TestUpgrade() { - s.Setup() + s.SetupWithCustomChainId(v21.TestingChainId) dummyUpgrade(s) s.Require().NotPanics(func() { s.App.BeginBlocker(s.Ctx, abci.RequestBeginBlock{}) From da030c5b18aca9064bb2c0b64a2809919778edc8 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Thu, 9 Nov 2023 21:36:08 -0700 Subject: [PATCH 18/19] fix tests --- x/poolmanager/protorev.go | 4 ++-- x/poolmanager/taker_fee_test.go | 12 ++++++++++-- x/protorev/keeper/protorev_test.go | 17 ++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/x/poolmanager/protorev.go b/x/poolmanager/protorev.go index 98ccc0faa74..286aa817569 100644 --- a/x/poolmanager/protorev.go +++ b/x/poolmanager/protorev.go @@ -59,7 +59,7 @@ func (k Keeper) GetTakerFeeTrackerForStakers(ctx sdk.Context) (currentTakerFeeFo // If no volume was found, we treat the existing volume as 0. // While we can technically require volume to exist, we would need to store empty coins in state for each pool (past and present), // which is a high storage cost to pay for a weak guardrail. - currentTakerFeeForStakers = sdk.NewCoins() + currentTakerFeeForStakers = sdk.Coins(nil) if takerFeeFound { currentTakerFeeForStakers = takerFeeForStakers.Amount } @@ -80,7 +80,7 @@ func (k Keeper) GetTakerFeeTrackerForCommunityPool(ctx sdk.Context) (currentTake // If no volume was found, we treat the existing volume as 0. // While we can technically require volume to exist, we would need to store empty coins in state for each pool (past and present), // which is a high storage cost to pay for a weak guardrail. - currentTakerFeeForCommunityPool = sdk.NewCoins() + currentTakerFeeForCommunityPool = sdk.Coins(nil) if takerFeeFound { currentTakerFeeForCommunityPool = takerFeeForCommunityPool.Amount } diff --git a/x/poolmanager/taker_fee_test.go b/x/poolmanager/taker_fee_test.go index c50776f55f8..dbdb44cfb32 100644 --- a/x/poolmanager/taker_fee_test.go +++ b/x/poolmanager/taker_fee_test.go @@ -117,8 +117,16 @@ func (s *KeeperTestSuite) TestChargeTakerFee() { // Validate results. s.Require().Equal(tc.expectedResult.String(), tokenInAfterTakerFee.String()) - s.Require().Equal(takerFeeTrackerForStakersBefore.Add(expectedTakerFeeToStakers), takerFeeTrackerForStakersAfter) - s.Require().Equal(takerFeeTrackerForCommunityPoolBefore.Add(expectedTakerFeeToCommunityPool), takerFeeTrackerForCommunityPoolAfter) + expectedTakerFeeTrackerForStakersAfter := takerFeeTrackerForStakersBefore.Add(expectedTakerFeeToStakers) + if expectedTakerFeeTrackerForStakersAfter.Empty() { + expectedTakerFeeTrackerForStakersAfter = sdk.Coins(nil) + } + s.Require().Equal(expectedTakerFeeTrackerForStakersAfter, takerFeeTrackerForStakersAfter) + expectedTakerFeeTrackerForCommunityPoolAfter := takerFeeTrackerForCommunityPoolBefore.Add(expectedTakerFeeToCommunityPool) + if expectedTakerFeeTrackerForCommunityPoolAfter.Empty() { + expectedTakerFeeTrackerForCommunityPoolAfter = sdk.Coins(nil) + } + s.Require().Equal(expectedTakerFeeTrackerForCommunityPoolAfter, takerFeeTrackerForCommunityPoolAfter) }) } } diff --git a/x/protorev/keeper/protorev_test.go b/x/protorev/keeper/protorev_test.go index cfcf7cdc533..aba8a03587d 100644 --- a/x/protorev/keeper/protorev_test.go +++ b/x/protorev/keeper/protorev_test.go @@ -6,6 +6,7 @@ import ( "github.com/osmosis-labs/osmosis/osmomath" poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types" "github.com/osmosis-labs/osmosis/v20/x/protorev/types" + txfeestypes "github.com/osmosis-labs/osmosis/v20/x/txfees/types" ) // TestGetTokenPairArbRoutes tests the GetTokenPairArbRoutes function. @@ -331,7 +332,21 @@ func (s *KeeperTestSuite) TestGetAllProtocolRevenue() { s.App.PoolManagerKeeper.SetParams(s.Ctx, poolManagerParams) allProtoRev := s.App.ProtoRevKeeper.GetAllProtocolRevenue(s.Ctx) - s.Require().Empty(allProtoRev) + s.Require().Equal(types.AllProtocolRevenue{ + TakerFeesTracker: poolmanagertypes.TakerFeesTracker{ + TakerFeesToStakers: sdk.Coins(nil), + TakerFeesToCommunityPool: sdk.Coins(nil), + HeightAccountingStartsFrom: 0, + }, + TxFeesTracker: txfeestypes.TxFeesTracker{ + TxFees: sdk.Coins(nil), + HeightAccountingStartsFrom: 0, + }, + CyclicArbTracker: types.CyclicArbTracker{ + CyclicArb: sdk.NewCoins(), + HeightAccountingStartsFrom: 0, + }, + }, allProtoRev) // Swap on a pool to charge taker fee swapInCoin := sdk.NewCoin("Atom", osmomath.NewInt(1000)) From 2944189a69bbf3ce838a92a3dae7102ab081a9cc Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 10 Nov 2023 04:38:51 +0000 Subject: [PATCH 19/19] Auto: update go.mod after push to adam/all-protocol-rev-query that modified dependencies locally --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 69f4ec287da..cb78e8c6df0 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/ory/dockertest/v3 v3.10.0 github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3 github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231108202153-af031b1367bb - github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231108202153-af031b1367bb + github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231110043608-da030c5b18ac github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231108202153-af031b1367bb github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.9-0.20231108202153-af031b1367bb github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 3164abd404a..20a90237a38 100644 --- a/go.sum +++ b/go.sum @@ -1458,8 +1458,8 @@ github.com/osmosis-labs/go-mutesting v0.0.0-20221208041716-b43bcd97b3b3 h1:Ylmch 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.20231108202153-af031b1367bb h1:d4JXafqN5tqmM5gQ56nMGsOccLI9M+zp3KgI3vFU8vk= github.com/osmosis-labs/osmosis/osmomath v0.0.7-0.20231108202153-af031b1367bb/go.mod h1:I8CSvdOyPJREATq1Kb4mFPiDVrl2jxCRd4W3NVQFom8= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231108202153-af031b1367bb h1:Xt1HqDuWA4ix+B+wEJIqoFHTrcE6hxoK26Nk/6uC4qo= -github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231108202153-af031b1367bb/go.mod h1:5vLzE4XFr/qa5bXq6zSFncM3jUwTMOW9hMjVRSlTQAc= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231110043608-da030c5b18ac h1:60A8/hLeNPpEJ4QPoJbpN0BgJEjMzcAy+0lByxGIlaE= +github.com/osmosis-labs/osmosis/osmoutils v0.0.7-0.20231110043608-da030c5b18ac/go.mod h1:5vLzE4XFr/qa5bXq6zSFncM3jUwTMOW9hMjVRSlTQAc= github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231108202153-af031b1367bb h1:Gz4FoT0QgrqbYUt+fj+pl7kpcmv/Jd4VAKWOq3Bjpow= github.com/osmosis-labs/osmosis/x/epochs v0.0.3-0.20231108202153-af031b1367bb/go.mod h1:mno+X8PKNJZ+zKX+nG0R2Z0tEc+IM5RSvIRWKjhY+UA= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.9-0.20231108202153-af031b1367bb h1:GsepaIGS+uWEZT0K7cQ9hxjIVN5U6x+jzOr/7qNz7cc=