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.

94 lines
4.5 KiB

  1. --- order: 3 ---
  2. # PBTS
  3. This document provides an overview of the Proposer-Based Timestamp (PBTS)
  4. algorithm added to Tendermint in the v0.36 release. It outlines the core
  5. functionality as well as the parameters and constraints of the this algorithm.
  6. ## Algorithm Overview
  7. The PBTS algorithm defines a way for a Tendermint blockchain to create block
  8. timestamps that are within a reasonable bound of the clocks of the validators on
  9. the network. This replaces the original BFTTime algorithm for timestamp
  10. assignment that relied on the timestamps included in precommit messages.
  11. ## Algorithm Parameters
  12. The functionality of the PBTS algorithm is governed by two parameters within
  13. Tendermint. These two parameters are [consensus
  14. parameters](https://github.com/tendermint/tendermint/blob/master/spec/abci/apps.md#L291),
  15. meaning they are configured by the ABCI application and are expected to be the
  16. same across all nodes on the network.
  17. ### `Precision`
  18. The `Precision` parameter configures the acceptable upper-bound of clock drift
  19. among all of the nodes on a Tendermint network. Any two nodes on a Tendermint
  20. network are expected to have clocks that differ by at most `Precision`
  21. milliseconds any given instant.
  22. ### `MessageDelay`
  23. The `MessageDelay` parameter configures the acceptable upper-bound for
  24. transmitting a `Proposal` message from the proposer to _all_ of the validators
  25. on the network.
  26. Networks should choose as small a value for `MessageDelay` as is practical,
  27. provided it is large enough that messages can reach all participants with high
  28. probability given the number of participants and latency of their connections.
  29. ## Algorithm Concepts
  30. ### Block timestamps
  31. Each block produced by the Tendermint consensus engine contains a timestamp.
  32. The timestamp produced in each block is a meaningful representation of time that is
  33. useful for the protocols and applications built on top of Tendermint.
  34. The following protocols and application features require a reliable source of time:
  35. * Tendermint Light Clients [rely on correspondence between their known time](https://github.com/tendermint/tendermint/blob/master/spec/light-client/verification/README.md#definitions-1) and the block time for block verification.
  36. * Tendermint Evidence validity is determined [either in terms of heights or in terms of time](https://github.com/tendermint/tendermint/blob/master/spec/consensus/evidence.md#verification).
  37. * Unbonding of staked assets in the Cosmos Hub [occurs after a period of 21
  38. days](https://github.com/cosmos/governance/blob/master/params-change/Staking.md#unbondingtime).
  39. * IBC packets can use either a [timestamp or a height to timeout packet
  40. delivery](https://docs.cosmos.network/v0.44/ibc/overview.html#acknowledgements)
  41. ### Proposer Selects a Block Timestamp
  42. When the proposer node creates a new block proposal, the node reads the time
  43. from its local clock and uses this reading as the timestamp for the proposed
  44. block.
  45. ### Timeliness
  46. When each validator on a Tendermint network receives a proposed block, it
  47. performs a series of checks to ensure that the block can be considered valid as
  48. a candidate to be the next block in the chain.
  49. The PBTS algorithm performs a validity check on the timestamp of proposed
  50. blocks. When a validator receives a proposal it ensures that the timestamp in
  51. the proposal is within a bound of the validator's local clock. Specifically, the
  52. algorithm checks that the timestamp is no more than `Precision` greater than the
  53. node's local clock and no less than `Precision` + `MessageDelay` behind than the
  54. node's local clock. This creates range of acceptable timestamps around the
  55. node's local time. If the timestamp is within this range, the PBTS algorithm
  56. considers the block **timely**. If a block is not **timely**, the node will
  57. issue a `nil` `prevote` for this block, signaling to the rest of the network
  58. that the node does not consider the block to be valid.
  59. ### Clock Synchronization
  60. The PBTS algorithm requires the clocks of the validators on a Tendermint network
  61. are within `Precision` of each other. In practice, this means that validators
  62. should periodically synchronize to a reliable NTP server. Validators that drift
  63. too far away from the rest of the network will no longer propose blocks with
  64. valid timestamps. Additionally they will not view the timestamps of blocks
  65. proposed by their peers to be valid either.
  66. ## See Also
  67. * [The PBTS specification](https://github.com/tendermint/tendermint/blob/master/spec/consensus/proposer-based-timestamp/README.md)
  68. contains all of the details of the algorithm.