Skip to content
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

Add gas fees for new chains #7635

Closed
wants to merge 27 commits into from
Closed

Conversation

Hosuke
Copy link
Collaborator

@Hosuke Hosuke commented Feb 8, 2025

Development notes here:


Abstract's gas fee calculation includes:
L2 execution gas: L2_gas_units * L2_gas_price
Batch overhead gas: L1_base_fee * txn_size + K (where K is a constant for proving costs)
Total = L2_execution + overhead_gas


[OP] Boba Network is an Optimistic Rollup chain that has some specific gas fee considerations. Boba follows these key principles for gas fees:

  • Boba's gas price updates every 10 minutes based on Ethereum L1 gas prices with smoothing
  • The maximum percentage change from one price to another is capped at 5%
  • Boba supports custom fee tokens, allowing chain operators to use tokens other than ETH for gas fees
  • Like other Optimistic Rollups, Boba has L1 data costs that need to be considered

[OP] Ink is an Ethereum Layer 2 blockchain built on the Optimism OP Stack (Superchain) designed to be the house of DeFi for the Superchain.

As a Superchain L2, the fee for each transaction on Ink has two components:
1. An execution fee for the chain itself (L2 execution fee)
2. A security fee that helps secure the L2 by publishing L2 transactions to Ethereum (L1 data fee)


[OP] Every World Chain transaction consists of two costs:
1. An L2 (execution) fee for executing transactions on the chain itself
2. An L1 (security) fee that covers the estimated cost of publishing the transaction data on Ethereum


[Arb] Corn
As an Arbitrum Orbit chain, Corn's gas fee structure consists of four main components:

    1. l2BaseFee: Fees paid to execute transactions on the Orbit chain itself. This covers the computational
       costs of running the chain's transactions and state changes.
    
    2. l2SurplusFee: Additional surplus fees charged during periods of network congestion, similar to
       Ethereum's priority fees. These help manage network demand and prioritize transactions.
    
    3. l1BaseFee: Fees paid to cover the cost of posting settlement transactions to the parent chain
       (either Ethereum or Arbitrum One). This ensures data availability and security.
    
    4. l1SurplusFee: An additional surplus fee that can be configured to award extra fees to the batch
       poster for ensuring timely inclusion of transactions.

[Arb] Nova's gas fee structure includes:

    1. L1 Data Costs: Fees paid to cover the cost of posting data to Ethereum. These are significantly lower
       than regular Arbitrum due to the DAC model, which only posts small proofs to L1 rather than all transaction data.
    
    2. L2 Execution Costs: Fees paid for computation on the Nova chain itself, which uses a gas pricing mechanism
       similar to Arbitrum One but with a lower base fee (starting at 0.01 gwei).
    
    3. Fallback Mechanism: In case the DAC fails to make data available, Nova includes a fallback mechanism
       that leverages Ethereum's mainnet for data storage, which would increase fees but ensure system security.

Flare's gas fee mechanism follows an Ethereum-compatible model with some important distinctions:

    1. Gas Price: Users set this fee for each unit of gas used, affecting transaction speed. Like Ethereum,
       this represents the amount of FLR (Flare's native token) the user is willing to pay per unit of gas.
    
    2. Gas Limit: This is a cap on gas expenditure that protects users against excessive costs when executing
       smart contracts. It prevents transactions from consuming unlimited computational resources.
    
    3. Network Congestion: Fees fluctuate with network demand - higher during congestion periods and lower
       during quieter times, similar to Ethereum's dynamic fee mechanism.
    
    4. Lower Base Costs: Flare's network is designed to operate with significantly lower base gas costs
       compared to Ethereum, due to its consensus mechanism and network architecture.
    
    5. Transaction Types: Different operations require varying amounts of gas:
       - Simple token transfers require minimal gas
       - Smart contract interactions require more gas depending on computational complexity
       - Delegating FLR tokens involves gas fees that affect overall staking rewards
    
    The overall gas fee calculation for a transaction on Flare follows the standard formula:
    Gas Fee = Gas Price × Gas Used
    
    Where Gas Used is the actual amount of computational resources consumed, capped by the Gas Limit.
    
    Gas fees on Flare are paid in FLR tokens, which serve as the native utility token for the network.

[ZK] Polygon zkEVM is a ZK rollup solution that leverages zero-knowledge proofs to scale Ethereum,
providing Ethereum-equivalent security while significantly reducing transaction costs.

    The gas fee mechanism on Polygon zkEVM has several important characteristics:
    
    1. Two-Tiered Fee Structure:
       - L1 Data Availability Costs: Fees paid to publish validity proofs on Ethereum
       - L2 Computation Costs: Fees for transaction execution on the Polygon zkEVM network
    
    2. Gas Price Dynamics:
       - Base Fee: Adjusts based on network congestion following EIP-1559 principles
       - Priority Fee: Optional tips to incentivize faster inclusion
    
    3. Deterministic Fee Calculation:
       Unlike Optimistic rollups where L1 costs can vary based on calldata size, Polygon zkEVM 
       has a more deterministic fee estimation process due to the fixed-size nature of validity proofs.
    
    4. EVM Equivalence Impact:
       - Gas costs for operations are carefully calibrated to match Ethereum's EVM
       - This ensures compatibility for smart contracts migrating from Ethereum
       - However, the actual gas costs are much lower due to the Layer 2 efficiencies
    
    5. Batch Processing Effect:
       - Transactions are processed in batches and then proven together
       - This amortizes the fixed costs of generating validity proofs across multiple transactions
       - Results in lower per-transaction costs compared to individual transaction verification

[ZK] zkSync Era is a ZK rollup that leverages zero-knowledge proofs to scale Ethereum, reducing transaction
costs while inheriting Ethereum's security. The gas fee mechanism on zkSync Era has several unique
characteristics:

    1. Two-Component Fee Structure:
       - L1 Data Availability Costs: Fees paid to cover the cost of posting data to Ethereum
       - L2 Computation Costs: Fees for execution on the zkSync network itself
    
    2. Gas Cost Calculation:
       Each transaction's total gas cost is determined by:
       - The gas used for L2 computation (similar to standard Ethereum gas)
       - The gas used for publishing data to L1, which depends on transaction size

[OP] Blast

  • L1 Data Availability Costs: Fees for publishing data to Ethereum
  • L2 Execution Costs: Fees for computation on the Blast network

[ZK] Linea is a Type 2 zero-knowledge rollup (ZK rollup) developed by ConsenSys, focused on EVM equivalence.
It leverages ZK proofs to offer security and scalability without compromising Ethereum compatibility.

Two-Tier Fee Structure:
- L2 Execution Fee: Covers the computational cost of executing transactions on Linea
- L1 Data Availability Fee: Covers the cost of posting transaction data and proofs to Ethereum


Sei Dual Gas Price System:
- Base Gas Price: Set by the protocol and adjusted based on network demand
- Priority Gas Price: Optional additional fee to prioritize transactions during high congestion

@github-actions github-actions bot marked this pull request as draft February 8, 2025 09:13
@github-actions github-actions bot added WIP work in progress dbt: hourly covers the hourly dbt subproject labels Feb 8, 2025
version: 2

models:
- name: gas_abstract_fees
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeff-dude
Copy link
Member

just noting that i'm waiting here, we should focus on getting transfers and new chain PRs done first.

@jeff-dude jeff-dude self-assigned this Feb 20, 2025
@Hosuke
Copy link
Collaborator Author

Hosuke commented Mar 9, 2025

Too many chains in one pr is hard for debugging, we may need to reduce batch size next time.

@Hosuke
Copy link
Collaborator Author

Hosuke commented Mar 9, 2025

I think the current output of the views makes sense, but the column definition in the seed may be ambiguous for some chains.

@Hosuke
Copy link
Collaborator Author

Hosuke commented Mar 9, 2025

Gas fees sample

I think usage by txn may be the important field here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to design a new form for gas testing, but I have no idea yet. Currently all I know is that Gas Used by Txn need to match the gas_used column.

@jeff-dude
Copy link
Member

closing since we broke out macro into models. we can talk tomorrow on plans moving forward.

@jeff-dude jeff-dude closed this Mar 24, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dbt: hourly covers the hourly dbt subproject WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants