Skip to content

Spec

Documentation for tests/prague/eip7702_set_code_tx/spec.py@49c766fb.

Defines EIP-7702 specification constants and functions.

Spec dataclass

Parameters from the EIP-7702 specifications as defined at https://eips.ethereum.org/EIPS/eip-7702

Source code in tests/prague/eip7702_set_code_tx/spec.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@dataclass(frozen=True)
class Spec:
    """
    Parameters from the EIP-7702 specifications as defined at
    https://eips.ethereum.org/EIPS/eip-7702
    """

    SET_CODE_TX_TYPE = 0x04
    MAGIC = 0x05
    PER_AUTH_BASE_COST = 12_500
    PER_EMPTY_ACCOUNT_COST = 25_000
    DELEGATION_DESIGNATION = Bytes("ef0100")
    DELEGATION_DESIGNATION_READING = Bytes("ef01")
    RESET_DELEGATION_ADDRESS = Address(0)

    MAX_CHAIN_ID = 2**64 - 1
    MAX_NONCE = 2**64 - 1

    @staticmethod
    def delegation_designation(address: Address) -> Bytes:
        """
        Returns the delegation designation for the given address.
        """
        return Bytes(Spec.DELEGATION_DESIGNATION + bytes(address))