rollmint
rollmint copied to clipboard
Distinguish soft and hard finality to the ABCI app
Goal Some sequencer schemes have soft-confirmation mechanisms, with varying guarantees. Users of rollups should be able to:
- query parts of the latest-finalized state
- query parts of the latest-observed state User experiences such as wallets and front-ends should be able to visually distinguish whether some state displayed to the user is finalized, or just soft-confirmed.
Rollkit Rollkit currently scrapes blocks out of the DA layer and passes them to the ABCI app for execution, via ApplyBlock. In the future, Rollkit will additionally receive blocks via p2p gossip, prior to their finality. Because of the possibility of being reverted by another block winning the fork-choice rule, end-users should be visually-informed of the finality status of certain parts of the state they're interested in, such as their balance in a wallet.
ABCI App
The blocks passed to the ABCI app via rollkit have to be demarcated somehow as finalized or soft, and the ABCI app needs to be able to revert non-finalized state transitions. Cosmos-SDK contains a versioned / branched blockstore, this could possibly be used or repurposed for this functionality, for example storing a latestFinalizedHeight
integer.
pseudocode:
for {
select {
...
case blockSoftConf := <- softBlockInCh:
if blockSoftConf.height > finalizedHeight {
blockCandidates := getObservedBlocksAtHeight(height)
winner := applyForkChoiceRule(blockCandidates)
// revert the non-finalized part of the chain to right before the height of the block that wins fork-choice
executor.RevertToHeight(blockSoftConf.height - 1)
// apply the block that wins fork-choice
executor.ApplyBlock(winner)
}
}
}