BOXFoundation / boxd

Blockchain for BOX Payout
MIT License
40 stars 10 forks source link

BFT requires three-phase commit #275

Open LeonLi000 opened 5 years ago

LeonLi000 commented 5 years ago

We currently use the dpos+ BFT consensus to confirm our block. We need a three-phase commit to fully commit a block, otherwise there will be a problem when reorganization occurs.

LeonLi000 commented 5 years ago

Why does Pbft have to submit in three stages?

If a small number of people reach the commit stage and think that a block is irreversible, most people don't receive enough irreversible messages. If there is a revert later, it will be a problem.

Two nodes think that the block is irreversible, but at this time most other nodes do not agree. If the next block reverts, the two nodes that are irreversible cannot be reverted.

The irreversible node of the block is divided into two types of nodes:

  1. The miner node can modify the irreversible state of the block locally after confirming the bft two-stage.

  2. The ordinary node modifies the irreversible state of the local block through the irreversible information of the block broadcast by the miner node.

Why can a miner node not modify the irreversible state of a block by the irreversible information of the block broadcast by the miner node? Because there is no bft two-stage confirmation, it is impossible to confirm that most nodes receive enough irreversible messages.

After Node A finishes the 5th block, Node B does not dare to do evil. He does not dare to deliberately not accept the 5th block of Node A, because Node B cannot determine whether the 5th block of Node A is already on the other node. Reach an irreversible state. The hidden problem here is: If the fifth block of node A has reached the lib state, but node B does not receive the fifth block of node A, node B will not be able to block in its outbound cycle because it Can't revert the fifth block of node A