ethereum / ethereum/execution-specs

Use dynamic address allocation in ported static tests

Open
#2,517 4 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
1.2k
Forks
505
Avg merge
2d 14h
Merged PRs (30d)
116

Description

## Use dynamic address allocation in ported static tests

Follow-up to #2455.

The 2,180 script-ported tests in `tests/ported_static/` use hardcoded addresses and sender keys throughout (~5,000 hardcoded `address=Address(...)` calls, ~10,000 hardcoded `key=0x...` values). Every test is marked `@pytest.mark.pre_alloc_mutable` to support this.

Standard EEST tests use dynamic allocation instead — `pre.deploy_contract(code=...)` returns an address, and `pre.fund_eoa()` returns a sender. This is more robust (no collisions, no coupling to specific address values) and lets the framework manage allocation.

### What needs to change

- Remove `address=` from `pre.deploy_contract(...)` calls and use the returned address
- Replace hardcoded `EOA(key=...)` with `pre.fund_eoa()`
- Update any bytecode that embeds raw addresses to reference the dynamically allocated ones
- Remove `@pytest.mark.pre_alloc_mutable` once addresses are no longer hardcoded
- Update expected `post` state to use the dynamic addresses

### Notes

- This could likely best done by updating the porting script from #2455 rather than manual edits, but not certain
- Some tests embed addresses directly in `tx_data_hex` bytecode blobs, those are harder to make dynamic and may need to stay hardcoded or be refactored to use `Op` assembly

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.