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.

138 lines
7.5 KiB

  1. # Proposer-Based Time v2 - Part II
  2. ## Proposal Time
  3. PBTS computes for a proposed value `v` the proposal time `v.time`, with bounded difference to the actual real-time the proposed value was generated.
  4. The proposal time is read from the clock of the process that proposes a value for the first time, its original proposer.
  5. A value that receives `2f + 1 PREVOTES` in a round of consensus may be re-proposed in a subsequent round.
  6. A value that is re-proposed **retains its original proposal time**, assigned by its original proposer.
  7. In other words, once assigned, the proposal time of a value is definitive.
  8. In the [first version][v1] of this specification, proposals were defined as pairs `(v, time)`.
  9. In addition, the same value could be proposed, in different rounds, associated to distinct times.
  10. Since this possibility does not exist in this second specification, the proposal time became part of the proposed value.
  11. With this simplification, several small changes to the [arXiv][arXiv] algorithm, replacing `v` by `(v, t)`, are no longer required.
  12. ## Time Monotonicity
  13. Values decided in successive heights of consensus must have increasing times, so:
  14. - Monotonicity: for any process `p` and any two decided heights `h` and `h'`, if `h > h'` then `decision_p[h].time > decision_p[h'].time`.
  15. For ensuring time monotonicity, it is enough to ensure that a value `v` proposed by process `p` at height `h_p` has `v.time > decision_p[h_p-1].time`.
  16. So, if process `p` is the proposer of a round of height `h_p` and reads from its clock a time `now_p <= decision_p[h_p-1]`,
  17. it should postpone the generation of its proposal until `now_p > decision_p[h_p-1]`.
  18. > Although it should be considered, this scenario is unlikely during regular operation,
  19. as from `decision_p[h_p-1].time` and the start of height `h_p`, a complete consensus instance need to terminate.
  20. Notice that monotonicity is not introduced by this proposal, being already ensured by [`bfttime`][bfttime].
  21. In `bfttime`, the `Timestamp` field of every `Precommit` message of height `h_p` sent by a correct process is required to be larger than `decision_p[h_p-1].time`, as one of such `Timestamp` fields becomes the time assigned to a value proposed at height `h_p`.
  22. The time monotonicity of values proposed in heights of consensus is verified by the `valid()` predicate, to which every proposed value is submitted.
  23. A value rejected by the `valid()` implementation is not accepted by any correct process.
  24. ## Timely Proposals
  25. PBTS introduces a new requirement for a process to accept a proposal: the proposal must be `timely`.
  26. It is a temporal requirement, associated to a couple of synchrony (that is, timing) assumptions regarding the behavior of processes and the network.
  27. The evaluation of the `timely` requirement requires comparing the proposal's sending time with the proposal's receiving time.
  28. As these two time values can be read from different clocks, at different processes, we need to assume that processes' clocks are synchronized.
  29. As these two times refer to two distinct events, we need to assume a minimum and a maximum real time interval between the occurrence of the two events.
  30. The two synchronous assumptions adopted to evaluate the `timely` predicate are:
  31. - Synchronized clocks: the values read from clocks of any two correct processes at the same instant of real time differ by at most `PRECISION`;
  32. - Bounded transmission delays: the real time interval between the sending of a proposal at a correct process, and the reception of the proposal at any correct process is upper bounded by `MSGDELAY`.
  33. #### **[PBTS-RECEPTION-STEP.1]**
  34. Let `now_p` be the time, read from the clock of process `p`, at which `p` receives the proposed value `v`.
  35. The proposal is considered `timely` by `p` when:
  36. 1. `now_p >= v.time - PRECISION`
  37. 1. `now_p <= v.time + MSGDELAY + PRECISION`
  38. The first condition derives from the fact that the generation and sending of `v` precedes its reception.
  39. The minimum receiving time `now_p` for `v` be considered `timely` by `p` is derived from the extreme scenario when
  40. the clock of `p` is `PRECISION` *behind* of the clock of the proposer of `v`, and the proposal's transmission delay is `0` (minimum).
  41. The second condition derives from the assumption of an upper bound for the transmission delay of a proposal.
  42. The maximum receiving time `now_p` for `v` be considered `timely` by `p` is derived from the extreme scenario when
  43. the clock of `p` is `PRECISION` *ahead* of the clock of the proposer of `v`, and the proposal's transmission delay is `MSGDELAY` (maximum).
  44. ## Updated Consensus Algorithm
  45. The following changes are proposed for the algorithm in the [arXiv paper][arXiv].
  46. #### New `StartRound`
  47. There are two additions to the `propose` round step when executed by the `proposer` of a round:
  48. 1. to ensure time monotonicity, the proposer does not propose a value until its current local time becomes greater than the previously decided value's time
  49. 1. when the proposer produce a new proposal it sets the proposal's time to its current local time
  50. - no changes are made to the logic when a proposer has a non-nil `validValue`, which retains its original proposal time.
  51. #### **[PBTS-ALG-STARTROUND.1]**
  52. ```go
  53. function StartRound(round) {
  54. round_p ← round
  55. step_p ← propose
  56. if proposer(h_p, round_p) = p {
  57. wait until now_p > decision_p[h_p-1].time // time monotonicity
  58. if validValue_p != nil {
  59. proposal ← validValue_p
  60. } else {
  61. proposal ← getValue()
  62. proposal.time ← now_p // proposal time
  63. }
  64. broadcast ⟨PROPOSAL, h_p, round_p, proposal, validRound_p⟩
  65. } else {
  66. schedule OnTimeoutPropose(h_p,round_p) to be executed after timeoutPropose(round_p)
  67. }
  68. }
  69. ```
  70. #### New Rule Replacing Lines 22 - 27
  71. The rule on line 22 applies to values `v` proposed for the first time, i.e., for proposals not backed by `2f + 1 PREVOTE`s for `v` in a previous round.
  72. The `PROPOSAL` message, in this case, carry `-1` in its `validRound` field.
  73. The new rule for issuing a `PREVOTE` for a proposed value `v` requires the value to be `timely`.
  74. As the `timely` predicate is evaluated in the moment that the value is received,
  75. as part of a `PROPOSAL` message, we require the `PROPOSAL` message to be `timely`.
  76. #### **[PBTS-ALG-UPON-PROP.1]**
  77. ```go
  78. upon timely(⟨PROPOSAL, h_p, round_p, v, −1⟩) from proposer(h_p, round_p) while step_p = propose do {
  79. if valid(v) ∧ (lockedRound_p = −1 ∨ lockedValue_p = v) {
  80. broadcast ⟨PREVOTE, h_p, round_p, id(v)⟩
  81. }
  82. else {
  83. broadcast ⟨PREVOTE, h_p, round_p, nil⟩
  84. }
  85. step_p ← prevote
  86. }
  87. ```
  88. #### Rules at Lines 28 - 33 remain unchanged
  89. The rule on line 28 applies to values `v` proposed again in the current round because its proposer received `2f + 1 PREVOTE`s for `v` in a previous round `vr`.
  90. This means that there was a round `r <= vr` in which `2f + 1` processes accepted `v` for the first time, and so sent `PREVOTE`s for `v`.
  91. Which, in turn, means that these processes executed the line 22 of the algorithm, and therefore judged `v` as a `timely` proposal.
  92. In other words, we don't need to verify whether `v` is a timely proposal because at least `f + 1` processes judged `v` as `timely` in a previous round,
  93. and because, since `v` was re-proposed as a `validValue` (line 16), `v.time` has not being updated from its original proposal.
  94. **All other rules remains unchanged.**
  95. Back to [main document][main].
  96. [arXiv]: https://arxiv.org/abs/1807.04938
  97. [v1]: ./pbts-algorithm_001_draft.md
  98. [main]: ./pbts_001_draft.md
  99. [bfttime]: https://github.com/tendermint/spec/blob/439a5bcacb5ef6ef1118566d7b0cd68fff3553d4/spec/consensus/bft-time.md