Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Gas control tweaks #552

Closed
wants to merge 10 commits into from
Closed

Gas control tweaks #552

wants to merge 10 commits into from

Conversation

edfelten
Copy link
Contributor

This makes some changes to simplify the semantics of gas, and eliminate some non-intuitive behaviors.

First, when a sub-tx finishes, it verifies that the sub-tx's unused gas would be enough to pay for the net storage allocation done by the sub-tx. If not, it reverts the sub-tx, as if it had run out of gas. This ensures the invariant that a sub-tx can't deplete its parent's gas by more than the gas amount given to the sub-tx.

Second, the EVM GAS instruction now fully accounts for the storage cost that the current tx would incur if it finished immediately. If the current tx has been a net allocator of storage, the number of cells allocated, multiplied by the current ArbGas cost per storage cell, is subtracted from the remaining gas, to determine the value returned by the GAS instruction. If the result would be negative, the tx is immediately treated as out-of-gas. This causes the GAS instruction to have more intuitive behavior.

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2021

Codecov Report

Merging #552 (99c0c71) into london-hardfork (a38f1b5) will decrease coverage by 0.11%.
The diff coverage is 82.69%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           london-hardfork     #552      +/-   ##
===================================================
- Coverage            76.85%   76.73%   -0.12%     
===================================================
  Files                   84       84              
  Lines                29358    29395      +37     
===================================================
- Hits                 22562    22557       -5     
- Misses                6796     6838      +42     
Impacted Files Coverage Δ
arb_os/evmCallStack.mini 83.11% <69.23%> (-0.22%) ⬇️
arb_os/evmOps.mini 74.43% <72.72%> (-0.08%) ⬇️
arb_os/gasAccounting.mini 81.64% <92.30%> (-0.08%) ⬇️
arb_os/chainParameters.mini 80.48% <100.00%> (ø)
arb_os/retrybuffer.mini 81.18% <100.00%> (ø)
src/compile/typecheck.rs 64.66% <0.00%> (-0.98%) ⬇️
src/run/emulator.rs 53.90% <0.00%> (-0.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a38f1b5...99c0c71. Read the comment docs.

@rachel-bousfield
Copy link
Contributor

Our gas-charging model has evolved over time via other PRs, so this one is out of date with our current thinking

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit max increase in retryable cost Auto-redeem doesn't work with fees disabled
3 participants