Skip to content

feat: add SYSTEM_ADDRESS to StdConstants and CommonBase - #942

Closed
basantzp wants to merge 4 commits into
foundry-rs:masterfrom
basantzp:feat/add-system-address-constant
Closed

basantzp wants to merge 4 commits into
foundry-rs:masterfrom
basantzp:feat/add-system-address-constant

Conversation

@basantzp

@basantzp basantzp commented Nov 5, 2026

Copy link
Copy Markdown

Resolves #940

Summary

Adds the Ethereum protocol SYSTEM_ADDRESS (0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE, type(uint160).max - 1) constant to both StdConstants and CommonBase, along with unit tests in StdConstantsTest and CommonBaseTest.

Motivation & Context

  • EIP-7708 ETH Transfer Logs: Under the Amsterdam hardfork, every non-zero ETH transfer emits a log from SYSTEM_ADDRESS (0xfffffffffffffffffffffffffffffffffffffffe). Tests inspecting logs via vm.getRecordedLogs() require filtering out system ETH transfer events by emitter address.
  • Protocol System Calls: SYSTEM_ADDRESS is the caller of core system contracts (EIP-4788 beacon roots, EIP-2935 historical block hashes, EIP-7002 execution layer exits, and EIP-7251 consolidation requests). Testing contracts that enforce require(msg.sender == SYSTEM_ADDRESS) requires vm.prank(SYSTEM_ADDRESS).
  • Standardization: Providing SYSTEM_ADDRESS in StdConstants and CommonBase prevents projects from repeatedly defining custom magic constants and avoids EIP-55 checksum errors.

Changes

  • src/StdConstants.sol: Added SYSTEM_ADDRESS = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
  • src/Base.sol: Added SYSTEM_ADDRESS constant to CommonBase
  • test/StdConstants.t.sol: Added testSystemAddress verifying checksum literal and derivation from type(uint160).max - 1
  • test/CommonBase.t.sol: Added testSystemAddressValue asserting value parity with StdConstants.SYSTEM_ADDRESS

@basantzp

basantzp commented Nov 5, 2026

Copy link
Copy Markdown
Author

Closing in favor of #941 which was opened earlier by @JM-19G as coordinated in #940.

@basantzp basantzp closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SYSTEM_ADDRESS (0xff…fe) to StdConstants

1 participant