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

fix(rollapp): change finalization end blocker logic to not leave broken invariants #669

Merged
merged 18 commits into from
Mar 18, 2024

Conversation

omritoptix
Copy link
Contributor

@omritoptix omritoptix commented Mar 14, 2024

Description


Closes #657

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.

@omritoptix omritoptix changed the title fix: changed finalization end blocker logic to not leave broken invariants fix: change finalization end blocker logic to not leave broken invariants Mar 14, 2024
@omritoptix omritoptix marked this pull request as ready for review March 15, 2024 14:27
@omritoptix omritoptix requested a review from a team as a code owner March 15, 2024 14:27
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 76.47059% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 30.69%. Comparing base (c74746c) to head (1efd9eb).

Files Patch % Lines
x/rollapp/keeper/invariants.go 80.00% 5 Missing and 2 partials ⚠️
...llapp/keeper/block_height_to_finalization_queue.go 75.00% 6 Missing ⚠️
x/rollapp/module.go 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #669      +/-   ##
==========================================
+ Coverage   30.62%   30.69%   +0.06%     
==========================================
  Files         227      227              
  Lines       32024    32052      +28     
==========================================
+ Hits         9807     9837      +30     
+ Misses      20656    20653       -3     
- Partials     1561     1562       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@omritoptix omritoptix changed the title fix: change finalization end blocker logic to not leave broken invariants fix(rollapp): change finalization end blocker logic to not leave broken invariants Mar 15, 2024
mtsitrin
mtsitrin previously approved these changes Mar 17, 2024
for _, stateInfoIndex := range blockHeightToFinalizationQueue.FinalizationQueue {
stateInfo, found := k.GetStateInfo(ctx, stateInfoIndex.RollappId, stateInfoIndex.Index)
if !found || stateInfo.Status != common.Status_PENDING {
ctx.Logger().Error("Missing stateInfo data when trying to finalize or alreay finalized", "rollappID", stateInfoIndex.RollappId, "height", ctx.BlockHeight(), "index", stateInfoIndex.Index)
continue
// Invariant breaking
Copy link
Contributor

Choose a reason for hiding this comment

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

// Invariant breaking as later packets of same rollapp might be finalized

@omritoptix omritoptix linked an issue Mar 17, 2024 that may be closed by this pull request
@omritoptix omritoptix linked an issue Mar 17, 2024 that may be closed by this pull request
srene
srene previously approved these changes Mar 17, 2024
@mtsitrin
Copy link
Contributor

pls fix linter

[golangci-lint: app/app.go#L284](https://github.com/dymensionxyz/dymension/pull/669/files#annotation_19377802712)
File is not `gofumpt`-ed (gofumpt)

…ionxyz/dymension into omritoptix/657-invariant-handling
@omritoptix omritoptix merged commit 9a27004 into main Mar 18, 2024
7 of 14 checks passed
@omritoptix omritoptix deleted the omritoptix/657-invariant-handling branch March 18, 2024 15:02
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.

Verification of broken invariant logic
3 participants