EIP-7702: Set EOA account code

As a follow up to this topic of EXTCODE* ’s behavior, @dv3000 and I put together a technical writeup into code introspection, its relationship with EOF, and a simple path forward: [EIP-7702] Making the Case for “Delegation Introspection” - HackMD

We had an overall positive reception at ACD today and from the next steps given, we’ve put together a PR that reflects our proposed changes to the written spec:

2 Likes

gm, turns out Trezor and Ledger don’t currently support signing authorizations, let alone transaction type 4.

Afaik, they don’t have plans to - we at Ambire contacted Trezor recently and it turns out we’re the first team to bring this to their attention.

It would help if more wallet teams here who plan to support EIP-7702 request this feature from Trezor and Ledger, so that they can adequately prioritize this and don’t think it’s a niche EIP.

Furthermore, both teams told us that they’d only implement such a feature if they had an allow-list of audited designator contracts, which is also something we need to work on as a community. Has anyone started working on this?

2 Likes

Browser wallets like Metamask and Rabby no longer support eth_sign.
Based on the current implementation of signing the raw hash of the authorization object to produce the signature, would a new RPC method be required? For ex. eth_signAuthorization, similar to personal_sign which is purpose built for signing messages based on EIP-191

A tiny question about the gas accounting of Cost of Delegation section, other fields are quite clear. But for:

storing values in already warm account = 200

My understanding is this part is used to consider the nonce increment when applying an authorization tuple. Is 200 gas based on some rational estimations? Since I cannot find similar gas measuring in historical EIPs (maybe missed), and SSTORE is more expensive than 200 when considering updates from (i) zero values to non-zero values, and (ii) non-zero values to non-zero values, which the cases are similar to account nonce increment.

Combined with other parts, the 12500 gas consumption is quite reasonable, just a clarification question for a non-understood part.

Great thanks in advance!

This should maybe be clarified in the EIP for completeness. The “storing values in already warm account = 200” looks like it is actually storing 2 values. But we are obviously only delegating to one account in this calculation.

The reason is the number of database operations. First, the nonce has to be updated. But then, the code has to be updated. This is done by putting the codeHash (which is thus the hash of the code) in the account. But, we also need a lookup in the DB from hash → code. We thus need 2 writes to the DB in this case, as opposed to other storage write operations like changing balance or increasing the nonce.

1 Like

Thanks and it makes sense. So IIUC updating the nonce and codeHash in a warm account costs 2 * 100 gas (looks like updating the 23 bytes code is already considered in 200 * 23 = 4600 gas). Is there any spec about the 100 gas per warm account update, or is it a new and reasonable number?

This 100 is a result from EIP-2929: Gas cost increases for state access opcodes

It’s not directly mentioned in the EIP, but changing a warm storage slot (when this storage is originally non-empty) charges 100 gas. https://www.evm.codes/ has a nice gas cost calculator, try it yourselves for the SSTORE opcode :slight_smile:

yep, that’s exactly what I am confused about, in the spec of EIP-2200:

If current value does not equal new value
  If original value equals current value (this storage slot has not been changed by the current execution context)
    If original value is 0, SSTORE_SET_GAS is deducted.
    Otherwise, SSTORE_RESET_GAS gas is deducted. If new value is 0, add SSTORE_CLEARS_SCHEDULE gas to refund counter.

neither consumes 100 gas: the first case is 20000 gas, and the second is 5000 gas. https://www.evm.codes/ also shows the same results.

I’ll look into this, I’m rather sure there are situations where 100 gas is charged, but I am now getting confused, maybe I’m thinking of a different situation :thinking:

1 Like