go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

Skip validation of the EIP7702 Authority signature when EstimateGas

Open peekpi opened this issue 7 months ago • 3 comments

Rationale

When EstimateGas is called, if the authorizationList field is provided, its signature is verified during execution. If the signature is invalid, the sender's code is not updated. Example request on sepolia:

{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
        {
            "from": "0x0338f81BEDcE242929Fad9b6e7379B0295211577",
            "to": "0x0338f81BEDcE242929Fad9b6e7379B0295211577",
            "value": "0x0",
            "data": "0x61461954",
            "authorizationList": [
                {
                    "chainId": "0xaa36a7",
                    "nonce": "0x1",
                    "address": "0x6587f125a2626d59c2600ae058ffb62c8651ed33",
                    "yParity": "0x0",
                    "r": "0x0",
                    "s": "0x0"
                }
            ]
        }
    ],
    "id": 71
}

The alternative is to override the sender's code with a third argument, which works, but feels a little weird. The third parameter is import by #30695 .

{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
        {
            "from": "0x0338f81BEDcE242929Fad9b6e7379B0295211577",
            "to": "0x0338f81BEDcE242929Fad9b6e7379B0295211577",
            "value": "0x0",
            "data": "0x61461954",
            "authorizationList": [
                {
                    "chainId": "0xaa36a7",
                    "nonce": "0x1",
                    "address": "0x6587f125a2626d59c2600ae058ffb62c8651ed33",
                    "yParity": "0x0",
                    "r": "0x0",
                    "s": "0x0"
                }
            ]
        },
        "latest",
        {
                "0x0338f81BEDcE242929Fad9b6e7379B0295211577":{
                    "code": "0xef0100e22f5f1a03db3af7bdc7b40c146524ad19a7e513"
                }
        }
    ],
    "id": 71
}

Implementation

Skip authorityList validation when calling EstiamteGas.

peekpi avatar Apr 12 '25 05:04 peekpi

Not sure if it's the same issue. I’m using Wallet.authorize() from ethers v6.13.6 (supports EIP-7702) on Sepolia.

When ethers calling estimateGas on Geth/v1.15.5-stable-4263936a/linux-amd64/go1.23.7 (from RPC URL: https://ethereum-sepolia-rpc.publicnode.com), errors like

Error: missing revert data (action="estimateGas", data=null, reason=null, transaction={ "data": "0x", "from": "0xe7C0B0c95a2551d9C815ecc9555539489F667276", "to": "0x0000000000000000000000000000000000000000" }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.13.6)

often occur, though sometimes it succeeds and the transaction is broadcast.

oneleo avatar Apr 14 '25 01:04 oneleo

@peekpi Can you explain the rationale for this?

jwasinger avatar Apr 14 '25 04:04 jwasinger

Ah, I think I get it: from wallet's POV the user shouldn't have to be prompted to sign anything before being presented with the cost of the tx (?)

jwasinger avatar Apr 14 '25 05:04 jwasinger

would like to work on this!

rose2221 avatar Jun 16 '25 23:06 rose2221