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

Make sure that the error receipt we write always has a sequence greater than the existing one. #5237

Conversation

chatton
Copy link
Contributor

@chatton chatton commented Nov 29, 2023

Description

closes: #5226

Will wait until #5207 is merged to mark as R4R as the tests will need a small refactor.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

chatton and others added 4 commits November 30, 2023 09:02
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
…te-always-has-a-sequence-greater-than-the-existing-one' of https://github.com/cosmos/ibc-go into cian/issue#5226-make-sure-that-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
@chatton chatton marked this pull request as ready for review November 30, 2023 10:13
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@charleenfei charleenfei left a comment

Choose a reason for hiding this comment

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

thanks @chatton!

charleenfei and others added 4 commits December 4, 2023 19:14
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
@@ -944,3 +944,21 @@ func (k Keeper) restoreChannel(ctx sdk.Context, portID, channelID string, upgrad

return channel
}

// WriteErrorReceipt will write an error receipt from the provided UpgradeError.
func (k Keeper) WriteErrorReceipt(ctx sdk.Context, portID, channelID string, upgradeError *types.UpgradeError) {
Copy link
Member

Choose a reason for hiding this comment

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

Question regarding this new method, is the intension to make SetUpgradeErrorReceipt private? seems a little off to have many functions exposed for this.

I was looking at the cancellation handler and also thought that it is not super clear that an error receipt is set within the restoreChannel func above this method. It might be worth while opening another issue to see if we could improve that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I think we can probably make WriteErrorReceipt unexported and add a wrapper in export_test.go, and potentially just remove the writing of the error receipt from the restore fn, and just call it separately. the error receipt is kind of like a side effect of restoring the channel so I'd be happy with that, will create an issue for it.

…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
@crodriguezvega crodriguezvega added the channel-upgradability Channel upgradability feature label Dec 13, 2023
chatton and others added 2 commits December 13, 2023 10:03
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2023

Codecov Report

Merging #5237 (8adcfb4) into 04-channel-upgrades (b3f5fc1) will increase coverage by 0.01%.
Report is 1 commits behind head on 04-channel-upgrades.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           04-channel-upgrades    #5237      +/-   ##
=======================================================
+ Coverage                80.37%   80.39%   +0.01%     
=======================================================
  Files                      197      197              
  Lines                    14973    14984      +11     
=======================================================
+ Hits                     12035    12046      +11     
  Misses                    2474     2474              
  Partials                   464      464              
Files Coverage Δ
modules/core/04-channel/keeper/upgrade.go 91.57% <100.00%> (+0.14%) ⬆️

…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
…t-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one
@chatton chatton enabled auto-merge (squash) December 13, 2023 11:16
@chatton chatton merged commit 0323942 into 04-channel-upgrades Dec 13, 2023
53 of 55 checks passed
@chatton chatton deleted the cian/issue#5226-make-sure-that-the-error-receipt-we-write-always-has-a-sequence-greater-than-the-existing-one branch December 13, 2023 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
04-channel channel-upgradability Channel upgradability feature core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants