Skip to content

chore: remove a third-party type from public API#59

Merged
Fraser999 merged 1 commit intomainfrom
fraser/eng-1932/tidy-up-api
May 4, 2026
Merged

chore: remove a third-party type from public API#59
Fraser999 merged 1 commit intomainfrom
fraser/eng-1932/tidy-up-api

Conversation

@Fraser999
Copy link
Copy Markdown
Contributor

@Fraser999 Fraser999 commented May 4, 2026

[Claude Code]

Per the ticket, alloy and trevm are out of scope (too entrenched). This PR tackles the roaring leak called out explicitly. sqlx was investigated but pulled back to scope (see below).

Changes

signet-storage-types

  • IntegerList::iter() returns impl Iterator<Item = u64> + Clone + '_ instead of roaring::treemap::Iter<'_>. roaring no longer appears in any public signature; it remains an internal dependency only. + Clone is retained so callers that forked the iterator continue to compile.

sqlx - considered, deferred

An earlier draft hid sqlx from signet-cold-sql's public API by introducing an opaque SqlPoolConfig wrapping PoolOptions<sqlx::Any>, an opaque SqlBackendError replacing SqlColdError::Sqlx(sqlx::Error), and demoting SqlColdBackend::new(AnyPool) to pub(crate). That draft is reverted in this PR.

The blocker: a fully opaque SqlPoolConfig only exposes ~5 of PoolOptions' ~15 knobs. Notably absent are after_connect (needed for SQLite PRAGMA tuning - journal_mode=WAL, synchronous=NORMAL, busy_timeout), before_acquire/after_release hooks, test_before_acquire, lazy connection, and pool fairness. Recovering each opaquely is its own design problem (callbacks-as-SQL-strings, etc.) and partial removal is the worst of both worlds - it leaks sqlx types implicitly through reduced configurability while still requiring users to learn a new wrapper API. Either we hide sqlx completely (and re-expose every needed knob through opaque shims) or we don't. This PR chooses don't, for now. sqlx joins the "out of scope" table.

Remaining third-party types in storage public APIs (out of scope for this PR)

Crate Where Notes
alloy signet-storage-types, signet-cold, signet-hot, signet-storage Pervasive: BlockNumber, B256, Address, Filter, Log, Receipt, TxType, table key/value types. Ticket says out of scope.
trevm (re-exports revm) signet-storage-types::ExecutedBlock.bundle (BundleState); signet-hot::Bytecodes table value (Bytecode); signet-hot::RevmRead/RevmWrite impl Database/DatabaseRef/TryDatabaseCommit. Ticket says out of scope.
sqlx signet-cold-sql: SqlColdBackend::new(AnyPool), connect_with(_, PoolOptions<sqlx::Any>), SqlConnector::with_pool_options, SqlColdError::Sqlx(sqlx::Error). All-or-nothing ? see above.
tokio_util::sync::CancellationToken signet-storage (pub use + StorageBuilder::cancel_token, UnifiedStorage::spawn); signet-cold::ColdStorageTask::{new, spawn} Could be wrapped behind a small facade.
tokio_stream::wrappers::ReceiverStream signet-cold::LogStream type alias Could be replaced with a custom Stream-implementing wrapper.
tokio::sync::{mpsc, oneshot}, tokio::time::Instant signet-cold::Responder alias; signet-cold::StreamParams.{sender, deadline} Channel endpoints in public types ? harder to hide cleanly.
bytes::BufMut signet-storage-types::IntegerList::to_mut_bytes; signet-hot::ValSer::encode_value_to bound Soft leak via generic bound.
serde::{Serialize, Deserialize} signet-storage-types::{DbSignetEvent, DbZenithHeader} derives Standard; soft leak.
auto_impl::auto_impl signet-hot::HotKv/HotKvRead derive Macro on public traits; soft leak.
signet_libmdbx signet-hot-mdbx::{Tx<K>, Cursor, SyncMode, Ro/Rw/RoSync/RwSync, TransactionKind} Borderline ? published as signet- but is functionally a fork of reth-libmdbx. Treat alongside trevm/alloy.

Verification

  • cargo +nightly fmt -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo clippy --workspace --all-targets --no-default-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
  • cargo t -p signet-storage-types

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Fraser999 Fraser999 changed the title remove some third-party types from public API chore: remove a third-party type from public API May 4, 2026
@Fraser999 Fraser999 requested review from Evalir and prestwich May 4, 2026 15:25
@Fraser999 Fraser999 merged commit 560c231 into main May 4, 2026
8 checks passed
@Fraser999 Fraser999 deleted the fraser/eng-1932/tidy-up-api branch May 4, 2026 19:07
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