Direct Mapping Supercharged#5871
Merged
Lichtso merged 27 commits intoanza-xyz:masterfrom Jul 11, 2025
Merged
Conversation
|
The Firedancer team maintains a line-for-line reimplementation of the |
9d85e3a to
1cf4e9c
Compare
1179878 to
03bf5f3
Compare
b4cbde8 to
48c65cd
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5871 +/- ##
=========================================
- Coverage 83.2% 83.2% -0.1%
=========================================
Files 853 853
Lines 377582 376498 -1084
=========================================
- Hits 314502 313544 -958
+ Misses 63080 62954 -126 🚀 New features to boost your workflow:
|
3aa050a to
720953f
Compare
f53af04 to
4d52477
Compare
…olation_handler().
…irect_mapping as well.
…de of `if prev_len != post_len`.
…ller_account_region()`.
c3ceb62 to
6f5321a
Compare
LucasSte
approved these changes
Jul 11, 2025
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.
Problem
Direct mapping is very complex and still buggy. So far, we have been trying to match the existing behavior exactly, including things which are undefined behavior from the programs (not the runtimes) perspective. E.g. the runtime allows reads (in the realloc padding) beyond the current length of an account. From a programs perspective this is uninitialized memory and no sane program should be reading from it before writing to it first. If we were to stop supporting this and instead throw
InstructionError::AccountDataTooSmallwe could significantly simplify the direct mapping feature.Summary of Changes
Removes:
memcpy,memmov,memset,memcmp)MemoryRegion::host_addrandMemoryRegion::writablein SBPFMemoryRegion(Cell<>aroundhost_addrandwritable) in SBPF, which prevented declaring proper lifetimes on the results of map / translate calls in this repoVec::spare_capacity_mutMemoryRegionas writable and then reverted that usingscopeguard::deferserialize_parameters_aligned)update_caller_account)update_caller_account) when the underlyingVecwas reallocatedupdate_callee_account)update_caller_account)deserialize_parameters_aligned)MemoryRegionAdds:
New keyC37iaPi6VE4CZDueU1vL8y6pGp5i8amAbEsF31xzz723for the feature gatebpf_account_data_direct_mappingAccessType::Store) in syscalls which enables use of the borrow checker to ensure that theAccessViolationHandlercan not invalidate translated references during the syscallTransactionContext::access_violation_handler()when resize padding is written to (AccessType::Store)EbpfError::AccessViolationerror translation toInstructionError::AccountDataTooSmallandInstructionError::InvalidRealloctest_deny_access_beyond_current_length()forInstructionError::AccountDataTooSmallandInstructionError::InvalidRealloctest_access_violation_handler()for the interaction ofTransactionContext::access_violation_handler()andcreate_memory_region_of_account()Feature Gate Issue: https://github.com/anza-xyz/feature-gate-tracker/issues/16