You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

571 lines
26 KiB

  1. # Core Verification
  2. ## Problem statement
  3. We assume that the light client knows a (base) header `inithead` it trusts (by social consensus or because
  4. the light client has decided to trust the header before). The goal is to check whether another header
  5. `newhead` can be trusted based on the data in `inithead`.
  6. The correctness of the protocol is based on the assumption that `inithead` was generated by an instance of
  7. Tendermint consensus.
  8. ### Failure Model
  9. For the purpose of the following definitions we assume that there exists a function
  10. `validators` that returns the corresponding validator set for the given hash.
  11. The light client protocol is defined with respect to the following failure model:
  12. Given a known bound `TRUSTED_PERIOD`, and a block `b` with header `h` generated at time `Time`
  13. (i.e. `h.Time = Time`), a set of validators that hold more than 2/3 of the voting power
  14. in `validators(b.Header.NextValidatorsHash)` is correct until time `b.Header.Time + TRUSTED_PERIOD`.
  15. *Assumption*: "correct" is defined w.r.t. realtime (some Newtonian global notion of time, i.e., wall time),
  16. while `Header.Time` corresponds to the [BFT time](../consensus/bft-time.md). In this note, we assume that clocks of correct processes
  17. are synchronized (for example using NTP), and therefore there is bounded clock drift (`CLOCK_DRIFT`) between local clocks and
  18. BFT time. More precisely, for every correct light client process and every `header.Time` (i.e. BFT Time, for a header correctly
  19. generated by the Tendermint consensus), the following inequality holds: `Header.Time < now + CLOCK_DRIFT`,
  20. where `now` corresponds to the system clock at the light client process.
  21. Furthermore, we assume that `TRUSTED_PERIOD` is (several) order of magnitude bigger than `CLOCK_DRIFT` (`TRUSTED_PERIOD >> CLOCK_DRIFT`),
  22. as `CLOCK_DRIFT` (using NTP) is in the order of milliseconds and `TRUSTED_PERIOD` is in the order of weeks.
  23. We expect a light client process defined in this document to be used in the context in which there is some
  24. larger period during which misbehaving validators can be detected and punished (we normally refer to it as `UNBONDING_PERIOD`
  25. due to the "bonding" mechanism in modern proof of stake systems). Furthermore, we assume that
  26. `TRUSTED_PERIOD < UNBONDING_PERIOD` and that they are normally of the same order of magnitude, for example
  27. `TRUSTED_PERIOD = UNBONDING_PERIOD / 2`.
  28. The specification in this document considers an implementation of the light client under the Failure Model defined above.
  29. Mechanisms like `fork accountability` and `evidence submission` are defined in the context of `UNBONDING_PERIOD` and
  30. they incentivize validators to follow the protocol specification defined in this document. If they don't,
  31. and we have 1/3 (or more) faulty validators, safety may be violated. Our approach then is
  32. to *detect* these cases (after the fact), and take suitable repair actions (automatic and social).
  33. This is discussed in document on [Fork accountability](./accountability.md).
  34. The term "trusted" above indicates that the correctness of the protocol depends on
  35. this assumption. It is in the responsibility of the user that runs the light client to make sure that the risk
  36. of trusting a corrupted/forged `inithead` is negligible.
  37. *Remark*: This failure model might change to a hybrid version that takes heights into account in the future.
  38. ### High Level Solution
  39. Upon initialization, the light client is given a header `inithead` it trusts (by
  40. social consensus). When a light clients sees a new signed header `snh`, it has to decide whether to trust the new
  41. header. Trust can be obtained by (possibly) the combination of three methods.
  42. 1. **Uninterrupted sequence of headers.** Given a trusted header `h` and an untrusted header `h1`,
  43. the light client trusts a header `h1` if it trusts all headers in between `h` and `h1`.
  44. 2. **Trusted period.** Given a trusted header `h`, an untrusted header `h1 > h` and `TRUSTED_PERIOD` during which
  45. the failure model holds, we can check whether at least one validator, that has been continuously correct
  46. from `h.Time` until now, has signed `h1`. If this is the case, we can trust `h1`.
  47. 3. **Bisection.** If a check according to 2. (trusted period) fails, the light client can try to
  48. obtain a header `hp` whose height lies between `h` and `h1` in order to check whether `h` can be used to
  49. get trust for `hp`, and `hp` can be used to get trust for `snh`. If this is the case we can trust `h1`;
  50. if not, we continue recursively until either we found set of headers that can build (transitively) trust relation
  51. between `h` and `h1`, or we failed as two consecutive headers don't verify against each other.
  52. ## Definitions
  53. ### Data structures
  54. In the following, only the details of the data structures needed for this specification are given.
  55. ```go
  56. type Header struct {
  57. Height int64
  58. Time Time // the chain time when the header (block) was generated
  59. LastBlockID BlockID // prev block info
  60. ValidatorsHash []byte // hash of the validators for the current block
  61. NextValidatorsHash []byte // hash of the validators for the next block
  62. }
  63. type SignedHeader struct {
  64. Header Header
  65. Commit Commit // commit for the given header
  66. }
  67. type ValidatorSet struct {
  68. Validators []Validator
  69. TotalVotingPower int64
  70. }
  71. type Validator struct {
  72. Address Address // validator address (we assume validator's addresses are unique)
  73. VotingPower int64 // validator's voting power
  74. }
  75. type TrustedState {
  76. SignedHeader SignedHeader
  77. ValidatorSet ValidatorSet
  78. }
  79. ```
  80. ### Functions
  81. For the purpose of this light client specification, we assume that the Tendermint Full Node
  82. exposes the following functions over Tendermint RPC:
  83. ```go
  84. // returns signed header: Header with Commit, for the given height
  85. func Commit(height int64) (SignedHeader, error)
  86. // returns validator set for the given height
  87. func Validators(height int64) (ValidatorSet, error)
  88. ```
  89. Furthermore, we assume the following auxiliary functions:
  90. ```go
  91. // returns true if the commit is for the header, ie. if it contains
  92. // the correct hash of the header; otherwise false
  93. func matchingCommit(header Header, commit Commit) bool
  94. // returns the set of validators from the given validator set that
  95. // committed the block (that correctly signed the block)
  96. // it assumes signature verification so it can be computationally expensive
  97. func signers(commit Commit, validatorSet ValidatorSet) []Validator
  98. // returns the voting power the validators in v1 have according to their voting power in set v2
  99. // it does not assume signature verification
  100. func votingPowerIn(v1 []Validator, v2 ValidatorSet) int64
  101. // returns hash of the given validator set
  102. func hash(v2 ValidatorSet) []byte
  103. ```
  104. In the functions below we will be using `trustThreshold` as a parameter. For simplicity
  105. we assume that `trustThreshold` is a float between `1/3` and `2/3` and we will not be checking it
  106. in the pseudo-code.
  107. **VerifySingle.** The function `VerifySingle` attempts to validate given untrusted header and the corresponding validator sets
  108. based on a given trusted state. It ensures that the trusted state is still within its trusted period,
  109. and that the untrusted header is within assumed `clockDrift` bound of the passed time `now`.
  110. Note that this function is not making external (RPC) calls to the full node; the whole logic is
  111. based on the local (given) state. This function is supposed to be used by the IBC handlers.
  112. ```go
  113. func VerifySingle(untrustedSh SignedHeader,
  114. untrustedVs ValidatorSet,
  115. untrustedNextVs ValidatorSet,
  116. trustedState TrustedState,
  117. trustThreshold float,
  118. trustingPeriod Duration,
  119. clockDrift Duration,
  120. now Time) (TrustedState, error) {
  121. if untrustedSh.Header.Time > now + clockDrift {
  122. return (trustedState, ErrInvalidHeaderTime)
  123. }
  124. trustedHeader = trustedState.SignedHeader.Header
  125. if !isWithinTrustedPeriod(trustedHeader, trustingPeriod, now) {
  126. return (state, ErrHeaderNotWithinTrustedPeriod)
  127. }
  128. // we assume that time it takes to execute verifySingle function
  129. // is several order of magnitudes smaller than trustingPeriod
  130. error = verifySingle(
  131. trustedState,
  132. untrustedSh,
  133. untrustedVs,
  134. untrustedNextVs,
  135. trustThreshold)
  136. if error != nil return (state, error)
  137. // the untrusted header is now trusted
  138. newTrustedState = TrustedState(untrustedSh, untrustedNextVs)
  139. return (newTrustedState, nil)
  140. }
  141. // return true if header is within its light client trusted period; otherwise returns false
  142. func isWithinTrustedPeriod(header Header,
  143. trustingPeriod Duration,
  144. now Time) bool {
  145. return header.Time + trustedPeriod > now
  146. }
  147. ```
  148. Note that in case `VerifySingle` returns without an error (untrusted header
  149. is successfully verified) then we have a guarantee that the transition of the trust
  150. from `trustedState` to `newTrustedState` happened during the trusted period of
  151. `trustedState.SignedHeader.Header`.
  152. TODO: Explain what happens in case `VerifySingle` returns with an error.
  153. **verifySingle.** The function `verifySingle` verifies a single untrusted header
  154. against a given trusted state. It includes all validations and signature verification.
  155. It is not publicly exposed since it does not check for header expiry (time constraints)
  156. and hence it's possible to use it incorrectly.
  157. ```go
  158. func verifySingle(trustedState TrustedState,
  159. untrustedSh SignedHeader,
  160. untrustedVs ValidatorSet,
  161. untrustedNextVs ValidatorSet,
  162. trustThreshold float) error {
  163. untrustedHeader = untrustedSh.Header
  164. untrustedCommit = untrustedSh.Commit
  165. trustedHeader = trustedState.SignedHeader.Header
  166. trustedVs = trustedState.ValidatorSet
  167. if trustedHeader.Height >= untrustedHeader.Height return ErrNonIncreasingHeight
  168. if trustedHeader.Time >= untrustedHeader.Time return ErrNonIncreasingTime
  169. // validate the untrusted header against its commit, vals, and next_vals
  170. error = validateSignedHeaderAndVals(untrustedSh, untrustedVs, untrustedNextVs)
  171. if error != nil return error
  172. // check for adjacent headers
  173. if untrustedHeader.Height == trustedHeader.Height + 1 {
  174. if trustedHeader.NextValidatorsHash != untrustedHeader.ValidatorsHash {
  175. return ErrInvalidAdjacentHeaders
  176. }
  177. } else {
  178. error = verifyCommitTrusting(trustedVs, untrustedCommit, untrustedVs, trustThreshold)
  179. if error != nil return error
  180. }
  181. // verify the untrusted commit
  182. return verifyCommitFull(untrustedVs, untrustedCommit)
  183. }
  184. // returns nil if header and validator sets are consistent; otherwise returns error
  185. func validateSignedHeaderAndVals(signedHeader SignedHeader, vs ValidatorSet, nextVs ValidatorSet) error {
  186. header = signedHeader.Header
  187. if hash(vs) != header.ValidatorsHash return ErrInvalidValidatorSet
  188. if hash(nextVs) != header.NextValidatorsHash return ErrInvalidNextValidatorSet
  189. if !matchingCommit(header, signedHeader.Commit) return ErrInvalidCommitValue
  190. return nil
  191. }
  192. // returns nil if at least single correst signer signed the commit; otherwise returns error
  193. func verifyCommitTrusting(trustedVs ValidatorSet,
  194. commit Commit,
  195. untrustedVs ValidatorSet,
  196. trustLevel float) error {
  197. totalPower := trustedVs.TotalVotingPower
  198. signedPower := votingPowerIn(signers(commit, untrustedVs), trustedVs)
  199. // check that the signers account for more than max(1/3, trustLevel) of the voting power
  200. // this ensures that there is at least single correct validator in the set of signers
  201. if signedPower < max(1/3, trustLevel) * totalPower return ErrInsufficientVotingPower
  202. return nil
  203. }
  204. // returns nil if commit is signed by more than 2/3 of voting power of the given validator set
  205. // return error otherwise
  206. func verifyCommitFull(vs ValidatorSet, commit Commit) error {
  207. totalPower := vs.TotalVotingPower;
  208. signedPower := votingPowerIn(signers(commit, vs), vs)
  209. // check the signers account for +2/3 of the voting power
  210. if signedPower * 3 <= totalPower * 2 return ErrInvalidCommit
  211. return nil
  212. }
  213. ```
  214. **VerifyHeaderAtHeight.** The function `VerifyHeaderAtHeight` captures high level
  215. logic, i.e., application call to the light client module to download and verify header
  216. for some height.
  217. ```go
  218. func VerifyHeaderAtHeight(untrustedHeight int64,
  219. trustedState TrustedState,
  220. trustThreshold float,
  221. trustingPeriod Duration,
  222. clockDrift Duration) (TrustedState, error)) {
  223. trustedHeader := trustedState.SignedHeader.Header
  224. now := System.Time()
  225. if !isWithinTrustedPeriod(trustedHeader, trustingPeriod, now) {
  226. return (trustedState, ErrHeaderNotWithinTrustedPeriod)
  227. }
  228. newTrustedState, err := VerifyBisection(untrustedHeight,
  229. trustedState,
  230. trustThreshold,
  231. trustingPeriod,
  232. clockDrift,
  233. now)
  234. if err != nil return (trustedState, err)
  235. now = System.Time()
  236. if !isWithinTrustedPeriod(trustedHeader, trustingPeriod, now) {
  237. return (trustedState, ErrHeaderNotWithinTrustedPeriod)
  238. }
  239. return (newTrustedState, err)
  240. }
  241. ```
  242. Note that in case `VerifyHeaderAtHeight` returns without an error (untrusted header
  243. is successfully verified) then we have a guarantee that the transition of the trust
  244. from `trustedState` to `newTrustedState` happened during the trusted period of
  245. `trustedState.SignedHeader.Header`.
  246. In case `VerifyHeaderAtHeight` returns with an error, then either (i) the full node we are talking to is faulty
  247. or (ii) the trusted header has expired (it is outside its trusted period). In case (i) the full node is faulty so
  248. light client should disconnect and reinitialise with new peer. In the case (ii) as the trusted header has expired,
  249. we need to reinitialise light client with a new trusted header (that is within its trusted period),
  250. but we don't necessarily need to disconnect from the full node we are talking to (as we haven't observed full node misbehavior in this case).
  251. **VerifyBisection.** The function `VerifyBisection` implements
  252. recursive logic for checking if it is possible building trust
  253. relationship between `trustedState` and untrusted header at the given height over
  254. finite set of (downloaded and verified) headers.
  255. ```go
  256. func VerifyBisection(untrustedHeight int64,
  257. trustedState TrustedState,
  258. trustThreshold float,
  259. trustingPeriod Duration,
  260. clockDrift Duration,
  261. now Time) (TrustedState, error) {
  262. untrustedSh, error := Commit(untrustedHeight)
  263. if error != nil return (trustedState, ErrRequestFailed)
  264. untrustedHeader = untrustedSh.Header
  265. // note that we pass now during the recursive calls. This is fine as
  266. // all other untrusted headers we download during recursion will be
  267. // for a smaller heights, and therefore should happen before.
  268. if untrustedHeader.Time > now + clockDrift {
  269. return (trustedState, ErrInvalidHeaderTime)
  270. }
  271. untrustedVs, error := Validators(untrustedHeight)
  272. if error != nil return (trustedState, ErrRequestFailed)
  273. untrustedNextVs, error := Validators(untrustedHeight + 1)
  274. if error != nil return (trustedState, ErrRequestFailed)
  275. error = verifySingle(
  276. trustedState,
  277. untrustedSh,
  278. untrustedVs,
  279. untrustedNextVs,
  280. trustThreshold)
  281. if fatalError(error) return (trustedState, error)
  282. if error == nil {
  283. // the untrusted header is now trusted.
  284. newTrustedState = TrustedState(untrustedSh, untrustedNextVs)
  285. return (newTrustedState, nil)
  286. }
  287. // at this point in time we need to do bisection
  288. pivotHeight := ceil((trustedHeader.Height + untrustedHeight) / 2)
  289. error, newTrustedState = VerifyBisection(pivotHeight,
  290. trustedState,
  291. trustThreshold,
  292. trustingPeriod,
  293. clockDrift,
  294. now)
  295. if error != nil return (newTrustedState, error)
  296. return VerifyBisection(untrustedHeight,
  297. newTrustedState,
  298. trustThreshold,
  299. trustingPeriod,
  300. clockDrift,
  301. now)
  302. }
  303. func fatalError(err) bool {
  304. return err == ErrHeaderNotWithinTrustedPeriod OR
  305. err == ErrInvalidAdjacentHeaders OR
  306. err == ErrNonIncreasingHeight OR
  307. err == ErrNonIncreasingTime OR
  308. err == ErrInvalidValidatorSet OR
  309. err == ErrInvalidNextValidatorSet OR
  310. err == ErrInvalidCommitValue OR
  311. err == ErrInvalidCommit
  312. }
  313. ```
  314. ### The case `untrustedHeader.Height < trustedHeader.Height`
  315. In the use case where someone tells the light client that application data that is relevant for it
  316. can be read in the block of height `k` and the light client trusts a more recent header, we can use the
  317. hashes to verify headers "down the chain." That is, we iterate down the heights and check the hashes in each step.
  318. *Remark.* For the case were the light client trusts two headers `i` and `j` with `i < k < j`, we should
  319. discuss/experiment whether the forward or the backward method is more effective.
  320. ```go
  321. func VerifyHeaderBackwards(trustedHeader Header,
  322. untrustedHeader Header,
  323. trustingPeriod Duration,
  324. clockDrift Duration) error {
  325. if untrustedHeader.Height >= trustedHeader.Height return ErrErrNonDecreasingHeight
  326. if untrustedHeader.Time >= trustedHeader.Time return ErrNonDecreasingTime
  327. now := System.Time()
  328. if !isWithinTrustedPeriod(trustedHeader, trustingPeriod, now) {
  329. return ErrHeaderNotWithinTrustedPeriod
  330. }
  331. old := trustedHeader
  332. for i := trustedHeader.Height - 1; i > untrustedHeader.Height; i-- {
  333. untrustedSh, error := Commit(i)
  334. if error != nil return ErrRequestFailed
  335. if (hash(untrustedSh.Header) != old.LastBlockID.Hash) {
  336. return ErrInvalidAdjacentHeaders
  337. }
  338. old := untrustedSh.Header
  339. }
  340. if hash(untrustedHeader) != old.LastBlockID.Hash {
  341. return ErrInvalidAdjacentHeaders
  342. }
  343. now := System.Time()
  344. if !isWithinTrustedPeriod(trustedHeader, trustingPeriod, now) {
  345. return ErrHeaderNotWithinTrustedPeriod
  346. }
  347. return nil
  348. }
  349. ```
  350. *Assumption*: In the following, we assume that *untrusted_h.Header.height > trusted_h.Header.height*. We will quickly discuss the other case in the next section.
  351. We consider the following set-up:
  352. - the light client communicates with one full node
  353. - the light client locally stores all the headers that has passed basic verification and that are within light client trust period. In the pseudo code below we
  354. write *Store.Add(header)* for this. If a header failed to verify, then
  355. the full node we are talking to is faulty and we should disconnect from it and reinitialise with new peer.
  356. - If `CanTrust` returns *error*, then the light client has seen a forged header or the trusted header has expired (it is outside its trusted period).
  357. - In case of forged header, the full node is faulty so light client should disconnect and reinitialise with new peer. If the trusted header has expired,
  358. we need to reinitialise light client with new trusted header (that is within its trusted period), but we don't necessarily need to disconnect from the full node
  359. we are talking to (as we haven't observed full node misbehavior in this case).
  360. ## Correctness of the Light Client Protocols
  361. ### Definitions
  362. - `TRUSTED_PERIOD`: trusted period
  363. - for realtime `t`, the predicate `correct(v,t)` is true if the validator `v`
  364. follows the protocol until time `t` (we will see about recovery later).
  365. - Validator fields. We will write a validator as a tuple `(v,p)` such that
  366. - `v` is the identifier (i.e., validator address; we assume identifiers are unique in each validator set)
  367. - `p` is its voting power
  368. - For each header `h`, we write `trust(h) = true` if the light client trusts `h`.
  369. ### Failure Model
  370. If a block `b` with a header `h` is generated at time `Time` (i.e. `h.Time = Time`), then a set of validators that
  371. hold more than `2/3` of the voting power in `validators(h.NextValidatorsHash)` is correct until time
  372. `h.Time + TRUSTED_PERIOD`.
  373. Formally,
  374. \[
  375. \sum_{(v,p) \in validators(h.NextValidatorsHash) \wedge correct(v,h.Time + TRUSTED_PERIOD)} p >
  376. 2/3 \sum_{(v,p) \in validators(h.NextValidatorsHash)} p
  377. \]
  378. The light client communicates with a full node and learns new headers. The goal is to locally decide whether to trust a header. Our implementation needs to ensure the following two properties:
  379. - *Light Client Completeness*: If a header `h` was correctly generated by an instance of Tendermint consensus (and its age is less than the trusted period),
  380. then the light client should eventually set `trust(h)` to `true`.
  381. - *Light Client Accuracy*: If a header `h` was *not generated* by an instance of Tendermint consensus, then the light client should never set `trust(h)` to true.
  382. *Remark*: If in the course of the computation, the light client obtains certainty that some headers were forged by adversaries
  383. (that is were not generated by an instance of Tendermint consensus), it may submit (a subset of) the headers it has seen as evidence of misbehavior.
  384. *Remark*: In Completeness we use "eventually", while in practice `trust(h)` should be set to true before `h.Time + TRUSTED_PERIOD`. If not, the header
  385. cannot be trusted because it is too old.
  386. *Remark*: If a header `h` is marked with `trust(h)`, but it is too old at some point in time we denote with `now` (`h.Time + TRUSTED_PERIOD < now`),
  387. then the light client should set `trust(h)` to `false` again at time `now`.
  388. *Assumption*: Initially, the light client has a header `inithead` that it trusts, that is, `inithead` was correctly generated by the Tendermint consensus.
  389. To reason about the correctness, we may prove the following invariant.
  390. *Verification Condition: light Client Invariant.*
  391. For each light client `l` and each header `h`:
  392. if `l` has set `trust(h) = true`,
  393. then validators that are correct until time `h.Time + TRUSTED_PERIOD` have more than two thirds of the voting power in `validators(h.NextValidatorsHash)`.
  394. Formally,
  395. \[
  396. \sum_{(v,p) \in validators(h.NextValidatorsHash) \wedge correct(v,h.Time + TRUSTED_PERIOD)} p >
  397. 2/3 \sum_{(v,p) \in validators(h.NextValidatorsHash)} p
  398. \]
  399. *Remark.* To prove the invariant, we will have to prove that the light client only trusts headers that were correctly generated by Tendermint consensus.
  400. Then the formula above follows from the failure model.
  401. ## Details
  402. **Observation 1.** If `h.Time + TRUSTED_PERIOD > now`, we trust the validator set `validators(h.NextValidatorsHash)`.
  403. When we say we trust `validators(h.NextValidatorsHash)` we do `not` trust that each individual validator in `validators(h.NextValidatorsHash)`
  404. is correct, but we only trust the fact that less than `1/3` of them are faulty (more precisely, the faulty ones have less than `1/3` of the total voting power).
  405. *`VerifySingle` correctness arguments*
  406. Light Client Accuracy:
  407. - Assume by contradiction that `untrustedHeader` was not generated correctly and the light client sets trust to true because `verifySingle` returns without error.
  408. - `trustedState` is trusted and sufficiently new
  409. - by the Failure Model, less than `1/3` of the voting power held by faulty validators => at least one correct validator `v` has signed `untrustedHeader`.
  410. - as `v` is correct up to now, it followed the Tendermint consensus protocol at least up to signing `untrustedHeader` => `untrustedHeader` was correctly generated.
  411. We arrive at the required contradiction.
  412. Light Client Completeness:
  413. - The check is successful if sufficiently many validators of `trustedState` are still validators in the height `untrustedHeader.Height` and signed `untrustedHeader`.
  414. - If `untrustedHeader.Height = trustedHeader.Height + 1`, and both headers were generated correctly, the test passes.
  415. *Verification Condition:* We may need a Tendermint invariant stating that if `untrustedSignedHeader.Header.Height = trustedHeader.Height + 1` then
  416. `signers(untrustedSignedHeader.Commit) \subseteq validators(trustedHeader.NextValidatorsHash)`.
  417. *Remark*: The variable `trustThreshold` can be used if the user believes that relying on one correct validator is not sufficient.
  418. However, in case of (frequent) changes in the validator set, the higher the `trustThreshold` is chosen, the more unlikely it becomes that
  419. `verifySingle` returns with an error for non-adjacent headers.
  420. - `VerifyBisection` correctness arguments (sketch)*
  421. Light Client Accuracy:
  422. - Assume by contradiction that the header at `untrustedHeight` obtained from the full node was not generated correctly and
  423. the light client sets trust to true because `VerifyBisection` returns without an error.
  424. - `VerifyBisection` returns without error only if all calls to `verifySingle` in the recursion return without error (return `nil`).
  425. - Thus we have a sequence of headers that all satisfied the `verifySingle`
  426. - again a contradiction
  427. light Client Completeness:
  428. This is only ensured if upon `Commit(pivot)` the light client is always provided with a correctly generated header.
  429. *Stalling*
  430. With `VerifyBisection`, a faulty full node could stall a light client by creating a long sequence of headers that are queried one-by-one by the light client and look OK,
  431. before the light client eventually detects a problem. There are several ways to address this:
  432. - Each call to `Commit` could be issued to a different full node
  433. - Instead of querying header by header, the light client tells a full node which header it trusts, and the height of the header it needs. The full node responds with
  434. the header along with a proof consisting of intermediate headers that the light client can use to verify. Roughly, `VerifyBisection` would then be executed at the full node.
  435. - We may set a timeout how long `VerifyBisection` may take.