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

modify pool-incentives submit proposal cli #2086

Merged
merged 8 commits into from
Aug 24, 2022
Merged

modify pool-incentives submit proposal cli #2086

merged 8 commits into from
Aug 24, 2022

Conversation

catShaark
Copy link
Contributor

Closes: #1888

Brief Changelog

  • add proposal-specific flags to NewCmdSubmitUpdatePoolIncentivesProposal and NewCmdSubmitReplacePoolIncentivesProposal
  • disable poolincetives tx commands since these should be only used with a gov prefix
  • register NewCmdSubmitReplacePoolIncentivesProposal handler on the gov module

Testing and Verifying

  • Manually verified

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? yes
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? yes
  • How is the feature or change documented? not documented

@catShaark catShaark requested a review from a team July 15, 2022 18:43
Comment on lines 41 to 43
func (p *ReplacePoolIncentivesProposal) ProposalType() string {
return ProposalTypeUpdatePoolIncentives
return ProposalTypeReplacePoolIncentives
}
Copy link
Member

Choose a reason for hiding this comment

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

ooof, would this be state breaking to backport? (I don't have a sense for where ProposalType gets used)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they're used in routing

Copy link
Contributor

Choose a reason for hiding this comment

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

This is used in x/gov routing when executing the proposal's handler.

Copy link
Member

Choose a reason for hiding this comment

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

If it's only used for routing, I assume it's not going to be state-breaking to backport?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think If we have a ProposalTypeReplacePoolIncentives submited, this will be state-breaking

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

LGTM - I think we should create a changelog entry for this

Comment on lines 41 to 43
func (p *ReplacePoolIncentivesProposal) ProposalType() string {
return ProposalTypeUpdatePoolIncentives
return ProposalTypeReplacePoolIncentives
}
Copy link
Member

Choose a reason for hiding this comment

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

If it's only used for routing, I assume it's not going to be state-breaking to backport?

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/osmosis-labs/osmosis/v7/osmoutils"
"github.com/osmosis-labs/osmosis/v7/x/pool-incentives/types"
)

func NewTxCmd() *cobra.Command {
Copy link
Member

Choose a reason for hiding this comment

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

hrmm is it safe to delete this / is there a reason behind deleting this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is decided in #1888 that submit proposal cmd should only have gov prefix, so these command will be registered with gov handler instead of tx cmd of incentives module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LGTM - I think we should create a changelog entry for this

Should I add this to state breaking entry or not

Copy link
Member

Choose a reason for hiding this comment

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

imo should go under breaking changes

@github-actions github-actions bot added the C:docs Improvements or additions to documentation label Jul 18, 2022
@catShaark catShaark requested a review from mattverse July 29, 2022 10:49
CHANGELOG.md Outdated Show resolved Hide resolved
@ValarDragon
Copy link
Member

Sorry, I'm actually generally confused about whats going on in these governance proposal routing.

My understanding is that in the today code, replace incentives proposal works on mainnet. Looking into this, looks like the handler is registered here? https://github.com/osmosis-labs/osmosis/blob/main/app/keepers/keepers.go#L366

Which then splits execution based on type

func NewPoolIncentivesProposalHandler(k keeper.Keeper) govtypes.Handler {
return func(ctx sdk.Context, content govtypes.Content) error {
switch c := content.(type) {
case *types.UpdatePoolIncentivesProposal:
return handleUpdatePoolIncentivesProposal(ctx, k, c)
case *types.ReplacePoolIncentivesProposal:
return handleReplacePoolIncentivesProposal(ctx, k, c)
default:
return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized pool incentives proposal content type: %T", c)
}
}
}

So the routes being equivalent may be correct?

@ValarDragon
Copy link
Member

(this is also needlessly complex, and we should simplify it)

@ValarDragon ValarDragon requested a review from p0mvn August 4, 2022 22:40
@p0mvn
Copy link
Member

p0mvn commented Aug 5, 2022

Sorry, I'm actually generally confused about whats going on in these governance proposal routing.

My understanding is that in the today code, replace incentives proposal works on mainnet. Looking into this, looks like the handler is registered here? https://github.com/osmosis-labs/osmosis/blob/main/app/keepers/keepers.go#L366

Which then splits execution based on type

func NewPoolIncentivesProposalHandler(k keeper.Keeper) govtypes.Handler {
return func(ctx sdk.Context, content govtypes.Content) error {
switch c := content.(type) {
case *types.UpdatePoolIncentivesProposal:
return handleUpdatePoolIncentivesProposal(ctx, k, c)
case *types.ReplacePoolIncentivesProposal:
return handleReplacePoolIncentivesProposal(ctx, k, c)
default:
return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized pool incentives proposal content type: %T", c)
}
}
}

So the routes being equivalent may be correct?

I think that the linked handler registration is focused on routing. On the other hand, this PR is primarily about fixing the client bootstrapping / cli.

Currently, pool-incentives gov cli is broken due to incorrectly setting up the cli logic and registering some flags twice. I've verified that this should help fix the original problem in #1888.

We expose 2 ways to submit pool-incentives proposals:

  • osmosisd tx poolincentives update-pool-incentives
  • osmosisd tx gov submit-proposal update-pool-incentives

Only the latter is correct because it properly gets registered on the gov module. The original bug is stemming from attempting to support both ways and, as a result, registering some CLI flags twice which breaks both commands.

The change related to the proposal type seems to be a pass-through change. However, It does seem like a valid change that we should keep because we were returning an invalid proposal type.

The claim that ProposalType() is used in routing does seem to be correct. Although this is client-side (rest) routing.

Based on my investigation, the changes in this PR do not affect the state-breaking routing we are concerned about.

I think we need the changes in this PR to fix the CLI and client (REST) routing. However, it might make sense to spend more time manually testing to ensure that everything is sound

@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

@github-actions github-actions bot added the Stale label Aug 20, 2022
@github-actions github-actions bot removed the Stale label Aug 21, 2022
@p0mvn
Copy link
Member

p0mvn commented Aug 23, 2022

Hi @catShaark . I just would like to confirm that you've gotten a chance to manually test that both pool incentives proposals are functioning as expected.

Please let me know

@p0mvn
Copy link
Member

p0mvn commented Aug 23, 2022

I think it would be great to have an e2e test for submitting these pool-incentive proposals. Would you be interested in adding it?

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

utACK. Changes lgtm.

I would like to know whether a manual test has been done or if there is intention to add an e2e test for this?

Either is fine with me to merge this

CHANGELOG.md Show resolved Hide resolved
@p0mvn p0mvn merged commit bef1b97 into osmosis-labs:main Aug 24, 2022
@github-actions github-actions bot mentioned this pull request May 1, 2024
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:docs Improvements or additions to documentation C:x/pool-incentives
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update-Pool-Incentives Description field error
6 participants