From 4247715f5130f9e859fa8c2d58a72afe29de990c Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 5 Sep 2023 15:55:07 +0200 Subject: [PATCH 1/2] Fix transactions service being stuck before warp sync finishes --- light-base/src/transactions_service.rs | 72 +++++++++++++++++++------- wasm-node/CHANGELOG.md | 9 ++++ 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/light-base/src/transactions_service.rs b/light-base/src/transactions_service.rs index bf8403f0ee..4b5735c6ee 100644 --- a/light-base/src/transactions_service.rs +++ b/light-base/src/transactions_service.rs @@ -85,6 +85,7 @@ use core::{ time::Duration, }; use futures_channel::mpsc; +use futures_lite::FutureExt as _; use futures_util::stream::FuturesUnordered; use futures_util::{future, FutureExt as _, SinkExt as _, StreamExt as _}; use itertools::Itertools as _; @@ -352,19 +353,51 @@ async fn background_task(mut config: BackgroundTaskConfig { + let _ = updates_report + .send(TransactionStatus::Dropped(DropReason::GapInChain)) + .await; + } + Some(ToBackground::SubmitTransaction { .. }) => {} + None => break None, + } + } + }; + + match sub_future.or(messages_process).await { + Some(s) => s, + None => return, + } + }; - // The buffer size should be large enough so that, if the CPU is busy, it doesn't - // become full before the execution of the transactions service resumes. - // The maximum number of pinned block is ignored, as this maximum is a way to avoid - // malicious behaviors. This code is by definition not considered malicious. - let mut subscribe_all = worker - .runtime_service - .subscribe_all( - "transactions-service", - 32, - NonZeroUsize::new(usize::max_value()).unwrap(), - ) - .await; let initial_finalized_block_hash = header::hash_from_scale_encoded_header( &subscribe_all.finalized_block_scale_encoded_header, ); @@ -491,7 +524,7 @@ async fn background_task(mut config: BackgroundTaskConfig(mut config: BackgroundTaskConfig(mut config: BackgroundTaskConfig(mut config: BackgroundTaskConfig Date: Tue, 5 Sep 2023 15:56:19 +0200 Subject: [PATCH 2/2] PR link --- wasm-node/CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index d509145b0e..09fb6ca87c 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -4,12 +4,12 @@ ### Changed -- Transactions submitted through the JSON-RPC server before the warp syncing process is finished will now immediately be dropped. +- Transactions submitted through the JSON-RPC server before the warp syncing process is finished will now immediately be dropped. ([#1110](https://github.com/smol-dot/smoldot/pull/1110)) ### Fixed -- Fix `Chain.remove()` not actually removing the chain until the warp syncing process is finished (which might never happen if for example bootnodes are misconfigured). -- Fix JSON-RPC server not processing requests if many transactions are submitted before the warp syncing process is finished. +- Fix `Chain.remove()` not actually removing the chain until the warp syncing process is finished (which might never happen if for example bootnodes are misconfigured). ([#1110](https://github.com/smol-dot/smoldot/pull/1110)) +- Fix JSON-RPC server not processing requests if many transactions are submitted before the warp syncing process is finished. ([#1110](https://github.com/smol-dot/smoldot/pull/1110)) ## 1.0.17 - 2023-08-25