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!: disable ibc upgrade proposal handler #2574

Merged
merged 3 commits into from
Sep 28, 2023
Merged

Conversation

cmwaters
Copy link
Contributor

The proposal handler to upgrade IBC also invokes the standard ScheduleUpgrade within the upgrading module. See https://github.com/cosmos/ibc-go/blob/e2201aaf1b016356bbd40fcdc17988437adce5ae/modules/core/02-client/keeper/proposal.go#L82. This effectively means that one can create a governance proposal to upgrade the chain which is something we didn't want to support. As there is no need to handle updating the IBC client yet, this temporarily disables the proposal type.

@celestia-bot celestia-bot requested a review from a team September 25, 2023 13:14
@cmwaters cmwaters self-assigned this Sep 25, 2023
@cmwaters cmwaters added the backport:v1.x PR will be backported automatically to the v1.x branch upon merging label Sep 25, 2023
@evan-forbes
Copy link
Member

This effectively means that one can create a governance proposal to upgrade the chain which is something we didn't want to support.

mind elaborating on the flow that we would go through? I'm good with merging this now, and then we can expand on the existing tests to ensure that we don't accidently enable this

@cmwaters
Copy link
Contributor Author

I create a governance proposal with *types.UpgradeProposal as the Content. In there I include a types.Plan to upgrade at height 10,000. If it passes, ScheduleUpgrade is called on our standard SDK upgrade keeper. This will create the plan and at height 10,000 will result in all nodes panicking and halting (until people switch to the new version)

@cmwaters
Copy link
Contributor Author

@evan-forbes do you want me to try write a test?

@evan-forbes
Copy link
Member

do you want me to try write a test?

this working makes sense to me, but it would be good practice I think to write a test to ensure that this can actually happen and we're not missing something small or hidden before creating a consensus breaking change with some potetially important (albiet temporary as we could always fix with a hardfork) consequences with IBC

@evan-forbes
Copy link
Member

evan-forbes commented Sep 25, 2023

I'm still missing as to why this exists in the first place tbh. Why should another chain be able to trigger an upgrade ever? I was aware of the the client upgrades, as what is described in the linked docs, and those make sense. This specific code described doesn't make sense, but is clearly there.

edit: per a sync discussion, this still isn't documented that well, but does make more sense to me now. This seems to just be a helper function to update the client state and schedule an upgrade simultaneously. Imo its simpler to just create a normal upgrade and handle everything there, including updating the client state if necessary.

evan-forbes
evan-forbes previously approved these changes Sep 25, 2023
@cmwaters
Copy link
Contributor Author

I've added a test to the x/upgrade/test directory that uses the IBC Upgrade Proposal Handler. Without the modifications this test validated that in fact the proposal would pass (and assumable cause the upgrade module to invoke an upgrade at the specified height.

Just as further context, the reason why there are two governance related messages for invoking a classic sdk styled upgrade is one is a normal state machine breaking change while the ibc upgrade is for ibc specific breaking changes whereby the client state needs to be upgraded.

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

Merging #2574 (7c545ed) into main (a3d2453) will decrease coverage by 0.02%.
Report is 2 commits behind head on main.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #2574      +/-   ##
==========================================
- Coverage   20.64%   20.63%   -0.02%     
==========================================
  Files         132      133       +1     
  Lines       15334    15344      +10     
==========================================
  Hits         3166     3166              
- Misses      11865    11875      +10     
  Partials      303      303              
Files Coverage Δ
app/app.go 4.52% <0.00%> (ø)
app/ibc_proposal_handler.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

x/upgrade/test/integration_test.go Outdated Show resolved Hide resolved
signer, err := testnode.NewSignerFromContext(s.cctx, acc)
require.NoError(t, err)
subCtx, cancel := context.WithTimeout(s.cctx.GoContext(), time.Minute)
defer cancel()
Copy link
Member

Choose a reason for hiding this comment

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

alternatively t.Cleanup

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

thanks for adding the test! really great find! 👍

@cmwaters cmwaters merged commit 03b83f8 into main Sep 28, 2023
29 checks passed
@cmwaters cmwaters deleted the cal/ibc-upgrade-handler branch September 28, 2023 08:28
mergify bot pushed a commit that referenced this pull request Sep 28, 2023
The proposal handler to upgrade IBC also invokes the standard
`ScheduleUpgrade` within the upgrading module. See
https://github.com/cosmos/ibc-go/blob/e2201aaf1b016356bbd40fcdc17988437adce5ae/modules/core/02-client/keeper/proposal.go#L82.
This effectively means that one can create a governance proposal to
upgrade the chain which is something we didn't want to support. As there
is no need to handle updating the IBC client yet, this temporarily
disables the proposal type.

(cherry picked from commit 03b83f8)
evan-forbes pushed a commit that referenced this pull request Sep 28, 2023
This is an automatic backport of pull request #2574 done by
[Mergify](https://mergify.com).


---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the
[documentation](https://docs.mergify.com/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on
`<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.com) you
can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com
</details>

---------

Co-authored-by: Callum Waters <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:v1.x PR will be backported automatically to the v1.x branch upon merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants