Skip to content

fix(storage): keep !Send MDBX write tx out of async state machine#41

Merged
prestwich merged 2 commits intomainfrom
prestwich/eng-2080-fix-send-drain-above
Mar 20, 2026
Merged

fix(storage): keep !Send MDBX write tx out of async state machine#41
prestwich merged 2 commits intomainfrom
prestwich/eng-2080-fix-send-drain-above

Conversation

@prestwich
Copy link
Member

@prestwich prestwich commented Mar 20, 2026

Summary

  • Extract synchronous hot-storage unwind logic from drain_above into a new unwind_hot_above helper, keeping the !Send MDBX write transaction out of the async state machine
  • Add compile-time Send canaries for all async methods on UnifiedStorage<DatabaseEnv> (drain_above, cold_lag, replay_to_cold) and StorageBuilder::build
  • Bump workspace version to 0.6.7

Context

UnifiedStorage::drain_above() held an MDBX Tx<Rw, PtrUnsync> (which is !Send) across an .await point, making the returned future !Send. This broke reth::install_exex which requires Send futures.

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_lag holds a !Send reader 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-targets
  • cargo clippy -p signet-storage --no-default-features --all-targets
  • cargo t -p signet-storage — all 9 tests pass
  • Compile canary fails without the fix, passes with it
  • Audited all writer()/reader() uses across the repo for !Send across .await

🤖 Generated with Claude Code

prestwich and others added 2 commits March 20, 2026 15:37
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>
@prestwich prestwich enabled auto-merge (squash) March 20, 2026 19:54
@prestwich prestwich merged commit 1756951 into main Mar 20, 2026
6 checks passed
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.

2 participants