forked from axieinfinity/ronin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: miner does not mine its inturn block (axieinfinity#268)
We have an issue that a miner A is inturn for block 10. At block 9, due to a node is down, miner A mines the out of turn block 9 and broadcast to the network. As a result, miner A cannot mine block 10 due to recently signed rule. However, at block 9, there is another miner B that mines block 9' and this block is accepted by most of nodes in the network. Then based on block 9', block 10 is mined by miner C and there is a slash transaction for miner A because on network view block 9 is mined by miner B not miner A. Miner A receives the chain 9' - 10 and reorgs to that chain. In theory, miner can mine the block 10' which creates a canonical has greater difficulty. This drops the block 10 and the slash transaction. However, currently, miner tries to mine block 11 instead of reproducing new block 10. This leads to miner is slashed even though the node is running well. To fix this issue, when mining, we try to go backward on the canonical chain to find whether we can produce a better chain. If we cannot find way to create a better chain, we start mining based on the current head block same as current implementation. Fixes: axieinfinity#266
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters