Skip to content

Spec

Documentation for tests/prague/eip7702_set_code_tx/spec.py@0ed27a0e.

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
@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 = 2_500
    PER_EMPTY_ACCOUNT_COST = 25_000
    DELEGATION_DESIGNATION = bytes.fromhex("ef0100")

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