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

feat(CL): swaprouter cli, queries, module and keeper stubs (part 3 - no state breaks) #3557

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Nov 28, 2022

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 to main.

All this logic has already been given a round of reviews since we treated concentrated-liqudiity-main branch as main with appropriate review processes.

This particular PR does the following:

  • ports all cli and query logic while disabling tests
  • ports swaprouter's module package w/o registering types
  • ports all message server logic
  • ports all keeper stubs but not the implementations, tests are disabled.
  • adds a SwapRouterKeeper in app/keepers/keepers.go to let tests build. However, it does not initialize the keeper

There 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

@p0mvn p0mvn changed the title feat(CL): swaprouter cli, queries, module and keeper stubs (part 3 - … feat(CL): swaprouter cli, queries, module and keeper stubs (part 3 - no state breaks) Nov 28, 2022
@github-actions github-actions bot added C:app-wiring Changes to the app folder C:CLI C:x/swaprouter labels Nov 28, 2022
Comment on lines +124 to +125
// Note: DO NOT USE. This is not yet initialized
SwapRouterKeeper *swaprouter.Keeper
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: tracked in #3556

Comment on lines +64 to +65
// TODO: re-enable this once swaprouter is fully merged.
t.SkipNow()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: tracked in #3556

Comment on lines +54 to +55
// TODO: re-enable this once swaprouter is fully merged.
t.SkipNow()
Copy link
Member Author

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

Comment on lines +23 to +24
// TODO: re-enable this once swaprouter is fully merged.
t.SkipNow()
Copy link
Member Author

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

Comment on lines +144 to +145
// TODO: uncomment this once simulation is enabled.
// swaprouterGen.Params.PoolCreationFee = sdk.NewCoins(swaproutersimulation.PoolCreationFee)
Copy link
Member Author

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

Comment on lines +151 to +153
// TODO: uncomment this once simulation is enabled.
// return swaproutersimulation.DefaultActions(am.k, am.gammKeeper)
return nil
Copy link
Member Author

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

@p0mvn p0mvn added the V:state/compatible/no_backport State machine compatible PR, depends on prior breaks label Nov 28, 2022
@p0mvn p0mvn marked this pull request as ready for review November 28, 2022 23:05
@p0mvn p0mvn requested review from a team and czarcas7ic November 28, 2022 23:05
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment on lines +71 to +87
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)
Copy link
Member

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?

Copy link
Member Author

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

Comment on lines +12 to +25
// 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
}
Copy link
Member

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?

Copy link
Member Author

@p0mvn p0mvn Nov 29, 2022

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())
Copy link
Member

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?

Copy link
Member Author

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.

Comment on lines +30 to +43
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}
}
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

@p0mvn p0mvn Nov 29, 2022

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

@p0mvn
Copy link
Member Author

p0mvn commented Nov 29, 2022

Merging this since there are no state breaks and each PR has been reviewed in detail on concentrated-liquidity-main branch

@p0mvn p0mvn merged commit a0675d2 into main Nov 29, 2022
@p0mvn p0mvn deleted the roman/cl-swaprouter3 branch November 29, 2022 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:CLI C:x/swaprouter V:state/compatible/no_backport State machine compatible PR, depends on prior breaks
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants