fix(test-vm): Revert module-level cache to instance#2185
Merged
marioevz merged 1 commit intoethereum:forks/amsterdamfrom Feb 11, 2026
Merged
fix(test-vm): Revert module-level cache to instance#2185marioevz merged 1 commit intoethereum:forks/amsterdamfrom
marioevz merged 1 commit intoethereum:forks/amsterdamfrom
Conversation
marioevz
approved these changes
Feb 11, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2185 +/- ##
================================================
Coverage 86.07% 86.07%
================================================
Files 599 599
Lines 39472 39472
Branches 3780 3780
================================================
Hits 33977 33977
Misses 4862 4862
Partials 633 633
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description
Revert the module-level
@cacheon_bytecode_gas_cost()and_bytecode_refund()back to instance-level cachingWhat's happening here is the module-level
@cacherefactor I introduced in #2184 relies on__hash__/__eq__to deduplicate across instances. However,Bytecode.__hash__/__eq__only considers bytes and stack properties, andOpcode.__hash__/__eq__only considers the byte value. Neither accounts for metadata... so bytecode with identical bytes but different metadata collide in the cache, returning incorrect gas costs. We sort of yeeted that last commit in assuming things would pass but this seems to have revealed a bug in these methods.I think the "proper" / non-bandaid fix would be updating
__hash__/__eq__to include metadata, but Opcode intentionally compares by byte value only and theopcode_gas_maprelies on this for lookups. Changing it is a larger refactor.I opted for the bandaid fix here but we should talk about the way we want
hashandeqto ultimately behave.✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.Cute Animal Picture