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

light-client: new lib API for misbehaviour header verification #1294

Closed
1 task
ancazamfir opened this issue Apr 13, 2023 · 0 comments · Fixed by #1300
Closed
1 task

light-client: new lib API for misbehaviour header verification #1294

ancazamfir opened this issue Apr 13, 2023 · 0 comments · Fixed by #1300
Assignees
Labels
enhancement New feature or request

Comments

@ancazamfir
Copy link
Contributor

ancazamfir commented Apr 13, 2023

Description

Currently ibc-rs uses the verify() function to verify headers received in MsgUpdateClient

fn verify(
&self,
untrusted: UntrustedBlockState<'_>,
trusted: TrustedBlockState<'_>,
options: &Options,
now: Time,
) -> Verdict {
ensure_verdict_success!(self.verify_validator_sets(&untrusted));
ensure_verdict_success!(self.validate_against_trusted(&untrusted, &trusted, options, now));
ensure_verdict_success!(self.verify_commit_against_trusted(&untrusted, &trusted, options));
ensure_verdict_success!(self.verify_commit(&untrusted));
Verdict::Success
}
}

There is a need to verify headers received in MsgSubmitMisbehaviour. The verification for these headers is a bit more relaxed in order to catch FLA attacks. In particular the "header in the future" check for the header should be skipped from validate_against_trusted().
// Ensure the header isn't from a future time
verdict!(self.predicates.is_header_from_past(
untrusted.signed_header.header.time,
options.clock_drift,
now,
));

Currently the ibc-rs makes explicitly these calls from verify():

        ...verify_validator_sets(&untrusted);
        ...verify_commit_against_trusted(&untrusted, &trusted, options));
        ...verify_commit(&untrusted));

and also does all the checks from validate_against_trusted() except the header in the future one. Code is hard to follow as the checks are spread across multiple functions and also one needs to dive into the library to understand what it is being checked and where.

This PR reorganizes the code around client update/ misbehaviour. New code will temporarily call the same verify() API for both update and misbehaviour headers but we need to eventually provide the new API.
Intuitively this should also be needed for the light client detector in tendermint-rs for header verification from witnesses.

Definition of "done"

  • new verify_misbehaviour_header API implementation and documentation available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants