Skip to content

Commit 4b6f7ac

Browse files
docs: add docstring for check_misbehaviour (#1092)
1 parent b959279 commit 4b6f7ac

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

ibc-clients/ics07-tendermint/src/client_state.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,31 @@ where
255255
}
256256
}
257257

258+
/// Namely the following cases are covered:
259+
///
260+
/// 1 - fork:
261+
/// Assumes at least one consensus state before the fork point exists. Let
262+
/// existing consensus states on chain B be: [Sn,.., Sf, Sf-1, S0] with
263+
/// `Sf-1` being the most recent state before fork. Chain A is queried for a
264+
/// header `Hf'` at `Sf.height` and if it is different than the `Hf` in the
265+
/// event for the client update (the one that has generated `Sf` on chain),
266+
/// then the two headers are included in the evidence and submitted. Note
267+
/// that in this case the headers are different but have the same height.
268+
///
269+
/// 2 - BFT time violation for unavailable header (a.k.a. Future Lunatic
270+
/// Attack or FLA):
271+
/// Some header with a height that is higher than the latest height on A has
272+
/// been accepted and a consensus state was created on B. Note that this
273+
/// implies that the timestamp of this header must be within the
274+
/// `clock_drift` of the client. Assume the client on B has been updated
275+
/// with `h2`(not present on/ produced by chain A) and it has a timestamp of
276+
/// `t2` that is at most `clock_drift` in the future. Then the latest header
277+
/// from A is fetched, let it be `h1`, with a timestamp of `t1`. If `t1 >=
278+
/// t2` then evidence of misbehavior is submitted to A.
279+
///
280+
/// 3 - BFT time violation for existing headers:
281+
/// Ensure that consensus state times are monotonically increasing with
282+
/// height.
258283
fn check_for_misbehaviour(
259284
&self,
260285
ctx: &V,

0 commit comments

Comments
 (0)