Skip to main content
mip.watch
⌘K

MIP-7

Extension opcodes

Draft Standards Track Core GitHub ↗ Forum ↗
Idea Draft Review Last Call Final Living

Add a reserved opcode for implementation-defined extension opcodes

Authors
Category Labs
Created
2026-01-28
Updated
Jun 15, 2026

Stakeholder Impact

What this MIP changes for each audience. Severity and action flags are model-derived with deterministic floors per MIP type/category.

TL;DR

This MIP introduces a new opcode `EXTENSION` (`0xAE`) for the Monad VM to allow for future opcode extensions while ensuring compatibility with Ethereum. It aims to provide a safe way to implement new features without risking opcode collisions.

What's Changing

  • New opcode `EXTENSION` (`0xAE`) - This opcode allows for the addition of new features in the Monad VM without conflicting with Ethereum's opcode space.
  • Encoding scheme defined for extended instructions - The MIP specifies how to encode extended opcodes and their arguments, ensuring clarity and consistency.
  • Reserved opcode aligns with Ethereum's EIP-8163 - This reservation helps prevent future compatibility issues between Monad and Ethereum.

Developers

Smart contract & dapp builders, RPC consumers, tooling authors

The introduction of the new `EXTENSION` opcode (`0xAE`) allows for future opcode extensions without affecting existing contracts, as it is currently invalid. Developers will need to consider this new opcode for future implementations but no immediate changes to existing code are required.

Medium

Users

Wallet users, EOA holders, dapp visitors

This change introduces a new opcode for future extensions, but it does not affect current transaction fees, confirmation speeds, or asset safety. Users will not need to take any action as there are no immediate changes to wallet compatibility or address formats.

Low

Validators

Node operators, RPC operators, delegators

The introduction of the EXTENSION opcode does not directly affect validator revenue or profitability, as it does not change block rewards, fees, or staking mechanics. However, it may enable future features that could enhance the ecosystem, potentially leading to increased transaction volume and fees in the long run.

Medium

Foundation

Monad Foundation & Category Labs core devs

This proposal introduces a new opcode that requires coordination with cross-client implementations to ensure compatibility and adherence to the defined standards. It sets a precedent for future opcode extensions and necessitates clear documentation and communication with stakeholders.

High action required

Generated May 29, 2026, 8:51 AM · model: gpt-4o-mini

Specification

Cite
Subsystems executionevm

## Abstract

