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

refactor(lightclient): removed the need for next stateInfo for valiadition #1467

Merged

Conversation

mtsitrin
Copy link
Contributor

@mtsitrin mtsitrin commented Nov 13, 2024

DRY out the validation methods into 2:
ValidateHeaderAgainstStateInfo - validates LC updated against existing state info
ValidateStateInfoAgainstConsensusStates - validates State Info against existing consensus states

main changes:

  • on HandleMsgUpdateClient

    • refactor validation to use single state info, instead of checking state info for H+1
  • on SetCanonicalClient

    • changed iteration key: instead of iterating all the consensus states, we iterate over state infos
    • each state info is validated

mtsitrin and others added 30 commits October 22, 2024 13:54
#1406)

Co-authored-by: keruch <[email protected]>
Co-authored-by: zale144 <[email protected]>
Co-authored-by: Daniel T <[email protected]>
Co-authored-by: Omri <[email protected]>
Co-authored-by: Sergi Rene <[email protected]>
Co-authored-by: Itzhak Bokris <[email protected]>
Base automatically changed from mtsitrin/937-rollapp-hard-fork-hub-side to main November 14, 2024 14:29
@mtsitrin mtsitrin marked this pull request as draft November 15, 2024 06:30
@mtsitrin mtsitrin linked an issue Nov 17, 2024 that may be closed by this pull request
Copy link

codecov bot commented Nov 17, 2024

Codecov Report

Attention: Patch coverage is 91.75258% with 8 lines in your changes missing coverage. Please review.

Project coverage is 22.69%. Comparing base (a308fd0) to head (4d50d9c).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
x/lightclient/keeper/canonical_client.go 90.69% 3 Missing and 1 partial ⚠️
x/lightclient/keeper/hook_listener.go 92.59% 1 Missing and 1 partial ⚠️
x/lightclient/ante/ibc_msg_update_client.go 90.00% 1 Missing ⚠️
x/rollapp/types/state_info.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1467      +/-   ##
==========================================
- Coverage   22.69%   22.69%   -0.01%     
==========================================
  Files         575      575              
  Lines      124579   124516      -63     
==========================================
- Hits        28273    28257      -16     
+ Misses      92528    92494      -34     
+ Partials     3778     3765      -13     

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

@mtsitrin mtsitrin marked this pull request as ready for review November 17, 2024 17:54
@mtsitrin mtsitrin requested review from danwt and omritoptix November 18, 2024 07:38
@mtsitrin mtsitrin marked this pull request as draft December 3, 2024 21:00
@mtsitrin mtsitrin marked this pull request as ready for review December 4, 2024 08:30
@danwt danwt marked this pull request as draft December 4, 2024 16:48
@mtsitrin mtsitrin marked this pull request as ready for review January 8, 2025 13:49
Comment on lines +75 to +81
func (s *StateInfo) NextSequencerForHeight(height uint64) string {
if height != s.GetLatestHeight() {
return s.Sequencer
}
return s.NextProposer
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (s *StateInfo) NextSequencerForHeight(height uint64) string {
if height != s.GetLatestHeight() {
return s.Sequencer
}
return s.NextProposer
}
func (s *StateInfo) Successor(height uint64) string {
if height != s.GetLatestHeight() {
return s.Sequencer
}
return s.NextProposer
}

@danwt
Copy link
Contributor

danwt commented Jan 10, 2025

Great job
Not from your PR but I'm not a fan of this mutable nextSequencer field on the state info

@mtsitrin
Copy link
Contributor Author

Great job Not from your PR but I'm not a fan of this mutable nextSequencer field on the state info

agree
it was added for dymint validation process

@mtsitrin mtsitrin merged commit 200dd62 into main Jan 13, 2025
5 checks passed
@mtsitrin mtsitrin deleted the 1308-xlightclient-redundent-call-for-findstateinfobyheight branch January 13, 2025 11:01
danwt added a commit that referenced this pull request Jan 15, 2025
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.

x/lightclient redundent call for FindStateInfoByHeight
3 participants