Finality providers submit votes to finalize blocks on the consumer chain. This document specifies the process of submitting finality votes.
The finality provider maintains a persistent state variable lastVotedHeight
to track the most recent height where a finality vote was successfully submitted
This is to prevent voting for a previously voted height.
To determine the initial processing height startHeight
:
-
Query consumer chain for:
lastFinalizedHeight
(defaults to0
if no blocks are finalized)finalityActivationHeight
lastVotedHeightRemote
(defaults to0
if no votes exist)
-
Synchronize local state:
- Verify local
lastVotedHeight
>=lastVotedHeightRemote
- If verification fails, update local state to match remote
- Verify local
-
Calculate starting height based on reward distribution policy:
-
If rewards are available for already finalized blocks:
startHeight = max(lastVotedHeight + 1, finalityActivationHeight)
-
If rewards are only for unfinalized blocks:
startHeight = max(lastFinalizedHeight + 1, finalityActivationHeight)
-
The choice between using lastVotedHeight
or lastFinalizedHeight
depends on
the consumer chain's reward distribution mechanism.
Use lastVotedHeight
if the chain allows collecting rewards for already
finalized blocks. Otherwise, use lastFinalizedHeight
to only process
unfinalized blocks.
After the finality provider is bootstrap, it continuously monitors for new blocks from a trusted full node of the consumer chain. For each new block, it performs these validation checks:
- Block hasn't been previously processed
- Block height exceeds finality activation height
- Finality provider has sufficient voting power
Upon passing all checks, the finality provider:
- Requests a finality signature from the EOTS manager
- Submits the vote transaction to the consumer chain
- Implements retry logic until either:
- Maximum retry attempts are reached
- Block becomes finalized
A batch submission mechanism is needed to deal with cases where:
- recovery from downtime, and
- the consumer chain has rapid block production.
Batch sumission puts multiple new blocks into a batch and process them in the same loop, after which all the finality votes will be sent in the same transaction to the consumer chain.
To submit a finality vote, the finality provider needs to fill the MsgAddFinalitySig:
- Finality provider public key: the BTC PK of the finality provider that casts the vote in BIP340 format.
- Block height: the height of the block that the vote is signed for.
- Public randomness: the public randomness that is retrieved from the local,
which is a 32-byte point over
secp256k1
. - Merkle proof: the merkle proof of the public randomness, which is generated when constructing the public randomness commit using the CometBFT's merkle library.
- Block hash: the hash bytes of the block that the vote is signed.
- Finality signature: the EOTS signature that is signed by the finality provider's private key and the corresponding private randomness.
The consumer chain verifies:
- The finality provider has voting power for the given height
- Randomness was pre-committed and BTC-timestamped
- EOTS signature validity