This MIP proposes a new opcode `EXTENSION` (`0xAE`) that can be used to extend the Monad VM with new opcode-level features, while minimizing the risk of collision with future changes to the Ethereum execution layer. It defines the encoding scheme for extended instructions, including the extension selector and two styles for encoding immediate arguments, and aligns with [EIP-8163](https://eips.ethereum.org/EIPS/eip-8163), which reserves the same opcode on Ethereum L1.

## Motivation

At present, bytecode execution in the Monad VM is fully Ethereum-compatible: all Ethereum opcodes are supported, and there are no additional opcodes implemented by Monad that are not present in Ethereum. However, in the future, new features will be proposed for Monad that warrant the addition of new opcodes. For example, an early version of [MIP-4](./MIP-4.md) specified the addition of an opcode to inspect the state of Monad's reserve balance mechanism. While that MIP rejected the opcode-based design in favour of a precompile, the design decisions discussed in relation to that early version prompted this MIP.

EIP-8163 reserves the `EXTENSION` (`0xAE`) opcode on Ethereum L1 specifically to enable non-L1 EVM chains to safely experiment with extensions without risking future incompatibility. This MIP adopts that reservation for Monad.

## Specification

### Extended Opcode Encoding

The `EXTENSION` opcode (`0xAE`) MUST be immediately followed by a 1-byte extension selector. The extension selector MUST NOT be `0x5B` (`JUMPDEST`) or in the range `0x60`-`0x7F` (`PUSH1`-`PUSH32`). An extension selector in this excluded range MUST cause an exceptional halt, consuming all remaining gas.

Define **extended opcode** as the 2-byte sequence `0xAE XX`.

Until a future MIP assigns meaning to a given selector, executing any extended opcode MUST behave as if `INVALID` (`0xFE`) had been executed.

### Argument Encoding

If a particular extension requires immediate arguments, future MIPs MUST use one of the two encoding styles:

#### Restricted-Range Immediates

Similar to [EIP-8024](https://eips.ethereum.org/EIPS/eip-8024), argument bytes follow the extended opcode directly:

```
0xAE XX a1 a2 ...
```

Each argument byte MUST NOT be `0x5B` or in the range `0x60`-`0x7F`. The number of argument bytes is fixed per extension selector and MUST be specified by the MIP that defines the extension.

#### PUSH-Prefix Immediates

Argument bytes are framed by a `PUSHx` byte (`0x60`-`0x7F`) that follows the extended opcode:

```
0xAE XX PUSHx b1 b2 ... bn
```

The `PUSHx` byte determines the argument length (n = opcode − `0x5F`). The full byte range `0x00`-`0xFF` is available.

In either encoding style, an extended opcode followed by incorrectly encoded bytes MUST behave as if `INVALID` (`0xFE`) had been executed.

## Rationale

Several alternative designs were considered:

### No Extension

In this design, new implementation-specific opcodes are simply allocated to unused bytes in the existing EVM opcode space. This design is simple from an implementation perspective, but risks collision with future Ethereum upgrades. If such a collision were to occur, it is likely that a more complex resolution would be required, or that Monad would have to accept a permanent break of compatibility with Ethereum. A single reserved extension opcode reduces this risk substantially.

### Selector Encoding like `PUSH1`

The currently accepted approach to introducing multibyte opcodes is to do so in a `JUMPDEST` analysis preserving way, following the precedent of [EIP-8024](https://eips.ethereum.org/EIPS/eip-8024). `JUMPDEST` analysis is unaffected by `EXTENSION` and by either of its argument encodings.

An earlier version of this MIP proposed that `EXTENSION` carry a single-byte immediate operand (structurally identical to `PUSH1`), forming a two-byte `0xAEXX` instruction and skipping over the `XX` byte during `JUMPDEST` analysis. This conflicts with `JUMPDEST` analysis preservation and compromises code portability across chains.

### Stack-based

Rather than encoding extension arguments as immediate data, an alternative would be to pop the implementation-specific opcode from the stack. Doing so has the advantage of simpler upstream compatibility. The main downside of this approach is performance: popping a 32-byte word from the stack, interpreting it as an opcode, and dispatching on it would exit the hot path of typical interpreter designs. However, it is worth noting that the Monad VM's native-code compiler could trivially inline the presumed common pattern of `PUSH1 0xXX; EXTENSION` with zero overhead.

Additionally, stack-based dispatch would allow opcode selection to come from runtime data or computation, preventing static analysis of stack contents and extension behavior, and hindering EVM execution optimization.

### Gas Costs

No gas costs for individual extension opcodes are proposed by this MIP. Any invalid or undefined extension opcode should cost the same as executing `INVALID` (consume all gas and revert).

### Choice of Immediates Encoding Style

This MIP leaves the choice of immediates encoding style to the particular selector. Restricted-range immediates are compact and suitable for short arguments that do not require the full byte range. PUSH-prefix immediates allow arbitrary byte values at the cost of an extra framing byte.

### Precompiles

Some features could potentially be implemented either as new opcodes or as precompiles: adding precompiles is less risky from a collision perspective, but calling precompiles incurs additional overhead for ABI compatibility that may not be viable for all features.

## Backwards Compatibility

The opcode `0xAE` is currently invalid in both Ethereum and Monad. Since `JUMPDEST` analysis is unaffected by `EXTENSION`, no existing code behavior changes.

## Security Considerations

Because `JUMPDEST` analysis is unaffected by `EXTENSION`, the risks associated with divergent jump analysis between Monad and Ethereum are mitigated. On both chains, `0xAE` followed by `0x5B` results in the `0x5B` remaining a valid jump destination.

## References

- [EIP-8163: Reserve EXTENSION (0xAE) Opcode](https://eips.ethereum.org/EIPS/eip-8163)
- [EIP-8024: Backward Compatible SWAPN, DUPN, EXCHANGE](https://eips.ethereum.org/EIPS/eip-8024)
- [Monad Initial Specification](https://category-labs.github.io/category-research/monad-initial-spec-proposal.pdf)

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).

Forum discussion

4 posts · 1 likes · 4 months ago
Read more on forum ↗
  1. @Bruce Collie #1 Jan 29, 2026, 9:57 AM

    github.com/monad-crypto/MIPs MIPS/MIP-7.md main --- mip: 7 title: Extension opcodes description: Add a reserved two-byte opcode family for implementation-defined extension opcodes author: Category Labs category: Core created: 2026-01-28 --- ## Abstract This MIP proposes a new 2-byte opcode `EXTENSION` (`0xEEXX`, where `XX` is a single byte immediate operand) that can be used to extend the Monad VM with new opcode-level features, while minimizing the risk of collision with future changes to the Ethereum execution layer. ## Motivation At present, bytecode execution in the Monad VM is fully Ethereum-compatible: all Ethereum opcodes are supported, and there are no additional opcodes implemented by Monad that are not present in Ethereum. However, in the future, new features will be proposed for Monad that warrant the addition of new opcodes. For example, an early version of [MIP-...

  2. @Pdobacz #2 Feb 4, 2026, 1:57 PM

    Disclaimer: I’m currently analyzing the JUMPDEST situation, and might propose a different approach to it (that there are reasons for the extension opcode to be JUMPDEST-analysis neutral). This is more of an editorial suggestion to current approach: In the Jumpdest Analysis section, the rule is too weak. In current form 0xEE605B would cause the 0x5B to be an invalid jump destination. I think it should read: As for PUSH1 opcode, an immediate data byte following a 0xEE byte is skipped over during JUMPDEST analysis. In particular: - In 0xEE5B the 0x5B is not a valid jump destination - In 0xEE605B the 0x5B is a valid jump destination - In 0xEE615B5B both 0x5B ’s are valid jump destinations etc. For completeness: we’re unfortunate EIP-8024 is considered for Amsterdam, complicating things. If it goes in, 0xE6EE5B , 0xEEE65B (and similar) must be dealt with.

  3. @Pdobacz #3 Feb 9, 2026, 10:00 AM

    I would recommend that an EIP-8024 -like approach to JUMPDEST-analysis is taken. Problem statement Let’s call the current approach “JUMPDEST-analysis expanding”, because we’re expanding the rules of the analysis, to cover 0xEE immediate arguments. The interaction of current JUMPDEST-analysis expanding MIP-7 and EIP-8024 is broken: Consider the bytecode: 0xE6 0xEE 0x60 0x5B . Here we compare how its JUMPDEST analysis and execution unfold: EVM Jumpdest Analysis Execution Osaka 0x5B is an invalid jumpdest as it is a PUSH1 argument: JD✗ invalid , invalid , PUSH1 0x5B EIP-8024 0x5B is an invalid jumpdest as it is a PUSH1 argument: JD✗ DUPN-0xEE (valid), PUSH1-0x5B MIP-7 0xEE skips 0x60 making 0x5B a valid jump destination: JD✓ invalid , EXTENSION-0x60 , JUMPDEST Both 0xEE skips 0x60 making 0x5B a valid jump destination: JD✓ DUPN-0xEE (valid), PUSH1-0x5B Osaka and M...

  4. @Pdobacz #4 Mar 10, 2026, 10:57 AM

    Added a proposal to MIP-7 to update and align with EIP-8163: Reserve EXTENSION (0xae) opcode