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(sequencers): validate sequencer unbonding_time greater than dispute_period #1115

Conversation

mtsitrin
Copy link
Contributor

Closes #613

This PR:

  • refactors x/sequencer to have params in own store instead of deprecated x/params
  • migration handler
  • stateful validation for param changes

@mtsitrin mtsitrin requested a review from a team as a code owner August 19, 2024 14:04
@mtsitrin mtsitrin requested a review from spoo-bar August 19, 2024 14:04
@omritoptix omritoptix changed the title feat(sequencers): validate sequencer unbondingtime greater then disputeperiod feat(sequencers): validate sequencer unbonding_time greater then dispute_period Aug 19, 2024
danwt
danwt previously approved these changes Aug 20, 2024
x/sequencer/keeper/params.go Outdated Show resolved Hide resolved
@omritoptix omritoptix changed the title feat(sequencers): validate sequencer unbonding_time greater then dispute_period feat(sequencers): validate sequencer unbonding_time greater then dispute_period Aug 21, 2024
@mtsitrin mtsitrin requested a review from danwt August 22, 2024 07:06
@danwt danwt added the security label Aug 22, 2024
x/sequencer/keeper/params.go Show resolved Hide resolved
@@ -153,7 +163,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 2 }
func (AppModule) ConsensusVersion() uint64 { return 3 }
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use a const?

@mtsitrin mtsitrin requested a review from zale144 August 25, 2024 07:10
@zale144 zale144 changed the title feat(sequencers): validate sequencer unbonding_time greater then dispute_period feat(sequencers): validate sequencer unbonding_time greater than dispute_period Aug 29, 2024
// Get the time duration of the dispute period
disputeDuration := time.Duration(rollappParams.DisputePeriodInBlocks) * HubExpectedTimePerBlock // dispute period duration
if params.UnbondingTime < disputeDuration {
return errorsmod.Wrapf(gerrc.ErrInvalidArgument, "unbonding time must be greater than dispute period")
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't check if they are equal

Copy link
Contributor

@omritoptix omritoptix left a comment

Choose a reason for hiding this comment

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

I see segregation in migration where some are done in upgrade.go and some in dedicated migration.go file within the sequencer module.
wondering why is that.

opened an issue for that here: #1160

x/sequencer/keeper/params.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Aug 31, 2024

Codecov Report

Attention: Patch coverage is 19.70021% with 375 lines in your changes missing coverage. Please review.

Project coverage is 27.39%. Comparing base (61d5ab1) to head (3b6c037).
Report is 31 commits behind head on main.

Files with missing lines Patch % Lines
x/sequencer/types/tx.pb.go 3.05% 314 Missing and 3 partials ⚠️
x/sequencer/types/msg_bond_change.go 47.36% 20 Missing ⚠️
x/sequencer/keeper/msg_server_update_params.go 0.00% 11 Missing ⚠️
x/sequencer/types/msg_update_params.go 0.00% 11 Missing ⚠️
x/sequencer/keeper/params.go 75.00% 6 Missing and 2 partials ⚠️
x/sequencer/migrations.go 72.72% 2 Missing and 1 partial ⚠️
x/sequencer/keeper/keeper.go 50.00% 1 Missing and 1 partial ⚠️
x/sequencer/module.go 66.66% 1 Missing and 1 partial ⚠️
app/upgrades/v4/upgrade.go 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1115      +/-   ##
==========================================
- Coverage   28.22%   27.39%   -0.83%     
==========================================
  Files         332      456     +124     
  Lines       52494    82936   +30442     
==========================================
+ Hits        14818    22724    +7906     
- Misses      35346    57305   +21959     
- Partials     2330     2907     +577     

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

omritoptix
omritoptix previously approved these changes Aug 31, 2024
@omritoptix omritoptix merged commit eddfc50 into main Aug 31, 2024
6 checks passed
@omritoptix omritoptix deleted the mtsitrin/613-sequencers-validate-sequencer-unbondingtime-greater-then-disputeperiod branch August 31, 2024 20:55
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.

[sequencers] validate sequencer UnbondingTime greater then disputePeriod
4 participants