stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 667 forks source link

Nakamoto miner building from not the latest parent block #5145

Closed obycode closed 3 weeks ago

obycode commented 3 weeks ago

Running in naka-3 with branch fix/5136-signer-block-state-tracking (as of commit 3047b5f10f9aa1e0ea0464433956ff6455574122), I am seeing some strange behavior from the Nakamoto miner. In the first tenure of epoch 3.0, burn block 131, the canonical tip is block 128, but the miner is attempting to reorg this block and mine another block 128. The signers correctly reject these block proposals, so we end up with no blocks in tenure 131. Complete logs can be found here.

Miner Logs:

09/04/2024, 10:20:19.201 PM stacks-blockchain:miner.eb2ccfb4b40488c3f0e17f9b51d19f4001ff3196f2eb03b1244f01ba861f0f4f - Error while gathering signatures: SignersRejected. Will try mining again.
09/04/2024, 10:20:17.361 PM stacks-blockchain:miner.eb2ccfb4b40488c3f0e17f9b51d19f4001ff3196f2eb03b1244f01ba861f0f4f - SignCoordinator: beginning to watch for block signatures OR posted blocks.
09/04/2024, 10:20:17.206 PM stacks-blockchain:miner.eb2ccfb4b40488c3f0e17f9b51d19f4001ff3196f2eb03b1244f01ba861f0f4f - Miner: Assembled block #28 for signer set proposal: 394338327c7e10fc5580f1551e923632d0af51fa9b6a361cf58c5d2b7ed03b57, with 2 txs
09/04/2024, 10:20:17.121 PM stacks-blockchain:miner.eb2ccfb4b40488c3f0e17f9b51d19f4001ff3196f2eb03b1244f01ba861f0f4f - Miner: mined Nakamoto block

Signer logs:

09/04/2024, 10:20:18.110 PM signer:signer_runloop:30000 - Cycle #6 Signer #2: Block proposal invalid
09/04/2024, 10:20:18.110 PM signer:signer_runloop:30000 - Miner is not building off of most recent tenure, but a tenure they attempted to reorg has already mined blocks, and there is no local knowledge for that tenure's block timing.
09/04/2024, 10:20:17.995 PM signer:signer_runloop:30000 - Most recent miner's tenure does not build off the prior sortition, checking if this is valid behavior
09/04/2024, 10:20:17.673 PM signer:signer_runloop:30000 - Cycle #6 Signer #2: received a block proposal for a new block. Submit block for validation. 
09/04/2024, 10:20:17.133 PM signer:signer_runloop:30000 - Cycle #6 Signer #2: Received a new burn block event for block height 131
jferrant commented 3 weeks ago

This seems to be due to the miner submitting an invalid block commit built off of 129 and not successfully rbf'ing it before 130 is mined. Therefore it always keeps trying to rebuild off the wrong commit and signers correctly reject it.