Improve eth_flush performance by disabling wait in Client::doWork#5547
Improve eth_flush performance by disabling wait in Client::doWork#5547
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5547 +/- ##
=========================================
+ Coverage 61.89% 61.9% +<.01%
=========================================
Files 344 344
Lines 28757 28757
Branches 3267 3267
=========================================
+ Hits 17800 17802 +2
+ Misses 9787 9785 -2
Partials 1170 1170 |
|
@gumb0 Since this only impacts This implies that
Another possible approach would be to parameterize the wait in |
Correct
Good point, I think
We can't just remove
It doesn't look useful to me, it's just the sleep in the very end of the method. You could do this sleep on the calling side if you need it. ... Now when I think of alternative approaches, I think the better way to flush would be to wait until the Transaction Queue is empty, and all transactions are included into the pending block (it's basically what soltest ended up doing for now on their side) |
eth_flushis a non-standard / not documented method, I don't know for sure why it was created, but it seems to be suitable workaround for the problems Solidity team was having lately running soltest+aleth on CI argotorg/solidity#6457Their problem basically boils down to
eth_sendTransaction, followed bytest_mineBlocks(1)doesn't guarantee that the submitted transaction will end up included in the mined block.(The reason is the way
Client::doWorkworks - it checks for new transactions in the Transaction Queue, then checks whether it should start sealing current pending block. Ifeth_sendTransaction&test_mineBlockscalls happen in-between these two checks, the mined block will not contain the transaction)So quick workaround solution without complicating
Clientlogic further could be to calleth_flushright aftereth_sendTransactionbut beforetest_mineBlocks- that will runClient::doWorkonce, which should push new transaction from Transaction Queue to the pending block.This PR disables 1 second sleep in the end of
Client::doWork(when called frometh_flush) which looks unnecessary for this case and is slowing down Solidity tests significantly.