Skip to content

Reintroduce a gasLimit in EOA wallet / eth_estimateGas #823

@karlfloersch

Description

@karlfloersch

Is your feature request related to a problem? Please describe.
We have disabled the gasLimit check inside of the ECDSA wallet account here:

// TEMPORARY: Disable gas checks for mainnet.
// // Need to make sure that the gas is sufficient to execute the transaction.
// require(
// gasleft() >= SafeMath.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),
// "Gas is not sufficient to execute the transaction."
// );

We disabled this check because we changed the meaning of gasLimit signed in transactions to equal fee. This meant that the wallet contract no longer had access to the gas required for execution. Removing this check introduces a security vulnerability for user wallets as the sequencer can extract a fee even if the gas supplied to the call is lower than what is acceptable.

For more information on why we turned gasLimit into fee see this discussion (mirror).

Describe the solution you'd like
Currently,

gasLimit = gasUsed*executionPrice + transactionSizeInBytes*dataPrice
gasPrice = 1gwei

We propose to change this to:

gasLimit = Math.round((gasUsed*executionPrice + transactionSizeInBytes*dataPrice) / feeDivisor) + gasUsed/gasLimitGranularity
gasPrice = 0.001gwei

Where feeDivisor=10000000 and gasLimitGranularity=100000. Note this means that gasLimits can only be set in increments of 100k.

Next we modify the wallet contract to include the following check:

        gasLimit = (decodedTx.gasLimit % 1000) * 100,000;
        require(
           gasleft() >= SafeMath.add(gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),
           "Gas is not sufficient to execute the transaction."
        );

This change also requires modifying L2Geth's estimateGas endpoint to return a gas value which also encodes the gasLimit as is done above.

Describe alternatives you've considered
Another option is require that the wallet's call does not revert. This has the adverse effect that the sequencer must execute all transactions before applying them. Otherwise they won't know that the transaction will pay them. This is a DOS vector,

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions