github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/spec/consensus/proposer-based-timestamp/pbts-sysmodel_002_draft.md (about)

     1  # PBTS: System Model and Properties
     2  
     3  ## Outline
     4  
     5   - [System model](#system-model)
     6     - [Synchronized clocks](#synchronized-clocks)
     7     - [Message delays](#message-delays)
     8   - [Problem Statement](#problem-statement)
     9   - [Protocol Analysis - Timely Proposals](#protocol-analysis---timely-proposals)
    10      - [Timely Proof-of-Locks](#timely-proof-of-locks)
    11      - [Derived Proof-of-Locks](#derived-proof-of-locks)
    12   - [Temporal Analysis](#temporal-analysis)
    13      - [Safety](#safety)
    14      - [Liveness](#liveness)
    15  
    16  ## System Model
    17  
    18  #### **[PBTS-CLOCK-NEWTON.0]**
    19  
    20  There is a reference Newtonian real-time `t`.
    21  
    22  No process has direct access to this reference time, used only for specification purposes.
    23  The reference real-time is assumed to be aligned with the Coordinated Universal Time (UTC).
    24  
    25  ### Synchronized clocks
    26  
    27  Processes are assumed to be equipped with synchronized clocks,
    28  aligned with the Coordinated Universal Time (UTC).
    29  
    30  This requires processes to periodically synchronize their local clocks with an
    31  external and trusted source of the time (e.g. NTP servers).
    32  Each synchronization cycle aligns the process local clock with the external
    33  source of time, making it a *fairly accurate* source of real time.
    34  The periodic (re)synchronization aims to correct the *drift* of local clocks,
    35  which tend to pace slightly faster or slower than the real time.
    36  
    37  To avoid an excessive level detail in the parameters and guarantees of
    38  synchronized clocks, we adopt a single system parameter `PRECISION` to
    39  encapsulate the potential inaccuracy of the synchronization mechanisms,
    40  and drifts of local clocks from real time.
    41  
    42  #### **[PBTS-CLOCK-PRECISION.0]**
    43  
    44  There exists a system parameter `PRECISION`, such that
    45  for any two processes `p` and `q`, with local clocks `C_p` and `C_q`:
    46  
    47  - If `p` and `q` are equipped with synchronized clocks,
    48   then for any real-time `t` we have `|C_p(t) - C_q(t)| <= PRECISION`.
    49  
    50  `PRECISION` thus bounds the difference on the times simultaneously read by processes
    51  from their local clocks, so that their clocks can be considered synchronized.
    52  
    53  #### Accuracy
    54  
    55  A second relevant clock parameter is accuracy, which binds the values read by
    56  processes from their clocks to real time.
    57  
    58  ##### **[PBTS-CLOCK-ACCURACY.0]**
    59  
    60  For the sake of completeness, we define a parameter `ACCURACY` such that:
    61  
    62  - At real time `t` there is at least one correct process `p` which clock marks
    63    `C_p(t)` with `|C_p(t) - t| <= ACCURACY`.
    64  
    65  As a consequence, applying the definition of `PRECISION`, we have:
    66  
    67  - At real time `t` the synchronized clock of any correct process `p` marks
    68    `C_p(t)` with `|C_p(t) - t| <= ACCURACY + PRECISION`.
    69  
    70  The reason for not adopting `ACCURACY` as a system parameter is the assumption
    71  that `PRECISION >> ACCURACY`.
    72  This allows us to consider, for practical purposes, that the `PRECISION` system
    73  parameter embodies the `ACCURACY` model parameter.
    74  
    75  ### Message Delays
    76  
    77  The assumption that processes have access to synchronized clocks ensures that proposal times
    78  assigned by *correct processes* have a bounded relation with the real time.
    79  It is not enough, however, to identify (and reject) proposal times proposed by Byzantine processes.
    80  
    81  To properly evaluate whether the time assigned to a proposal is consistent with the real time,
    82  we need some information regarding the time it takes for a message carrying a proposal
    83  to reach all its (correct) destinations.
    84  More precisely, the *maximum delay* for delivering a proposal to its destinations allows
    85  defining a lower bound, a *minimum time* that a correct process assigns to proposal.
    86  While *minimum delay* for delivering a proposal to a destination allows defining
    87  an upper bound, the *maximum time* assigned to a proposal.
    88  
    89  #### **[PBTS-MSG-DELAY.0]**
    90  
    91  There exists a system parameter `MSGDELAY` for end-to-end delays of proposal messages,
    92  such for any two correct processes `p` and `q`:
    93  
    94  - If `p` sends a proposal message `m` at real time `t` and `q` receives `m` at
    95    real time `t'`, then `t <= t' <= t + MSGDELAY`.
    96  
    97  Notice that, as a system parameter, `MSGDELAY` should be observed for any
    98  proposal message broadcast by correct processes: it is a *worst-case* parameter.
    99  As message delays depends on the message size, the above requirement implicitly
   100  indicates that the size of proposal messages is either fixed or upper bounded.
   101  
   102  ## Problem Statement
   103  
   104  In this section we define the properties of Tendermint consensus
   105  (cf. the [arXiv paper][arXiv]) in this system model.
   106  
   107  ### **[PBTS-PROPOSE.0]**
   108  
   109  A proposer proposes a consensus value `v` that includes a proposal time
   110  `v.time`.
   111  
   112  > We then restrict the allowed decisions along the following lines:
   113  
   114  #### **[PBTS-INV-AGREEMENT.0]**
   115  
   116  - [Agreement] No two correct processes decide on different values `v`.
   117  
   118  This implies that no two correct processes decide on different proposal times
   119  `v.time`.
   120  
   121  #### **[PBTS-INV-VALID.0]**
   122  
   123  - [Validity] If a correct process decides on value `v`, then `v` satisfies a
   124    predefined `valid` predicate.
   125  
   126  With respect to PBTS, the `valid` predicate requires proposal times to be
   127  [monotonic](./pbts-algorithm_002_draft.md#time-monotonicity) over heights of
   128  consensus:
   129  
   130  ##### **[PBTS-INV-MONOTONICITY.0]**
   131  
   132  - If a correct process decides on value `v` at the height `h` of consensus,
   133    thus setting `decision[h] = v`, then `v.time > decision[h'].time` for all
   134    previous heights `h' < h`.
   135  
   136  The monotonicity of proposal times, and external validity in general,
   137  implicitly assumes that heights of consensus are executed in order.
   138  
   139  #### **[PBTS-INV-TIMELY.0]**
   140  
   141  - [Time-Validity] If a correct process decides on value `v`, then the proposal
   142    time `v.time` was considered `timely` by at least one correct process.
   143  
   144  PBTS introduces a `timely` predicate that restricts the allowed decisions based
   145  on the proposal time `v.time` associated with a proposed value `v`.
   146  As a synchronous predicate, the time at which it is evaluated impacts on
   147  whether a process accepts or reject a proposal time.
   148  For this reason, the Time-Validity property refers to the previous evaluation
   149  of the `timely` predicate, detailed in the following section.
   150  
   151  ## Protocol Analysis - Timely proposals
   152  
   153  For PBTS, a `proposal` is a tuple `(v, v.time, v.round)`, where:
   154  
   155  - `v` is the proposed value;
   156  - `v.time` is the associated proposal time;
   157  - `v.round` is the round at which `v` was first proposed.
   158  
   159  We include the proposal round `v.round` in the proposal definition because a
   160  value `v` and its associated proposal time `v.time` can be proposed in multiple
   161  rounds, but the evaluation of the `timely` predicate is only relevant at round
   162  `v.round`.
   163  
   164  > Considering the algorithm in the [arXiv paper][arXiv], a new proposal is
   165  > produced by the `getValue()` method, invoked by the proposer `p` of round
   166  > `round_p` when starting its proposing round with a nil `validValue_p`.
   167  > The first round at which a value `v` is proposed is then the round at which
   168  > the proposal for `v` was produced, and broadcast in a `PROPOSAL` message with
   169  > `vr = -1`.
   170  
   171  #### **[PBTS-PROPOSAL-RECEPTION.0]**
   172  
   173  The `timely` predicate is evaluated when a process receives a proposal.
   174  More precisely, let `p` be a correct process:
   175  
   176  - `proposalReceptionTime(p,r)` is the time `p` reads from its local clock when
   177    `p` is at round `r` and receives the proposal of round `r`.
   178  
   179  #### **[PBTS-TIMELY.0]**
   180  
   181  The proposal `(v, v.time, v.round)` is considered `timely` by a correct process
   182  `p` if:
   183  
   184  1. `proposalReceptionTime(p,v.round)` is set, and
   185  1. `proposalReceptionTime(p,v.round) >= v.time - PRECISION`, and
   186  1. `proposalReceptionTime(p,v.round) <= v.time + MSGDELAY + PRECISION`.
   187  
   188  A correct process at round `v.round` only sends a `PREVOTE` for `v` if the
   189  associated proposal time `v.time` is considered `timely`.
   190  
   191  > Considering the algorithm in the [arXiv paper][arXiv], the `timely` predicate
   192  > is evaluated by a process `p` when it receives a valid `PROPOSAL` message
   193  > from the proposer of the current round `round_p` with `vr = -1`.
   194  
   195  ### Timely Proof-of-Locks
   196  
   197  A *Proof-of-Lock* is a set of `PREVOTE` messages of round of consensus for the
   198  same value from processes whose cumulative voting power is at least `2f + 1`.
   199  We denote as `POL(v,r)` a proof-of-lock of value `v` at round `r`.
   200  
   201  For PBTS, we are particularly interested in the `POL(v,v.round)` produced in
   202  the round `v.round` at which a value `v` was first proposed.
   203  We call it a *timely* proof-of-lock for `v` because it can only be observed
   204  if at least one correct process considered it `timely`:
   205  
   206  #### **[PBTS-TIMELY-POL.0]**
   207  
   208  If
   209  
   210  - there is a valid `POL(v,r)` with `r = v.round`, and
   211  - `POL(v,v.round)` contains a `PREVOTE` message from at least one correct process,
   212  
   213  Then, let `p` is a such correct process:
   214  
   215  - `p` received a `PROPOSAL` message of round `v.round`, and
   216  - the `PROPOSAL` message contained a proposal `(v, v.time, v.round)`, and
   217  - `p` was in round `v.round` and evaluated the proposal time `v.time` as `timely`.
   218  
   219  The existence of a such correct process `p` is guaranteed provided that the
   220  voting power of Byzantine processes is bounded by `2f`.
   221  
   222  ### Derived Proof-of-Locks
   223  
   224  The existence of `POL(v,r)` is a requirement for the decision of `v` at round
   225  `r` of consensus.
   226  
   227  At the same time, the Time-Validity property establishes that if `v` is decided
   228  then a timely proof-of-lock `POL(v,v.round)` must have been produced.
   229  
   230  So, we need to demonstrate here that any valid `POL(v,r)` is either a timely
   231  proof-of-lock or it is derived from a timely proof-of-lock:
   232  
   233  #### **[PBTS-DERIVED-POL.0]**
   234  
   235  If
   236  
   237  - there is a valid `POL(v,r)`, and
   238  - `POL(v,r)` contains a `PREVOTE` message from at least one correct process,
   239  
   240  Then
   241  
   242  - there is a valid `POL(v,v.round)` with `v.round <= r` which is a timely proof-of-lock.
   243  
   244  The above relation is trivially observed when `r = v.round`, as `POL(v,r)` must
   245  be a timely proof-of-lock.
   246  Notice that we cannot have `r < v.round`, as `v.round` is defined as the first
   247  round at which `v` was proposed.
   248  
   249  For `r > v.round` we need to demonstrate that if there is a valid `POL(v,r)`,
   250  then a timely `POL(v,v.round)` was previously obtained.
   251  We observe that a condition for observing a `POL(v,r)` is that the proposer of
   252  round `r` has broadcast a `PROPOSAL` message for `v`.
   253  As `r > v.round`, we can affirm that `v` was not produced in round `r`.
   254  Instead, by the protocol operation, `v` was a *valid value* for the proposer of
   255  round `r`, which means that if the proposer has observed a `POL(v,vr)` with `vr
   256  < r`.
   257  The above operation considers a *correct* proposer, but since a `POL(v,r)` was
   258  produced (by hypothesis) we can affirm that at least one correct process (also)
   259  observed a `POL(v,vr)`.
   260  
   261  > Considering the algorithm in the [arXiv paper][arXiv], `v` was proposed by
   262  > the proposer `p` of round `round_p` because its `validValue_p` variable was
   263  > set to `v`.
   264  > The `PROPOSAL` message broadcast by the proposer, in this case, had `vr > -1`,
   265  > and it could only be accepted by processes that also observed a `POL(v,vr)`.
   266  
   267  Thus, if there is a `POL(v,r)` with `r > v.round`, then there is a valid
   268  `POL(v,vr)` with `v.round <= vr < r`.
   269  If `vr = v.round` then `POL(vr,v)` is a timely proof-of-lock and we are done.
   270  Otherwise, there is another valid `POL(v,vr')` with `v.round <= vr' < vr`,
   271  and the above reasoning can be recursively applied until we get `vr' = v.round`
   272  and observe a timely proof-of-lock.
   273  
   274  ## Temporal analysis
   275  
   276  In this section we present invariants that need be observed for ensuring that
   277  PBTS is both safe and live.
   278  
   279  In addition to the variables and system parameters already defined, we use
   280  `beginRound(p,r)` as the value of process `p`'s local clock
   281  when it starts round `r` of consensus.
   282  
   283  ### Safety
   284  
   285  The safety of PBTS requires that if a value `v` is decided, then at least one
   286  correct process `p` considered the associated proposal time `v.time` timely.
   287  Following the definition of [timely proposals](#pbts-timely0) and
   288  proof-of-locks, we require this condition to be asserted at a specific round of
   289  consensus, defined as `v.round`:
   290  
   291  #### **[PBTS-SAFETY.0]**
   292  
   293  If
   294  
   295  - there is a valid commit `C` for a value `v`
   296  - `C` contains a `PRECOMMIT` message from at least one correct process
   297  
   298  then there is a correct process `p` (not necessarily the same above considered) such that:
   299  
   300  - `beginRound(p,v.round) <= proposalReceptionTime(p,v.round) <= beginRound(p,v.round+1)` and
   301  - `proposalReceptionTime (p,v.round) - MSGDELAY - PRECISION <= v.time <= proposalReceptionTime(p,v.round) + PRECISION`
   302  
   303  That is, a correct process `p` started round `v.round` and, while still at
   304  round `v.round`, received a `PROPOSAL` message from round `v.round` proposing
   305  `v`.
   306  Moreover, the reception time of the original proposal for `v`, according with
   307  `p`'s local clock, enabled `p` to consider the proposal time `v.time` as
   308  `timely`.
   309  This is the requirement established by PBTS for issuing a `PREVOTE` for the
   310  proposal `(v, v.time, v.round)`, so for the eventual decision of `v`.
   311  
   312  ### Liveness
   313  
   314  The liveness of PBTS relies on correct processes accepting proposal times
   315  assigned by correct proposers.
   316  We thus present a set of conditions for assigning a proposal time `v.time` so
   317  that every correct process should be able to issue a `PREVOTE` for `v`.
   318  
   319  #### **[PBTS-LIVENESS.0]**
   320  
   321  If
   322  
   323  - the proposer of a round `r` of consensus is correct
   324  - and it proposes a value `v` for the first time, with associated proposal time `v.time`
   325  
   326  then the proposal `(v, v.time, r)` is accepted by every correct process provided that:
   327  
   328  - `min{p is correct : beginRound(p,r)} <= v.time <= max{p is correct : beginRound(p,r)}` and
   329  - `max{p is correct : beginRound(p,r)} <= v.time + MSGDELAY + PRECISION <= min{p is correct : beginRound(p,r+1)}`
   330  
   331  The first condition establishes a range of safe proposal times `v.time` for round `r`.
   332  This condition is trivially observed if a correct proposer `p` sets `v.time` to the time it
   333  reads from its clock when starting round `r` and proposing `v`.
   334  A `PROPOSAL` message sent by `p` at local time `v.time` should not be received
   335  by any correct process before its local clock reads `v.time - PRECISION`, so
   336  that condition 2 of [PBTS-TIMELY.0] is observed.
   337  
   338  The second condition establishes that every correct process should start round
   339  `v.round` at a local time that allows `v.time` to still be considered timely,
   340  according to condition 3. of [PBTS-TIMELY.0].
   341  In addition, it requires correct processes to stay long enough in round
   342  `v.round` so that they can receive the `PROPOSAL` message of round `v.round`.
   343  It assumed here that the proposer of `v` broadcasts a `PROPOSAL` message at
   344  time `v.time`, according to its local clock, so that every correct process
   345  should receive this message by time `v.time + MSGDELAY + PRECISION`, according
   346  to their local clocks.
   347  
   348  Back to [main document][main].
   349  
   350  [main]: ./README.md
   351  
   352  [algorithm]: ./pbts-algorithm_002_draft.md
   353  
   354  [sysmodel]: ./pbts-sysmodel_002_draft.md
   355  [sysmodel_v1]: ./v1/pbts-sysmodel_001_draft.md
   356  
   357  [arXiv]: https://arxiv.org/pdf/1807.04938.pdf