-
Notifications
You must be signed in to change notification settings - Fork 342
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
refactor(batcher): retry function #1273
Conversation
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.
This provider is using main rpc instead of fallback https://github.com/yetanotherco/aligned_layer/pull/1273/files#diff-fb54942eba81c272160ef10dfb2972fd0a6de56d45ed87c98ca1a65b3b2dd29bR126-R127
d556a33
to
7da5d3e
Compare
Changes to gas cost
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
39fb306
to
7da5d3e
Compare
Co-authored-by: avilagaston9 <[email protected]> Co-authored-by: samoht9277 <[email protected]> Co-authored-by: Urix <[email protected]>
Motivation
This PR implements the
retry_function()
, which receives a function to be retried using exponential backoff.Description
Modifies the batcher to use
retry_function()
in the following calls:user_balance_is_unlocked
get_user_nonce_from_ethereum
get_user_balance
get_gas_price
s3::upload_object
listen_new_blocks()
Stops using our forked version of
ethers-rs
since is not longer needed.Observations
The calls within the
Batcher::new()
function are not modified since in case of failure the program will panic (changes can be implemented if needed).Also
create_new_task
was left for a different PR.All modified calls use the following default parameters:
DEFAULT_MIN_DELAY = 500
DEFAULT_MAX_TIMES = 5
DEFAULT_FACTOR = 2.0
How to Test
Now try killing the container running the s3 service. You should see 5 warnings separated by exponential time:
There are also some test in
batcher/aligned-batcher/src/retry.rs
You can also add a
sleep()
before the function you want to test in the batcher, and then kill Anvil before the call happens.