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

throw outOfGas error when gaslimit too low #899

Merged
merged 5 commits into from
Dec 7, 2023

Conversation

shunjizhan
Copy link
Collaborator

@shunjizhan shunjizhan commented Dec 6, 2023

Change

throws outOfGas error when:

  • gas param is too small when calling eth_call or eth_estimateGas RPC
  • gasLimit override is too small when sending transaction

also cleaned up getTransactionRequest, it now has more concise logic, and will auto transform gas to gasLimit if present

fix #895

Test

added tests for all cases mentioned above

@shunjizhan shunjizhan changed the title throw outOfGas err when gaslimit too low throw outOfGas error when gaslimit too low Dec 6, 2023
@shunjizhan shunjizhan requested a review from zjb0807 December 6, 2023 14:42
@shunjizhan shunjizhan marked this pull request as ready for review December 6, 2023 14:42
@@ -826,7 +822,7 @@ export abstract class BaseProvider extends AbstractProvider {
const api = at ? await this.api.at(at) : this.api;

const { from, to, gasLimit, storageLimit, value, data, accessList } = callRequest;
const estimate = true;
const estimate = false;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cool, I think I changed that when randomly trying things out lol

@shunjizhan shunjizhan merged commit 8aae21f into master Dec 7, 2023
11 checks passed
@shunjizhan shunjizhan deleted the throw-error-when-gas-low branch December 7, 2023 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eth_estimateGas should revert with small gasLimit
2 participants