bluealloy / revm

Rust implementation of the Ethereum Virtual Machine.
https://bluealloy.github.io/revm/
MIT License
1.65k stars 562 forks source link

EIP-7702 inconsistency #1714

Closed mrLSD closed 2 months ago

mrLSD commented 2 months ago

Description

According to EIP-7702 Specification it's several inconsistencies:

➡️ In validation Step 1 there is no validation step Behavior 1..

authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s]

It's a vector of attack.

➡️ Step 4 - accodingto specification Nonce is required filed, and it's impossible situation for Option<None>

➡️ Step 6 just wrong (in Specification it's step 7):

Set the code of authority to be 0xef0100 || address. This is a delegation designation.

➡️ A nit: Behavior steps number in the specification and in comments are different, and it's confusing.

➡️ Step 8 from Specification just absent:

Increase the nonce of authority by one.

Main logic of EIP-7702

It looks, like after creating list it doesn't used for Delegation Designation logic

Unclearity

It's unclear intention of:

pub enum AuthorizationList {
    Signed(Vec<SignedAuthorization>),
    Recovered(Vec<RecoveredAuthorization>),
}

It looks overcomplicated for such simple simple structure (according to Spec) like authorization_list.

Relations

Related to #1268

rakita commented 2 months ago

Current EIP-7702 changes were needed for devnet-1 and devnet-2 devnets as agreed by core devs.

New changes are coming in effecy in devnet-3 (expected in week or two) and those changes are made in PR here https://github.com/bluealloy/revm/pull/1695.

That PR will be merges in few days after they pass eth statetests. Statetests for newest EIP version was made today.