go-ethereum/eth/catalyst
Péter Szilágyi 542c861b4f
core/txpool, eth/catalyst: fix racy simulator due to txpool background reset (#28837)
This PR fixes an issues in the new simulated backend. The root cause is the fact that the transaction pool has an internal reset operation that runs on a background thread.

When a new transaction is added to the pool via the RPC, the transaction is added to a non-executable queue and will be moved to its final location on a background thread. If the machine is overloaded (or simply due to timing issues), it can happen that the simulated backend will try to produce the next block, whilst the pool has not yet marked the newly added transaction executable. This will cause the block to not contain the transaction. This is an issue because we want determinism from the simulator: add a tx, mine a block. It should be in there.

The PR fixes it by adding a Sync function to the txpool, which waits for the current reset operation (if any) to finish, and then runs an entire round of reset on top. The new round is needed because resets are only triggered by new head events, so newly added transactions will not trigger the outer resets that we can wait on. The transaction pool would eventually internally do a reset even on transaction addition, but there's no easy way to wait on that and there's no meaningful reason to bubble that across everything. A clean outer reset will at worse be a small noop goroutine.
2024-01-23 20:59:38 +01:00
..
api_test.go eth/catalyst: add timestamp checks to fcu and new payload and improve param checks (#28230) 2024-01-23 16:02:08 +01:00
api.go core/txpool, eth/catalyst: fix racy simulator due to txpool background reset (#28837) 2024-01-23 20:59:38 +01:00
queue.go cmd/geth: implement dev mode for post-merge (#27327) 2023-07-06 04:42:34 -04:00
simulated_beacon_api.go ethclient/simulated: implement new sim backend (#28202) 2024-01-10 16:45:08 +01:00
simulated_beacon_test.go cmd/geth: add support for --dev flag in dumpgenesis (#28463) 2023-11-22 12:08:39 +01:00
simulated_beacon.go core/txpool, eth/catalyst: fix racy simulator due to txpool background reset (#28837) 2024-01-23 20:59:38 +01:00
tester.go cmd, eth: switch the dev synctarget to hash from block (#28209) 2023-09-29 22:11:15 +03:00