go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

eth, miner: add timeout for building sealing block

Open rjl493456442 opened this issue 3 years ago • 1 comments

This PR adds a timeout mechanism for building sealing block.

Once The Merge is conducted, block has to be prepared in the period of a slot. If we encounter some transactions that perform particularly expensive, instead of spending a lot of time filling the block, we would rather return a block that is not full, but it can be created at the specified time.

The timeout value should be chosen aligned with consensus spec.

TODO

  • [x] Make the timeout configurable via CLI flag

rjl493456442 avatar Jul 26 '22 03:07 rjl493456442

But I believe it could also be triggered by the mainLoop before, which it cannot now?

Ah, so that case is fine: it could be triggered from the mainLoop, but only if we're not actively mining.

			// Apply transactions to the pending state if we're not sealing
			//
			// Note all transactions received may not be continuous with transactions
			// already included in the current sealing block. These transactions will
			// be automatically eliminated.
			if !w.isRunning() && w.current != nil {

If we're not actively mining, it doesn't matter about tuning the resubmit interval.

holiman avatar Sep 21 '22 06:09 holiman

@holiman the recommit interval adjustment can still be triggered in mainLoop whenever we serve the requests for creating new mining block. Specifically in line 553, worker.go. In line 619, this logic will never be triggered since the interruption signal passed is nil. All in all, it's just a code movement shouldn't touch the original logic.

But honestly since we have switched to PoS, I guess we should retire block building logic in miner and can only build block via catalyst.

rjl493456442 avatar Sep 23 '22 05:09 rjl493456442