Skip to content
This repository was archived by the owner on Feb 23, 2022. It is now read-only.
This repository was archived by the owner on Feb 23, 2022. It is now read-only.

Proposer time - fix message filter condition #353

Closed

Description

@josef-widder

Protocol Change Proposal

Summary

@zeu5 brought up a problem in the filtering of messages. As a result we propose to update [PBTS-RECEPTION-STEP.0] to:

In the reception step at process p at local time now_p, upon receiving a message m:

  • if the message m is of type PROPOSE and satisfies now_p - PRECISION - MSGDELAY < m.time < now_p + PRECISION, then mark the message as timely.

Problem Definition

The check to test the validity of the time proposed by the proposer is crucial for correctness. I am not sure how we came up with the current check, but here are the arguments for the proposed new check:

  • Let T be the local time at a correct validator p when the a correct proposer sends m
  • By precision we have
    • (A): T - PRECISION < m.time
    • (B): m.time < T + PRECISION.
  • Let now_p be the time when m is received by p
  • By the delay assumption we have:
    • (C) T <= now_p
    • (D) now_p <= T + MSGDELAY, that is, now_p - MSGDELAY <= T
  • Eliminating T in (A) using (D) we get
    • (E) now_p - MSGDELAY - PRECISION < m.time
  • Eliminating T in (B) using (C) we get
    • (F) m.time < now_p + PRECISION

The formulas (E) and (F) thus constitute the new check.

Proposal

  • We need to recheck the property.
  • We need to update the property in the spec as well as the mention in the formula in ADR-071

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

  1. josef-widder commented on Oct 13, 2021

    @josef-widder
    ContributorAuthor

    @cason, please have a look. (I tried to asign you the issue, but failed. We need to add you to the repo...)

  2. cmwaters commented on Oct 13, 2021

    @cmwaters
    Contributor

    I can look to add him to the repo

  3. zeu5 commented on Oct 13, 2021

    @zeu5

    Thank you @josef-widder. To add,

    We can use the same reasoning to change [PBTS-CONSENSUS-REALTIME-VALID.0],
    From accuracy assumptions we have,

    • (G) propRecvTime(m) - ACCURACY < now_p
    • (H) now_p < propRecvTime(m) + ACCURACY

    And eliminating now_p this with (E) and (F), we get,
    propRecvTime(m) - ACCURACY - MSGDELAY - PRECISION < m.time and m.time < propRecvTime(m) + ACCURACY + PRECISION.

  4. josef-widder commented on Oct 22, 2021

    @josef-widder
    ContributorAuthor

    yes. the reasoning seems right.

  5. josef-widder commented on Oct 22, 2021

    @josef-widder
    ContributorAuthor

    Also timely needs to check whether the blocktime is greater than the previous blocktime

  6. williambanfield commented on Oct 27, 2021

    @williambanfield
    Contributor

    @josef-widder
    Should (A) and (B) also allow for T +/- PRECISION to equal m.time?

  7. josef-widder commented on Oct 27, 2021

    @josef-widder
    ContributorAuthor

    The strict inequalities come from assumption [PBTS-CLOCK-PRECISION.0]. In principle we can change [PBTS-CLOCK-PRECISION.0] to "<=", but then we should also go through the remainder of the spec to consistently change it everywhere. I think there was a discussion around this question in the PR that led to the current version of the spec, but we decided to keep it.

  8. williambanfield commented on Nov 1, 2021

    @williambanfield
    Contributor

    Thanks!
    Additionally, do (C) and (D) need to include ACCURACY? It seems to me like we're making an assumption about how close T is to 'real time' in those inequalities.

  9. cason commented on Nov 3, 2021

    @cason

    Hi, finally I thought properly about these inequalities (and spent a lot of paper in this process), and I agree with the formulas proposed in this post: (E) and (F).

    @williambanfield, we don't need accuracy in the formulas, in the way they are presented. But if you assume that the clocks of each validator has an ACCURACY with the real time, then you can replace PRECISION in the formulas by 2 * ACCURACY.

    My reasoning started by considering the real time t at which the block is proposed, and the real times t_p at each a validator p receives the proposed block.

    To consider a block timely, a validator p should receive the block at real time t_p with:

    1. t_p >= t, because the receiving of a message cannot occur before the message is sent
    2. t_p <= t + MSGDELAY, because MSGDELAY is maximum propagation delay for a message to be considered timely

    Instants t and the multiple t_ps are from the real time, but they are measured by different clocks:

    • m.time is the time read by the proposer of the block at real time instant t
    • now_p is the time read by the validator p at real time instant t_p

    If we assume that clocks have a given ACCURACY with the real time, we have that:

    • t - ACCURACY <= m.time <= t + ACCURACY
    • t_p - ACCURACY <= now_p <= t_p + ACCURACY

    We don't want t > t_p, i.e., a block timestamp in the future. So we cannot allow the minimum allowed value of t provided that m.time was read by the proposer, to be greater than the maximum allowed value of t_p, provided that validator p read now_p from its clock. So we don't want m.time - ACCURACY > now_p + ACCURACY.

    So, for a block to be timely we want now_p >= m.time - 2 * ACCURACY.

    A similar reasoning applies for the second condition above: we don't want t_p > t + MSGDELAY. So we cannot allow the minimum allowed value of t_p, provided that validator p read now_p from its clock, to be greater than maximum allowed value of t + MSGDELAY, provided that m.time was read by the proposer and that the clock drift in the interested interval is negligible. So we don't want now_p - ACCURACY > m.time + ACCURACY + MSGDELAY.

    So, for a block to be timely we also want now_p <= m.time + MSGDELAY + 2 * ACCURACY.


    The reasoning about considers ACCURACY as a parameter because I'm using real times for the events.

    But if validator clocks' readings are within ACCURACY from the real time, the maximum difference of the value read by two validators from their clocks at the same real time is PRECISION = 2 * ACCURACY.

    And even though validators' clocks have no accuracy with real time at all, if simultaneous readings of two validators' clocks always return values that are not more than PRECISION far from each other, the same reasoning above is valid when replacing 2 * ACCURACY by PRECISION.

  10. josef-widder commented on Nov 4, 2021

    @josef-widder
    ContributorAuthor

    @cason : thanks for thinking this through!

    I guess this also means that in the expression for [PBTS-CONSENSUS-REALTIME-VALID.0] discussed here, we will end up with a term containing3 * ACCURACY, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions