Skip to content
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

Use gas limit for tenderly simulation #205

Merged
merged 3 commits into from
May 18, 2022
Merged

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented May 18, 2022

Access list gas_used calculation uses Tenderly simulation API.
However, a bug was noticed: https://logs.gnosis.io/goto/35666490-d6aa-11ec-89c6-1d03c10630c7

Value for gas_used was abnormal because sometimes, when transaction reverts, the EVM spends all the remaining gas up until the provided transaction gas limit. Since we did not set gas limit when calling Tenderly API, calculated gas_used ended up being a high number.

This PR adds the gas limit for cases when Tenderly API is used for calculation of the gas_used. For other cases, for example, when Tenderly API is used for access list calculation, gas limit is irrelevant, so None is provided in that case.

Test Plan

Unit test simulate_before_after_access_list_test passes.

@sunce86 sunce86 requested a review from a team as a code owner May 18, 2022 13:06
@@ -171,6 +171,7 @@ pub async fn simulate_before_after_access_list(
from,
input: transaction.input.0,
to,
gas: Some(transaction.gas.as_u64()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it also required to supply the gas price here?
I assume these are possible parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gas price is irrelevant for both access list and gas used calculations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, this may be important. See gnosis/gp-v2-services#883

If its not too much work, I would also include the gas price here to prevent simulation issues ☝️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, interesting. The only thing I knew about is that we had some differences in transaction simulation when the sender does not have enough funds for transaction fee.
Anyway, for our piece of mind, let's add it: #207

@sunce86 sunce86 enabled auto-merge (squash) May 18, 2022 13:27
@sunce86 sunce86 merged commit aa29117 into main May 18, 2022
@sunce86 sunce86 deleted the use-gas-limit-with-tenderly branch May 18, 2022 13:30
@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2022
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.

3 participants