-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, have some questions though (see comment in this PR)
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_flush
is 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 ethereum/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::doWork
works - it checks for new transactions in the Transaction Queue, then checks whether it should start sealing current pending block. Ifeth_sendTransaction
&test_mineBlocks
calls happen in-between these two checks, the mined block will not contain the transaction)So quick workaround solution without complicating
Client
logic further could be to calleth_flush
right aftereth_sendTransaction
but beforetest_mineBlocks
- that will runClient::doWork
once, 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.