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.

38 lines
1.9 KiB

5 years ago
5 years ago
  1. /*
  2. Package evidence handles all evidence storage and gossiping from detection to block proposal.
  3. For the different types of evidence refer to the `evidence.go` file in the types package
  4. or https://github.com/tendermint/spec/blob/master/spec/consensus/light-client/accountability.md.
  5. Gossiping
  6. The core functionality begins with the evidence reactor (see reactor.
  7. go) which operates both the sending and receiving of evidence.
  8. The `Receive` function takes a list of evidence and does the following:
  9. 1. Breaks it down into individual evidence if it is `Composite Evidence`
  10. (see types/evidence.go#ConflictingHeadersEvidence)
  11. 2. Checks that it does not already have the evidence stored
  12. 3. Verifies the evidence against the node's state (see state/validation.go#VerifyEvidence)
  13. 4. Stores the evidence to a db and a concurrent list
  14. The gossiping of evidence is initiated when a peer is added which starts a go routine to broadcast currently
  15. uncommitted evidence at intervals of 60 seconds (set by the by broadcastEvidenceIntervalS).
  16. It uses a concurrent list to store the evidence and before sending verifies that each evidence is still valid in the
  17. sense that it has not exceeded the max evidence age and height (see types/params.go#EvidenceParams).
  18. Proposing
  19. When a new block is being proposed (in state/execution.go#CreateProposalBlock),
  20. `PendingEvidence(maxNum)` is called to send up to the maxNum number of uncommitted evidence, from the evidence store,
  21. based on a priority that is a product of the age of the evidence and the voting power of the malicious validator.
  22. Once the proposed evidence is submitted,
  23. the evidence is marked as committed and is moved from the broadcasted set to the committed set (
  24. the committed set is used to verify whether new evidence has actually already been submitted).
  25. As a result it is also removed from the concurrent list so that it is no longer gossiped.
  26. */
  27. package evidence