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

Support out of gas execution #7

Closed
cleanunicorn opened this issue Apr 22, 2022 · 0 comments · Fixed by #11
Closed

Support out of gas execution #7

cleanunicorn opened this issue Apr 22, 2022 · 0 comments · Fixed by #11
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@cleanunicorn
Copy link
Owner

cleanunicorn commented Apr 22, 2022

Context

An out-of-gas execution is useful for other people trying to mock contract implementations.

Details

A way of doing this might be executing an invalid bytecode that forces all gas to be used up. This can be achieved by using an assert(false) natively in Solidity without any complicated loop/assembly/precompile.

EIP-141 defines the 0xfe as the standard for invalid opcode that uses up all the gas and reverts execution.

More info is also in wolflo's evm-opcodes repo.

Alternatives

Gnosis implements out-of-gas execution mocking by doing low-level calls to EC (precompile 0x6):

https://github.com/gnosis/mock-contract/blob/b0f735ddc62d5000b50667011d69142a4dee9c71/contracts/MockContract.sol#L300-L308

Security concerns

Still considering the implications of this new feature.

Has the feature been requested before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant