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

     1  # PBTS: System Model and Properties (first draft)
     2  
     3  This specification is **OUTDATED**. Please refer to the [new version][sysmodel].
     4  
     5  ## System Model
     6  
     7  ### Time and Clocks
     8  
     9  #### **[PBTS-CLOCK-NEWTON.0]**
    10  
    11  There is a reference Newtonian real-time `t` (UTC).
    12  
    13  Every correct validator `V` maintains a synchronized clock `C_V` that ensures:
    14  
    15  #### **[PBTS-CLOCK-PRECISION.0]**
    16  
    17  There exists a system parameter `PRECISION` such that for any two correct validators `V` and `W`, and at any real-time `t`,  
    18  `|C_V(t) - C_W(t)| < PRECISION`
    19  
    20  
    21  ### Message Delays
    22  
    23  We do not want to interfere with the Tendermint timing assumptions. We will postulate a timing restriction, which, if satisfied, ensures that liveness is preserved.
    24  
    25  In general the local clock may drift from the global time. (It may progress faster, e.g., one second of clock time might take 1.005 seconds of real-time). As a result the local clock and the global clock may be measured in different time units. Usually, the message delay is measured in global clock time units. To estimate the correct local timeout precisely, we would need to estimate the clock time duration of a message delay taking into account the clock drift. For simplicity we ignore this, and directly postulate the message delay assumption in terms of local time.
    26  
    27  
    28  #### **[PBTS-MSG-D.0]**
    29  
    30  There exists a system parameter `MSGDELAY` for message end-to-end delays **counted in clock-time**.
    31  
    32  > Observe that [PBTS-MSG-D.0] imposes constraints on message delays as well as on the clock.
    33  
    34  #### **[PBTS-MSG-FAIR.0]**
    35  
    36  The message end-to-end delay between a correct proposer and a correct validator (for `PROPOSE` messages) is less than `MSGDELAY`.
    37  
    38  
    39  ## Problem Statement
    40  
    41  In this section we define the properties of Tendermint consensus (cf. the [arXiv paper][arXiv]) in this new system model.
    42  
    43  #### **[PBTS-PROPOSE.0]**
    44  
    45  A proposer proposes a pair `(v,t)` of consensus value `v` and time `t`.
    46  
    47  > We then restrict the allowed decisions along the following lines:
    48  
    49  #### **[PBTS-INV-AGREEMENT.0]**
    50  
    51  [Agreement] No two correct validators decide on different values `v`.
    52  
    53  #### **[PBTS-INV-TIME-VAL.0]**
    54  
    55  [Time-Validity] If a correct validator decides on `t` then `t` is "OK" (we will formalize this below), even if up to `2f` validators are faulty.
    56  
    57  However, the properties of Tendermint consensus are of more interest with respect to the blocks, that is, what is written into a block and when. We therefore, in the following, will give the safety and liveness properties from this block-centric viewpoint.  
    58  For this, observe that the time `t` decided at consensus height `k` will be written in the block of height `k+1`, and will be supported by `2f + 1` `PRECOMMIT` messages of the same consensus round `r`. The time written in the block, we will denote by `b.time` (to distinguish it from the term `bfttime` used for median-based time). For this, it is important to have the following consensus algorithm property:
    59  
    60  #### **[PBTS-INV-TIME-AGR.0]**
    61  
    62  [Time-Agreement] If two correct validators decide in the same round, then they decide on the same `t`.
    63  
    64  #### **[PBTS-DECISION-ROUND.0]**
    65  
    66  Note that the relation between consensus decisions, on the one hand, and blocks, on the other hand, is not immediate; in particular if we consider time: In the proposed solution,
    67  as validators may decide in different rounds, they may decide on different times.
    68  The proposer of the next block, may pick a commit (at least `2f + 1` `PRECOMMIT` messages from one round), and thus it picks a decision round that is going to become "canonic".
    69  As a result, the proposer implicitly has a choice of one of the times that belong to rounds in which validators decided. Observe that this choice was implicitly the case already in the median-based `bfttime`.
    70  However, as most consensus instances terminate within one round on the Cosmos hub, this is hardly ever observed in practice.
    71  
    72  
    73  
    74  Finally, observe that the agreement ([Agreement] and [Time-Agreement]) properties are based on the Tendermint security model [TMBC-FM-2THIRDS.0] of more than 2/3 correct validators, while [Time-Validity] is based on more than 1/3 correct validators.
    75  
    76  ### SAFETY
    77  
    78  Here we will provide specifications that relate local time to block time. However, since we do not assume (by now) that local time is linked to real-time, these specifications also do not provide a relation between block time and real-time. Such properties are given [later](#REAL-TIME-SAFETY).
    79  
    80  For a correct validator `V`, let `beginConsensus(V,k)` be the local time when it sets its height to `k`, and let `endConsensus(V,k)` be the time when it sets its height to `k + 1`.
    81  
    82  Let
    83  
    84  - `beginConsensus(k)` be the minimum over `beginConsensus(V,k)`, and
    85  - `last-beginConsensus(k)` be the maximum over `beginConsensus(V,k)`, and
    86  - `endConsensus(k)` the maximum over `endConsensus(V,k)`
    87  
    88  for all correct validators `V`.
    89  
    90  > Observe that `beginConsensus(k) <= last-beginConsensus(k)` and if local clocks are monotonic, then `last-beginConsensus(k) <= endConsensus(k)`.
    91  
    92  #### **[PBTS-CLOCK-GROW.0]**
    93  
    94  We assume that during one consensus instance, local clocks are not set back, in particular for each correct validator `V` and each height `k`, we have `beginConsensus(V,k) < endConsensus(V,k)`.
    95  
    96  
    97  #### **[PBTS-CONSENSUS-TIME-VALID.0]**
    98  
    99  If
   100  
   101  - there is a valid commit `c` for height `k`, and
   102  - `c` contains a `PRECOMMIT` message by at least one correct validator,
   103  
   104  then the time `b.time` in the block `b` that is signed by `c` satisfies
   105  
   106  - `beginConsensus(k) - PRECISION <= b.time < endConsensus(k) + PRECISION + MSGDELAY`.
   107  
   108  
   109  > [PBTS-CONSENSUS-TIME-VALID.0] is based on an analysis where the proposer is faulty (and does does not count towards `beginConsensus(k)` and `endConsensus(k)`), and we estimate the times at which correct validators receive and `accept` the `propose` message. If the proposer is correct we obtain
   110  
   111  #### **[PBTS-CONSENSUS-LIVE-VALID-CORR-PROP.0]**
   112  
   113  If the proposer of round 1 is correct, and
   114  
   115  - [TMBC-FM-2THIRDS.0] holds for a block of height `k - 1`, and
   116  - [PBTS-MSG-FAIR.0], and
   117  - [PBTS-CLOCK-PRECISION.0], and
   118  - [PBTS-CLOCK-GROW.0] (**TODO:** is that enough?)
   119  
   120  then eventually (within bounded time) every correct validator decides in round 1.
   121  
   122  #### **[PBTS-CONSENSUS-SAFE-VALID-CORR-PROP.0]**
   123  
   124  If the proposer of round 1 is correct, and
   125  
   126  - [TMBC-FM-2THIRDS.0] holds for a block of height `k - 1`, and
   127  - [PBTS-MSG-FAIR.0], and
   128  - [PBTS-CLOCK-PRECISION.0], and
   129  - [PBTS-CLOCK-GROW.0] (**TODO:** is that enough?)
   130  
   131  then `beginConsensus_k <= b.time <= last-beginConsensus_k`.
   132  
   133  
   134  > For the above two properties we will assume that a correct proposer `v` sends its `PROPOSAL` at its local time `beginConsensus(v,k)`.
   135  
   136  ### LIVENESS
   137  
   138  If
   139  
   140  - [TMBC-FM-2THIRDS.0] holds for a block of height `k - 1`, and
   141  - [PBTS-MSG-FAIR.0],
   142  - [PBTS-CLOCK.0], and
   143  - [PBTS-CLOCK-GROW.0] (**TODO:** is that enough?)
   144  
   145  then eventually there is a valid commit `c` for height `k`.
   146  
   147  
   148  ### REAL-TIME SAFETY
   149  
   150  > We want to give a property that can be exploited from the outside, that is, given a block with some time stored in it, what is the estimate at which real-time the block was generated. To do so, we need to link clock-time to real-time; which is not the case with [PBTS-CLOCK.0]. For this, we introduce the following assumption on the clocks:
   151  
   152  #### **[PBTS-CLOCKSYNC-EXTERNAL.0]**
   153  
   154  There is a system parameter `ACCURACY`, such that for all real-times `t` and all correct validators `V`,
   155  
   156  - `| C_V(t) - t | < ACCURACY`.
   157  
   158  > `ACCURACY` is not necessarily visible at the code level. The properties below just show that the smaller
   159  its value, the closer the block time will be to real-time
   160  
   161  #### **[PBTS-CONSENSUS-PTIME.0]**
   162  
   163  LET `m` be a propose message. We consider the following two real-times `proposalTime(m)` and `propRecvTime(m)`:
   164  
   165  - if the proposer is correct and sends `m` at time `t`, we write `proposalTime(m)` for real-time `t`.
   166  - if first correct validator receives `m` at time `t`, we write `propRecvTime(m)` for real-time `t`.
   167  
   168  
   169  #### **[PBTS-CONSENSUS-REALTIME-VALID.0]**
   170  
   171  Let `b` be a block with a valid commit that contains at least one `precommit` message by a correct validator (and `proposalTime` is the time for the height/round `propose` message `m` that triggered the `precommit`). Then:
   172  
   173  `propRecvTime(m) - ACCURACY - PRECISION < b.time < propRecvTime(m) + ACCURACY + PRECISION + MSGDELAY`
   174  
   175  
   176  #### **[PBTS-CONSENSUS-REALTIME-VALID-CORR.0]**
   177  
   178  Let `b` be a block with a valid commit that contains at least one `precommit` message by a correct validator (and `proposalTime` is the time for the height/round `propose` message `m` that triggered the `precommit`). Then, if the proposer is correct:
   179  
   180  `proposalTime(m) - ACCURACY < b.time < proposalTime(m) + ACCURACY`
   181  
   182  > by the algorithm at time `proposalTime(m)` the proposer fixes `m.time <- now_p(proposalTime(m))`
   183  
   184  > "triggered the `PRECOMMIT`" implies that the data in `m` and `b` are "matching", that is, `m` proposed the values that are actually stored in `b`.
   185  
   186  Back to [main document][main_v1].
   187  
   188  [main_v1]: ./pbts_001_draft.md
   189  
   190  [algorithm_v1]: ./pbts-algorithm_001_draft.md
   191  
   192  [sysmodel]: ../pbts-sysmodel_002_draft.md
   193  
   194  [arXiv]: https://arxiv.org/abs/1807.04938