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(fork): restricts to post genesis transfer heights only #1600

Merged
merged 13 commits into from
Dec 3, 2024

Conversation

danwt
Copy link
Contributor

@danwt danwt commented Dec 2, 2024

Description


Closes

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

PR review checkboxes:

I have...

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Targeted PR against the correct branch
  • included the correct type prefix in the PR title
  • Linked to the GitHub issue with discussion and accepted design
  • Targets only one GitHub issue
  • Wrote unit and integration tests
  • Wrote relevant migration scripts if necessary
  • All CI checks have passed
  • Added relevant godoc comments
  • Updated the scripts for local run, e.g genesis_config_commands.sh if the PR changes parameters
  • Add an issue in the e2e-tests repo if necessary

SDK Checklist

  • Import/Export Genesis
  • Registered Invariants
  • Registered Events
  • Updated openapi.yaml
  • No usage of go map
  • No usage of time.Now()
  • Used fixed point arithmetic and not float arithmetic
  • Avoid panicking in Begin/End block as much as possible
  • No unexpected math Overflow
  • Used sendCoin and not SendCoins
  • Out-of-block compute is bounded
  • No serialized ID at the end of store keys
  • UInt to byte conversion should use BigEndian

Full security checklist here


For Reviewer:

  • Confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • Confirmed all author checklist items have been addressed

After reviewer approval:

  • In case the PR targets the main branch, PR should not be squash merge in order to keep meaningful git history.
  • In case the PR targets a release branch, PR must be rebased.

@danwt danwt changed the title Danwt/1599 fork trigger restrictions feat(fork): restricts to post genesis transfer heights only Dec 2, 2024
Comment on lines +79 to +81
if !k.rollappKeeper.ForkLatestAllowed(ctx, seq.RollappId) {
return nil, gerrc.ErrFailedPrecondition.Wrap("rotation could cause fork before genesis transfer")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eagerly prevent rotation when it would end up in a fork before genesis transfer
better ux and prevents rollapp getting completely broken

Copy link
Contributor

Choose a reason for hiding this comment

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

why u check it on the notice period start?
I think it will male more sense, to check on rotation start (notice period ends), in case nextProposer is sentinel

@danwt danwt marked this pull request as ready for review December 2, 2024 19:40
@danwt danwt requested a review from a team as a code owner December 2, 2024 19:40
@mtsitrin mtsitrin self-requested a review December 3, 2024 07:23
x/rollapp/types/rollapp.go Show resolved Hide resolved
x/common/types/rollapp_packet.go Show resolved Hide resolved
// is the rollback fork going to violate assumptions?
func (k Keeper) ForkAllowed(ctx sdk.Context, rollapp string, lastValidHeight uint64) bool {
ra := k.MustGetRollapp(ctx, rollapp)
return 0 < ra.GenesisState.TransferProofHeight && ra.GenesisState.TransferProofHeight <= lastValidHeight
Copy link
Contributor

Choose a reason for hiding this comment

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

missing true on ra.GenesisState.TransferProofHeight == 0

Copy link
Contributor

Choose a reason for hiding this comment

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

we're not gonna allow to fork before genesis bridge period (regardless of if ibc opened or not) to avoid now edge cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

isn't it the use case this PR tries to solve?
we want to allow fork before genesis bridge as well
we just want to avoid rollback from post GB to pre GB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No @mtsitrin we are not

Comment on lines +79 to +81
if !k.rollappKeeper.ForkLatestAllowed(ctx, seq.RollappId) {
return nil, gerrc.ErrFailedPrecondition.Wrap("rotation could cause fork before genesis transfer")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why u check it on the notice period start?
I think it will male more sense, to check on rotation start (notice period ends), in case nextProposer is sentinel

omritoptix
omritoptix previously approved these changes Dec 3, 2024
@danwt
Copy link
Contributor Author

danwt commented Dec 3, 2024

why u check it on the notice period start?
I think it will male more sense, to check on rotation start (notice period ends), in case nextProposer is sentinel

I disagree that's way more complicated and no ux improvement

@danwt danwt requested a review from mtsitrin December 3, 2024 10:32
@mtsitrin mtsitrin merged commit 3e0c553 into main Dec 3, 2024
5 checks passed
@mtsitrin mtsitrin deleted the danwt/1599-fork-trigger-restrictions branch December 3, 2024 11:32
@danwt danwt mentioned this pull request Dec 3, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants