Skip to content

Comments

fix: return MemoryLimitOOG when memory_limit is enabled#3109

Merged
rakita merged 1 commit intobluealloy:mainfrom
wojtek0x:fix_memory_limit
Oct 17, 2025
Merged

fix: return MemoryLimitOOG when memory_limit is enabled#3109
rakita merged 1 commit intobluealloy:mainfrom
wojtek0x:fix_memory_limit

Conversation

@wojtek0x
Copy link
Contributor

Summary

This PR reintroduces memory memory limit enforcement when memory_limit feature is used.

Currently, EVM configuration allows specifying memory_limit here, but the limit is not actually enforced anywhere. It appears that enforcement logic was unintentionally dropped in this major refactor. On top of that, in another refactor, MemoryOOG was replaced with MemoryLimitOOG. This PR restores the original semantics of these two instruction results.

Context

We run Reth with gas cap set to uint64::MAX to allow for complex EVM computation. Without memory limit enforcement, this configuration risks out-of-memory crashes if a buggy contract triggers invalid allocations (e.g., MSTORE with an invalid offset). The included unit test demonstrates this scenario.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 16, 2025

CodSpeed Performance Report

Merging #3109 will improve performances by 3.73%

Comparing wojtek0x:fix_memory_limit (e9a6fbd) with main (9613d61)

Summary

⚡ 1 improvement
✅ 172 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
ecrecover precompile 204 µs 196.7 µs +3.73%

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@rakita rakita merged commit ff1eb09 into bluealloy:main Oct 17, 2025
31 checks passed
@github-actions github-actions bot mentioned this pull request Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants