-
Notifications
You must be signed in to change notification settings - Fork 388
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
fix: multicall return gas used in case of failure #534
Merged
jsy1218
merged 4 commits into
main
from
jsy1218/multicall-return-gas-used-in-case-of-failure
Apr 17, 2024
Merged
fix: multicall return gas used in case of failure #534
jsy1218
merged 4 commits into
main
from
jsy1218/multicall-return-gas-used-in-case-of-failure
Apr 17, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cgkol
approved these changes
Apr 17, 2024
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.
When are we planning on doing this?
so that routing-api can calculate that the difference between gasUsed and gasLimit may be small enough to be due to out of gas
Sometime today. I have the routing-api draft PR, just need to add some test |
d0677c4
to
83f4374
Compare
Merged
jsy1218
added a commit
that referenced
this pull request
Apr 17, 2024
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) Release #534
jsy1218
added a commit
to Uniswap/routing-api
that referenced
this pull request
Apr 17, 2024
Once SOR returns per-quote-call gasUsed and gasLimit (Uniswap/smart-order-router#534), then routing-api can calculate per-quote call failure is due to likely out-of-gas error. I was deciding between using gasUsed and gasLimit vs the encoded error from the return data, but the [simulation](https://www.tdly.co/shared/simulation/39de04bb-d794-43b0-aed2-8ea31957ca77) shows me that the encoded error from the return data might not be accurate. For this simulation, the error indicates [SLP](https://docs.uniswap.org/contracts/v3/reference/error-codes), which is not true: ``` cast 4byte-decode 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000353504c0000000000000000000000000000000000000000000000000000000000 1) "Error(string)" "SPL" ``` Now testing coverage added.
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) Release #534
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * log quote success rate metric
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * 3.28.11
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) Release #534
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * log quote success rate metric
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * 3.28.11
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 9, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * log optimistic quote metrics prefix in onchain quoting * fix prettier * add underscore metrics prefix * use provider config
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) Release #534
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * log quote success rate metric
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * 3.28.11
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
* fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * log optimistic quote metrics prefix in onchain quoting * fix prettier * add underscore metrics prefix * use provider config
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
* return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit
jsy1218
added a commit
that referenced
this pull request
May 10, 2024
#570) * fix: multicall return gas used in case of failure (#534) * return gas used from multicall in case of a failed quote * fix compiling error * add target contract address to the failed multicall debug log * also return gas limit * onchain quoter batch param differed by optimistic cached routes * fix prettier onchain quoter * fix build
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feature
What is the current behavior? (You can also link to an open issue here)
Meanwhile we are comparing the current quoter quotes vs new view-only quoter quotes in prod in shadow sampling for mainnet at 1%, we encounter a case, where we have some quotes that are failing due to the out-of-gas from multicall (e.g. this simulation), but from routing-api side, we don't have a good way to programmatically determine this is the case, within compareQuotes.
This is the case where some quotes from multicalls fail, but overall success rate is still above the threshold. This is different from the entire multicall failures due to out of gas. In that case, on-chain quote provider will throw ProviderOutOfGasError, and routing-api can generalize to where currentQuoterSucceeded = false
What is the new behavior (if this is a feature change)?
Within SOR, we will return both gasUsed and gasLimit per call from the multicalls, so that routing-api can calculate that the difference between gasUsed and gasLimit may be small enough to be due to out of gas.
Other information:
This works in tendom with routing-api changes.