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

Stop executing the handler when proposal is sumbmitted #534

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

wojciech-sei
Copy link

Describe your changes and provide context

Testing performed to validate your change

CI will test it

@wojciech-sei wojciech-sei requested a review from a team August 14, 2024 15:19
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.84%. Comparing base (0831407) to head (8dcc041).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #534      +/-   ##
==========================================
- Coverage   54.84%   54.84%   -0.01%     
==========================================
  Files         631      631              
  Lines       54791    54806      +15     
==========================================
+ Hits        30050    30058       +8     
- Misses      22589    22597       +8     
+ Partials     2152     2151       -1     
Files Coverage Δ
x/gov/keeper/proposal.go 82.63% <ø> (+1.43%) ⬆️

... and 1 file with indirect coverage changes

@yzang2019
Copy link
Collaborator

yzang2019 commented Aug 14, 2024

Can you please fill up the context of this change? Why do we actually wanna remove that logic?

cacheCtx, _ := ctx.CacheContext()
handler := keeper.router.GetRoute(content.ProposalRoute())
if err := handler(cacheCtx, content); err != nil {
return types.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalContent, err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

does this have the side effect of allowing users to submit invalid props?

Copy link
Author

Choose a reason for hiding this comment

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

yes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to fix the underline issue other than removing this handler? What does the upstream tendermint do here?

Copy link
Author

Choose a reason for hiding this comment

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

We could mark ctx with some flag saying that handler is executed in the "submit" scope and then act accordingly in the handler. But it means that we have to be careful about every handler in the system.

The current cosmos sdk stopped executing the handlers: https://github.com/cosmos/cosmos-sdk/blob/release/v0.50.x/x/gov/keeper/proposal.go#L72

They do it only for legacy types for backward compatibility, but no one uses those legacy proposals anymore.

@cordt-sei
Copy link
Contributor

Oops, button-mashed and updated this branch.

@wojciech-sei wojciech-sei merged commit 3395ce7 into main Aug 23, 2024
15 checks passed
@wojciech-sei wojciech-sei deleted the wojciech/gov-proposal-handler branch August 23, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants