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

core: ensure increasing BlockGen withdrawal index

Open Rjected opened this issue 2 years ago • 1 comments

Previously, during chain generation, AddWithdrawal would look at parent blocks to determine what the proper withdrawal index is when adding a withdrawal. This was flawed because if there were no withdrawals in parent blocks, and one block added multiple withdrawals, those withdrawals would be given the same index.

The AddWithdrawal method is changed, setting the index based on the withdrawal with the highest index in the current block, if there are any other withdrawals.

A test is added, derived from the withdrawals branch of rpctestgen, making sure same-block withdrawals have increasing indexes.

Rjected avatar Feb 22 '23 02:02 Rjected

hmmm, when running the test TestHeaderInsertion individually, it passes, but when running core tests with the new test, it fails. removing the test I added also causes TestHeaderInsertion to pass, wondering what could cause this

Rjected avatar Feb 22 '23 03:02 Rjected

🚀 thank you for the reviews and followup work!

Rjected avatar Feb 28 '23 15:02 Rjected