REP-0003 Title: Optimistic Fast Finality Author: Ronin Core Team Type: Standards Track Status: Executed Created: 2023-07-10
This REP proposes a new fast finality mechanism that aims to increase the speed of transaction confirmation on Ronin. The proposed mechanism is expected to significantly reduce the time it takes for transactions to be confirmed on Ronin, which will help to improve the user experience and make Ronin more competitive in the market.
Finality is critical for blockchain security, once the block is finalized, it would not be reverted anymore. The fast finality feature is very useful, users can make sure they get accurate information from the latest finalized block, then they can decide what to do next instantly.
Currently, to confirm a transaction on Ronin, the users need to wait for 15 blocks (~45s). With the new fast finality mechanism, optimistically, they only need to wait for 2 blocks (~6s) to confirm a transaction.
We propose a voting mechanism to enable optimistic fast finality.
Validators confirm a block's validity by providing their signatures on the block's hash. If a block receives enough votes, the validators can create a quorum certificate (QC) to attest to the block's validity. The block's QC is included in its direct descendant block.
Validators vote according to the following rules:
- Rule 1: A validator must not publish two distinct votes for the same height.
- Rule 2: A validator always votes for the latest block of its best chain.
- Rule 3: A validator only votes for the block with a bigger block height than its previous vote.
Once the validators vote for a block, the next block producer collects those votes and creates a Quorum Certificate (QC) if there are at least
The QC will be verified by other nodes in the network. A block containing an invalid QC will be considered invalid. To optimize the size and verification time of QCs, we use the BLS signature scheme. The BLS signature allows us to aggregate the signatures of validators on a block into a single signature. Compared to unaggregated signatures, the aggregated signature can save up to
Finalizing a block involves two steps: justification and finalization.
- A block is considered justified if its QC is included in the header of its direct descendant block.
- A block is considered finalized if it is justified and its direct descendant (in the same epoch) is also justified. If a block is finalized, all of its ancestor blocks are finalized.
In the figure above, block
In Ronin, validators use the sum of the difficulty field to compare and confirm which chain is the best ancestor to pick. This finality mechanism requires the chain to grow under a new fork choice rule.
- The chain that includes the highest justified block is considered the best chain, even if there are other chains with a higher total difficulty.
- If multiple chains include the highest justified block, the chain with the highest total difficulty is selected as the best chain.
At most 0.5% of the block rewards (including transaction fees and staking rewards) will be distributed to the validators who vote to finalize blocks. Note that, these rewards will not be distributed to the delegators.
The rewards will be distributed in every period to the validators based on their votes.
- Let
$n_1$ be the number of blocks in the period and$n_2$ be the number of blocks where the QC is included. Let$r$ be the total rewards in the period. The total rewards for all validators for finalizing blocks are$0.5$ %$\times r\times n_2/n_1$ . - For every QC that is included in a block, the reward weight of the validators, who have their vote included in the QC, increase by
$1$ . The reward of a validator in a period will be proportional her/his reward weight.
The validator who violates Rule 1 will get slashed.
- The evidence can be submitted by anyone, whenever someone sees the malicious behavior.
- The malicious validator will get slashed for 250,000 RON and will be put in jail for
$2^{63}-1$ blocks (same as double-sign slash).
A secure consensus protocol must satisfy two properties: safety and liveness. In addition, we will analyze a new property called fast finality.
- Safety. If a block is finalized, it cannot be reverted, i.e., two blocks in different forks cannot be finalized.
- Liveness. New blocks will be added to the chain after some certain time.
- Fast finality. A block will be finalized after 2 blocks.
If at least
First, we show that two blocks
Next, we show that blocks
As
If at least
When there are at least
We will demonstrate that block producers should include all votes in their QC to maximize profits. A rational validator may intentionally exclude the votes of certain validators in an effort to reduce the reward weight of those validators and increase its own rewards. However, if a rational validator does this, the excluded validators may retaliate by also excluding the votes of the rational validator. Ultimately, the rational validator will receive fewer rewards.
The content is licensed under CC0.