You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 23, 2022. It is now read-only.
@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
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.
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.
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.
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 replacePRECISION 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:
t_p >= t, because the receiving of a message cannot occur before the message is sent
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.
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?
Activity
josef-widder commentedon Oct 13, 2021
@cason, please have a look. (I tried to asign you the issue, but failed. We need to add you to the repo...)
cmwaters commentedon Oct 13, 2021
I can look to add him to the repo
zeu5 commentedon Oct 13, 2021
Thank you @josef-widder. To add,
We can use the same reasoning to change [PBTS-CONSENSUS-REALTIME-VALID.0],
From accuracy assumptions we have,
propRecvTime(m) - ACCURACY < now_pnow_p < propRecvTime(m) + ACCURACYAnd eliminating
now_pthis with (E) and (F), we get,propRecvTime(m) - ACCURACY - MSGDELAY - PRECISION < m.timeandm.time < propRecvTime(m) + ACCURACY + PRECISION.josef-widder commentedon Oct 22, 2021
yes. the reasoning seems right.
josef-widder commentedon Oct 22, 2021
Also
timelyneeds to check whether the blocktime is greater than the previous blocktimewilliambanfield commentedon Oct 27, 2021
@josef-widder
Should (A) and (B) also allow for T +/- PRECISION to equal m.time?
josef-widder commentedon Oct 27, 2021
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.
williambanfield commentedon Nov 1, 2021
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.
cason commentedon Nov 3, 2021
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
ACCURACYwith the real time, then you can replacePRECISIONin the formulas by2 * ACCURACY.My reasoning started by considering the real time
tat which the block is proposed, and the real timest_pat each a validatorpreceives the proposed block.To consider a block timely, a validator
pshould receive the block at real timet_pwith:t_p >= t, because the receiving of a message cannot occur before the message is sentt_p <= t + MSGDELAY, becauseMSGDELAYis maximum propagation delay for a message to be considered timelyInstants
tand the multiplet_ps are from the real time, but they are measured by different clocks:m.timeis the time read by the proposer of the block at real time instanttnow_pis the time read by the validatorpat real time instantt_pIf we assume that clocks have a given
ACCURACYwith the real time, we have that:t - ACCURACY <= m.time <= t + ACCURACYt_p - ACCURACY <= now_p <= t_p + ACCURACYWe don't want
t > t_p, i.e., a block timestamp in the future. So we cannot allow the minimum allowed value oftprovided thatm.timewas read by the proposer, to be greater than the maximum allowed value oft_p, provided that validatorpreadnow_pfrom its clock. So we don't wantm.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 oft_p, provided that validatorpreadnow_pfrom its clock, to be greater than maximum allowed value oft + MSGDELAY, provided thatm.timewas read by the proposer and that the clock drift in the interested interval is negligible. So we don't wantnow_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
ACCURACYas a parameter because I'm using real times for the events.But if validator clocks' readings are within
ACCURACYfrom the real time, the maximum difference of the value read by two validators from their clocks at the same real time isPRECISION = 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
PRECISIONfar from each other, the same reasoning above is valid when replacing2 * ACCURACYbyPRECISION.josef-widder commentedon Nov 4, 2021
@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 containing
3 * ACCURACY, right?