Skip to content
Closed
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
5 changes: 5 additions & 0 deletions src/Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ abstract contract CommonBase {
uint256 internal constant SECP256K1_ORDER =
115792089237316195423570985008687907852837564279074904382605163141518161494337;

/// @dev Protocol system address: caller of system calls (EIP-4788, EIP-2935, EIP-7002, EIP-7251)
/// and emitter of EIP-7708 ETH transfer logs.
/// Taken from https://eips.ethereum.org/EIPS/eip-4788.
address internal constant SYSTEM_ADDRESS = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;

uint256 internal constant UINT256_MAX =
115792089237316195423570985008687907853269984665640564039457584007913129639935;

Expand Down
4 changes: 4 additions & 0 deletions src/StdConstants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ library StdConstants {
/// @dev The order of the secp256k1 curve.
uint256 internal constant SECP256K1_ORDER =
115792089237316195423570985008687907852837564279074904382605163141518161494337;
/// @dev Protocol system address: caller of system calls (EIP-4788, EIP-2935, EIP-7002, EIP-7251)
/// and emitter of EIP-7708 ETH transfer logs.
/// Taken from https://eips.ethereum.org/EIPS/eip-4788.
address internal constant SYSTEM_ADDRESS = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
}
4 changes: 4 additions & 0 deletions test/CommonBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ contract CommonBaseTest is Test {
assertEq(SECP256K1_ORDER, StdConstants.SECP256K1_ORDER);
}

function testSystemAddressValue() public pure {
assertEq(SYSTEM_ADDRESS, StdConstants.SYSTEM_ADDRESS);
}

function testUint256MaxValue() public pure {
assertEq(UINT256_MAX, type(uint256).max);
}
Expand Down
5 changes: 5 additions & 0 deletions test/StdConstants.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ contract StdConstantsTest is Test {
assertEq(address(this), StdConstants.VM.computeCreateAddress(StdConstants.DEFAULT_SENDER, 1));
assertEq(StdConstants.DEFAULT_TEST_CONTRACT, StdConstants.VM.computeCreateAddress(address(this), 1));
}

function testSystemAddress() public pure {
assertEq(StdConstants.SYSTEM_ADDRESS, 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE);
assertEq(StdConstants.SYSTEM_ADDRESS, address(uint160(uint256(type(uint160).max - 1))));
}
}

contract Dummy {}