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

Limit gas on contract call #240

Open
kroggen opened this issue Aug 4, 2023 · 1 comment
Open

Limit gas on contract call #240

kroggen opened this issue Aug 4, 2023 · 1 comment
Labels
feature New feature or request V4 To be released on hardfork V4

Comments

@kroggen
Copy link
Member

kroggen commented Aug 4, 2023

When a contract calls another one, it should be able to specify a limit of gas that the called contract can use

  contract.call.gas(123)(address, function_name, args)

This feature appears to be partially implemented. It can be reviewed to check for viability.

@kroggen kroggen added the feature New feature or request label Aug 4, 2023
@kroggen
Copy link
Member Author

kroggen commented Sep 23, 2023

Probably the above is not required, if #239 is implemented it can be done like this:

local gas_before = contract.gasLeft()
contract.call(address, function_name, args)
local used_gas = gas_before - contract.gasLeft()
assert(used_gas <= 12500, "contract call used too much gas: " .. tostring(used_gas))

@kroggen kroggen added the V4 To be released on hardfork V4 label Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request V4 To be released on hardfork V4
Projects
None yet
Development

No branches or pull requests

1 participant