> For the complete documentation index, see [llms.txt](https://docs.megaeth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.megaeth.com/spec/network-upgrades/rex1.md).

# Rex1

Rex1 network upgrade — patch release fixing cross-transaction gas detention state leak.

This page is an informative summary of the Rex1 specification. For the full normative definition, see the Rex1 spec in the mega-evm repository.

## Summary

Rex1 is a patch release that fixes a single critical bug: the [compute gas](https://docs.megaeth.com/spec/reference/glossary.md#compute-gas) limit lowered by [volatile data](https://docs.megaeth.com/spec/reference/glossary.md#volatile-data) access in one transaction persisted to subsequent transactions within the same block. This caused unrelated transactions to fail unexpectedly.

## What Changed

### Compute Gas Limit Reset Between Transactions

#### Previous behavior

* The [detained](https://docs.megaeth.com/spec/reference/glossary.md#detained-limit) compute gas limit persists across transactions within the same block.
* A later transaction may inherit a lowered limit from an earlier transaction's volatile data access and halt with `ComputeGasLimitExceeded` even though it never accessed volatile data itself.

For example:

1. TX1 accesses the oracle contract — compute gas limit is lowered to 1M.
2. TX2 is a normal transaction requiring more than 1M compute gas.
3. TX2 fails with `ComputeGasLimitExceeded` despite never accessing volatile data — it inherited TX1's lowered limit.

#### New behavior

* The compute gas limit resets to the configured transaction compute gas limit at the start of each transaction.
* The compute gas usage counter resets to zero at the start of each transaction.
* Gas detention from volatile data access is scoped to the transaction that triggered it and does not affect subsequent transactions.

## Developer Impact

**Unexpected `ComputeGasLimitExceeded` failures from cross-transaction detention leakage are resolved.** Transactions no longer inherit gas detention state from earlier transactions in the same block.

No other behavior changes — Rex1 inherits all Rex semantics.

## Safety and Compatibility

All pre-Rex1 behavior is unchanged. The fix only affects the transaction boundary reset of the compute gas detained limit. Storage gas economics, transaction intrinsic storage gas, resource limits, CALL-like opcode behavior, and volatile data access detection all remain the same as Rex.

## References

* [mega-evm repository](https://github.com/megaeth-labs/mega-evm)
* [Gas Detention](https://docs.megaeth.com/spec/megaevm/gas-detention.md) — background on the gas detention mechanism


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.megaeth.com/spec/network-upgrades/rex1.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
