Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: finalize feature gating on component #4895

Closed
wants to merge 2 commits into from

Conversation

conorsch
Copy link
Contributor

@conorsch conorsch commented Oct 10, 2024

Describe your changes

Follow-up to #4892. During review of that PR, I noticed that cargo run -p pcli was emitting a lot of warnings about unused imports. Here I try to address those warnings, by adding more conditional imports based on the component feature.

Issue ticket number and link

#4892, #4885.

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    the feature-gating should preserve existing app functionality, by way of default-features

Testing and review

I pushed up a script that I used locally to evaluate this behavior. You can run it via just check. It'll take a while on first run, and create about 50GB of local cache, but after that it's snappy: ~6s. Running that same script on the main branch will show errors, which motivated this PR. I'm intentionally not adding that script to CI because of the caching requirements. We can run it opportunistically locally.

Follow-up to #4892. During review of that PR, I noticed that `cargo run
-p pcli` was emitting a lot of warnings about unused imports.
Here I try to address those warnings, by adding more conditional
imports based on the `component` feature.
Uses the usual `cargo check`, failing on warnings, and adds a custom
target-dir for caching the check results alongside the usual
debug/release targets. Doing so enables fast rechecks from local cache.
Lots of disk space required: ~50GB for the `./target/check/` directory.
This is why I'm not bolting it to CI right now. When cache is warm
locally, the whole `just check` flow takes ~6s.
use ibc_types::core::{channel::ChannelId, client::Height as IbcHeight};

#[cfg(feature = "component")]
use ibc_types::core::channel::PortId;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change makes me suspect I'm optimizing for the disabling warnings, rather than meaningfully structuring the imports.

Copy link
Contributor

@cronokirby cronokirby left a comment

Choose a reason for hiding this comment

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

I think we should be able to fix warnings just by changing what gets imported, and without changing what api each crate exposes.

In particular this pr will break the outstanding dex indexing related PRS.

cfg_if::cfg_if! {
if #[cfg(feature="component")] {
pub mod component;
pub mod event;
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not want to ever feature gate the events!! Pindexer wants to read these without pulling in cnidarium and rocksdb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point, we should align imports and not the exports. But I'm confused about why the proposed breakage isn't detected at build time: I tried cherry-picking this commit onto the dex PRs you reference (#4894) and I was able to build pindexer just fine. That's not the same as pindexer actually working, of course, but I'd expect mucking around with the event interface would break things early.

@conorsch
Copy link
Contributor Author

Closing as a distraction: I'll just continue to use cargo run --bin pcli rather than cargo run -p pcli. Messing around with the per-package feature resolution is interesting, but since we build all the packages as a workspace, it's not solving any problems. Thanks for taking a look!

@conorsch conorsch closed this Oct 10, 2024
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