Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Support undefined fulfillment gas limit #481

Merged
merged 3 commits into from
Oct 9, 2023

Conversation

acenolaza
Copy link
Contributor

Closes #447

I'm basically doing the following:

  1. check if fulfillmentGasLimit exist in the config
  2. if it doesn't then estimate the gas limit
    2.1. estimate based on Api3ServerV1.multicall (tryMulticall estimate is usually wrong). If successful then add an extra since tryMulticall is a bit more expensive
    2.2. if previous failed, estimate based on a single beacon update using dummy data (for beacon set update we add up the estimate of updating all beacon plus the beaconSet)
    2.3. if both previous failed then just return a hardcoded gas limit of 2_000_000

This is still a draft because I need to fix/add some tests and do some minor cleanup/refactor

@acenolaza acenolaza self-assigned this Sep 22, 2023
retries: 1,
});
if (estimateGasMulticall.success) {
// Adding a extra 10% because multicall consumes less gas than tryMulticall
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came here to suggest adding a % overhead 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that worries me now is that these changes should be an improvement over the fulfillmentGasLimit magic number but I'm now adding a different magic number which might even be configurable by chain 😅
On tests against the local hardhat network even 1% was enough but I added 10% just to be more confident it will be enough on all chains.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I very much doubt this will be a problem

…ted to the beaconIds passed to updateBeaconSetWithBeacons
@acenolaza acenolaza marked this pull request as ready for review September 25, 2023 21:13
@acenolaza
Copy link
Contributor Author

@bdrhn9 @aquarat friendly reminder to look at this whenever you guys have some time 🙏🏻 Thanks

Copy link
Contributor

@bdrhn9 bdrhn9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's well-designed and LGTM 🔥. Because I was planning to take vacation, I'd like to focus on tasks onnodaryio and reblokio organizations. So sorry for really late review.

src/utils.ts Outdated Show resolved Hide resolved
@acenolaza
Copy link
Contributor Author

It's well-designed and LGTM 🔥. Because I was planning to take vacation, I'd like to focus on tasks onnodaryio and reblokio organizations. So sorry for really late review.

No worries and thanks for checking this PR out @bdrhn9 🙏🏻

@acenolaza acenolaza merged commit fe9e0f0 into main Oct 9, 2023
10 checks passed
@acenolaza acenolaza deleted the 447-estimate-gas-multicall-updates branch October 9, 2023 20:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support undefined fulfillment gas limit
3 participants