From 98dda370241c42c64fc51ef283e0958583ce287a Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 10:56:21 +0200 Subject: [PATCH 01/24] Make essential task panic on error --- substrate/frame/revive/rpc/src/cli.rs | 10 ++++--- substrate/frame/revive/rpc/src/client.rs | 37 ++++++++++++------------ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/substrate/frame/revive/rpc/src/cli.rs b/substrate/frame/revive/rpc/src/cli.rs index 4f3113795c6e4..6c640b3f8d426 100644 --- a/substrate/frame/revive/rpc/src/cli.rs +++ b/substrate/frame/revive/rpc/src/cli.rs @@ -222,12 +222,14 @@ pub fn run(cmd: CliCommand) -> anyhow::Result<()> { let fut1 = client.subscribe_and_cache_new_blocks(SubscriptionType::BestBlocks); let fut2 = client.subscribe_and_cache_new_blocks(SubscriptionType::FinalizedBlocks); - if let Some(index_last_n_blocks) = index_last_n_blocks { + let res = if let Some(index_last_n_blocks) = index_last_n_blocks { let fut3 = client.subscribe_and_cache_blocks(index_last_n_blocks); - tokio::join!(fut1, fut2, fut3); + tokio::try_join!(fut1, fut2, fut3).map(|_| ()) } else { - tokio::join!(fut1, fut2); - } + tokio::try_join!(fut1, fut2).map(|_| ()) + }; + + panic!("Block subscription task failed: {res:?}",) }); task_manager.keep_alive(rpc_server_handle); diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index 2eb1fb913a327..106ea6314d900 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -329,6 +329,7 @@ impl Client { }; let block_number = block.number(); + log::trace!(target: "eth-rpc::subscription", "⏳ Processing {subscription_type:?} block: {block_number}"); if let Err(err) = callback(block).await { log::error!(target: LOG_TARGET, "Failed to process block {block_number}: {err:?}"); @@ -342,9 +343,12 @@ impl Client { } /// Start the block subscription, and populate the block cache. - pub async fn subscribe_and_cache_new_blocks(&self, subscription_type: SubscriptionType) { + pub async fn subscribe_and_cache_new_blocks( + &self, + subscription_type: SubscriptionType, + ) -> Result<(), ClientError> { log::info!(target: LOG_TARGET, "🔌 Subscribing to new blocks ({subscription_type:?})"); - let res = self + return self .subscribe_new_blocks(subscription_type, |block| async { let (signed_txs, receipts): (Vec<_>, Vec<_>) = self.receipt_provider.insert_block_receipts(&block).await?.into_iter().unzip(); @@ -357,29 +361,24 @@ impl Client { Ok(()) }) .await; - - if let Err(err) = res { - log::error!(target: LOG_TARGET, "Block subscription error: {err:?}"); - } } /// Cache old blocks up to the given block number. - pub async fn subscribe_and_cache_blocks(&self, index_last_n_blocks: SubstrateBlockNumber) { + pub async fn subscribe_and_cache_blocks( + &self, + index_last_n_blocks: SubstrateBlockNumber, + ) -> Result<(), ClientError> { let last = self.latest_block().await.number().saturating_sub(1); let range = last.saturating_sub(index_last_n_blocks)..last; log::info!(target: LOG_TARGET, "🗄️ Indexing past blocks in range {range:?}"); - let res = self - .subscribe_past_blocks(range, |block| async move { - self.receipt_provider.insert_block_receipts(&block).await?; - Ok(()) - }) - .await; + self.subscribe_past_blocks(range, |block| async move { + self.receipt_provider.insert_block_receipts(&block).await?; + Ok(()) + }) + .await?; - if let Err(err) = res { - log::error!(target: LOG_TARGET, "Past Block subscription error: {err:?}"); - } else { - log::info!(target: LOG_TARGET, "🗄️ Finished indexing past blocks"); - } + log::info!(target: LOG_TARGET, "🗄️ Finished indexing past blocks"); + Ok(()) } /// Get the block hash for the given block number or tag. @@ -624,7 +623,7 @@ impl Client { pub async fn trace_call( &self, transaction: GenericTransaction, - block: BlockNumberOrTag, + block: BlockNumberOrTagOrHash, config: TracerType, ) -> Result { let block_hash = self.block_hash_for_tag(block.into()).await?; From 3fee4e5da1c209f4d46c08794298dfc20414f20d Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 10:59:55 +0200 Subject: [PATCH 02/24] fix --- substrate/frame/revive/rpc/src/cli.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/src/cli.rs b/substrate/frame/revive/rpc/src/cli.rs index 6c640b3f8d426..ef7d9dd0673d0 100644 --- a/substrate/frame/revive/rpc/src/cli.rs +++ b/substrate/frame/revive/rpc/src/cli.rs @@ -229,7 +229,9 @@ pub fn run(cmd: CliCommand) -> anyhow::Result<()> { tokio::try_join!(fut1, fut2).map(|_| ()) }; - panic!("Block subscription task failed: {res:?}",) + if let Err(err) = res { + panic!("Block subscription task failed: {res:?}",) + } }); task_manager.keep_alive(rpc_server_handle); From f2bd2748ab12d75a070ecc2766aaa2e3ed279dd3 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Wed, 21 May 2025 11:01:09 +0200 Subject: [PATCH 03/24] Update substrate/frame/revive/rpc/src/client.rs --- substrate/frame/revive/rpc/src/client.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index 106ea6314d900..b4f304fc63256 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -329,7 +329,6 @@ impl Client { }; let block_number = block.number(); - log::trace!(target: "eth-rpc::subscription", "⏳ Processing {subscription_type:?} block: {block_number}"); if let Err(err) = callback(block).await { log::error!(target: LOG_TARGET, "Failed to process block {block_number}: {err:?}"); From 540d5bb76558754455da3955d7bf7e7e270b70b1 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 09:02:07 +0000 Subject: [PATCH 04/24] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump patch' --- prdoc/pr_8587.prdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 prdoc/pr_8587.prdoc diff --git a/prdoc/pr_8587.prdoc b/prdoc/pr_8587.prdoc new file mode 100644 index 0000000000000..d278f8b4b4c2f --- /dev/null +++ b/prdoc/pr_8587.prdoc @@ -0,0 +1,10 @@ +title: '[pallet-revive] make subscription task panic on error' +doc: +- audience: Runtime Dev + description: 'subscription task are "essential tasks" and the service should go + down when they fail. + + ' +crates: +- name: pallet-revive-eth-rpc + bump: patch From 587b6f50f8b11f58f38ef780fc3d932efd84f14d Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Wed, 21 May 2025 11:02:17 +0200 Subject: [PATCH 05/24] Update substrate/frame/revive/rpc/src/client.rs --- substrate/frame/revive/rpc/src/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index b4f304fc63256..10f095f117438 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -622,7 +622,7 @@ impl Client { pub async fn trace_call( &self, transaction: GenericTransaction, - block: BlockNumberOrTagOrHash, + block: BlockNumberOrTag, config: TracerType, ) -> Result { let block_hash = self.block_hash_for_tag(block.into()).await?; From f7621be461169f8e2a50ef581caa3594bcc9fe51 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 11:07:27 +0200 Subject: [PATCH 06/24] fix --- substrate/frame/revive/rpc/src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/src/cli.rs b/substrate/frame/revive/rpc/src/cli.rs index ef7d9dd0673d0..495bec1763e50 100644 --- a/substrate/frame/revive/rpc/src/cli.rs +++ b/substrate/frame/revive/rpc/src/cli.rs @@ -230,7 +230,7 @@ pub fn run(cmd: CliCommand) -> anyhow::Result<()> { }; if let Err(err) = res { - panic!("Block subscription task failed: {res:?}",) + panic!("Block subscription task failed: {err:?}",) } }); From 0e0cb6f023dc894ebc04f480d732abca044506de Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 11:12:24 +0200 Subject: [PATCH 07/24] update health_api --- substrate/frame/revive/rpc/src/apis/health_api.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/src/apis/health_api.rs b/substrate/frame/revive/rpc/src/apis/health_api.rs index 509c88c14e022..7a9ab4ec02209 100644 --- a/substrate/frame/revive/rpc/src/apis/health_api.rs +++ b/substrate/frame/revive/rpc/src/apis/health_api.rs @@ -48,7 +48,10 @@ impl SystemHealthRpcServer for SystemHealthRpcServerImpl { tokio::try_join!(self.client.sync_state(), self.client.system_health())?; let latest = self.client.latest_block().await.number(); - if sync_state.current_block > latest { + + // Compare against `latest + 1` to avoid a false positive if the health check runs + // immediately after a new block is produced but before the cache updates. + if sync_state.current_block > latest + 1 { log::warn!( target: LOG_TARGET, "Client is out of sync. Current block: {}, latest cache block: {latest}", From 74703cb1d65d511c50a3c78ad36819bb7c8b4e64 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 12:22:40 +0200 Subject: [PATCH 08/24] add error print --- substrate/frame/revive/rpc/src/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index 10f095f117438..ba04e6671b968 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -318,7 +318,7 @@ impl Client { if err.is_disconnected_will_reconnect() { log::warn!( target: LOG_TARGET, - "The RPC connection was lost and we may have missed a few blocks" + "The RPC connection was lost and we may have missed a few blocks: {err:?}" ); continue; } From 5c71703758aa89b714250ee280e3207edef21562 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 12:25:43 +0200 Subject: [PATCH 09/24] nit --- substrate/frame/revive/rpc/src/client.rs | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index ba04e6671b968..0cb6e809c7b05 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -347,19 +347,18 @@ impl Client { subscription_type: SubscriptionType, ) -> Result<(), ClientError> { log::info!(target: LOG_TARGET, "🔌 Subscribing to new blocks ({subscription_type:?})"); - return self - .subscribe_new_blocks(subscription_type, |block| async { - let (signed_txs, receipts): (Vec<_>, Vec<_>) = - self.receipt_provider.insert_block_receipts(&block).await?.into_iter().unzip(); - - let evm_block = - self.evm_block_from_receipts(&block, &receipts, signed_txs, false).await; - self.block_provider.update_latest(block, subscription_type).await; - - self.fee_history_provider.update_fee_history(&evm_block, &receipts).await; - Ok(()) - }) - .await; + self.subscribe_new_blocks(subscription_type, |block| async { + let (signed_txs, receipts): (Vec<_>, Vec<_>) = + self.receipt_provider.insert_block_receipts(&block).await?.into_iter().unzip(); + + let evm_block = + self.evm_block_from_receipts(&block, &receipts, signed_txs, false).await; + self.block_provider.update_latest(block, subscription_type).await; + + self.fee_history_provider.update_fee_history(&evm_block, &receipts).await; + Ok(()) + }) + .await } /// Cache old blocks up to the given block number. From 79e34a946b003dbe9eaa99e81194aabfecb2fbcb Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 21 May 2025 23:54:49 +0200 Subject: [PATCH 10/24] update subxt to 0.41 --- Cargo.lock | 31 +++++++-------- Cargo.toml | 6 +-- substrate/frame/revive/rpc/src/client.rs | 39 +++++++++---------- .../frame/revive/rpc/src/subxt_client.rs | 39 +------------------ 4 files changed, 38 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24f88cf132469..b5ac4764731ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5083,7 +5083,7 @@ dependencies = [ "log", "parity-scale-codec", "polkadot-primitives", - "subxt 0.38.1", + "subxt 0.41.0", "tokio", ] @@ -5098,8 +5098,8 @@ dependencies = [ "polkadot-primitives", "serde", "serde_json", - "subxt 0.38.1", - "subxt-signer 0.38.0", + "subxt 0.41.0", + "subxt-signer 0.41.0", "tokio", "zombienet-orchestrator", "zombienet-sdk", @@ -6515,8 +6515,8 @@ dependencies = [ "sp-version 29.0.0", "sp-wasm-interface 20.0.0", "substrate-test-runtime", - "subxt 0.38.1", - "subxt-signer 0.38.0", + "subxt 0.41.0", + "subxt-signer 0.41.0", "thiserror 1.0.65", "thousands", "westend-runtime", @@ -12742,7 +12742,7 @@ dependencies = [ "staging-xcm", "staging-xcm-builder", "substrate-bn", - "subxt-signer 0.38.0", + "subxt-signer 0.41.0", ] [[package]] @@ -12777,8 +12777,8 @@ dependencies = [ "static_init", "substrate-cli-test-utils", "substrate-prometheus-endpoint", - "subxt 0.38.1", - "subxt-signer 0.38.0", + "subxt 0.41.0", + "subxt-signer 0.41.0", "thiserror 1.0.65", "tokio", ] @@ -15511,7 +15511,7 @@ dependencies = [ "substrate-frame-rpc-system", "substrate-prometheus-endpoint", "substrate-state-trie-migration-rpc", - "subxt-metadata 0.38.0", + "subxt-metadata 0.41.0", "tokio", "wait-timeout", ] @@ -16727,8 +16727,8 @@ dependencies = [ "serde_json", "substrate-build-script-utils", "subwasmlib", - "subxt 0.38.1", - "subxt-signer 0.38.0", + "subxt 0.41.0", + "subxt-signer 0.41.0", "tokio", "tokio-util", "zombienet-orchestrator", @@ -20101,7 +20101,7 @@ dependencies = [ "sp-state-machine 0.35.0", "sp-version 29.0.0", "sp-wasm-interface 20.0.0", - "subxt 0.38.1", + "subxt 0.41.0", "thiserror 1.0.65", ] @@ -24089,7 +24089,7 @@ dependencies = [ "sp-keyring", "staging-node-inspect", "substrate-cli-test-utils", - "subxt-signer 0.38.0", + "subxt-signer 0.41.0", "tempfile", "tokio", "tokio-util", @@ -24774,7 +24774,6 @@ dependencies = [ "async-trait", "derive-where", "either", - "finito", "frame-metadata 17.0.0", "futures", "hex", @@ -25035,6 +25034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ba7494d250d65dc3439365ac5e8e0fbb9c3992e6e84b7aa01d69e082249b8b8" dependencies = [ "derive-where", + "finito", "frame-metadata 20.0.0", "futures", "hex", @@ -25047,6 +25047,7 @@ dependencies = [ "subxt-core 0.41.0", "subxt-lightclient 0.41.0", "thiserror 2.0.12", + "tokio", "tokio-util", "tracing", "url", @@ -25059,13 +25060,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7a336d6a1f86f126100a4a717be58352de4c8214300c4f7807f974494efdb9" dependencies = [ "base64 0.22.1", - "bip32", "bip39", "cfg-if", "crypto_secretbox", "hex", "hmac 0.12.1", - "keccak-hash", "parity-scale-codec", "pbkdf2", "polkadot-sdk 0.7.0", diff --git a/Cargo.toml b/Cargo.toml index 3c25cdda2bd27..d3a2a04da07d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1376,9 +1376,9 @@ substrate-test-runtime-client = { path = "substrate/test-utils/runtime/client" } substrate-test-runtime-transaction-pool = { path = "substrate/test-utils/runtime/transaction-pool" } substrate-test-utils = { path = "substrate/test-utils" } substrate-wasm-builder = { path = "substrate/utils/wasm-builder", default-features = false } -subxt = { version = "0.38.1", default-features = false } -subxt-metadata = { version = "0.38.0", default-features = false } -subxt-signer = { version = "0.38" } +subxt = { version = "0.41", default-features = false } +subxt-metadata = { version = "0.41", default-features = false } +subxt-signer = { version = "0.41"} syn = { version = "2.0.87" } sysinfo = { version = "0.30" } tar = { version = "0.4" } diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index 0cb6e809c7b05..8ff168d225dc2 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -28,7 +28,11 @@ use crate::{ BlockInfoProvider, BlockTag, FeeHistoryProvider, ReceiptProvider, SubxtBlockInfoProvider, TracerType, TransactionInfo, LOG_TARGET, }; -use jsonrpsee::types::{error::CALL_EXECUTION_FAILED_CODE, ErrorObjectOwned}; +use jsonrpsee::{ + core::traits::ToRpcParams, + rpc_params, + types::{error::CALL_EXECUTION_FAILED_CODE, ErrorObjectOwned}, +}; use pallet_revive::{ evm::{ decode_revert_reason, Block, BlockNumberOrTag, BlockNumberOrTagOrHash, FeeHistoryResult, @@ -49,7 +53,6 @@ use subxt::{ }, }, config::Header, - error::RpcError, Config, OnlineClient, }; use thiserror::Error; @@ -83,17 +86,14 @@ pub enum SubscriptionType { } /// Unwrap the original `jsonrpsee::core::client::Error::Call` error. -fn unwrap_call_err(err: &subxt::error::RpcError) -> Option { +fn unwrap_call_err( + err: &Box, +) -> Option { use subxt::backend::rpc::reconnecting_rpc_client; - match err { - subxt::error::RpcError::ClientError(err) => { - match err.downcast_ref::() { - Some(reconnecting_rpc_client::Error::RpcError( - jsonrpsee::core::client::Error::Call(err), - )) => Some(err.clone().into_owned()), - _ => None, - } - }, + match err.downcast_ref::() { + Some(reconnecting_rpc_client::Error::RpcError(jsonrpsee::core::client::Error::Call( + err, + ))) => Some(err.clone().into_owned()), _ => None, } } @@ -107,9 +107,8 @@ pub enum ClientError { /// A [`subxt::Error`] wrapper error. #[error(transparent)] SubxtError(#[from] subxt::Error), - /// A [`RpcError`] wrapper error. #[error(transparent)] - RpcError(#[from] RpcError), + RpcError(#[from] subxt::ext::subxt_rpcs::Error), /// A [`sqlx::Error`] wrapper error. #[error(transparent)] SqlxError(#[from] sqlx::Error), @@ -148,7 +147,10 @@ const REVERT_CODE: i32 = 3; impl From for ErrorObjectOwned { fn from(err: ClientError) -> Self { match err { - ClientError::SubxtError(subxt::Error::Rpc(err)) | ClientError::RpcError(err) => { + ClientError::SubxtError(subxt::Error::Rpc(subxt::error::RpcError::ClientError( + subxt::ext::subxt_rpcs::Error::Client(err), + ))) | + ClientError::RpcError(subxt::ext::subxt_rpcs::Error::Client(err)) => { if let Some(err) = unwrap_call_err(&err) { return err; } @@ -554,11 +556,8 @@ impl Client { >, ClientError, > { - let res = self - .rpc_client - .request("chain_getBlock".to_string(), subxt::rpc_params![block_hash].build()) - .await - .unwrap(); + let params = rpc_params![block_hash].to_rpc_params().unwrap_or_default(); + let res = self.rpc_client.request("chain_getBlock".to_string(), params).await.unwrap(); let signed_block: sp_runtime::generic::SignedBlock< sp_runtime::generic::Block< diff --git a/substrate/frame/revive/rpc/src/subxt_client.rs b/substrate/frame/revive/rpc/src/subxt_client.rs index cb1f1e53e0bb5..08d9343797e31 100644 --- a/substrate/frame/revive/rpc/src/subxt_client.rs +++ b/substrate/frame/revive/rpc/src/subxt_client.rs @@ -17,7 +17,7 @@ //! The generated subxt client. //! Generated against a substrate chain configured with [`pallet_revive`] using: //! subxt metadata --url ws://localhost:9944 -o rpc/revive_chain.scale -use subxt::config::{signed_extensions, Config, PolkadotConfig}; +pub use subxt::config::PolkadotConfig as SrcChainConfig; #[subxt::subxt( runtime_metadata_path = "revive_chain.metadata", @@ -66,40 +66,3 @@ use subxt::config::{signed_extensions, Config, PolkadotConfig}; )] mod src_chain {} pub use src_chain::*; - -/// The configuration for the source chain. -pub enum SrcChainConfig {} -impl Config for SrcChainConfig { - type Hash = sp_core::H256; - type AccountId = ::AccountId; - type Address = ::Address; - type Signature = ::Signature; - type Hasher = BlakeTwo256; - type Header = subxt::config::substrate::SubstrateHeader; - type AssetId = ::AssetId; - type ExtrinsicParams = signed_extensions::AnyOf< - Self, - ( - signed_extensions::CheckSpecVersion, - signed_extensions::CheckTxVersion, - signed_extensions::CheckNonce, - signed_extensions::CheckGenesis, - signed_extensions::CheckMortality, - signed_extensions::ChargeAssetTxPayment, - signed_extensions::ChargeTransactionPayment, - signed_extensions::CheckMetadataHash, - ), - >; -} - -/// A type that can hash values using the blaks2_256 algorithm. -/// TODO remove once subxt is updated -#[derive(Debug, Clone, Copy, PartialEq, Eq, codec::Encode)] -pub struct BlakeTwo256; - -impl subxt::config::Hasher for BlakeTwo256 { - type Output = sp_core::H256; - fn hash(s: &[u8]) -> Self::Output { - sp_crypto_hashing::blake2_256(s).into() - } -} From 79a4ce70139e17101e4e51cbc20b309ce9ba7c13 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 00:47:05 +0200 Subject: [PATCH 11/24] fix subxt method --- .../frame/benchmarking-cli/src/overhead/remark_builder.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/substrate/utils/frame/benchmarking-cli/src/overhead/remark_builder.rs b/substrate/utils/frame/benchmarking-cli/src/overhead/remark_builder.rs index 65f0fcc32a690..c5546de232b6a 100644 --- a/substrate/utils/frame/benchmarking-cli/src/overhead/remark_builder.rs +++ b/substrate/utils/frame/benchmarking-cli/src/overhead/remark_builder.rs @@ -117,8 +117,9 @@ impl ExtrinsicBuilder for DynamicRemarkBuilder { let transaction = self .offline_client .tx() - .create_signed_offline(&dynamic_tx, &signer, params) - .unwrap(); + .create_partial_offline(&dynamic_tx, params) + .unwrap() + .sign(&signer); let mut encoded = transaction.into_encoded(); OpaqueExtrinsic::from_bytes(&mut encoded).map_err(|_| "Unable to construct OpaqueExtrinsic") From 152f355e60a6e5d2bff318b674606d3f98daa4ec Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 11:52:50 +0200 Subject: [PATCH 12/24] fix err --- substrate/frame/revive/rpc/src/client.rs | 27 +++--------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index 8ff168d225dc2..91e3d68704739 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -85,19 +85,6 @@ pub enum SubscriptionType { FinalizedBlocks, } -/// Unwrap the original `jsonrpsee::core::client::Error::Call` error. -fn unwrap_call_err( - err: &Box, -) -> Option { - use subxt::backend::rpc::reconnecting_rpc_client; - match err.downcast_ref::() { - Some(reconnecting_rpc_client::Error::RpcError(jsonrpsee::core::client::Error::Call( - err, - ))) => Some(err.clone().into_owned()), - _ => None, - } -} - /// The error type for the client. #[derive(Error, Debug)] pub enum ClientError { @@ -148,18 +135,10 @@ impl From for ErrorObjectOwned { fn from(err: ClientError) -> Self { match err { ClientError::SubxtError(subxt::Error::Rpc(subxt::error::RpcError::ClientError( - subxt::ext::subxt_rpcs::Error::Client(err), + subxt::ext::subxt_rpcs::Error::User(err), ))) | - ClientError::RpcError(subxt::ext::subxt_rpcs::Error::Client(err)) => { - if let Some(err) = unwrap_call_err(&err) { - return err; - } - ErrorObjectOwned::owned::>( - CALL_EXECUTION_FAILED_CODE, - err.to_string(), - None, - ) - }, + ClientError::RpcError(subxt::ext::subxt_rpcs::Error::User(err)) => + ErrorObjectOwned::owned::>(err.code, err.message, None), ClientError::TransactError(EthTransactError::Data(data)) => { let msg = match decode_revert_reason(&data) { Some(reason) => format!("execution reverted: {reason}"), From 402800a63f2339a927653db1ca3b80f55728df0d Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 13:35:50 +0200 Subject: [PATCH 13/24] use zombienet-sdk subxt re-export --- Cargo.lock | 2 - polkadot/zombienet-sdk-tests/Cargo.toml | 2 - .../tests/disabling/slashing.rs | 6 ++- .../tests/elastic_scaling/basic_3cores.rs | 8 ++-- .../doesnt_break_parachains.rs | 8 ++-- .../elastic_scaling/slot_based_12cores.rs | 8 ++-- .../elastic_scaling/slot_based_3cores.rs | 8 ++-- .../functional/approval_voting_coalescing.rs | 6 ++- .../approved_peer_mixed_validators.rs | 6 ++- .../async_backing_6_seconds_rate.rs | 6 ++- .../tests/functional/duplicate_collations.rs | 8 ++-- .../spam_statement_distribution_requests.rs | 6 ++- .../tests/functional/sync_backing.rs | 6 ++- .../tests/smoke/coretime_revenue.rs | 44 ++++++++++++------- 14 files changed, 77 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5ac4764731ce..94d9edc2a6960 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16727,8 +16727,6 @@ dependencies = [ "serde_json", "substrate-build-script-utils", "subwasmlib", - "subxt 0.41.0", - "subxt-signer 0.41.0", "tokio", "tokio-util", "zombienet-orchestrator", diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index 8a2ca05c105d5..ce42a2a4dd5d6 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -16,8 +16,6 @@ log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } serde = { workspace = true } serde_json = { workspace = true } -subxt = { workspace = true } -subxt-signer = { workspace = true } tokio = { workspace = true, features = ["rt-multi-thread"] } tokio-util = { workspace = true, features = ["time"] } zombienet-orchestrator = { workspace = true } diff --git a/polkadot/zombienet-sdk-tests/tests/disabling/slashing.rs b/polkadot/zombienet-sdk-tests/tests/disabling/slashing.rs index 8d66d9430b5ec..372b42b35c4d9 100644 --- a/polkadot/zombienet-sdk-tests/tests/disabling/slashing.rs +++ b/polkadot/zombienet-sdk-tests/tests/disabling/slashing.rs @@ -12,11 +12,13 @@ use cumulus_zombienet_sdk_helpers::{ }; use polkadot_primitives::{BlockNumber, CandidateHash, DisputeState, Id as ParaId, SessionIndex}; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; use tokio::time::Duration; use tokio_util::time::FutureExt; use zombienet_orchestrator::network::node::LogLineCountOptions; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn dispute_past_session_slashing() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/basic_3cores.rs b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/basic_3cores.rs index ceb27551ad454..92a59d6ded8d0 100644 --- a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/basic_3cores.rs +++ b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/basic_3cores.rs @@ -8,9 +8,11 @@ use anyhow::anyhow; use cumulus_zombienet_sdk_helpers::{assert_finalized_para_throughput, create_assign_core_call}; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn basic_3cores_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/doesnt_break_parachains.rs b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/doesnt_break_parachains.rs index 1a0bdcd215eb9..340bad10bed70 100644 --- a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/doesnt_break_parachains.rs +++ b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/doesnt_break_parachains.rs @@ -11,9 +11,11 @@ use cumulus_zombienet_sdk_helpers::{ use polkadot_primitives::{CoreIndex, Id as ParaId}; use serde_json::json; use std::collections::{BTreeMap, VecDeque}; -use subxt::{OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn doesnt_break_parachains_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_12cores.rs b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_12cores.rs index ed9bad3034011..959966de08d05 100644 --- a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_12cores.rs +++ b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_12cores.rs @@ -11,9 +11,11 @@ use cumulus_zombienet_sdk_helpers::{ }; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn slot_based_12cores_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_3cores.rs b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_3cores.rs index 422feb4d20cf4..c626fdc00d91c 100644 --- a/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_3cores.rs +++ b/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_3cores.rs @@ -11,9 +11,11 @@ use cumulus_zombienet_sdk_helpers::{ }; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn slot_based_3cores_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/functional/approval_voting_coalescing.rs b/polkadot/zombienet-sdk-tests/tests/functional/approval_voting_coalescing.rs index 717328f759a48..1402f32eb2d4e 100644 --- a/polkadot/zombienet-sdk-tests/tests/functional/approval_voting_coalescing.rs +++ b/polkadot/zombienet-sdk-tests/tests/functional/approval_voting_coalescing.rs @@ -8,8 +8,10 @@ use anyhow::anyhow; use cumulus_zombienet_sdk_helpers::{assert_finality_lag, assert_para_throughput}; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn approval_voting_coalescing_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/functional/approved_peer_mixed_validators.rs b/polkadot/zombienet-sdk-tests/tests/functional/approved_peer_mixed_validators.rs index 0da219711e7eb..9052cf33a9274 100644 --- a/polkadot/zombienet-sdk-tests/tests/functional/approved_peer_mixed_validators.rs +++ b/polkadot/zombienet-sdk-tests/tests/functional/approved_peer_mixed_validators.rs @@ -12,9 +12,11 @@ use tokio::time::Duration; use cumulus_zombienet_sdk_helpers::{assert_finality_lag, assert_finalized_para_throughput}; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; use zombienet_orchestrator::network::node::LogLineCountOptions; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn approved_peer_mixed_validators_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/functional/async_backing_6_seconds_rate.rs b/polkadot/zombienet-sdk-tests/tests/functional/async_backing_6_seconds_rate.rs index 09c3b2b4d8b24..6dec2339be47e 100644 --- a/polkadot/zombienet-sdk-tests/tests/functional/async_backing_6_seconds_rate.rs +++ b/polkadot/zombienet-sdk-tests/tests/functional/async_backing_6_seconds_rate.rs @@ -8,8 +8,10 @@ use anyhow::anyhow; use cumulus_zombienet_sdk_helpers::{assert_finality_lag, assert_finalized_para_throughput}; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn async_backing_6_seconds_rate_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/functional/duplicate_collations.rs b/polkadot/zombienet-sdk-tests/tests/functional/duplicate_collations.rs index 13cd2114ca848..39cd1383fb54c 100644 --- a/polkadot/zombienet-sdk-tests/tests/functional/duplicate_collations.rs +++ b/polkadot/zombienet-sdk-tests/tests/functional/duplicate_collations.rs @@ -10,10 +10,12 @@ use tokio::time::Duration; use cumulus_zombienet_sdk_helpers::{assert_finalized_para_throughput, create_assign_core_call}; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; use zombienet_orchestrator::network::node::LogLineCountOptions; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfigBuilder, +}; const VALIDATOR_COUNT: u8 = 3; diff --git a/polkadot/zombienet-sdk-tests/tests/functional/spam_statement_distribution_requests.rs b/polkadot/zombienet-sdk-tests/tests/functional/spam_statement_distribution_requests.rs index a3a62e1e2f92a..0e346f658d38b 100644 --- a/polkadot/zombienet-sdk-tests/tests/functional/spam_statement_distribution_requests.rs +++ b/polkadot/zombienet-sdk-tests/tests/functional/spam_statement_distribution_requests.rs @@ -9,9 +9,11 @@ use tokio::time::Duration; use cumulus_zombienet_sdk_helpers::assert_para_throughput; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; use zombienet_orchestrator::network::node::LogLineCountOptions; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn spam_statement_distribution_requests_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/functional/sync_backing.rs b/polkadot/zombienet-sdk-tests/tests/functional/sync_backing.rs index 0d2de9024c8d0..2e8ec0a10a122 100644 --- a/polkadot/zombienet-sdk-tests/tests/functional/sync_backing.rs +++ b/polkadot/zombienet-sdk-tests/tests/functional/sync_backing.rs @@ -8,8 +8,10 @@ use anyhow::anyhow; use cumulus_zombienet_sdk_helpers::{assert_finality_lag, assert_finalized_para_throughput}; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfigBuilder, +}; #[tokio::test(flavor = "multi_thread")] async fn sync_backing_test() -> Result<(), anyhow::Error> { diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs b/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs index 5105bdf156d8a..2a71c1829e085 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs @@ -11,10 +11,10 @@ use anyhow::anyhow; -#[subxt::subxt(runtime_metadata_path = "metadata-files/coretime-rococo-local.scale")] +#[zombienet_sdk::subxt(runtime_metadata_path = "metadata-files/coretime-rococo-local.scale")] mod coretime_rococo {} -#[subxt::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")] +#[zombienet_sdk::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")] mod rococo {} use rococo::runtime_types::{ @@ -30,10 +30,12 @@ use rococo::runtime_types::{ use serde_json::json; use std::{fmt::Display, sync::Arc}; -use subxt::{events::StaticEvent, utils::AccountId32, OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; use tokio::sync::RwLock; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{ + subxt::{events::StaticEvent, utils::AccountId32, OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfigBuilder, +}; use coretime_rococo::{ self as coretime_api, @@ -88,7 +90,7 @@ async fn assert_total_issuance( assert_eq!(ti, actual_ti); } -type EventOf = Arc)>>>; +type EventOf = Arc)>>>; macro_rules! trace_event { ($event:ident : $mod:ident => $($ev:ident),*) => { @@ -102,9 +104,11 @@ macro_rules! trace_event { }; } -async fn para_watcher(api: OnlineClient, events: EventOf) -where - ::Number: Display, +async fn para_watcher( + api: OnlineClient, + events: EventOf, +) where + ::Number: Display, { let mut blocks_sub = api.blocks().subscribe_finalized().await.unwrap(); @@ -130,9 +134,11 @@ where } } -async fn relay_watcher(api: OnlineClient, events: EventOf) -where - ::Number: Display, +async fn relay_watcher( + api: OnlineClient, + events: EventOf, +) where + ::Number: Display, { let mut blocks_sub = api.blocks().subscribe_finalized().await.unwrap(); @@ -157,7 +163,11 @@ where } } -async fn wait_for_event bool + Copy>( +async fn wait_for_event< + C: zombienet_sdk::subxt::Config + Clone, + E: StaticEvent, + P: Fn(&E) -> bool + Copy, +>( events: EventOf, pallet: &'static str, variant: &'static str, @@ -179,9 +189,11 @@ async fn wait_for_event b } } -async fn ti_watcher(api: OnlineClient, prefix: &'static str) -where - ::Number: Display, +async fn ti_watcher( + api: OnlineClient, + prefix: &'static str, +) where + ::Number: Display, { let mut blocks_sub = api.blocks().subscribe_finalized().await.unwrap(); From 91f1faa76a108f460eb1d5127ec59abdd6074230 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 13:38:54 +0200 Subject: [PATCH 14/24] rm subxt deps --- Cargo.lock | 2 -- cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml | 1 - cumulus/zombienet/zombienet-sdk/Cargo.toml | 2 -- 3 files changed, 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 94d9edc2a6960..a572b75894382 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5098,8 +5098,6 @@ dependencies = [ "polkadot-primitives", "serde", "serde_json", - "subxt 0.41.0", - "subxt-signer 0.41.0", "tokio", "zombienet-orchestrator", "zombienet-sdk", diff --git a/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml b/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml index b015c32868689..dccc085ff53d3 100644 --- a/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml +++ b/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml @@ -12,6 +12,5 @@ anyhow = { workspace = true, default-features = true } codec = { workspace = true, features = ["derive"] } log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } -subxt = { workspace = true, features = ["native"] } tokio = { workspace = true, features = ["rt-multi-thread", "macros", "time"] } diff --git a/cumulus/zombienet/zombienet-sdk/Cargo.toml b/cumulus/zombienet/zombienet-sdk/Cargo.toml index ba1f30f5763c3..546bda1293b4c 100644 --- a/cumulus/zombienet/zombienet-sdk/Cargo.toml +++ b/cumulus/zombienet/zombienet-sdk/Cargo.toml @@ -14,8 +14,6 @@ log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } serde = { workspace = true } serde_json = { workspace = true } -subxt = { workspace = true } -subxt-signer = { workspace = true } tokio = { workspace = true, features = ["rt-multi-thread"] } zombienet-sdk = { workspace = true } zombienet-orchestrator = { workspace = true } From c47e1a8d07cd8c00409e16be0ca4fd7e800755d0 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 13:52:24 +0200 Subject: [PATCH 15/24] fix --- Cargo.lock | 1 - Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a572b75894382..7063dd910524c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5083,7 +5083,6 @@ dependencies = [ "log", "parity-scale-codec", "polkadot-primitives", - "subxt 0.41.0", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index d3a2a04da07d3..6db78d0e3dedd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1378,7 +1378,7 @@ substrate-test-utils = { path = "substrate/test-utils" } substrate-wasm-builder = { path = "substrate/utils/wasm-builder", default-features = false } subxt = { version = "0.41", default-features = false } subxt-metadata = { version = "0.41", default-features = false } -subxt-signer = { version = "0.41"} +subxt-signer = { version = "0.41" } syn = { version = "2.0.87" } sysinfo = { version = "0.30" } tar = { version = "0.4" } From 95b81df0705c6f3d632c0885907c3c91db7fc57c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 14:28:07 +0200 Subject: [PATCH 16/24] fix misc subxt:: --- cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs b/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs index 0f572c4b0619d..a5958b67a644e 100644 --- a/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs +++ b/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs @@ -8,14 +8,14 @@ use std::{ collections::{HashMap, HashSet}, ops::Range, }; -use subxt::{ - blocks::Block, events::Events, ext::scale_value::value, tx::DynamicPayload, utils::H256, - OnlineClient, PolkadotConfig, -}; use tokio::{ join, time::{sleep, Duration}, }; +use zombienet::subxt::{ + blocks::Block, events::Events, ext::scale_value::value, tx::DynamicPayload, utils::H256, + OnlineClient, PolkadotConfig, +}; // Maximum number of blocks to wait for a session change. // If it does not arrive for whatever reason, we should not wait forever. @@ -30,7 +30,7 @@ pub fn create_assign_core_call(core_and_para: &[(u32, u32)]) -> DynamicPayload { }); } - subxt::tx::dynamic( + zombienet::subxt::tx::dynamic( "Sudo", "sudo", vec![value! { @@ -238,7 +238,7 @@ pub async fn assert_para_throughput( /// /// The session change is detected by inspecting the events in the block. pub async fn wait_for_first_session_change( - blocks_sub: &mut subxt::backend::StreamOfResults< + blocks_sub: &mut zombienet::subxt::backend::StreamOfResults< Block>, >, ) -> Result<(), anyhow::Error> { @@ -249,7 +249,7 @@ pub async fn wait_for_first_session_change( /// /// The session change is detected by inspecting the events in the block. pub async fn wait_for_nth_session_change( - blocks_sub: &mut subxt::backend::StreamOfResults< + blocks_sub: &mut zombienet::subxt::backend::StreamOfResults< Block>, >, mut sessions_to_wait: u32, From ab4980a34a1042d9f016d75d096751131880aeb3 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 15:54:53 +0200 Subject: [PATCH 17/24] fixes --- Cargo.lock | 1 + cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml | 2 +- cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7063dd910524c..fd2d75698a28f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5084,6 +5084,7 @@ dependencies = [ "parity-scale-codec", "polkadot-primitives", "tokio", + "zombienet-sdk", ] [[package]] diff --git a/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml b/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml index dccc085ff53d3..e5a0291697069 100644 --- a/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml +++ b/cumulus/zombienet/zombienet-sdk-helpers/Cargo.toml @@ -13,4 +13,4 @@ codec = { workspace = true, features = ["derive"] } log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } tokio = { workspace = true, features = ["rt-multi-thread", "macros", "time"] } - +zombienet-sdk = { workspace = true } diff --git a/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs b/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs index a5958b67a644e..be78a2f159050 100644 --- a/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs +++ b/cumulus/zombienet/zombienet-sdk-helpers/src/lib.rs @@ -12,7 +12,7 @@ use tokio::{ join, time::{sleep, Duration}, }; -use zombienet::subxt::{ +use zombienet_sdk::subxt::{ blocks::Block, events::Events, ext::scale_value::value, tx::DynamicPayload, utils::H256, OnlineClient, PolkadotConfig, }; @@ -30,7 +30,7 @@ pub fn create_assign_core_call(core_and_para: &[(u32, u32)]) -> DynamicPayload { }); } - zombienet::subxt::tx::dynamic( + zombienet_sdk::subxt::tx::dynamic( "Sudo", "sudo", vec![value! { @@ -238,7 +238,7 @@ pub async fn assert_para_throughput( /// /// The session change is detected by inspecting the events in the block. pub async fn wait_for_first_session_change( - blocks_sub: &mut zombienet::subxt::backend::StreamOfResults< + blocks_sub: &mut zombienet_sdk::subxt::backend::StreamOfResults< Block>, >, ) -> Result<(), anyhow::Error> { @@ -249,7 +249,7 @@ pub async fn wait_for_first_session_change( /// /// The session change is detected by inspecting the events in the block. pub async fn wait_for_nth_session_change( - blocks_sub: &mut zombienet::subxt::backend::StreamOfResults< + blocks_sub: &mut zombienet_sdk::subxt::backend::StreamOfResults< Block>, >, mut sessions_to_wait: u32, From c240c57cd5191736ce6e3b2aa86f1490619ce543 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 18:39:22 +0200 Subject: [PATCH 18/24] misc --- cumulus/zombienet/zombienet-sdk/tests/bootnodes/mod.rs | 6 ++++-- .../elastic_scaling_multiple_blocks_per_slot.rs | 8 +++++--- .../sync_blocks_from_tip_without_connected_collator.rs | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cumulus/zombienet/zombienet-sdk/tests/bootnodes/mod.rs b/cumulus/zombienet/zombienet-sdk/tests/bootnodes/mod.rs index 6b1529f1b0243..7ee1ae45038a6 100644 --- a/cumulus/zombienet/zombienet-sdk/tests/bootnodes/mod.rs +++ b/cumulus/zombienet/zombienet-sdk/tests/bootnodes/mod.rs @@ -5,9 +5,11 @@ use anyhow::anyhow; use tokio::time::Duration; use cumulus_zombienet_sdk_helpers::wait_for_nth_session_change; -use subxt::{OnlineClient, PolkadotConfig}; use zombienet_orchestrator::network::node::LogLineCountOptions; -use zombienet_sdk::{NetworkConfig, NetworkConfigBuilder}; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + NetworkConfig, NetworkConfigBuilder, +}; async fn build_network_config() -> Result { let images = zombienet_sdk::environment::get_images_from_env(); diff --git a/cumulus/zombienet/zombienet-sdk/tests/elastic_scaling/elastic_scaling_multiple_blocks_per_slot.rs b/cumulus/zombienet/zombienet-sdk/tests/elastic_scaling/elastic_scaling_multiple_blocks_per_slot.rs index 660440fb7998c..4612e4ff142f5 100644 --- a/cumulus/zombienet/zombienet-sdk/tests/elastic_scaling/elastic_scaling_multiple_blocks_per_slot.rs +++ b/cumulus/zombienet/zombienet-sdk/tests/elastic_scaling/elastic_scaling_multiple_blocks_per_slot.rs @@ -8,9 +8,11 @@ use cumulus_zombienet_sdk_helpers::{ }; use polkadot_primitives::Id as ParaId; use serde_json::json; -use subxt::{OnlineClient, PolkadotConfig}; -use subxt_signer::sr25519::dev; -use zombienet_sdk::{NetworkConfig, NetworkConfigBuilder}; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + subxt_signer::sr25519::dev, + NetworkConfig, NetworkConfigBuilder, +}; const PARA_ID: u32 = 2400; diff --git a/cumulus/zombienet/zombienet-sdk/tests/sync_blocks/sync_blocks_from_tip_without_connected_collator.rs b/cumulus/zombienet/zombienet-sdk/tests/sync_blocks/sync_blocks_from_tip_without_connected_collator.rs index 916c9e29672c8..e9f1690380bb1 100644 --- a/cumulus/zombienet/zombienet-sdk/tests/sync_blocks/sync_blocks_from_tip_without_connected_collator.rs +++ b/cumulus/zombienet/zombienet-sdk/tests/sync_blocks/sync_blocks_from_tip_without_connected_collator.rs @@ -5,8 +5,10 @@ use anyhow::anyhow; use cumulus_zombienet_sdk_helpers::assert_para_throughput; use polkadot_primitives::Id as ParaId; -use subxt::{OnlineClient, PolkadotConfig}; -use zombienet_sdk::{LocalFileSystem, Network, NetworkConfigBuilder}; +use zombienet_sdk::{ + subxt::{OnlineClient, PolkadotConfig}, + LocalFileSystem, Network, NetworkConfigBuilder, +}; const PARA_ID: u32 = 2000; const BEST_BLOCK_METRIC: &str = "block_height{status=\"best\"}"; From 90be5a1443d8c2e4525f8653c2bc941484560a27 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 19:59:41 +0200 Subject: [PATCH 19/24] fix --- polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs b/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs index 2a71c1829e085..501b1b20a51eb 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs @@ -11,10 +11,10 @@ use anyhow::anyhow; -#[zombienet_sdk::subxt(runtime_metadata_path = "metadata-files/coretime-rococo-local.scale")] +#[zombienet_sdk::subxt::subxt(runtime_metadata_path = "metadata-files/coretime-rococo-local.scale")] mod coretime_rococo {} -#[zombienet_sdk::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")] +#[zombienet_sdk::subxt::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")] mod rococo {} use rococo::runtime_types::{ From 367bcdf440e5e7cb7afbff8ed59b626013d3b9ce Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 23 May 2025 11:07:55 +0200 Subject: [PATCH 20/24] try to include subxt again in "polkadot-zombienet-sdk-tests" --- polkadot/zombienet-sdk-tests/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index ce42a2a4dd5d6..c1b3871cb42d8 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -15,6 +15,7 @@ env_logger = { workspace = true } log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } serde = { workspace = true } +subxt = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true, features = ["rt-multi-thread"] } tokio-util = { workspace = true, features = ["time"] } From 4f62393116f4e42906d780357f3489ea94b2e86c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 23 May 2025 13:46:01 +0200 Subject: [PATCH 21/24] fix lock --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 06fa497a6fcd3..a27d8d146bea2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16747,6 +16747,7 @@ dependencies = [ "serde_json", "substrate-build-script-utils", "subwasmlib", + "subxt 0.41.0", "tokio", "tokio-util", "zombienet-orchestrator", From 30d2eb3aa9f32332a102fbb2c54c80465c3fbc44 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 12:12:23 +0000 Subject: [PATCH 22/24] Update from github-actions[bot] running command 'fmt' --- polkadot/zombienet-sdk-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index c1b3871cb42d8..2fbbcea9cc377 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -15,8 +15,8 @@ env_logger = { workspace = true } log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } serde = { workspace = true } -subxt = { workspace = true } serde_json = { workspace = true } +subxt = { workspace = true } tokio = { workspace = true, features = ["rt-multi-thread"] } tokio-util = { workspace = true, features = ["time"] } zombienet-orchestrator = { workspace = true } From 99f0c25aec6a8c1ecb9eeb4c1d9f599fa83fbc9c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 23 May 2025 14:18:25 +0200 Subject: [PATCH 23/24] test --- Cargo.lock | 2 +- polkadot/zombienet-sdk-tests/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a27d8d146bea2..885bc0cc3ba33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16747,7 +16747,7 @@ dependencies = [ "serde_json", "substrate-build-script-utils", "subwasmlib", - "subxt 0.41.0", + "subxt 0.38.1", "tokio", "tokio-util", "zombienet-orchestrator", diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index 2fbbcea9cc377..2a7c76f824682 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -16,7 +16,7 @@ log = { workspace = true } polkadot-primitives = { workspace = true, default-features = true } serde = { workspace = true } serde_json = { workspace = true } -subxt = { workspace = true } +subxt = { version = "0.38.1", default-features = false } tokio = { workspace = true, features = ["rt-multi-thread"] } tokio-util = { workspace = true, features = ["time"] } zombienet-orchestrator = { workspace = true } From 6f3934ccd47c8663fb85c0e350f4a2fbc225c7b5 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 26 May 2025 13:02:43 +0000 Subject: [PATCH 24/24] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump patch --force' --- prdoc/pr_8587.prdoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/prdoc/pr_8587.prdoc b/prdoc/pr_8587.prdoc index d278f8b4b4c2f..a9d9fc8662e95 100644 --- a/prdoc/pr_8587.prdoc +++ b/prdoc/pr_8587.prdoc @@ -1,10 +1,12 @@ title: '[pallet-revive] make subscription task panic on error' doc: - audience: Runtime Dev - description: 'subscription task are "essential tasks" and the service should go - down when they fail. - - ' + description: |- + - subscription task are "essential tasks" and the service should go down when they fail. + - Upgrade subxt to 0.41 + - Update zombienet-sdk to use the subxt re-export of subxt so it does not conflict with the workspace version crates: - name: pallet-revive-eth-rpc bump: patch +- name: frame-benchmarking-cli + bump: patch