Skip to content

Conversation

@lorenzogentile404
Copy link
Contributor

@lorenzogentile404 lorenzogentile404 commented Dec 1, 2025

Note

Reduces widths of gas-related fields across hub/txndata schemas and updates the gas zkasm to 32-bit types.

  • Gas execution:
    • Update gas in gas/gas.zkasm to use u32 for GAS_COST, GAS_ACTUAL, and tmp.
  • Schema changes (hub/ and txndata/*)*:
    • Narrow gas-related columns: GAS_ACTUAL, GAS_COST -> i32; GAS_LEFTOVER -> i32; REFUND_COUNTER_INFINITY/REFUND_COUNTER_FINAL/REFUND_EFFECTIVE -> i25; GAS_CUMULATIVE -> i32.
    • Applied across forks shanghai, london, cancun, osaka, prague in hub/*/columns/*.lisp and txndata/*/columns*.lisp.

Written by Cursor Bugbot for commit e84d451. This will update automatically on new commits. Configure here.

@lorenzogentile404 lorenzogentile404 linked an issue Dec 1, 2025 that may be closed by this pull request
OlivierBBB
OlivierBBB previously approved these changes Dec 1, 2025
Copy link
Collaborator

@OlivierBBB OlivierBBB left a 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 ?

Copy link
Collaborator

@letypequividelespoubelles letypequividelespoubelles left a 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 ...

( REFUND_EFFECTIVE :i128 )
( GAS_LEFTOVER :i64 )
( REFUND_COUNTER_FINAL :i64 )
( REFUND_EFFECTIVE :i64 )
Copy link
Collaborator

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

( REFUND_EFFECTIVE :i128 )
( GAS_LEFTOVER :i32 )
( REFUND_COUNTER_FINAL :i25 )
( REFUND_EFFECTIVE :i25 )
Copy link

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)

Fix in Cursor Fix in Web

( REFUND_EFFECTIVE :i64 )
( GAS_LEFTOVER :i32 )
( REFUND_COUNTER_INFINITY :i25 )
( REFUND_EFFECTIVE :i25 )
Copy link

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)

Fix in Cursor Fix in Web

( REFUND_EFFECTIVE :i64 )
( GAS_LEFTOVER :i32 )
( REFUND_COUNTER_INFINITY :i25 )
( REFUND_EFFECTIVE :i25 )
Copy link

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.

Additional Locations (2)

Fix in Cursor Fix in Web

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.

Type correction in TXN_DATA

4 participants