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: Attack detector and evidence reporting #1291

Closed
romac opened this issue Apr 4, 2023 · 0 comments · Fixed by #1292
Closed

light-client: Attack detector and evidence reporting #1291

romac opened this issue Apr 4, 2023 · 0 comments · Fixed by #1292
Assignees
Labels
enhancement New feature or request

Comments

@romac
Copy link
Member

romac commented Apr 4, 2023

See also: #1219 & #415

Description

Implement a light client attack detector, based on its Go version in Comet.

A tentative API for the detector could look like this:

pub struct Divergence {
    pub evidence: LightClientAttackEvidence,
    pub challenging_block: LightBlock,
}

/// Given a primary trace and a witness, detect any divergence between the two,
/// by querying the witness for the same header as the last header in the primary trace
/// (ie. the target block), and comparing the hashes.
///
/// If the hashes match, then no divergence has been detected and the target block can be trusted.
///
/// If the hashes do not match, then the witness has provided a conflicting header.
/// This could possibly imply an attack on the light client.
/// In this case, we need to verify the witness's header using the same skipping verification
/// and then we need to find the point that the headers diverge and examine this for any evidence of an attack.
/// We then attempt to find the bifurcation point and if successful construct the evidence of an
/// attack to report to the witness.
pub async fn detect_divergence(
    witness: &mut Provider,
    primary_trace: Vec<LightBlock>,
    max_clock_drift: Duration,
    max_block_lag: Duration,
    now: Time
) -> Result<Option<Divergence>, DivergenceError>;

Definition of "done"

The light client attack detector is implemented, tested and documented, and the API it exposes can be successfully integrated into Hermes.

@romac romac added the enhancement New feature or request label Apr 4, 2023
@romac romac self-assigned this Apr 4, 2023
@romac romac changed the title light-client: Attack detector light-client: Attack detector and evidence reporting Apr 4, 2023
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
Development

Successfully merging a pull request may close this issue.

1 participant