There is no commentSelect some text and then click Comment, or simply add a comment to this page from below to start a discussion.
Safe Head: happy case
Basic definitions and notation
We will use for slots, for blocks, for epochs. Often times we will use for the block at slot abusing notation when no confusion could arise. For example, a forkchoice diagram of the form
denotes a reorg where the block in slot 13 has the block in slot 11 as parent. We will say things like The parent of is to mean the parent of the block in slot is the block in slot .
All our forkchoice diagrams will have time going from left to right, that is a block to the right of a block will correspond to a slot .
For a slot we will denote by the canonical head during . When this depends on the time withing the slot, eg. if the block has arrived or not, we will explicitly specify it.
LMD Weights For a block at slot , that is a leaf of the forkchoice tree, we will write to mean the LMD GHOST weight of the branch supporting this head. That is, in terms of the forkchoice implementation the node's weight*
For example, assuming that each node in the diagram above was voted by a single validator with 10ETH of effective balance, we would have and .
For two different tips at and with equal FFG information (that is equal justification and finalization checkpoints) we have implies that is preferred over as the current canonical head. In the example above, the node at would be preferred over that at .
We will abuse notation and also use to denote the LMD weight of a node even when it is not a tip of forkchoice. With the same assumptions as above we would have and . Recall that when a validator cast a vote, its previous vote is removed from the corresponding forkchoice node's balance and weight. Consider a chain without any forks, there are exactly 32 validators , with 10 ETH effective balance and each has voted sequentially, that is validator voted at slot for each one of the blocks.
In this case, the weight of the vote at slot was removed from this slot and assigned to slot when validator voted during epoch . Then it was removed from block and assigned to during Epoch and finally removed from and assigned to during epoch . We see that (the total effective balance) and .
For a block with parent , we will define . That is the total stake that voted directly for and we will refer to it as the balance of . In the first example above, the balance of every node is . However, in the last example we have while .
More generally for a slot/block and its ancestor we will write , that is, the relative weight of votes cast for blocks supporting after . In particular we have . In the last example above we have and .
Safety Assumptions Let be the total effective balance of validators divided by 32, this is roughly the total stake attesting per slot.
We use PB to denote the proposer boost weight, currently set on mainnet to .
Let be percentage staked by malicious validators. We assume that
We assume that validators are online and attesting, this is measured below by the amount of stake of missing attestations that we will keep at a minimum (eg below 5% of the total stake).
We assume that validators are equidistributed, each committee has the same proportion of honest/dishonest validators.
Safe Head definition
Setup Let be the current slot, be the current epoch. The current canonical head is at slot , and its parent block is at slot .
We assume that is justified, ie. the current justified checkpoint is of the form .
Let be the total stake of attestations that could have been cast in the last 32 slots and have not been acounted for, that is, those attestations have not been seen yet either over gossip nor included in any block that is currently in forkchoice.
Let be the total stake of attestations (only the last possible vote of each validator) that have been cast for non-canonical blocks.
Lemma 1. Let be any ancestor of , we have that
Proof. This is simply the fact that the maximum possible number of votes is given by and from these votes the worst that can happen is that the attestations that weren't accounted for (ie ) are given to non-canonical blocks.
QED
A simple variation of this Lemma is Lemma 2. Let be any contending block of with common ancestor , then Proof. The proof is the same as Lemma 1, the only difference is the extra votes that not only do not count for but may count for the contending branch of .
QED
Theorem 2. Under the above conditions, let be the highest LMD weight of any head contending with or any ancestor of (excluding itself)
the block is final.
Proof. We want to prove the following. For any slot , let be the canonical head (from the point of view of an honest validator) at . Then is a descendant of for .
If , there is nothing to prove. Let be a slot that does not satisfy the hipothesis, that is does not descend from . Let be the slot of their common ancestor, let be the best head descending from at the time , and let be the best head on the chain of at slot , so that we have
Here notice that may not to descend from and the slot of is less than .
Without loss of generality we may assume that is the minimal slot with this property. This implies that either was in the chain of or was not the canonical head during . for all such that .
For simplicity of exposition, let us first make the following assumptions:
both and have the same justified checkpoint . In this case we must have .
All of , and are slots in the same epoch .
There are only two viable heads at all times (that is, we have a simple fork)
For each , honest validators voted for the block during , and this block is a descendant of by hypothesis. Some of these votes however may have been supporting the branch before, that is, any vote from an honest validator that was before would have supported the branch and no longer does. Honest validators votes on slots between and however, were not supporting the chain of before, and will therefore not change the difference in the LMD weight of the chain of with respect to that of . On the other hand, all validators that vote between slots and are votes during epoch . By our assumptions, their previous votes were cast during epoch , therefore before slot . The votes that are added to the chain of (not changing its weight) and subtracted from the chain of are then
On the other hand, malicious validators would be voting for the contending branch of , and for each vote they cast that was previously voting for the B branch, it would now count towards . In the worst case scenario, every single malicious vote, shifts from the B branch to the S branch. These votes, with total weight will be removed from the branch and added to the LMD weight of the branch (without changing its weight since they were already counted towards ).
We can assume also that all of the witheld attestations were malicious, were valid, and could be added to the branch, and that also the block at was timely, thus proposer boosted. This accounts for a total LMD weight for the branch of at the start of its slot of at most
On the other hand the branch supporting will have weight at least
From it follows that
Since we obtain
We now have reduced the problem to prove that our assumptions above were not necessary. Let us first deal with the second assumption, that is that , and are all in the same epoch . Let us suppose first that and are on the same epoch , but not necessarily is the case for and , that is, the fork is long enough to cross epoch boundaries but the common ancestor is close to the block which we want to prove is final. Notice that for each slot during epoch and after slot , the difference of LMD weight between the tip of the chain supporting and the chain supporting increases by an amount of . Since was justified, and all votes during are for the same target, when crossing the epoch boundary to we have that the justification of the chain is at least the justification of the chain, that is This is because and honest validators are attesting on the chain. It follows that honest validators will continue voting during on the chain, while malicious validators can continue voting on the chain. At the start of epoch , the difference on LMD weights of both chains has increased by (accounting for the slots between the and the start of ).
During , validators that had voted up to slot during will account for a difference in LMD weights of .
Malicious validators that had voted during on the chain supporting , that is between the slots and , can shift their vote during to the chain of , these will increase the weight on and decrease it from , the maximum difference caused by these is .
It follows that during a slot in epoch we have is at least
By Lemma 2 we have From where we obtain that during epoch we have where we have added another terms of withdeld votes that counted for the branch and proposer boost to the last block produced by the malicious branch. We see that the RHS is positive if which is guaranteed by our assumptions on .
If the slot is in an epoch higher than , the situation does not change, since malicious validators have already been accounted for the branch and honest validators for the branch , thus the LMD difference will continue to increase, and the same argument can be applied for justification.