Skip to content

Fix floresta's re-exports#1176

Open
luisschwab wants to merge 2 commits into
getfloresta:masterfrom
luisschwab:fix/floresta-re-exports
Open

Fix floresta's re-exports#1176
luisschwab wants to merge 2 commits into
getfloresta:masterfrom
luisschwab:fix/floresta-re-exports

Conversation

@luisschwab

@luisschwab luisschwab commented Jun 30, 2026

Copy link
Copy Markdown
Member

Closes #1157

This PR fixes re-exports on the floresta meta-crate.

It adds missing crate re-exports, implements a more granular crate export via feature flags, and moves metrics under crates/. I've also added a minimal README for the floresta crate, which can be extended later.

Re-exports

We were missing re-exports for a few crates, namely:

  • floresta-compact-filters
  • floresta-domain
  • floresta-node
  • floresta-rpc

Selecting features from individual re-exported crates was also not possible. I've devised a more granular feature-based selection for that. Every crate is locked behind a feature, and every crate's feature is also locked behind a feature. For example: if I want to select floresta-chain with the flat-chainstore feature, I can either import floresta with chain and chain-flat-chainstore, or simply chain-flat-chainstore.

Since cargo-hack would try to test every feature combination (~400K), I've made it only test the full feature. cargo-rbmt will make this look cleaner.

I've also updated floresta's examples so that they use the crates it re-exports (e.g. use floresta::chain instead of use floresta_chain).

Metrics

floresta consumers could not use the metrics exporters implemented here, since that was conditional on using floresta-node. Now, metrics is moved under crates/floresta-metrics and re-exported on floresta.

@luisschwab luisschwab self-assigned this Jun 30, 2026
@luisschwab luisschwab added the code quality Generally improves code readability and maintainability label Jun 30, 2026
@luisschwab luisschwab moved this to Needs review in Floresta Jun 30, 2026
@luisschwab luisschwab added this to the Q2/2026 milestone Jun 30, 2026
@luisschwab

Copy link
Copy Markdown
Member Author

bdk-floresta PR using this branch: luisschwab/bdk-floresta#149

@jaoleal jaoleal left a comment

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.

Nice, some notes and

the second commit, chore(floresta): clean up the floresta crate tittle is ambiguous, the description is good but i suggest a more precise title for the commit: chore: granular feature-aware re-exports for the floresta crate

Comment thread crates/floresta/README.md
Comment thread contrib/feature_matrix.sh
mempool = ["dep:floresta-mempool"]

# floresta-metrics
metrics = ["dep:floresta-metrics"]

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.

I think that switching the third commit and the second commit of places may reduce the diff

metrics = { workspace = true, optional = true }

[dev-dependencies]
bitcoin = { workspace = true, features = ["serde"] }

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.

b84fcdd

For this commit, shouldn't you also remove it from here? Otherwise why did you do this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The issue is that it's not enough to just enable the serde dependency, we also need to enable bitcoin's serde. I caught this when testing floresta's 400K feature combinations. We weren't checking this edge case before with current test matrices.

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.

But test-utils is pulling bitcoin/serde. Will test-utils be used for something that's not floresta-chain's tests?

@luisschwab luisschwab Jul 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe this should live in floresta-common instead. Follow-up.

Comment thread crates/floresta/src/lib.rs
Comment thread crates/floresta/src/lib.rs
Comment thread crates/floresta/Cargo.toml Outdated
Comment on lines +61 to +62
"chain-bitcoinkernel",
"chain-flat-chainstore",

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.

bf6b812

Thinking out loud again: floresta-chain-persintance and floresta-consensus 👀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes!

* Add missing crate re-exports

* Re-export crates granularly using features:
  - Every re-exported crate is locked behind a feature,
    and every crate's feature is also locked behind a feature.
    This makes it so that consumers have to be explicit about
    what they want to import.
* Clean up the `Cargo.toml`

* Add a minimal README

* Modify `feature_matrix.sh` so that `cargo-hack`
  wont test every feature combination on the
  `floresta` crate (486,160 combinations). Instead,
  it will only test the `full` feature.
Move `metrics` into `crates/floresta-metrics` such
that libfloresta consumers can export metrics without
being locked to `floresta-node`.
@luisschwab
luisschwab force-pushed the fix/floresta-re-exports branch from 41216f1 to beb6ecd Compare July 2, 2026 22:33
@luisschwab
luisschwab requested a review from Davidson-Souza July 2, 2026 22:43
@csgui csgui modified the milestones: Q2/2026, Q3/2026 Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Generally improves code readability and maintainability

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

floresta meta-crate does not re-export all crates

4 participants