Uh oh!
There was an error while loading. Please reload this page.
fix: add retry and timeout to create_new_task - #1317
Conversation
This reverts commit 6c3b76c.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
MarcosNicolau
left a comment
There was a problem hiding this comment.
I tested on macos and linux and everything went well. I left some comments for minor improvements.
MauroToscano
left a comment
There was a problem hiding this comment.
Don't bump fee at 0.5 s, nothing in Ethereum gets done in half a second. Use more reasonable constants
MauroToscano
commented
Nov 4, 2024
Add the constants used in the PR, I want to check the mechanism |
avilagaston9
commented
Nov 5, 2024
My bad. I’ve updated the description to include the changes made. Let me know if you’d like me to review anything |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com>
Co-authored-by: Mariano Nicolini <mariano.nicolini.91@gmail.com> Co-authored-by: samoht9277 <totobighouse@gmail.com> Co-authored-by: Urix <43704209+uri-99@users.noreply.github.com> Co-authored-by: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com>
Add retry and timeout to
create_new_taskWarning
This PR requires the deploy of new metrics/dashboards
Motivation
Currently, if the gas price rises abruptly, we don't have a mechanism to abort the task sent by the batcher, causing it to get stuck while waiting for the transaction Receipt.
Description
General Description
bumped_gas_pricebased on the current gas price of the net, the previous used one and the iteration number.bumped_gas_priceto override the previous transaction, aborting the batch inclusion.1using exponential backoff with ausize::MAXnumber of retries until the Receipt is received.Observation: We use an exponential backoff because the timeout is not the only thing that can fail. For example, the
get_gas_pricecall or sending the transaction can fail too.Bump Gas Price Mechanism
plus_per_iteration = GAS_PRICE_INCREMENT_PERCENTAGE_PER_ITERATION * iterationoverride_gas_multiplier = OVERRIDE_GAS_PRICE_PERCENTAGE_MULTIPLIER + plus_per_iteration.bumped_gas_price = gas_price * override_gas_multiplier / PERCENTAGE_DIVIDER.Constants added
transaction_wait_timeout: 36_000 milliseconds (3 blocks)GAS_PRICE_INCREMENT_PERCENTAGE_PER_ITERATION: 5OVERRIDE_GAS_PRICE_PERCENTAGE_MULTIPLIER: 120Additional Changes
http_providerswithbatcher_signersbecause they are needed to sign the cancel transaction.GasEscalatorMiddlewarefrom ourSignerMiddlewareTtype, as we don't want theProviderto bump the created tasks for us.get_gas_priceandget_current_noncefunctions tobatcher/aligned-batcher/src/eth/utils.rs.transaction_wait_timeoutconstant to the batcher config file. This is the configurable time we wait for a transaction to be included in Ethereum on each attempt.How to test
Modify the
create_new_taskfunction inbatcher/aligned-batcher/src/lib.rsto callcreate_new_task_retryablewith a timeout of only one millisecond:Then, run the following:
After some time, you should see the following logs in the batcher:
You can also modify the call to
cancel_create_new_task_retryablein the same way to see the retries while canceling thecreated_task:Type of change
Checklist