Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def fn(
return_cost_deducted_prior_execution=True,
)
intrinsic_cost += (
authorization_count * gas_costs.REGULAR_PER_AUTH_BASE_COST
authorization_count * gas_costs.EXECUTION_PER_AUTH_BASE_COST
)

is_self_transfer = recipient_type == RecipientType.SELF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def gas_costs(cls) -> GasCosts:
TX_CREATE=create_access,
AUTH_PER_EMPTY_ACCOUNT=account_write
+ execution_per_auth_base_cost,
REGULAR_PER_AUTH_BASE_COST=execution_per_auth_base_cost,
EXECUTION_PER_AUTH_BASE_COST=execution_per_auth_base_cost,
)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/src/execution_testing/forks/gas_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GasCosts:
AUTH_BASE: int = 0
# State-independent execution gas charged per EIP-7702 authorization
# tuple; 0 before the state-access repricing introduces it.
REGULAR_PER_AUTH_BASE_COST: int = 0
EXECUTION_PER_AUTH_BASE_COST: int = 0

# Utility
MEMORY_PER_WORD: int
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/forks/amsterdam/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def calculate_intrinsic_cost(
4. Calldata cost (zero and non-zero bytes).
5. Access list entries (if applicable).
6. Authorizations (if applicable): only the state-independent base
cost (`REGULAR_PER_AUTH_BASE_COST`) per tuple. The
cost (`EXECUTION_PER_AUTH_BASE_COST`) per tuple. The
state-dependent account-creation and delegation-write costs are
charged at the top frame by `set_delegation`.

Expand Down Expand Up @@ -694,7 +694,7 @@ def calculate_intrinsic_cost(

auth_cost = Uint(0)
if isinstance(tx, SetCodeTransaction):
auth_cost = GasCosts.REGULAR_PER_AUTH_BASE_COST * ulen(
auth_cost = GasCosts.EXECUTION_PER_AUTH_BASE_COST * ulen(
tx.authorizations
)

Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/forks/amsterdam/vm/eoa_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def set_delegation(evm: Evm) -> None:
costs at the top frame.

Each valid authorization is charged, on top of the
state-independent ``GasCosts.REGULAR_PER_AUTH_BASE_COST`` already
state-independent ``GasCosts.EXECUTION_PER_AUTH_BASE_COST`` already
paid in the intrinsic cost:

- ``StateGasCosts.NEW_ACCOUNT`` (state) when the authority's
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/forks/amsterdam/vm/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class GasCosts:

# Authorization
AUTH_TUPLE_BYTES: Final[Uint] = Uint(101)
REGULAR_PER_AUTH_BASE_COST: Final[Uint] = (
EXECUTION_PER_AUTH_BASE_COST: Final[Uint] = (
AUTH_TUPLE_BYTES * TX_DATA_TOKEN_FLOOR
+ PRECOMPILE_ECRECOVER
+ COLD_ACCOUNT_ACCESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_intrinsic_gas_floor_boundary_with_authorizations(
) -> None:
"""
Reject a type-4 transaction when ``gas_limit = intrinsic_gas - 1``,
where the intrinsic includes ``REGULAR_PER_AUTH_BASE_COST`` per
where the intrinsic includes ``EXECUTION_PER_AUTH_BASE_COST`` per
authorization.

EIP-2780 keeps only the state-independent per-authorization base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
A type-4 transaction's authorizations are processed at the top frame
(in ``set_delegation``), where their state-dependent costs are charged.
Each authorization pays, on top of the state-independent
``REGULAR_PER_AUTH_BASE_COST`` charged in the intrinsic:
``EXECUTION_PER_AUTH_BASE_COST`` charged in the intrinsic:

- ``NEW_ACCOUNT`` (state) + ``ACCOUNT_WRITE`` (execution) when the
authority's account leaf does not yet exist, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,12 +701,12 @@ def test_authorization_list_intrinsic_gas(
"""
Verify the authorization-list intrinsic cost under EIP-2780.

Each authorization adds exactly ``REGULAR_PER_AUTH_BASE_COST`` to
Each authorization adds exactly ``EXECUTION_PER_AUTH_BASE_COST`` to
the (execution) intrinsic; the state-dependent authorization costs
moved to the top frame. Measured on the *raw* intrinsic (before
the EIP-7623 calldata floor is applied) the per-authorization
delta is exactly ``num_authorizations *
REGULAR_PER_AUTH_BASE_COST`` -- even when the floor would
EXECUTION_PER_AUTH_BASE_COST`` -- even when the floor would
otherwise mask it (e.g. a single authorization whose base cost
stays below the floor). Each existing authority then pays the
first-write ``ACCOUNT_WRITE`` (execution) and ``AUTH_BASE``
Expand Down Expand Up @@ -752,9 +752,9 @@ def test_authorization_list_intrinsic_gas(

actual_auth_cost = intrinsic_with_auth - intrinsic_without_auth
assert actual_auth_cost == (
num_authorizations * gas_costs.REGULAR_PER_AUTH_BASE_COST
num_authorizations * gas_costs.EXECUTION_PER_AUTH_BASE_COST
), (
"auth intrinsic must be n * REGULAR_PER_AUTH_BASE_COST, got: "
"auth intrinsic must be n * EXECUTION_PER_AUTH_BASE_COST, got: "
f"{actual_auth_cost}"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ class Spec:
# EIP-8038 then repriced them.
EXECUTION_GAS_CREATE = 11000
# Total execution intrinsic per EIP-7702 authorization:
# ACCOUNT_WRITE (8000) + REGULAR_PER_AUTH_BASE_COST (7816).
# ACCOUNT_WRITE (8000) + EXECUTION_PER_AUTH_BASE_COST (7816).
PER_AUTH_BASE_COST = 15816
GAS_COLD_STORAGE_WRITE = 13000
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
top-frame charge model.

Under EIP-2780 (Amsterdam) an authorization's intrinsic cost is only the
state-independent ``REGULAR_PER_AUTH_BASE_COST``; there is no intrinsic
state-independent ``EXECUTION_PER_AUTH_BASE_COST``; there is no intrinsic
auth state gas and there are no auth refunds. The state-dependent costs
are charged lazily at the top frame in ``set_delegation``, keyed on each
authority's pre-transaction state:
Expand Down Expand Up @@ -615,7 +615,7 @@ def test_invalid_nonce_auth_still_charges_intrinsic(
An authorization with a wrong nonce is skipped during
``set_delegation``, so it writes no delegation indicator and incurs
no top-frame charge. Its state-independent
``REGULAR_PER_AUTH_BASE_COST`` is still charged in the intrinsic, and
``EXECUTION_PER_AUTH_BASE_COST`` is still charged in the intrinsic, and
the authority is left untouched.
"""
contract = pre.deploy_contract(code=Op.STOP)
Expand Down Expand Up @@ -670,7 +670,7 @@ def test_invalid_chain_id_auth_still_charges_intrinsic(

An authorization with a mismatched chain ID is skipped during
``set_delegation`` and incurs no top-frame charge, but its
``REGULAR_PER_AUTH_BASE_COST`` is still charged in the intrinsic and
``EXECUTION_PER_AUTH_BASE_COST`` is still charged in the intrinsic and
the authority is left untouched.
"""
contract = pre.deploy_contract(code=Op.STOP)
Expand Down Expand Up @@ -946,7 +946,7 @@ def test_mixed_valid_and_invalid_auths(
Test mixed valid and invalid authorizations under the top-frame model.

Every tuple (valid or invalid) pays the intrinsic
``REGULAR_PER_AUTH_BASE_COST``. Only the valid authorizations reach
``EXECUTION_PER_AUTH_BASE_COST``. Only the valid authorizations reach
``set_delegation`` and each writes a net-new delegation on an existing
authority, paying the first-write ``ACCOUNT_WRITE`` and the top-frame
``AUTH_BASE``; the invalid (wrong nonce) tuples are skipped and pay
Expand Down Expand Up @@ -1923,7 +1923,7 @@ def test_invalid_auth_no_top_frame_charge(
neither ``NEW_ACCOUNT`` / ``ACCOUNT_WRITE`` nor ``AUTH_BASE`` at the
top frame (and, unlike the superseded EIP-8037 model, nothing is
refilled because nothing was charged). Only the intrinsic
``REGULAR_PER_AUTH_BASE_COST`` is paid and the authority is never
``EXECUTION_PER_AUTH_BASE_COST`` is paid and the authority is never
created. Swept over the reasons an authorization is rejected.
"""
target = pre.deploy_contract(code=Op.STOP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ def test_auth_intrinsic_at_transition(
The ``7702`` authorization intrinsic *falls* across the boundary.
EIP-2780 moves the state-dependent authorization costs (account
creation and the delegation-write base) out of the intrinsic and into
the top frame, leaving only the execution ``REGULAR_PER_AUTH_BASE_COST``
in the intrinsic. The post-fork single-authorization intrinsic is
the top frame, leaving only ``EXECUTION_PER_AUTH_BASE_COST`` in the
intrinsic. The post-fork single-authorization intrinsic is
therefore strictly smaller than the pre-fork one, so a tx whose
``gas_limit`` equals the (lower) post-fork intrinsic is rejected with
``INTRINSIC_GAS_TOO_LOW`` before the fork but valid after.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def test_mixed_validity_multi_auth_receipt_gas(
Pin the exact receipt gas of a transaction carrying one valid and
one invalid authorization under the EIP-2780 top-frame charge model.

Both tuples pay the state-independent ``REGULAR_PER_AUTH_BASE_COST``
Both tuples pay the state-independent ``EXECUTION_PER_AUTH_BASE_COST``
in the intrinsic. The single valid authorization's authority leaf
already exists (a funded EOA) and gains a net-new delegation
indicator, so at the top frame it pays the first-write
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
reduced, refund-free charge via the exact receipt gas:

* a non-clearing delegation on an existing empty-code leaf pays the
intrinsic ``REGULAR_PER_AUTH_BASE_COST`` plus the top-frame
intrinsic ``EXECUTION_PER_AUTH_BASE_COST`` plus the top-frame
``ACCOUNT_WRITE`` (first leaf write) and ``AUTH_BASE`` (the net-new
delegation indicator); and
* a *clearing* re-authorization of an existing-delegation authority
Expand Down
Loading