test_top_frame_new_account_skipped_for_prefunded_create_target()¶
Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py::test_top_frame_new_account_skipped_for_prefunded_create_target@26332146.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py::test_top_frame_new_account_skipped_for_prefunded_create_target --fork Amsterdam
A creation transaction whose nonce-derived target address already
holds a balance does not incur the top-frame NEW_ACCOUNT state
charge.
The create branch of prepare_dispatch keys the charge on the
transaction pre-state being empty — a live check would always see
the account, because process_create_message bumps the target's
nonce before dispatch. Pre-funding the create address makes the
pre-state leaf non-empty, so the charge must be skipped; a
balance-only leaf does not trigger the create-collision check
(only nonce or code do), so the deployment still succeeds.
The gas limit carries headroom above the exact total so the
transaction never runs out of gas, and the receipt pins
cumulative_gas_used to exactly the intrinsic plus the init-code
execution gas: a wrongly charged NEW_ACCOUNT for the
pre-existing leaf (or a spurious refill) shifts the receipt by
183,600 in either direction.
Source code in tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
Parametrized Test Cases¶
This test generates 2 parametrized test cases across 1 fork.