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

PassAll gas option for program to program calls #1417

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

iFrostizz
Copy link
Contributor

@iFrostizz iFrostizz commented Aug 20, 2024

Closes #1184

Create a new Gas type that replaces the current alias by an enum that can either be PassAll or Units(NonZeroU64). The new PassAll works around the current way of spending gas, namely calling ConsumeFuel with the passed Fuel parameter and refunding any unused gas by calling AddFuel after the execution.

Copy link
Contributor

@samliok samliok left a comment

Choose a reason for hiding this comment

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

I think this PR's functionality is important but I don't think a Gas enum is the best way to do it. It seems much more intuitive to have gas be a field of context. This way we can keep the u64 type(which is nice for dev experience and contract readability) and also have access to the actual amount of gas via the context.

@iFrostizz
Copy link
Contributor Author

Good point @samliok ! Thanks

@iFrostizz
Copy link
Contributor Author

iFrostizz commented Aug 22, 2024

Actually I'm not sure if that's totally correct. We already have the remaining_fuel method in the implementation of Program but it's not gonna work because it's the full amount of gas is passed and there isn't really any way to predict how much is the external call going to spend (which is the point of this PR) so essentially we want a placeholder that does that for us, which would pass remaining_fuel() - external_call_fuel_cost

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.

Pass all gas parameter in ExternalCallContext
2 participants