Skip to content

Conversation

AdityaSripal
Copy link
Contributor

Description

This PR intercepts the message before it reaches the ethereum client package and no-ops on VerifyClientMessage and UpdateStateMsg if the header slot is the same as the latest consensus state height.

It is intended as the most feasible stopgap solution before allowing historical updates

Note it does not check if the header is valid at all. We can't do header verification here without historical updates since the cosmwasm contract grabs the latest consensus state as the trusted state automatically. We cannot no-op in this case in the verification package as that would simply be a bug in the library.

It also does not implement automatic misbehaviour detection since this would require historical updates.

I have this PR up along with tests to show that this can work. But given the above reasons, I think it is most wise to simply go directly to allowing historical updates which is what i will work on next.

Leaving this PR up so that the team has context on my decision.

closes: #XXXX


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.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Comment on lines +233 to +235
let header_bz: Vec<u8> = serde_json::to_vec(&header).unwrap();
let header_bz2: Vec<u8> = header_bz.clone();
let header_bz3: Vec<u8> = header_bz.clone();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

did this just to shut the compiler up but lmk what the canonical solution is @srdtrk

Comment on lines +265 to +280
verify_client_message(
deps.as_ref(),
env2,
VerifyClientMessageMsg {
client_message: Binary::from(header_bz3),
},
)
.unwrap();

update_state(
deps.as_mut(),
UpdateStateMsg {
client_message: Binary::from(header_bz4),
},
)
.unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both calls fail here with their respective no-op code commented out

@codecov
Copy link

codecov bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.86%. Comparing base (a46550b) to head (7ac4bb8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #501   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files          15       15           
  Lines         766      766           
=======================================
  Hits          765      765           
  Misses          1        1           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant