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

Adds check -Zcheck-cfg job #419

Merged
merged 3 commits into from
Mar 30, 2024
Merged

Adds check -Zcheck-cfg job #419

merged 3 commits into from
Mar 30, 2024

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Mar 28, 2024

Motivation

Ref: #416

And fixes: #416 (comment)

Solution

Adds reqwest and hyper features in alloy-provider.
@prestwich Unsure why but adding these features forced the ProviderBuilder::on_client(&self, client: RpcClient<T>) to only accept RpcClient<BoxTransport>

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya
Copy link
Member Author

Also, I think we should make the reqwest feature default in alloy-provider just like its in alloy-rpc-client

#[cfg(feature = "hyper")]
pub fn on_hyper_http(self, url: url::Url) -> Result<L::Provider, TransportError>
where
L: ProviderLayer<RootProvider<N, BoxTransport>, N, BoxTransport>,
N: Network,
{
let client = ClientBuilder::default().hyper_http(url);
let client = ClientBuilder::default().hyper_http(url).boxed();
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be boxed

Copy link
Member Author

Choose a reason for hiding this comment

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

@prestwich Unsure why but adding these features forced the ProviderBuilder::on_client(&self, client: RpcClient) to only accept RpcClient

Yes it shouldn't.

Copy link
Member

Choose a reason for hiding this comment

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

oh I just saw this in #379 and was confused about it 🤔

Copy link
Member

Choose a reason for hiding this comment

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

i think what happened is that the blocks were previously entirely non-functional, and therefore were written incorrectly and we didn't notice (because they were non-functional and never checked by the compiler). Now that the cfg blocks are effective, a compiler warning appears. I'll fix in #379 in a second

@zerosnacks
Copy link
Member

Also, I think we should make the reqwest feature default in alloy-provider just like its in alloy-rpc-client

Added here: #421

@prestwich
Copy link
Member

@yash-atreya would you rebase now that #379 is in?

@yash-atreya
Copy link
Member Author

@yash-atreya would you rebase now that #379 is in?

Yeah I'll take care of it

@yash-atreya yash-atreya requested a review from DaniPopes March 30, 2024 00:42
@prestwich prestwich merged commit 8f05300 into alloy-rs:main Mar 30, 2024
18 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.

[Bug] Fix unknown/unused cfgs
4 participants