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

Incorrect header validation during tendermint client update #911

Closed
Tracked by #882
rnbguy opened this issue Oct 11, 2023 · 0 comments · Fixed by #912
Closed
Tracked by #882

Incorrect header validation during tendermint client update #911

rnbguy opened this issue Oct 11, 2023 · 0 comments · Fixed by #912
Assignees
Labels
A: bug Admin: something isn't working A: critical Admin: critical or Important
Milestone

Comments

@rnbguy
Copy link
Collaborator

rnbguy commented Oct 11, 2023

Bug Summary

This check inside Header::validate_basic is not correct

if self.trusted_next_validator_set.hash() != self.signed_header.header.next_validators_hash

Because trusted_next_validator_set is the next_validator_set of the header at the trusted height stored in the client state on the host. Semantically it is different than the submitted header's next_validator_set.

Details

We need to remove this condition. The correct condition is checked after validate_basic() in ClientState::verify_header().

let trusted_client_cons_state_path =
ClientConsensusStatePath::new(client_id, &header.trusted_height);
let trusted_consensus_state = downcast_tm_consensus_state(
ctx.consensus_state(&trusted_client_cons_state_path)?
.as_ref(),
)?;
check_header_trusted_next_validator_set(&header, &trusted_consensus_state)?;

fn check_header_trusted_next_validator_set(
header: &TmHeader,
trusted_consensus_state: &TmConsensusState,
) -> Result<(), ClientError> {
if header.trusted_next_validator_set.hash() == trusted_consensus_state.next_validators_hash {
Ok(())
} else {

Version

>=0.40.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: bug Admin: something isn't working A: critical Admin: critical or Important
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants