-
Notifications
You must be signed in to change notification settings - Fork 21
Reduced size of GAS_CUMULATIVE, GAS_LEFTOVER, REFUND_COUNTER_FINAL, REFUND_COUNTER, REFUND_EFFECTIVE
#841
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
base: master
Are you sure you want to change the base?
Conversation
…EFUND_COUNTER, REFUND_EFFECTIVE
OlivierBBB
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Are there similar changes to apply to the zkASM-ified GAS module ?
letypequividelespoubelles
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why putting i64 where you could have less ? block gas is cap at 2000000000 for linea and tx GAs since Osaka, so ...
txndata/cancun/columns/hub_view.lisp
Outdated
| ( REFUND_EFFECTIVE :i128 ) | ||
| ( GAS_LEFTOVER :i64 ) | ||
| ( REFUND_COUNTER_FINAL :i64 ) | ||
| ( REFUND_EFFECTIVE :i64 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refund is cap by tx ax gas, so i25
Signed-off-by: Lorenzo Gentile <[email protected]>
Signed-off-by: Lorenzo Gentile <[email protected]>
Signed-off-by: Lorenzo Gentile <[email protected]>
Signed-off-by: Lorenzo Gentile <[email protected]>
Signed-off-by: Lorenzo Gentile <[email protected]>
Signed-off-by: Lorenzo Gentile <[email protected]>
Signed-off-by: Lorenzo Gentile <[email protected]>
… types Signed-off-by: Lorenzo Gentile <[email protected]>
| ( REFUND_EFFECTIVE :i128 ) | ||
| ( GAS_LEFTOVER :i32 ) | ||
| ( REFUND_COUNTER_FINAL :i25 ) | ||
| ( REFUND_EFFECTIVE :i25 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Refund field type too small for large transactions
The REFUND_COUNTER_FINAL and REFUND_EFFECTIVE fields are reduced to :i25 (max ~33.5 million), but on Linea the block gas limit is 2 billion. With MAX_REFUND_QUOTIENT of 5, a transaction consuming all available gas could have a refund up to 400 million, which far exceeds what :i25 can represent. The transaction gas cap (EIP-7825 at 2^24) that would justify this size only applies to Osaka, not to cancun, prague, london, or shanghai forks where this change is also applied. This would cause overflow for large transactions.
Additional Locations (2)
| ( REFUND_EFFECTIVE :i64 ) | ||
| ( GAS_LEFTOVER :i32 ) | ||
| ( REFUND_COUNTER_INFINITY :i25 ) | ||
| ( REFUND_EFFECTIVE :i25 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Refund fields use insufficient bit width for values
The REFUND_COUNTER_INFINITY, REFUND_COUNTER_FINAL, and REFUND_EFFECTIVE fields are reduced to :i25 (max ~33.5 million), but with LINEA_BLOCK_GAS_LIMIT at 2 billion, the maximum REFUND_EFFECTIVE value can reach 400 million (gas_used/5 per EIP-3529). Additionally, REFUND_COUNTER_INFINITY receives values from REFUND_COUNTER_NEW which is :i32 in the HUB's shared columns, creating a type mismatch. The 25-bit width is insufficient to hold these potential values and could cause overflow or truncation.
Additional Locations (2)
| ( REFUND_EFFECTIVE :i64 ) | ||
| ( GAS_LEFTOVER :i32 ) | ||
| ( REFUND_COUNTER_INFINITY :i25 ) | ||
| ( REFUND_EFFECTIVE :i25 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Refund columns too small for pre-Osaka forks
The REFUND_COUNTER_INFINITY and REFUND_EFFECTIVE columns are reduced to :i25 (max ~33.5 million), but the i25 size is only valid when EIP-7825 applies (which caps transaction gas at 2^24 ≈ 16.7M). EIP-7825 only applies to Osaka fork. For pre-Osaka forks (London, Shanghai, Cancun, Prague), transaction gas can reach LINEA_GAS_LIMIT_MAXIMUM = 2 billion, making REFUND_EFFECTIVE potentially up to 2 billion and refund_limit up to 400 million - both exceeding the i25 capacity and causing overflow.
Note
Reduces widths of gas-related fields across hub/txndata schemas and updates the gas zkasm to 32-bit types.
gasingas/gas.zkasmto useu32forGAS_COST,GAS_ACTUAL, andtmp.GAS_ACTUAL,GAS_COST->i32;GAS_LEFTOVER->i32;REFUND_COUNTER_INFINITY/REFUND_COUNTER_FINAL/REFUND_EFFECTIVE->i25;GAS_CUMULATIVE->i32.shanghai,london,cancun,osaka,pragueinhub/*/columns/*.lispandtxndata/*/columns*.lisp.Written by Cursor Bugbot for commit e84d451. This will update automatically on new commits. Configure here.