fix(storage): keep !Send MDBX write tx out of async state machine#41
Merged
fix(storage): keep !Send MDBX write tx out of async state machine#41
Conversation
Extract synchronous hot-storage unwind logic from `drain_above` into `unwind_hot_above` so the `!Send` MDBX write transaction never appears in the async generator's state machine. This makes the future returned by `drain_above` `Send`, unblocking use from `Send`-bounded executors like `reth::install_exex`. Adds compile-time `Send` canaries for `drain_above` and `cold_lag` parameterized over `DatabaseEnv` to prevent regressions. Closes ENG-2080 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fraser999
approved these changes
Mar 20, 2026
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.
Summary
drain_aboveinto a newunwind_hot_abovehelper, keeping the!SendMDBX write transaction out of the async state machineSendcanaries for all async methods onUnifiedStorage<DatabaseEnv>(drain_above,cold_lag,replay_to_cold) andStorageBuilder::buildContext
UnifiedStorage::drain_above()held an MDBXTx<Rw, PtrUnsync>(which is!Send) across an.awaitpoint, making the returned future!Send. This brokereth::install_exexwhich requiresSendfutures.All other
writer()/reader()call sites were audited — the remaining uses are in synchronous code (conformance tests, test utilities,write_hot,unwind_above) and not at risk.cold_lagholds a!Sendreader but it's dead before the.await, so the compiler correctly excludes it from the state machine. The canary guards against regressions there.Closes ENG-2080
Test plan
cargo clippy -p signet-storage --all-features --all-targetscargo clippy -p signet-storage --no-default-features --all-targetscargo t -p signet-storage— all 9 tests passwriter()/reader()uses across the repo for!Sendacross.await🤖 Generated with Claude Code