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

Fix(rpc): Estimate gas properly estimates contract deployments #118

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

birchmd
Copy link
Member

@birchmd birchmd commented Dec 22, 2023

The primary purpose of this PR is the fix in engine/src/gas.rs. It fixes a bug where eth_estimateGas was incorrectly interpreting requests missing the to field as requests with "to": "0x00". In the EVM, transactions to the zero address are calls whereas transactions without any to field are contract deployments -- this distinction is very important.

Additionally, this PR changes the eth_estiamteGas response to add 33% to the value it computes. This gives some buffer in case the on-chain transaction consumes more gas than the local simulation.

This PR also includes a test for this fix, which the bulk of the newly added lines of code.

@birchmd birchmd added the bug Something isn't working label Dec 22, 2023
Copy link
Collaborator

@spilin spilin left a comment

Choose a reason for hiding this comment

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

LTGM!

@birchmd birchmd merged commit e65e472 into main Dec 27, 2023
6 checks passed
@birchmd birchmd deleted the fix/birchmd/estimate-gas branch December 27, 2023 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants