-
Notifications
You must be signed in to change notification settings - Fork 622
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 Compute Costs calculation when reaching gas limit #8908
Comments
I'm interested in stabilizing it against 1.34 (happens in 2 weeks?), so I can help if needed. |
I think it will be cleaner to implement compute costs directly in the gas counter. This would mean modifying places that call |
Sounds like potentially a lot of work but yeah if it's easy enough let's go for this.
Thinking about this for a while, I feel like fractional counters would be rather messy. Mostly because the profile data becomes less intuitive and profile-using code would become more complicated. Finally, we can also consider making a small protocol change (presumably without NEP) and change how we account for overflowed gas. Since the code follows the principle "burn gas before taking action" it would seem fine to not burn the gas of that last step at all. (Refund it instead.) This would generally simplify the gas logic and help us in this instance. I have no strong opinion on which solution is the best here... I wish gas wasn't as complicated as it is :) |
This is a solution to #8908. Now when we try to prepay the gas for some operation and run into the gas limit, both the gas and compute usage for that operation will be paid partially, where compute cost is calculated as `gas_burnt / gas_cost * compute_cost`.
This is fixed with #8914 |
This PR re-introduces changes from #8805 together with #8892 after fixing #8908: The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s. This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
This is a solution to #8908. Now when we try to prepay the gas for some operation and run into the gas limit, both the gas and compute usage for that operation will be paid partially, where compute cost is calculated as `gas_burnt / gas_cost * compute_cost`.
This PR re-introduces changes from #8805 together with #8892 after fixing #8908: The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s. This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
This PR re-introduces changes from #8805 together with #8892 after fixing #8908: The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s. This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
This PR re-introduces changes from #8805 together with #8892 after fixing #8908: The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s. This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
This PR re-introduces changes from #8805 together with #8892 after fixing #8908: The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s. This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
This is a solution to #8908. Now when we try to prepay the gas for some operation and run into the gas limit, both the gas and compute usage for that operation will be paid partially, where compute cost is calculated as `gas_burnt / gas_cost * compute_cost`.
This PR re-introduces changes from #8805 together with #8892 after fixing #8908: The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s. This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
We needed to revert Compute Costs calculation during receipts processing because it was inconsistent with a burnt gas estimate. Incorrect accounting happens when as a part of the chunk we have a function call that runs out of gas. See this test for a concrete example: dfc0bce.
This happens because the compute costs are currently based on the gas profiling information which deviates from the burnt gas when function call reaches one of the gas limits (
prepaid_gas
ormax_gas_burnt
) and we need to cap burnt gas to honor these limits.To resolve this we either need to make profiles account for that limit, or we need to calculate compute cost directly in the gas counter.
The text was updated successfully, but these errors were encountered: