Skip to content

Test Value Moving With Tx Delegation

Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_value_moving_with_tx_delegation.py@c74f1a67.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_value_moving_with_tx_delegation.py --fork Amsterdam

Tests for EIP-2780 x EIP-7702 interaction.

When a type-4 transaction's authorization list installs a delegation on tx.to, set_delegation runs before the top-frame check fires. That ordering changes which top-frame charges apply:

  • COLD_ACCOUNT_ACCESS for the delegated recipient still fires; the spec charges the access uniformly whenever the recipient holds a delegation prefix at top-frame time, regardless of who installed it.
  • NEW_ACCOUNT for a value transfer to an otherwise-empty recipient is suppressed implicitly: set_delegation writes the delegation code and increments the nonce, so is_account_alive returns True by the time the top-frame check evaluates it.

A complementary set of scenarios installs the delegation on the sender (self-sponsored authorization). The authorization's nonce must equal the sender's nonce after the transaction's nonce increment.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_tx_installs_delegation_on_empty_recipient state_test 2 Scenario 2: tx.to is a non-existent (empty) account. The type-4
test_tx_installs_delegation_on_funded_recipient state_test 2 Scenario 1: tx.to is a funded EOA with no prior delegation.
test_tx_installs_delegation_on_sender state_test 4 Self-sponsored type-4 transaction: the sender signs an