-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/block rejections timeout heuristic #5731
Conversation
@obycode I have refactored the logic to keep the old behaviour and just check for change in the rejections amount. Combined with timeout checks i got no more stalls while waiting for the condvar |
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.
Thanks!
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.
Mainly requesting a change to the integration test, because you can simplify the code a lot.
Nice work on this! The miner-related code is very straightforward.
…ctions to Counters struct
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.
LGTM, just had a minor comment to help remove some type casting.
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.
👍
Description
This patch modifies the logic of miner timeout while waiting for signer confirmations/rejections.
The current behaviour is to wait indefinitely until the threshold is reached (for both rejections and confirmations) or the burnchain tip changes or the block is found in the staging db.
The new behaviour adds heuristic for introducing a timeout (instead of waiting indefinitely and in addition to the threshold checks) that decreases based on the amount of rejections.
Note that if the initial timeout (the one set at the start of the cycle) expires without having rejections, the old behaviour of retrying from scratch is still valid. (eventually the other mechanisms, like the change of the burnchain tip will kick in as before)
The timeout steps can be configured from the config file:
That configure the system to wait 100 seconds when there are 0% rejections and 200 when there are 15% rejections. The user is free to specifies more steps:
The default is:
Applicable issues
Additional info (benefits, drawbacks, caveats)
Note that the original code was set to trigger the conditional variable of the waiting cycle only when reaching the threshold (in confirmations or rejections). Now it is triggered at every update to move the logic of timeout in the block proposal final part ( get_block_status() )
The integration test is based on a test only atomic counter (added to the Counters struct) that gets updated with computed timeout value based on rejections.
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml