Abstract
The address range between 0x0000000000000000000000000000000000001000 and 0x0000000000000000000000000000000000001fff is reserved for Monad precompiles. A precompile specified by a MIP is assigned an address in this range and nowhere else.
Motivation
Monad has two precompiles of its own: the staking precompile at 0x1000 and the reserve balance precompile at 0x1001 (MIP-4). Their addresses were chosen by convention. The reason MIP-4 gives for 0x1001 is that it follows the staking precompile. No specification says where the next Monad precompile goes, or that these addresses belong to Monad at all.
Both addresses sit in space that two other processes allocate from. EIP-1352 reserves 0x0000 to 0xffff for Ethereum precompiles and system contracts, and EIP-7587 sets aside 0x0100 to 0x01ff within it for the RIP process. Monad adopts precompiles from both: the Ethereum precompiles at 0x01 to 0x11, and P256VERIFY at 0x0100. Without a reservation of its own, Monad’s precompiles occupy addresses that an EIP may assign to something else, and every precompile MIP has to justify its address from scratch.
Specification
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.
This MIP concerns the execution layer only. The consensus daemon is unaffected.
Short forms such as 0x1000 denote the 20-byte address with leading zero bytes, i.e. 0x0000000000000000000000000000000000001000.
Constants
| Name | Value |
|---|---|
MONAD_PRECOMPILE_RANGE_START |
0x0000000000000000000000000000000000001000 |
MONAD_PRECOMPILE_RANGE_END |
0x0000000000000000000000000000000000001fff |
Definitions
- A Monad precompile is a precompiled contract specified by a MIP, as opposed to one adopted from an EIP or a RIP.
- An upstream precompile is a precompiled contract specified by an EIP or a RIP and adopted by Monad.
Reserved range
The address range between MONAD_PRECOMPILE_RANGE_START and MONAD_PRECOMPILE_RANGE_END, inclusive, is reserved for Monad precompiles. It is referred to below as the Monad precompile range and contains 4096 addresses.
Assignment
- A Monad precompile MUST be assigned an address in the Monad precompile range. A MIP MUST NOT assign a Monad precompile an address outside it.
- The address is assigned by the MIP that specifies the precompile. A new assignment SHOULD use the lowest address in the range that no other MIP has assigned.
- An address at which a precompile has been activated on Monad Mainnet or Monad Testnet MUST NOT be assigned to a different precompile, including after that precompile is deprecated or removed.
The following assignments predate this MIP and are confirmed by it:
| Address | Precompile | Specified by |
|---|---|---|
0x1000 |
Staking | Predates the MIP process |
0x1001 |
Reserve balance | MIP-4 |
Exceptions
EIP-1352 range
EIP-1352 reserves 0x0000 to 0xffff for Ethereum precompiles and system contracts. The Monad precompile range lies entirely within that range. On Monad, the EIP-1352 reservation applies to all of it except the Monad precompile range:
- The Monad precompile range is excluded from the EIP-1352 reservation. An EIP does not assign an address in the Monad precompile range on Monad. If Monad adopts an EIP that specifies a precompile or system contract at an address in the Monad precompile range, the adopting MIP MUST assign its address on Monad under Assignment, as if it were a Monad precompile. The assigned address MAY equal the address in the EIP if that address is unassigned.
- The remainder of the EIP-1352 range,
0x0000to0x0fffand0x2000to0xffff, stays reserved as EIP-1352 specifies. A MIP MUST NOT assign a Monad precompile there. An upstream precompile adopted from an EIP is activated at the address the EIP assigns and is not subject to Assignment.
Resulting layout
| Range | Reserved for | Assigned by |
|---|---|---|
0x0000 to 0x00ff |
Ethereum precompiles and system contracts | EIP process |
0x0100 to 0x01ff |
RIP precompiles | RIP process, per EIP-7587 |
0x0200 to 0x0fff |
Ethereum precompiles and system contracts | EIP process |
0x1000 to 0x1fff |
Monad precompiles | MIP process, per this MIP |
0x2000 to 0xffff |
Ethereum precompiles and system contracts | EIP process |
Rationale
Choice of range
Both existing Monad precompiles are already in 0x1000 to 0x1fff, so the reservation needs no migration and no fork. The range is clear of the two upstream allocators: Ethereum’s own assignments run sequentially from 0x01 and currently end at 0x11, and the RIP range, which holds P256VERIFY, ends at 0x01ff. Its 4096 addresses are far more than Monad is likely to use.
A range outside 0x0000 to 0xffff would avoid any exception to EIP-1352, but it would mean moving the staking and reserve balance precompiles, which deployed contracts already call.
Backwards Compatibility
This MIP changes no behavior.
Test Cases
Not applicable. For resulting layout, see § Resulting layout.
Security Considerations
Upstream collisions
EIP-1352 and EIP-7587 do not recognize the Monad precompile range, so a future EIP or RIP may assign an address inside it. The exception in this MIP resolves that case deterministically, at the cost of address divergence for the affected precompile. A contract ported to Monad that hardcodes the upstream address would then call a different precompile or an account without code. The likelihood is low, since both upstream processes allocate well below 0x1000.
Cross-chain ambiguity
Other EVM chains use the same low addresses for unrelated contracts. BNB Smart Chain, for example, places its genesis system contracts at 0x1000 and above. An address in the Monad precompile range identifies a Monad precompile only on Monad. This predates this MIP and is not changed by it.
Copyright
Copyright and related rights waived via CC0.