state: Dedup the recipient lookup in execute_message#1607
Merged
Conversation
A value-transferring CALL looked the recipient up twice. Clean up this piece of code and lookup the account once.
There was a problem hiding this comment.
Pull request overview
This PR refactors Host::execute_message() in the state-test host to avoid looking up the CALL recipient account twice in the value-transfer path, reducing redundant state map probing while preserving existing semantics.
Changes:
- Cache the CALL recipient account pointer once and reuse it for the non-zero value transfer branch.
- Replace
get_or_insert()with a conditionalinsert()only when the recipient truly does not exist. - Add TODO notes highlighting remaining double-probe opportunities in related account-creation logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1607 +/- ##
=======================================
Coverage 97.40% 97.40%
=======================================
Files 164 164
Lines 14693 14693
Branches 3389 3389
=======================================
Hits 14312 14312
Misses 280 280
Partials 101 101
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 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.
A value-transferring CALL looked the recipient up twice. Clean up this piece of code and lookup the account once.