Skip to content

electrsd: include in workspace and CI#570

Open
satsfy wants to merge 13 commits intorust-bitcoin:masterfrom
satsfy:include-electrsd
Open

electrsd: include in workspace and CI#570
satsfy wants to merge 13 commits intorust-bitcoin:masterfrom
satsfy:include-electrsd

Conversation

@satsfy
Copy link
Copy Markdown
Contributor

@satsfy satsfy commented Apr 24, 2026

Closes #552

  • Include electrsd in the workspace so it is built, linted, and tested alongside the other crates, mirroring the bitcoind crate pattern.
  • Apply cargo fmt and clippy fixes in electrsd
  • Updates the lockfiles with ./contrib/update-lock-files.sh
  • Make electrs_0_10_6 the default version feature. Version features are now chained like bitcoind as a version cascade: electrs_0_10_6 -> 0_9_11 -> 0_9_1 -> 0_8_10 -> esplora. --all-features resolves to 0.10.6.
  • Version-specific behavior is identified in versions.rs with legible constants USE_LEGACY_COOKIE (replacing old legacy feature), USE_JSONRPC_IMPORT, USE_VERBOSE_ARG.
  • Esplora is tested with --no-default-features so it does not accidentally combine with the default electrs version.
  • no-download job now enables bitcoind_download because it still needs a bitcoind binary while using the system-provided ELECTRS_EXEC.
  • Corrected the bitcoind 23_2 feature name in ee9443c.
  • Make electrsd CI coverage easier to debug by putting RUST_LOG=debug on electrsd jobs.

Tests now include electrsd. Check by running: cargo test --all-features

I've had various versions problems. Ran a CI matrix of every bitcoin version and electrds in Ubuntu 24.04 to understand what would work with what.

Comment thread electrsd/src/versions.rs Outdated
Comment thread electrsd/src/lib.rs Outdated
@satsfy
Copy link
Copy Markdown
Contributor Author

satsfy commented Apr 24, 2026

One thing I thought to include is a default electrsd version, like bitcoind in 0_17_2, I suppose either 0_8_10 or 0_10_6. I have not included a default because it required including std (for bitreq's get() to download), and I'm not sure if it's this PR's scope.

Edit: I suppose we need the default so tests work with an explicit version.

@satsfy satsfy force-pushed the include-electrsd branch from 2a42a61 to 4c939ef Compare April 25, 2026 04:01
@satsfy
Copy link
Copy Markdown
Contributor Author

satsfy commented Apr 25, 2026

Latest force push improves the legibility of the solution, sets a default electrs version, reworked the version feature graph so the cfg cascade in versions.rs is unambiguous. Replaced the legacy feature with versions::USE_LEGACY_COOKIE so --all-features tests pass.

@satsfy satsfy force-pushed the include-electrsd branch 2 times, most recently from af412f2 to 6e540e4 Compare April 25, 2026 04:23
@satsfy satsfy requested a review from jamillambert April 25, 2026 17:49
@tcharding
Copy link
Copy Markdown
Member

Needs rebase mate. Out of interest what made you go with electrs_0_8_10 instead of electrs_0_10_6?

@satsfy satsfy force-pushed the include-electrsd branch from 6e540e4 to 8343421 Compare April 28, 2026 03:02
@satsfy
Copy link
Copy Markdown
Contributor Author

satsfy commented Apr 28, 2026

Great point, I made a mistake regarding 0_8_10. I had matched bitcoind pattern, but accidentally reversed the order of the versions. The highest version in bitcoind chain is the lowest, meanwhile I put the highest for electrsd. Latest rebase reverses that order.

EDIT: The problem with v0.10.6 in CI was caused by using the legacy --jsonrpc-import arg after 0.8.10. That nuance was lost on me because execution would fail on my Ubuntu 22.04 for requiring GLIBC 2.38 to test 0.10.6 properly.

@satsfy satsfy force-pushed the include-electrsd branch from 8343421 to 12645ba Compare April 28, 2026 19:35
@satsfy
Copy link
Copy Markdown
Contributor Author

satsfy commented Apr 28, 2026

On the latest rebase:

  • New electrs feature version cascade: electrs_0_10_6 -> 0_9_11 -> 0_9_1 -> 0_8_10 -> esplora.
  • Centralized the version-specific behavior in versions.rs with legible constants USE_LEGACY_COOKIE, USE_JSONRPC_IMPORT, USE_VERBOSE_ARG.
  • Esplora is tested with --no-default-features so it does not accidentally combine with the default electrs version.
  • no-download job now enables bitcoind_download because it still needs a bitcoind binary while using the system-provided ELECTRS_EXEC.
  • Corrected the bitcoind 23_2 feature name in ee9443c (is this correct? Should I have done it in a separate PR)?
  • Optional change that I think should be merged: make electrsd CI coverage easier to debug by putting RUST_LOG=debug on electrsd jobs.

@satsfy satsfy force-pushed the include-electrsd branch 2 times, most recently from eca4af4 to 70b269f Compare April 28, 2026 20:29
@tcharding
Copy link
Copy Markdown
Member

Can we separate the fmt changes from actual code changes in c61ea18

Comment thread electrsd/src/ext.rs Outdated
Comment on lines +12 to +13
#[cfg(not(feature = "electrs_0_8_10"))]
#[cfg(not(all(feature = "electrs_0_8_10", not(feature = "electrs_0_9_1"))))]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These feature gates are making my eyes bleed. not, all, not - is there any way we can make this easier to reason about?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified version conditions with any like

#[cfg(any(feature = "electrs_0_9_1", not(feature = "electrs_0_8_10")))]

And also used simpler conditions like crate::versions::IS_ELECTRS_0_8_10 in another spot.

@satsfy satsfy force-pushed the include-electrsd branch from 70b269f to 28022c5 Compare April 29, 2026 19:22
@satsfy
Copy link
Copy Markdown
Contributor Author

satsfy commented Apr 29, 2026

Latest rebase:

  • Split rustfmt cleanup (17866ee), lint error fixes (33158b2) and new rbmt lint configuration (9143712).
  • Fix Cargo.toml link typo (28022c5)
  • Simplifies version conditions:
    • Using any in #[cfg(any(feature = "electrs_0_9_1", not(feature = "electrs_0_8_10")))]
    • or crate::versions::IS_ELECTRS_0_8_10.

@satsfy satsfy force-pushed the include-electrsd branch 4 times, most recently from 93b3716 to 3866f93 Compare April 29, 2026 21:16
satsfy added 9 commits April 29, 2026 18:25
When running `--all-features`, both `electrs_0_8_10` and
`esplora_a33e97e1` features are enabled. This PR handles such case by
enabling the legacy cookie handling when `esplora_a33e97e1` is enabled.
The `legacy` flag is semantically meaningless, therefore it was dropped.
`std` was included in bitreq for the download `get()` function.
It tested an unsuported version 0.11.x.
Mirrors bitcoind solution. It also removes default electrs download for
non-esplora paths.
@satsfy satsfy force-pushed the include-electrsd branch from 3866f93 to cd0ddfe Compare April 29, 2026 21:26
@satsfy
Copy link
Copy Markdown
Contributor Author

satsfy commented Apr 29, 2026

Latest rebase updates lockfiles because of upstream changes to fix ci

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.

Include electrsd in the workspace

3 participants