Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bring mempool v20.x work to main #6858

Merged
merged 10 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### State Breaks

* [#6758](https://github.com/osmosis-labs/osmosis/pull/6758) Add codec for MsgUndelegateFromRebalancedValidatorSet
* [#6836](https://github.com/osmosis-labs/osmosis/pull/6836) Add DenomsMetadata to stargate whitelist and fixs the DenomMetadata response type
* [#6836](https://github.com/osmosis-labs/osmosis/pull/6836) Add DenomsMetadata to stargate whitelist and fixs the DenomMetadata response type
* [#6814](https://github.com/osmosis-labs/osmosis/pull/6814) Add EstimateTradeBasedOnPriceImpact to stargate whitelist

### Misc Improvements

* [#6788](https://github.com/osmosis-labs/osmosis/pull/6788) Improve error message when CL LP fails due to slippage bound hit.
* [#6858](https://github.com/osmosis-labs/osmosis/pull/6858) Merge mempool improvements from v20

### API Breaks

Expand Down
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ func NewOsmosisApp(
}

app.homePath = homePath
dataDir := filepath.Join(homePath, "data")
wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
// Uncomment this for debugging contracts. In the future this could be made into a param passed by the tests
Expand All @@ -285,6 +286,7 @@ func NewOsmosisApp(
encodingConfig,
bApp,
maccPerms,
dataDir,
wasmDir,
wasmConfig,
wasmEnabledProposals,
Expand Down
2 changes: 2 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
encodingConfig appparams.EncodingConfig,
bApp *baseapp.BaseApp,
maccPerms map[string][]string,
dataDir string,
wasmDir string,
wasmConfig wasm.Config,
wasmEnabledProposals []wasm.ProposalType,
Expand Down Expand Up @@ -402,6 +403,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.GAMMKeeper,
appKeepers.ProtoRevKeeper,
appKeepers.DistrKeeper,
dataDir,
)
appKeepers.TxFeesKeeper = &txFeesKeeper
appKeepers.ProtoRevKeeper.SetTxFeesKeeper(appKeepers.TxFeesKeeper)
Expand Down
3 changes: 3 additions & 0 deletions cmd/osmosisd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ arbitrage-min-gas-fee = ".005"
# This is the minimum gas fee any tx with high gas demand should have, denominated in uosmo per gas
# Default value of ".0025" then means that a tx with 1 million gas costs (.0025 uosmo/gas) * 1_000_000 gas = .0025 osmo
min-gas-price-for-high-gas-tx = ".0025"

# This parameter enables EIP-1559 like fee market logic in the mempool
adaptive-fee-enabled = "false"
`

return OsmosisAppTemplate, OsmosisAppCfg
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
mvdan.cc/gofumpt v0.5.0
)

Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
12 changes: 12 additions & 0 deletions proto/osmosis/superfluid/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ service Query {
"account_undelegating_cl_positions/"
"{delegator_address}";
}

rpc RestSupply(QueryRestSupplyRequest) returns (QueryRestSupplyResponse) {
option (google.api.http).get = "/osmosis/superfluid/v1beta1/supply";
}
}

message QueryParamsRequest {}
Expand Down Expand Up @@ -320,3 +324,11 @@ message UserConcentratedSuperfluidPositionsUndelegatingResponse {
repeated ConcentratedPoolUserPositionRecord cl_pool_user_position_records = 1
[ (gogoproto.nullable) = false ];
}

// THIS QUERY IS TEMPORARY
message QueryRestSupplyRequest { string denom = 1; }

message QueryRestSupplyResponse {
// amount is the supply of the coin.
cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ];
}
15 changes: 15 additions & 0 deletions proto/osmosis/txfees/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ service Query {
rpc BaseDenom(QueryBaseDenomRequest) returns (QueryBaseDenomResponse) {
option (google.api.http).get = "/osmosis/txfees/v1beta1/base_denom";
}

// Returns a list of all base denom tokens and their corresponding pools.
rpc GetEipBaseFee(QueryEipBaseFeeRequest) returns (QueryEipBaseFeeResponse) {
option (google.api.http).get = "/osmosis/txfees/v1beta1/cur_eip_base_fee";
}
}

message QueryFeeTokensRequest {}
Expand Down Expand Up @@ -73,3 +78,13 @@ message QueryBaseDenomRequest {}
message QueryBaseDenomResponse {
string base_denom = 1 [ (gogoproto.moretags) = "yaml:\"base_denom\"" ];
}

message QueryEipBaseFeeRequest {}
message QueryEipBaseFeeResponse {
string base_fee = 1 [
(gogoproto.moretags) = "yaml:\"base_fee\"",

(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}
64 changes: 63 additions & 1 deletion x/poolmanager/types/msg_swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,73 @@ type SwapMsgRoute interface {
TokenDenomsOnPath() []string
}

type MultiSwapMsgRoute interface {
GetSwapMsgs() []SwapMsgRoute
}

func (msg MsgSplitRouteSwapExactAmountIn) GetSwapMsgs() []SwapMsgRoute {
routes := make([]SwapMsgRoute, len(msg.Routes))
for i := 0; i < len(msg.Routes); i++ {
routes[i] = SwapAmountInSplitRouteWrapper{msg.Routes[i].Pools, msg.TokenInDenom}
}
return routes
}

func (msg MsgSplitRouteSwapExactAmountOut) GetSwapMsgs() []SwapMsgRoute {
routes := make([]SwapMsgRoute, len(msg.Routes))
for i := 0; i < len(msg.Routes); i++ {
routes[i] = SwapAmountOutSplitRouteWrapper{msg.Routes[i].Pools, msg.TokenOutDenom}
}
return routes
}

type SwapAmountInSplitRouteWrapper struct {
Pools []SwapAmountInRoute `json:"pools"`
InDenom string `json:"in_denom"`
}

type SwapAmountOutSplitRouteWrapper struct {
Pools []SwapAmountOutRoute `json:"pools"`
OutDenom string `json:"in_denom"`
}

var (
_ SwapMsgRoute = MsgSwapExactAmountOut{}
_ SwapMsgRoute = MsgSwapExactAmountIn{}
_ SwapMsgRoute = MsgSwapExactAmountOut{}
_ SwapMsgRoute = SwapAmountInSplitRouteWrapper{}
_ SwapMsgRoute = SwapAmountOutSplitRouteWrapper{}
)

func (msg SwapAmountOutSplitRouteWrapper) TokenInDenom() string {
return msg.Pools[0].TokenInDenom
}
func (msg SwapAmountOutSplitRouteWrapper) TokenOutDenom() string {
return msg.OutDenom
}
func (msg SwapAmountOutSplitRouteWrapper) TokenDenomsOnPath() []string {
denoms := make([]string, 0, len(msg.Pools)+1)
for i := 0; i < len(msg.Pools); i++ {
denoms = append(denoms, msg.Pools[i].TokenInDenom)
}
denoms = append(denoms, msg.TokenOutDenom())
return denoms
}

func (msg SwapAmountInSplitRouteWrapper) TokenInDenom() string {
return msg.InDenom
}
func (msg SwapAmountInSplitRouteWrapper) TokenOutDenom() string {
return msg.Pools[len(msg.Pools)-1].TokenOutDenom
}
func (msg SwapAmountInSplitRouteWrapper) TokenDenomsOnPath() []string {
denoms := make([]string, 0, len(msg.Pools)+1)
denoms = append(denoms, msg.TokenInDenom())
for i := 0; i < len(msg.Pools); i++ {
denoms = append(denoms, msg.Pools[i].TokenOutDenom)
}
return denoms
}

func (msg MsgSwapExactAmountOut) TokenInDenom() string {
return msg.Routes[0].GetTokenInDenom()
}
Expand Down
10 changes: 10 additions & 0 deletions x/superfluid/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,13 @@ func (q Querier) filterConcentratedPositionLocks(ctx sdk.Context, positions []mo
}
return clPoolUserPositionRecords, nil
}

// TEMPORARY CODE
func (q Querier) RestSupply(goCtx context.Context, req *types.QueryRestSupplyRequest) (*types.QueryRestSupplyResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

supply := q.bk.GetSupply(sdk.UnwrapSDKContext(goCtx), req.Denom)
return &types.QueryRestSupplyResponse{Amount: supply}, nil
}
1 change: 1 addition & 0 deletions x/superfluid/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type BankKeeper interface {
AddSupplyOffset(ctx sdk.Context, denom string, offsetAmount osmomath.Int)
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
GetSupply(ctx sdk.Context, denom string) sdk.Coin
}

// StakingKeeper expected staking keeper.
Expand Down
Loading