-
Notifications
You must be signed in to change notification settings - Fork 746
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
Dynamic gas value for special opcodes #593
Comments
Hm, I think the easiest way we could do this is to measure remaining gas after the step, and subtract it from the previous gas remainder. In future we should have a dynamic gas calculator for each of the opcodes and need it, and we can return the result of this function for the step event. |
This looks fine for time being. |
Can a timeline be suggested for this? We have multiple issues depending on it. |
I guess you can already do what I suggested. Each step event has the |
Should we implement this as a temporal fix? If we don't give a solution and people start doing this themselves, it would be hard to change it later. What do you think @s1na @holgerd77 ? BTW, @cgewecke you may run into this same issue. |
I was trying to implement this and realized that it's not possible to add this info to the We emit @Aniket-Engg can you tell us more about your use case so we can have a better understanding of what an |
@alcuadrado use case is to simply calculate the gas used in the execution of an opcode |
That's a good point. We could still compute the dynamic gas before executing the opcode. Opcodes that have a dynamic gas would need a pure function that given the input data (and probably some other parts of state) return needed gas. Geth is doing the same: But this is a bigger change than adding an |
I agree with this. I can implement it, but I'm not sure what other info that event should have. |
I think if there are not any other changes available to list in |
I suggested this approach but I just it needs special handling around CALL/CREATE boundaries (i.e. when a new call frame with a different gasLimit can be started). Documenting for future reference. Also I guess it'd be nice to support this in the VM. |
Will close in favor of #1169 (implementation in progress). |
At present, on event 'step', data for the opcode is getting fetched from the file statically here. but for some opcodes like
SSTORE
, gas calculation is done dynamically.This would be great if opcode data can return dynamically calculated fee for such opcodes.
CC: @yann300
The text was updated successfully, but these errors were encountered: