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.
Estimate the relation between timeoutPropose and PRECISION/ACCURACY #265
3. Should there be any relation between timeout propose and PRECISION since a proposer waiting for the time to be ready to send out their proposal could timeout and thus miss their block (or if PRECISION is too relaxed a proposer could set their block time well in the future, where the proposer of the next height will be unable to propose a block before the timeout).
You're right, we overlooked this. We will need timeoutPropose(r)>2∆+timeoutPrecommit(r−1) + x, where x is the maximum difference between the last block time and the local clocks. We will look at the exact value of x more closely next week.
We should update the timeout estimate in the spec according to the following reasoning:
If a proposer needs to wait to make sure its proposed time is larger than the blocktime of the previous block, then it sends by realtime blocktime + ACCURACY (By this time, its local clock must exceed blocktime)
the receiver will receive by blocktime + ACCURACY + MSGDELAY
the receiver's local clock will be <= blocktime + 2 * ACCURACY + MSGDELAY
thus when the receiver p enters this round it can set its timeout to a value T2 => blocktime + 2 * ACCURACY + MSGDELAY - now_p
So we should set the timeout to max(timeoutPropose, T2), where timeoutPropose is the old timeoutPropose.
@istoilkovska, let's incorporate this tomorrow, then we re ready to merge.
I have a follow up question that relates to this issue. It's actually more a couple of statements which may help me understand the relationship of ACCURACY and PRECISION and thus how to reach good approximations of these values in a live network.
We have the following definitions of these two parameters:
There exists a system parameter PRECISION such that for any two correct validators V and W, and at any real-time t, |C_V(t) - C_W(t)| < PRECISION
There is a system parameter ACCURACY, such that for all real-times t and all correct validators V, | C_V(t) - t | < ACCURACY
If all validators are within ACCURACY of real time, then they can be at most 2 * ACCURACY away from each other. So PRECISION = SAFETY_MARGIN + 2 * ACCURACY is a reasonable default to have.
Although, in terms of specification, it is good to clearly state these two parameters because they are different from one another, I am wondering for the actual implementation with an eye of keeping things simple for users, whether we should consider collapsing these two down to a single consensus parameter?
If all validators are within ACCURACY of real time, then they can be at most 2 * ACCURACY away from each other. So PRECISION = SAFETY_MARGIN + 2 * ACCURACY is a reasonable default to have.
I agree. The important point here is the precondition "all validators are within ACCURACY of real time". It is important to make validators aware of this requirement. I am not sure what is the right way of communicating that.
Although, in terms of specification, it is good to clearly state these two parameters because they are different from one another, I am wondering for the actual implementation with an eye of keeping things simple for users, whether we should consider collapsing these two down to a single consensus parameter?
If it makes things simpler that we can go for that in the implementation. We need to make sure to document this decision. Since we are anyways discussing spec work to keep code and spec aligned (#323), we should add a section about that. (Or perhaps an ADR is also a place for that?).
Another thing that I've come to realise is more nuanced than I thought is MSGDELAY. If we imagine a network where every node is connected to 10 other nodes and you have 810 nodes in a network, then the optimal degree of connectivity (how many times the same message needs to be sent) would be 3. In practice it might be double or triple that. If we imagine network latency across all geographic points in the world to be a constant (which it's not), then maybe we could calculate MSGDELAY as degrees of connectivity * network latency. But this is incorrect because we also need to factor in verification time. A node won't gossip on the message until it has verified it to be correct. This involves signature verification as well. I guess the most important thing is that the MSGDELAY should be the same for proposal, prevotes, and precommits. I'm hoping given that they are the same size and require a similar amount of time to verify that it's okay to have a single parameter for message delay. But I'm not sure because what about block propagation which might take significantly longer. In summary, I'm uncertain about the feasibility of having a single variable model the timeouts in consensus
For putting a parameter in the code, it is important that we actually use the assumption on timely proposals[PBTS-MSG-FAIR.0] for safety and liveness. I guess only a bound on proposals needs to be captured. But perhaps I miss something?
Activity
josef-widder commentedon Mar 15, 2021
Steps to take.
relate [PBTS-CONSENSUS-REALTIME-VALID.0] to the time the proposer of the next block starts round 0
proposeeven right now, liveness should be maintained without updating the initial value of
timeoutPropose(decision might be moved to a later round)for practical considerations changing the initial value of
timeoutProposestill seems favorable.josef-widder commentedon Mar 16, 2021
Rather than an additive term
x, it might more sense to estimate when a proposal needs to arrive based on theand have a timout as maximum over two expressions.
josef-widder commentedon Mar 22, 2021
We should update the timeout estimate in the spec according to the following reasoning:
blocktimeof the previous block, then it sends by realtimeblocktime + ACCURACY(By this time, its local clock must exceedblocktime)blocktime + ACCURACY + MSGDELAY<= blocktime + 2 * ACCURACY + MSGDELAYpenters this round it can set its timeout to a valueT2 => blocktime + 2 * ACCURACY + MSGDELAY - now_pSo we should set the timeout to
max(timeoutPropose, T2), wheretimeoutProposeis the oldtimeoutPropose.@istoilkovska, let's incorporate this tomorrow, then we re ready to merge.
cmwaters commentedon Jul 22, 2021
@josef-widder has the spec been updated or should this still be an open issue?
josef-widder commentedon Jul 26, 2021
the issue had been addressed. OK to keep the issue closed.
cmwaters commentedon Aug 5, 2021
I have a follow up question that relates to this issue. It's actually more a couple of statements which may help me understand the relationship of ACCURACY and PRECISION and thus how to reach good approximations of these values in a live network.
We have the following definitions of these two parameters:
If all validators are within ACCURACY of real time, then they can be at most 2 * ACCURACY away from each other. So
PRECISION = SAFETY_MARGIN + 2 * ACCURACYis a reasonable default to have.Although, in terms of specification, it is good to clearly state these two parameters because they are different from one another, I am wondering for the actual implementation with an eye of keeping things simple for users, whether we should consider collapsing these two down to a single consensus parameter?
josef-widder commentedon Aug 5, 2021
I agree. The important point here is the precondition "all validators are within ACCURACY of real time". It is important to make validators aware of this requirement. I am not sure what is the right way of communicating that.
If it makes things simpler that we can go for that in the implementation. We need to make sure to document this decision. Since we are anyways discussing spec work to keep code and spec aligned (#323), we should add a section about that. (Or perhaps an ADR is also a place for that?).
cmwaters commentedon Aug 5, 2021
Another thing that I've come to realise is more nuanced than I thought is
MSGDELAY. If we imagine a network where every node is connected to 10 other nodes and you have 810 nodes in a network, then the optimal degree of connectivity (how many times the same message needs to be sent) would be 3. In practice it might be double or triple that. If we imagine network latency across all geographic points in the world to be a constant (which it's not), then maybe we could calculate MSGDELAY as degrees of connectivity * network latency. But this is incorrect because we also need to factor in verification time. A node won't gossip on the message until it has verified it to be correct. This involves signature verification as well. I guess the most important thing is that theMSGDELAYshould be the same for proposal, prevotes, and precommits. I'm hoping given that they are the same size and require a similar amount of time to verify that it's okay to have a single parameter for message delay. But I'm not sure because what about block propagation which might take significantly longer. In summary, I'm uncertain about the feasibility of having a single variable model the timeouts in consensusjosef-widder commentedon Aug 6, 2021
For putting a parameter in the code, it is important that we actually use the assumption on timely proposals [PBTS-MSG-FAIR.0] for safety and liveness. I guess only a bound on proposals needs to be captured. But perhaps I miss something?
williambanfield commentedon Aug 6, 2021
It looks like [PBTS-ALG-STARTROUND.0] is the only step in the algorithm to use this parameter.
josef-widder commentedon Aug 9, 2021
It also appears in the reception at [PBTS-RECEPTION-STEP.0].