-
Notifications
You must be signed in to change notification settings - Fork 618
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
feat(CL): swaprouter cli, queries, module and keeper stubs (part 3 - no state breaks) #3557
Conversation
// Note: DO NOT USE. This is not yet initialized | ||
SwapRouterKeeper *swaprouter.Keeper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: tracked in #3556
// TODO: re-enable this once swaprouter is fully merged. | ||
t.SkipNow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: tracked in #3556
// TODO: re-enable this once swaprouter is fully merged. | ||
t.SkipNow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is tracked in #3556
// TODO: re-enable this once swaprouter is fully merged. | ||
t.SkipNow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is tracked in #3556
// TODO: uncomment this once simulation is enabled. | ||
// swaprouterGen.Params.PoolCreationFee = sdk.NewCoins(swaproutersimulation.PoolCreationFee) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is tracked in #3556
// TODO: uncomment this once simulation is enabled. | ||
// return swaproutersimulation.DefaultActions(am.k, am.gammKeeper) | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is tracked in #3556
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
val := s.network.Validators[0] | ||
|
||
info, _, err := val.ClientCtx.Keyring.NewMnemonic("NewSwapExactAmountOut", | ||
keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) | ||
s.Require().NoError(err) | ||
|
||
newAddr := sdk.AccAddress(info.GetPubKey().Address()) | ||
|
||
_, err = banktestutil.MsgSendExec( | ||
val.ClientCtx, | ||
val.Address, | ||
newAddr, | ||
sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 20000), sdk.NewInt64Coin("node0token", 20000)), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), | ||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), | ||
osmoutils.DefaultFeeString(s.cfg), | ||
) | ||
s.Require().NoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a lot of boilerplate that gets reused. Do you think we should make an issue to fix this in a subsequent PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that this isn't clean. However, auto CLI will fix it soon so I wouldn't spend any time refactoring CLI
// TODO: move these to exported types within an internal package | ||
type XCreatePoolInputs createBalancerPoolInputs | ||
|
||
type XCreatePoolInputsExceptions struct { | ||
XCreatePoolInputs | ||
Other *string // Other won't raise an error | ||
} | ||
|
||
type XCreateStableswapPoolInputs createStableswapPoolInputs | ||
|
||
type XCreateStableswapPoolInputsExceptions struct { | ||
XCreateStableswapPoolInputs | ||
Other *string // Other won't raise an error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what is going on here / why the prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. This is a copy from gamm. Seems to be coming from this PR: #3294
Based on the description, it inherits a code smell from the balancer. I wouldn't worry about these CLI issues. The existing cli tests ensure that these work. These code smells are going to be replaced with Auto CLI soon.
|
||
txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) | ||
|
||
txf, msg, err := NewBuildCreateBalancerPoolMsg(clientCtx, txf, cmd.Flags()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work, I thought we use the same CreatePool cli cmd for both balancer and stableswap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the same CreatePool
keeper method. This method takes a CreatePoolMsg
interface. Each pool has a message implementing this interface.
This is the client side of things where the message is being built. What you're referring to is chain side.
func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, gammKeeper types.SwapI, concentratedKeeper types.SwapI, bankKeeper types.BankI, accountKeeper types.AccountI, communityPoolKeeper types.CommunityPoolI) *Keeper { | ||
// set KeyTable if it has not already been set | ||
if !paramSpace.HasKeyTable() { | ||
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) | ||
} | ||
|
||
routes := map[types.PoolType]types.SwapI{ | ||
types.Balancer: gammKeeper, | ||
types.StableSwap: gammKeeper, | ||
types.Concentrated: concentratedKeeper, | ||
} | ||
|
||
return &Keeper{storeKey: storeKey, paramSpace: paramSpace, gammKeeper: gammKeeper, concentratedKeeper: concentratedKeeper, bankKeeper: bankKeeper, accountKeeper: accountKeeper, communityPoolKeeper: communityPoolKeeper, routes: routes} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We aren't initializing this keeper anywhere yet right? Just ensuring there are in fact no state breaks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct!
suite.PrepareBalancerPool() | ||
return | ||
case types.StableSwap: | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why cant we add SS to this in a state machine compatible way? Im only asking with the assumption that the next PR is the state break, so might as well get everything SM compatible in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests for stableswap haven't been added yet. That's why the stableswap logic hasn't been added here yet, There is an issue to add that later
Merging this since there are no state breaks and each PR has been reviewed in detail on |
Closes: #XXX
What is the purpose of the change
We would like to drop
concentrated-liquidity-main
branch to avoid branch synching overhead. As part of that, we are going to be incrementally merging the current concentrated liquidity feature state tomain
.All this logic has already been given a round of reviews since we treated
concentrated-liqudiity-main
branch asmain
with appropriate review processes.This particular PR does the following:
module
package w/o registering typesSwapRouterKeeper
inapp/keepers/keepers.go
to let tests build. However, it does not initialize the keeperThere should be no state or API breaks in this PR. Reviewer, please confirm.
For the latest state of the feature that we are merging, see: https://github.com/osmosis-labs/osmosis/tree/concentrated-liquidity-main
See spec: https://github.com/osmosis-labs/osmosis/pull/3052/files