# Rex1

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](/spec/reference/glossary.md#compute-gas) limit lowered by [volatile data](/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](/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](/spec/megaevm/gas-detention.md) — background on the gas detention mechanism


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
