Skip to content

fix: impose a memory limit#86

Merged
rakita merged 3 commits intobluealloy:mainfrom
onbjerg:onbjerg/memory-limit
Mar 28, 2022
Merged

fix: impose a memory limit#86
rakita merged 3 commits intobluealloy:mainfrom
onbjerg:onbjerg/memory-limit

Conversation

@onbjerg
Copy link
Collaborator

@onbjerg onbjerg commented Mar 18, 2022

Some Foundry tests might access memory at very high indexes that would not otherwise be possible due to gas constraints. A solution would be to lower the amount of gas tests can use, but ideally we'd want this to be as uncapped as possible to allow for deployment of big test contracts.

This imposes a memory limit of 16 megabytes for the interpreter which (I think?) should be more than enough. Let me know what you think/if there is a better solution. Could also be feature-gated

@rakita
Copy link
Member

rakita commented Mar 19, 2022

I feal like this is not the best way to do it, i still need to check how geth and oe bahave in this case just to be on same page with them.

@alcuadrado
Copy link
Contributor

Wouldn't this fit better in OverrideSpec? Idk if Foundry uses an Inspector though, which is needed to use OverrideSpec, but I guess it does.

@onbjerg
Copy link
Collaborator Author

onbjerg commented Mar 28, 2022

Wouldn't this fit better in OverrideSpec? Idk if Foundry uses an Inspector though, which is needed to use OverrideSpec, but I guess it does.

Dragan previously talked about removing the override spec thing so I opted not to put it in there. Foundry doesn't use it either 😄

@onbjerg onbjerg force-pushed the onbjerg/memory-limit branch from e8e0836 to 367e1ce Compare March 28, 2022 10:51
@onbjerg
Copy link
Collaborator Author

onbjerg commented Mar 28, 2022

@rakita This is now hidden behind the memory_limit feature and is configurable through CfgEnv. Let me know your thoughts.

I also removed interpreter.call_depth since you can just use subroutine.depth() instead

@rakita rakita merged commit 211c83b into bluealloy:main Mar 28, 2022
@onbjerg onbjerg deleted the onbjerg/memory-limit branch March 28, 2022 11:47
j75689 pushed a commit to j75689/revm that referenced this pull request Dec 26, 2024
Co-authored-by: zoro <296179868@qq.com>
j75689 pushed a commit to j75689/revm that referenced this pull request Dec 26, 2024
Co-authored-by: zoro <296179868@qq.com>
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.

4 participants