-
Notifications
You must be signed in to change notification settings - Fork 713
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
substrate-offchain: upgrade hyper to v1 #5919
Conversation
7b88c43
to
7d5636a
Compare
Review required! Latest push from author must always be reviewed |
I've rebased on master and fixed fmt fails with rustfmt nightly but still have to fix some tests are failing in CI (worked fine on my apple silicon mac) |
7d5636a
to
bdf5d57
Compare
bdf5d57
to
760258e
Compare
type Receiver = mpsc::Receiver<Result<hyper::body::Frame<hyper::body::Bytes>, hyper::Error>>; | ||
|
||
type HyperClient = client::Client<HttpsConnector<client::connect::HttpConnector>, Body>; | ||
type LazyClient = Lazy<HyperClient, Box<dyn FnOnce() -> HyperClient + Send>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once rustc has stabilized TAIT, this boxing can be avoided.
The other option is implementing similar thing as once_cell::Lazy
with once_cell::OnceCell
and std::cell::Cell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is fine
Ok(Self(Arc::new(Lazy::new(Box::new(|| { | ||
let connector = builder.https_or_http().enable_http1().enable_http2().build(); | ||
client::Client::builder(TokioExecutor::new()).build(connector) | ||
}))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above boxing is needed to resolve this; This should be a Lazy
with closure, otherwise we cannot return std::io::Result<Self>
and Self.0
becomes Lazy<std::io::Result<HyperClient>>
, which is quite inconvenient to use
substrate/client/offchain/src/lib.rs
Outdated
@@ -160,7 +160,7 @@ impl<RA, Block: traits::Block, Storage> OffchainWorkers<RA, Block, Storage> { | |||
"offchain-worker".into(), | |||
num_cpus::get(), | |||
)), | |||
shared_http_client: api::SharedClient::new(), | |||
shared_http_client: api::SharedClient::new().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this requires unwrap anyway...
@bkchr Is it ok to move the shared_http_client
to the OffchainWorkerOptions type
such that we can bail early from the service builder if this fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I thought that all the unwrap()
calls were inside the test codes but this was not 🙃 Maybe I should change the return type to std::io::Result<Self>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I'll wait for 😃
There was a problem hiding this 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 handle the error here and just pass SharedHttpClient in the OffChainWorkerOptions instead to avoid breaking this api.
We will break the API any way 🙈 As we need to do it, I think returning Result
from new
sounds better to me
There was a problem hiding this 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 handle the error here and just pass SharedHttpClient in the OffChainWorkerOptions instead to avoid breaking this api.
We will break the API any way 🙈 As we need to do it, I think returning
Result
fromnew
sounds better to me
Do you mean this new
method, OffchainWorkers::new
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, ignore my comment and change OffchainWorkers::new()
to return Result<Self, Error>
instead of Self
bot fmt |
@niklasad1 https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7524560 was started for your command Comment |
@niklasad1 Command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me modulo the unwrap stuff
760258e
to
34275f1
Compare
Formatted |
2e5457f
to
5e798a3
Compare
I have no idea why |
745834b
to
4647f23
Compare
The CI failure seems to be caused from docker image push timeout. I wonder if I should take some action for it 🤔 |
prdoc/pr_5919.prdoc
Outdated
|
||
crates: | ||
- name: sc-offchain | ||
bump: minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump: minor | |
bump: major |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've applied this change
4647f23
to
9738ac7
Compare
I'm rebasing to re-trigger failed required-actions |
Head branch was pushed to by a user without write access
9738ac7
to
2621027
Compare
You don't have to do that, that merge queue will merge it to master before running the tests anyway. By rebasing now you removed this from the merge queue.... Some job is probably flaky but don't rebase again and let's try to add it to the merge queue again. |
Oh, I thought that "required" checks were necessary 😅 Sorry |
Yeah, they are but these failed checks are really unrelated to your PR and "might" have been fixed on master concurrently, it's fine to rebase just avoid to do it when it's added to the merge queue. |
@ShoyuVanilla please merge master |
2621027
to
c67188a
Compare
Hi, this one seems still CI broken |
@jasl Is there anything that I should/could do for CI failure? I'm not familiar with CI and not sure the failure is related to this PR or not 😅 |
try to rebase one more time, sorry about this |
No problem 😄 |
Head branch was pushed to by a user without write access
c67188a
to
014c0ff
Compare
014c0ff
to
bab6482
Compare
5a14285
Closes #4896