fix: Add workspace dependencies for vendored pezkuwi-subxt and zombienet-sdk

- Add all missing workspace dependencies required by vendor crates
- Include external crates: scale-*, sp-core, sc-chain-spec, kube, etc.
- Include subxt dependencies: smoldot, web-time, wasm-bindgen, etc.
- Regenerate umbrella crate with updated dependencies
- Apply zepter std feature propagation fixes to vendor crates
- Apply rustfmt formatting to vendor and pezframe files
This commit is contained in:
2025-12-23 00:18:55 +03:00
parent 70ddb6516f
commit 49485a882c
133 changed files with 1070 additions and 697 deletions
@@ -227,8 +227,8 @@ pub(super) mod test_utils {
BestBlockChanged, Finalized, Initialized, NewBlock,
};
use std::sync::{
Arc,
atomic::{AtomicUsize, Ordering},
Arc,
};
/// Given some events, returns a follow stream getter that we can use in
@@ -297,10 +297,12 @@ impl<H: Hash> Shared<H> {
.collect();
shared.block_events_for_new_subscriptions.retain(|ev| match ev {
FollowEvent::NewBlock(new_block_ev) =>
!to_remove.contains(&new_block_ev.block_hash.hash()),
FollowEvent::BestBlockChanged(best_block_ev) =>
!to_remove.contains(&best_block_ev.best_block_hash.hash()),
FollowEvent::NewBlock(new_block_ev) => {
!to_remove.contains(&new_block_ev.block_hash.hash())
},
FollowEvent::BestBlockChanged(best_block_ev) => {
!to_remove.contains(&best_block_ev.best_block_hash.hash())
},
_ => true,
});
},
@@ -2,7 +2,7 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use super::{ChainHeadRpcMethods, follow_stream::FollowStream};
use super::{follow_stream::FollowStream, ChainHeadRpcMethods};
use crate::{
config::{Config, Hash, HashFor},
error::BackendError,
@@ -229,20 +229,27 @@ impl<H: Hash> Stream for FollowStreamUnpin<H> {
FollowStreamMsg::Event(FollowEvent::Stop)
},
// These events aren't interesting; we just forward them on:
FollowStreamMsg::Event(FollowEvent::OperationBodyDone(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationBodyDone(details)),
FollowStreamMsg::Event(FollowEvent::OperationCallDone(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationCallDone(details)),
FollowStreamMsg::Event(FollowEvent::OperationStorageItems(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationStorageItems(details)),
FollowStreamMsg::Event(FollowEvent::OperationWaitingForContinue(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationWaitingForContinue(details)),
FollowStreamMsg::Event(FollowEvent::OperationStorageDone(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationStorageDone(details)),
FollowStreamMsg::Event(FollowEvent::OperationInaccessible(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationInaccessible(details)),
FollowStreamMsg::Event(FollowEvent::OperationError(details)) =>
FollowStreamMsg::Event(FollowEvent::OperationError(details)),
FollowStreamMsg::Event(FollowEvent::OperationBodyDone(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationBodyDone(details))
},
FollowStreamMsg::Event(FollowEvent::OperationCallDone(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationCallDone(details))
},
FollowStreamMsg::Event(FollowEvent::OperationStorageItems(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationStorageItems(details))
},
FollowStreamMsg::Event(FollowEvent::OperationWaitingForContinue(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationWaitingForContinue(details))
},
FollowStreamMsg::Event(FollowEvent::OperationStorageDone(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationStorageDone(details))
},
FollowStreamMsg::Event(FollowEvent::OperationInaccessible(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationInaccessible(details))
},
FollowStreamMsg::Event(FollowEvent::OperationError(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationError(details))
},
};
// Return our event.
@@ -352,8 +359,8 @@ impl<H: Hash> FollowStreamUnpin<H> {
let mut blocks_to_unpin = vec![];
for (hash, details) in &self.pinned {
if rel_block_age.saturating_sub(details.rel_block_age) >= self.max_block_life ||
(unpin_flags.contains(hash) && details.can_be_unpinned)
if rel_block_age.saturating_sub(details.rel_block_age) >= self.max_block_life
|| (unpin_flags.contains(hash) && details.can_be_unpinned)
{
// The block is too old, or it's been flagged to be unpinned and won't be in a
// future backend event, so we can unpin it for real now.
@@ -460,7 +467,7 @@ impl<H: Hash> Drop for BlockRef<H> {
#[cfg(test)]
pub(super) mod test_utils {
use super::{
super::follow_stream::{FollowStream, test_utils::test_stream_getter},
super::follow_stream::{test_utils::test_stream_getter, FollowStream},
*,
};
use crate::config::bizinikiwi::H256;
+37 -26
View File
@@ -19,21 +19,21 @@ mod storage_items;
use self::follow_stream_driver::FollowStreamFinalizedHeads;
use crate::{
backend::{
Backend, BlockRef, BlockRefT, RuntimeVersion, StorageResponse, StreamOf, StreamOfResults,
TransactionStatus, utils::retry,
utils::retry, Backend, BlockRef, BlockRefT, RuntimeVersion, StorageResponse, StreamOf,
StreamOfResults, TransactionStatus,
},
config::{Config, Hash, HashFor},
error::{BackendError, RpcError},
};
use async_trait::async_trait;
use follow_stream_driver::{FollowStreamDriver, FollowStreamDriverHandle};
use futures::{Stream, StreamExt, future::Either};
use futures::{future::Either, Stream, StreamExt};
use pezkuwi_subxt_rpcs::{
RpcClient,
methods::chain_head::{
FollowEvent, MethodResponse, RuntimeEvent, StorageQuery, StorageQueryType,
StorageResultType,
},
RpcClient,
};
use std::{collections::HashMap, task::Poll};
use storage_items::StorageItems;
@@ -432,8 +432,9 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for ChainHeadBackend<T> {
.events()
.filter_map(|ev| {
let out = match ev {
FollowEvent::Initialized(init) =>
init.finalized_block_hashes.last().map(|b| b.clone().into()),
FollowEvent::Initialized(init) => {
init.finalized_block_hashes.last().map(|b| b.clone().into())
},
_ => None,
};
std::future::ready(out)
@@ -597,22 +598,28 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for ChainHeadBackend<T> {
match tx_status {
RpcTransactionStatus::Validated => TransactionStatus::Validated,
RpcTransactionStatus::Broadcasted => TransactionStatus::Broadcasted,
RpcTransactionStatus::BestChainBlockIncluded { block: None } =>
TransactionStatus::NoLongerInBestBlock,
RpcTransactionStatus::BestChainBlockIncluded { block: Some(block) } =>
RpcTransactionStatus::BestChainBlockIncluded { block: None } => {
TransactionStatus::NoLongerInBestBlock
},
RpcTransactionStatus::BestChainBlockIncluded { block: Some(block) } => {
TransactionStatus::InBestBlock {
hash: BlockRef::from_hash(block.hash),
},
RpcTransactionStatus::Finalized { block } =>
}
},
RpcTransactionStatus::Finalized { block } => {
TransactionStatus::InFinalizedBlock {
hash: BlockRef::from_hash(block.hash),
},
RpcTransactionStatus::Error { error } =>
TransactionStatus::Error { message: error },
RpcTransactionStatus::Invalid { error } =>
TransactionStatus::Invalid { message: error },
RpcTransactionStatus::Dropped { error } =>
TransactionStatus::Dropped { message: error },
}
},
RpcTransactionStatus::Error { error } => {
TransactionStatus::Error { message: error }
},
RpcTransactionStatus::Invalid { error } => {
TransactionStatus::Invalid { message: error }
},
RpcTransactionStatus::Dropped { error } => {
TransactionStatus::Dropped { message: error }
},
}
})
.map_err(Into::into)
@@ -782,15 +789,19 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for ChainHeadBackend<T> {
};
TransactionStatus::InBestBlock { hash: block_ref }
},
RpcTransactionStatus::BestChainBlockIncluded { block: None } =>
TransactionStatus::NoLongerInBestBlock,
RpcTransactionStatus::BestChainBlockIncluded { block: None } => {
TransactionStatus::NoLongerInBestBlock
},
RpcTransactionStatus::Broadcasted => TransactionStatus::Broadcasted,
RpcTransactionStatus::Dropped { error, .. } =>
TransactionStatus::Dropped { message: error },
RpcTransactionStatus::Error { error } =>
TransactionStatus::Error { message: error },
RpcTransactionStatus::Invalid { error } =>
TransactionStatus::Invalid { message: error },
RpcTransactionStatus::Dropped { error, .. } => {
TransactionStatus::Dropped { message: error }
},
RpcTransactionStatus::Error { error } => {
TransactionStatus::Error { message: error }
},
RpcTransactionStatus::Invalid { error } => {
TransactionStatus::Invalid { message: error }
},
RpcTransactionStatus::Validated => TransactionStatus::Validated,
};
return Poll::Ready(Some(Ok(tx_progress_ev)));
+10 -10
View File
@@ -8,15 +8,15 @@
use self::rpc_methods::TransactionStatus as RpcTransactionStatus;
use crate::{
backend::{
utils::{retry, retry_stream},
Backend, BlockRef, RuntimeVersion, StorageResponse, StreamOf, StreamOfResults,
TransactionStatus,
utils::{retry, retry_stream},
},
config::{Config, HashFor, Header},
error::BackendError,
};
use async_trait::async_trait;
use futures::{Future, FutureExt, Stream, StreamExt, TryStreamExt, future, future::Either, stream};
use futures::{future, future::Either, stream, Future, FutureExt, Stream, StreamExt, TryStreamExt};
use pezkuwi_subxt_rpcs::RpcClient;
use std::{
collections::VecDeque,
@@ -360,10 +360,10 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for LegacyBackend<T> {
let sub = self.methods.author_submit_and_watch_extrinsic(extrinsic).await?;
let sub = sub.filter_map(|r| {
let mapped = r
.map_err(|e| e.into())
.map(|tx| {
match tx {
let mapped =
r.map_err(|e| e.into())
.map(|tx| {
match tx {
// We ignore these because they don't map nicely to the new API. They don't
// signal "end states" so this should be fine.
RpcTransactionStatus::Future => None,
@@ -394,8 +394,8 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for LegacyBackend<T> {
.into(),
}),
}
})
.transpose();
})
.transpose();
future::ready(mapped)
});
@@ -504,8 +504,8 @@ impl<T: Config> Stream for StorageFetchDescendantKeysStream<T> {
match keys {
Ok(mut keys) => {
if this.pagination_start_key.is_some() &&
keys.first() == this.pagination_start_key.as_ref()
if this.pagination_start_key.is_some()
&& keys.first() == this.pagination_start_key.as_ref()
{
// Currently, Smoldot returns the "start key" as the first key in the
// input (see https://github.com/smol-dot/smoldot/issues/1692), whereas Bizinikiwi doesn't.
+11 -14
View File
@@ -25,9 +25,8 @@ use std::{pin::Pin, sync::Arc};
/// [`crate::ext::pezkuwi_subxt_rpcs`].
pub mod rpc {
pub use pezkuwi_subxt_rpcs::{
RpcClient, RpcClientT,
client::{RawRpcFuture, RawRpcSubscription, RawValue, RpcParams},
rpc_params,
rpc_params, RpcClient, RpcClientT,
};
crate::macros::cfg_reconnecting_rpc_client! {
@@ -123,7 +122,7 @@ pub trait Backend<T: Config>: sealed::Sealed + Send + Sync + 'static {
/// A stream of all new runtime versions as they occur.
async fn stream_runtime_version(&self)
-> Result<StreamOfResults<RuntimeVersion>, BackendError>;
-> Result<StreamOfResults<RuntimeVersion>, BackendError>;
/// A stream of all new block headers as they arrive.
async fn stream_all_block_headers(
@@ -390,10 +389,10 @@ mod test {
use crate::backend::StorageResponse;
use core::convert::Infallible;
use futures::StreamExt;
use pezkuwi_subxt_core::{Config, config::DefaultExtrinsicParams};
use pezkuwi_subxt_core::{config::DefaultExtrinsicParams, Config};
use pezkuwi_subxt_rpcs::client::{
MockRpcClient,
mock_rpc_client::{Json, MockRpcClientBuilder},
MockRpcClient,
};
use primitive_types::H256;
use rpc::RpcClientT;
@@ -429,7 +428,7 @@ mod test {
mod legacy {
use super::*;
use crate::{
backend::legacy::{LegacyBackend, rpc_methods::RuntimeVersion},
backend::legacy::{rpc_methods::RuntimeVersion, LegacyBackend},
error::RpcError,
};
@@ -688,7 +687,7 @@ mod test {
I: IntoIterator<Item = usize> + Send,
I::IntoIter: Send + Sync + 'static,
{
use pezkuwi_subxt_rpcs::{Error, UserError, client::mock_rpc_client::AndThen};
use pezkuwi_subxt_rpcs::{client::mock_rpc_client::AndThen, Error, UserError};
let recv = Arc::new(tokio::sync::Mutex::new(recv));
let mut ids = ids.into_iter();
@@ -824,13 +823,11 @@ mod test {
.await
.unwrap();
assert!(
response
.next()
.await
.unwrap()
.is_err_and(|e| matches!(e, BackendError::Other(e) if e == "error"))
);
assert!(response
.next()
.await
.unwrap()
.is_err_and(|e| matches!(e, BackendError::Other(e) if e == "error")));
assert!(response.next().await.is_none());
}
+1 -1
View File
@@ -2,7 +2,7 @@
use super::{StreamOf, StreamOfResults};
use crate::error::BackendError;
use futures::{FutureExt, Stream, StreamExt, future::BoxFuture};
use futures::{future::BoxFuture, FutureExt, Stream, StreamExt};
use std::{future::Future, pin::Pin, task::Poll};
/// Resubscribe callback.
+1 -1
View File
@@ -3,7 +3,7 @@
// see LICENSE for license details.
use crate::{
blocks::block_types::{CachedEvents, get_events},
blocks::block_types::{get_events, CachedEvents},
client::{OfflineClientT, OnlineClientT},
config::{Config, HashFor},
error::{EventsError, ExtrinsicDecodeErrorAt, ExtrinsicError},
+1 -1
View File
@@ -67,7 +67,7 @@
//! ```rust,ignore
#![doc = include_str!("../../examples/tx_basic.rs")]
//! ```
//!
//!
//! This example assumes that a Pezkuwi node is running locally (Subxt endeavors to support all
//! recent releases). Typically, to use Subxt to talk to some custom Bizinikiwi node (for example a
//! parachain node), you'll want to:
+1 -1
View File
@@ -45,7 +45,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/setup_client_custom_rpc.rs")]
//! ```
//!
//!
//! ### Creating an [`crate::OfflineClient`]:
//! ```rust,ignore
#![doc = include_str!("../../../examples/setup_client_offline.rs")]
+2 -2
View File
@@ -161,7 +161,7 @@
//! ```rust,ignore
#![doc = include_str ! ("../../../examples/setup_config_transaction_extension.rs")]
//! ```
//!
//!
//! ### Implementing [`crate::config::ExtrinsicParams`] from scratch
//!
//! Alternately, you are free to implement [`crate::config::ExtrinsicParams`] entirely from scratch if you know exactly what "extra" and
@@ -171,7 +171,7 @@
//! ```rust,ignore
#![doc = include_str ! ("../../../examples/setup_config_custom.rs")]
//! ```
//!
//!
//! ### Using a type from the metadata as a config parameter
//!
//! You can also use types that are generated from chain metadata as type parameters of the Config trait.
+3 -3
View File
@@ -58,7 +58,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/blocks_subscribing.rs")]
//! ```
//!
//!
//! ### Statically decode the extrinsic into [a specific pallet call](crate::blocks::ExtrinsicDetails::as_extrinsic())
//!
//! This is useful if you are expecting a specific extrinsic to be part of some block. If the extrinsic you try to decode
@@ -73,7 +73,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/block_decoding_static.rs")]
//! ```
//!
//!
//! ### Dynamically decode the extrinsic
//!
//! Sometimes you might use subxt with metadata that is not known at compile time. In this case, you do not
@@ -87,7 +87,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/block_decoding_dynamic.rs")]
//! ```
//!
//!
//! ## Decoding transaction extensions
//!
//! Extrinsics can contain transaction extensions. The transaction extensions can be different across chains.
+1 -1
View File
@@ -46,7 +46,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/constants_static.rs")]
//! ```
//!
//!
//! And here's one using a dynamic query:
//! ```rust,ignore
#![doc = include_str!("../../../examples/constants_dynamic.rs")]
+2 -2
View File
@@ -33,7 +33,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/light_client_basic.rs")]
//! ```
//!
//!
//! ### Connecting to a local node
//!
//! This example connects to a local chain and submits a transaction. To run this, you first need
@@ -41,7 +41,7 @@
//! ```text
//! pezkuwi --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001
//! ```
//!
//!
//! Then, the following code will download a chain spec from this local node, alter the bootnodes
//! to point only to the local node, and then submit a transaction through it.
//! ```rust,ignore
+2 -2
View File
@@ -58,7 +58,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/runtime_apis_static.rs")]
//! ```
//!
//!
//! ### Making a dynamic Runtime API call
//!
//! If you'd prefer to construct the call at runtime, you can do this using the
@@ -66,7 +66,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/runtime_apis_dynamic.rs")]
//! ```
//!
//!
//! ### Making a raw call
//!
//! This is generally discouraged in favour of one of the above, but may be necessary (especially if
+3 -3
View File
@@ -57,14 +57,14 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/storage_fetch.rs")]
//! ```
//!
//!
//! For completeness, below is an example using a dynamic query instead. Dynamic queries can define the types that
//! they wish to accept inputs and decode the return value into ([`crate::dynamic::Value`] can be used here anywhere we
//! are not sure of the specific types).
//! ```rust,ignore
#![doc = include_str!("../../../examples/storage_fetch_dynamic.rs")]
//! ```
//!
//!
//! ### Iterating storage entries
//!
//! Many storage entries are maps of values; as well as fetching individual values, it's possible to
@@ -72,7 +72,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/storage_iterating.rs")]
//! ```
//!
//!
//! Here's the same logic but using dynamically constructed values instead:
//! ```rust,ignore
#![doc = include_str!("../../../examples/storage_iterating_dynamic.rs")]
+5 -5
View File
@@ -162,7 +162,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/tx_basic.rs")]
//! ```
//!
//!
//! ### Providing transaction parameters
//!
//! If you'd like to provide parameters (such as mortality) to the transaction, you can use
@@ -170,7 +170,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/tx_with_params.rs")]
//! ```
//!
//!
//! This example doesn't wait for the transaction to be included in a block; it just submits it and
//! hopes for the best!
//!
@@ -180,7 +180,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/tx_boxed.rs")]
//! ```
//!
//!
//! ### Custom handling of transaction status updates
//!
//! If you'd like more control or visibility over exactly which status updates are being emitted for
@@ -188,7 +188,7 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/tx_status_stream.rs")]
//! ```
//!
//!
//! ### Signing transactions externally
//!
//! Subxt also allows you to get hold of the signer payload and hand that off to something else to be
@@ -196,6 +196,6 @@
//! ```rust,ignore
#![doc = include_str!("../../../examples/tx_partial.rs")]
//! ```
//!
//!
//! Take a look at the API docs for [`crate::tx::TxProgress`], [`crate::tx::TxStatus`] and
//! [`crate::tx::TxInBlock`] for more options.
+1 -1
View File
@@ -3,7 +3,6 @@
// see LICENSE for license details.
use crate::{
Metadata,
blocks::BlocksClient,
config::{Config, HashFor},
constants::ConstantsClient,
@@ -13,6 +12,7 @@ use crate::{
storage::StorageClient,
tx::TxClient,
view_functions::ViewFunctionsClient,
Metadata,
};
use derive_where::derive_where;
+3 -3
View File
@@ -4,8 +4,7 @@
use super::{OfflineClient, OfflineClientT};
use crate::{
Metadata,
backend::{Backend, BackendExt, StreamOfResults, legacy::LegacyBackend, rpc::RpcClient},
backend::{legacy::LegacyBackend, rpc::RpcClient, Backend, BackendExt, StreamOfResults},
blocks::{BlockRef, BlocksClient},
config::{Config, HashFor},
constants::ConstantsClient,
@@ -16,9 +15,10 @@ use crate::{
storage::StorageClient,
tx::TxClient,
view_functions::ViewFunctionsClient,
Metadata,
};
use derive_where::derive_where;
use futures::{TryFutureExt, future};
use futures::{future, TryFutureExt};
use pezkuwi_subxt_core::client::{ClientState, RuntimeVersion};
use std::sync::{Arc, RwLock};
@@ -2,7 +2,7 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{Config, client::OfflineClientT, error::ConstantError};
use crate::{client::OfflineClientT, error::ConstantError, Config};
use derive_where::derive_where;
use pezkuwi_subxt_core::constants::address::Address;
+1 -1
View File
@@ -7,4 +7,4 @@
mod constants_client;
pub use constants_client::ConstantsClient;
pub use pezkuwi_subxt_core::constants::address::{Address, DynamicAddress, StaticAddress, dynamic};
pub use pezkuwi_subxt_core::constants::address::{dynamic, Address, DynamicAddress, StaticAddress};
@@ -1,4 +1,4 @@
use crate::{Config, client::OfflineClientT, error::CustomValueError};
use crate::{client::OfflineClientT, error::CustomValueError, Config};
use derive_where::derive_where;
use pezkuwi_subxt_core::custom_values::address::{Address, Maybe};
@@ -45,13 +45,13 @@ impl<T: Config, Client: OfflineClientT<T>> CustomValuesClient<T, Client> {
#[cfg(test)]
mod tests {
use crate::{
Metadata, OfflineClient, BizinikiwConfig,
custom_values::{self, CustomValuesClient},
BizinikiwConfig, Metadata, OfflineClient,
};
use codec::Encode;
use pezkuwi_subxt_core::client::RuntimeVersion;
use scale_decode::DecodeAsType;
use scale_info::{TypeInfo, form::PortableForm};
use scale_info::{form::PortableForm, TypeInfo};
use std::collections::BTreeMap;
#[derive(Debug, Clone, PartialEq, Eq, Encode, TypeInfo, DecodeAsType)]
+1 -1
View File
@@ -8,5 +8,5 @@ mod custom_values_client;
pub use custom_values_client::CustomValuesClient;
pub use pezkuwi_subxt_core::custom_values::address::{
Address, DynamicAddress, StaticAddress, dynamic,
dynamic, Address, DynamicAddress, StaticAddress,
};
+1 -1
View File
@@ -8,7 +8,7 @@
use super::{DispatchErrorDecodeError, ModuleErrorDecodeError, ModuleErrorDetailsError};
use crate::metadata::Metadata;
use core::fmt::Debug;
use scale_decode::{DecodeAsType, TypeResolver, visitor::DecodeAsTypeResult};
use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType, TypeResolver};
use std::{borrow::Cow, marker::PhantomData};
/// An error dispatching a transaction.
+41 -35
View File
@@ -178,7 +178,9 @@ pub enum BackendError {
MetadataVersionNotFound(u32),
#[error("Backend error: Could not codec::Decode Runtime API response: {0}")]
CouldNotScaleDecodeRuntimeResponse(codec::Error),
#[error("Backend error: Could not codec::Decode metadata bytes into pezkuwi_subxt::Metadata: {0}")]
#[error(
"Backend error: Could not codec::Decode metadata bytes into pezkuwi_subxt::Metadata: {0}"
)]
CouldNotDecodeMetadata(codec::Error),
// This is for errors in `Backend` implementations which aren't any of the "pre-defined" set
// above:
@@ -253,11 +255,11 @@ pub enum BlockError {
impl BlockError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
BlockError::CouldNotGetBlockHeader { reason: e, .. } |
BlockError::CouldNotGetLatestBlock(e) |
BlockError::CouldNotSubscribeToAllBlocks(e) |
BlockError::CouldNotSubscribeToBestBlocks(e) |
BlockError::CouldNotSubscribeToFinalizedBlocks(e) => Some(e),
BlockError::CouldNotGetBlockHeader { reason: e, .. }
| BlockError::CouldNotGetLatestBlock(e)
| BlockError::CouldNotSubscribeToAllBlocks(e)
| BlockError::CouldNotSubscribeToBestBlocks(e)
| BlockError::CouldNotSubscribeToFinalizedBlocks(e) => Some(e),
_ => None,
}
}
@@ -305,10 +307,10 @@ pub enum OnlineClientError {
impl OnlineClientError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
OnlineClientError::CannotGetLatestFinalizedBlock(e) |
OnlineClientError::CannotGetGenesisHash(e) |
OnlineClientError::CannotGetCurrentRuntimeVersion(e) |
OnlineClientError::CannotFetchMetadata(e) => Some(e),
OnlineClientError::CannotGetLatestFinalizedBlock(e)
| OnlineClientError::CannotGetGenesisHash(e)
| OnlineClientError::CannotGetCurrentRuntimeVersion(e)
| OnlineClientError::CannotFetchMetadata(e) => Some(e),
_ => None,
}
}
@@ -328,7 +330,9 @@ pub enum RuntimeUpdaterError {
CannotGetNextRuntimeVersion(BackendError),
#[error("Error subscribing to runtime updates: Cannot stream finalized blocks: {0}")]
CannotStreamFinalizedBlocks(BackendError),
#[error("Error subscribing to runtime updates: Cannot get next finalized block in stream: {0}")]
#[error(
"Error subscribing to runtime updates: Cannot get next finalized block in stream: {0}"
)]
CannotGetNextFinalizedBlock(BackendError),
#[error("Cannot fetch new metadata for runtime update: {0}")]
CannotFetchNewMetadata(BackendError),
@@ -345,11 +349,11 @@ pub enum RuntimeUpdaterError {
impl RuntimeUpdaterError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
RuntimeUpdaterError::CannotStreamRuntimeVersion(e) |
RuntimeUpdaterError::CannotGetNextRuntimeVersion(e) |
RuntimeUpdaterError::CannotStreamFinalizedBlocks(e) |
RuntimeUpdaterError::CannotGetNextFinalizedBlock(e) |
RuntimeUpdaterError::CannotFetchNewMetadata(e) => Some(e),
RuntimeUpdaterError::CannotStreamRuntimeVersion(e)
| RuntimeUpdaterError::CannotGetNextRuntimeVersion(e)
| RuntimeUpdaterError::CannotStreamFinalizedBlocks(e)
| RuntimeUpdaterError::CannotGetNextFinalizedBlock(e)
| RuntimeUpdaterError::CannotFetchNewMetadata(e) => Some(e),
_ => None,
}
}
@@ -369,7 +373,9 @@ pub enum RuntimeUpdateeApplyError {
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum RuntimeApiError {
#[error("Cannot access Runtime APIs at latest block: Cannot fetch latest finalized block: {0}")]
#[error(
"Cannot access Runtime APIs at latest block: Cannot fetch latest finalized block: {0}"
)]
CannotGetLatestFinalizedBlock(BackendError),
#[error("{0}")]
OfflineError(#[from] CoreRuntimeApiError),
@@ -380,8 +386,8 @@ pub enum RuntimeApiError {
impl RuntimeApiError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
RuntimeApiError::CannotGetLatestFinalizedBlock(e) |
RuntimeApiError::CannotCallApi(e) => Some(e),
RuntimeApiError::CannotGetLatestFinalizedBlock(e)
| RuntimeApiError::CannotCallApi(e) => Some(e),
_ => None,
}
}
@@ -403,8 +409,8 @@ pub enum EventsError {
impl EventsError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
EventsError::CannotGetLatestFinalizedBlock(e) |
EventsError::CannotFetchEventBytes(e) => Some(e),
EventsError::CannotGetLatestFinalizedBlock(e)
| EventsError::CannotFetchEventBytes(e) => Some(e),
_ => None,
}
}
@@ -456,12 +462,12 @@ pub enum ExtrinsicError {
impl ExtrinsicError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
ExtrinsicError::CannotGetBlockBody(e) |
ExtrinsicError::CannotGetLatestFinalizedBlock(e) |
ExtrinsicError::ErrorSubmittingTransaction(e) |
ExtrinsicError::TransactionStatusStreamError(e) |
ExtrinsicError::CannotGetFeeInfo(e) |
ExtrinsicError::CannotGetValidationInfo(e) => Some(e),
ExtrinsicError::CannotGetBlockBody(e)
| ExtrinsicError::CannotGetLatestFinalizedBlock(e)
| ExtrinsicError::ErrorSubmittingTransaction(e)
| ExtrinsicError::TransactionStatusStreamError(e)
| ExtrinsicError::CannotGetFeeInfo(e)
| ExtrinsicError::CannotGetValidationInfo(e) => Some(e),
ExtrinsicError::AccountNonceError { reason, .. } => reason.backend_error(),
_ => None,
}
@@ -486,8 +492,8 @@ pub enum ViewFunctionError {
impl ViewFunctionError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
ViewFunctionError::CannotGetLatestFinalizedBlock(e) |
ViewFunctionError::CannotCallApi(e) => Some(e),
ViewFunctionError::CannotGetLatestFinalizedBlock(e)
| ViewFunctionError::CannotCallApi(e) => Some(e),
_ => None,
}
}
@@ -565,8 +571,8 @@ impl TransactionEventsError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
TransactionEventsError::CannotFetchBlockBody { error, .. } => Some(error),
TransactionEventsError::CannotDecodeEventInBlock { error, .. } |
TransactionEventsError::CannotFetchEventsForTransaction { error, .. } => error.backend_error(),
TransactionEventsError::CannotDecodeEventInBlock { error, .. }
| TransactionEventsError::CannotFetchEventsForTransaction { error, .. } => error.backend_error(),
_ => None,
}
}
@@ -658,10 +664,10 @@ pub enum StorageError {
impl StorageError {
fn backend_error(&self) -> Option<&BackendError> {
match self {
StorageError::CannotGetLatestFinalizedBlock(e) |
StorageError::CannotFetchValue(e) |
StorageError::CannotIterateValues(e) |
StorageError::StreamFailure(e) => Some(e),
StorageError::CannotGetLatestFinalizedBlock(e)
| StorageError::CannotFetchValue(e)
| StorageError::CannotIterateValues(e)
| StorageError::StreamFailure(e) => Some(e),
_ => None,
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::{
Metadata,
config::{Config, HashFor},
error::EventsError,
Metadata,
};
use derive_where::derive_where;
use pezkuwi_subxt_core::events::{EventDetails as CoreEventDetails, Events as CoreEvents};
+1 -1
View File
@@ -11,8 +11,8 @@ mod events_type;
use crate::{client::OnlineClientT, error::EventsError};
use pezkuwi_subxt_core::{
Metadata,
config::{Config, HashFor},
Metadata,
};
pub use events_client::EventsClient;
+6 -6
View File
@@ -8,7 +8,7 @@
//! ```rust,ignore
#![doc = include_str!("../examples/tx_basic.rs")]
//! ```
//!
//!
//! Take a look at [the Subxt guide](book) to learn more about how to use Subxt.
#![cfg_attr(docsrs, feature(doc_cfg))]
@@ -60,10 +60,10 @@ pub mod view_functions;
pub mod config {
pub use pezkuwi_subxt_core::{
config::{
Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, ExtrinsicParams,
ExtrinsicParamsEncoder, Hash, HashFor, Hasher, Header, PezkuwiConfig,
PezkuwiExtrinsicParams, BizinikiwConfig, BizinikiwiExtrinsicParams,
TransactionExtension, pezkuwi, bizinikiwi, transaction_extensions,
bizinikiwi, pezkuwi, transaction_extensions, BizinikiwConfig,
BizinikiwiExtrinsicParams, Config, DefaultExtrinsicParams,
DefaultExtrinsicParamsBuilder, ExtrinsicParams, ExtrinsicParamsEncoder, Hash, HashFor,
Hasher, Header, PezkuwiConfig, PezkuwiExtrinsicParams, TransactionExtension,
},
error::ExtrinsicParamsError,
};
@@ -88,7 +88,7 @@ cfg_unstable_light_client! {
// but leave most types behind their respective modules.
pub use crate::{
client::{OfflineClient, OnlineClient},
config::{Config, PezkuwiConfig, BizinikiwConfig},
config::{BizinikiwConfig, Config, PezkuwiConfig},
error::Error,
metadata::Metadata,
};
+1 -1
View File
@@ -8,7 +8,7 @@ mod runtime_client;
mod runtime_types;
pub use pezkuwi_subxt_core::runtime_api::payload::{
DynamicPayload, Payload, StaticPayload, dynamic,
dynamic, DynamicPayload, Payload, StaticPayload,
};
pub use runtime_client::RuntimeApiClient;
pub use runtime_types::RuntimeApi;
+1 -1
View File
@@ -7,6 +7,6 @@
mod storage_client;
mod storage_client_at;
pub use pezkuwi_subxt_core::storage::address::{Address, DynamicAddress, StaticAddress, dynamic};
pub use pezkuwi_subxt_core::storage::address::{dynamic, Address, DynamicAddress, StaticAddress};
pub use storage_client::StorageClient;
pub use storage_client_at::{StorageClientAt, StorageEntryClient, StorageKeyValue, StorageValue};
@@ -11,9 +11,9 @@ use crate::{
use derive_where::derive_where;
use futures::StreamExt;
use pezkuwi_subxt_core::{
Metadata,
storage::{PrefixOf, address::Address},
storage::{address::Address, PrefixOf},
utils::{Maybe, Yes},
Metadata,
};
use std::marker::PhantomData;
@@ -100,7 +100,7 @@ where
key_parts: KeyParts,
) -> Result<
impl futures::Stream<Item = Result<StorageKeyValue<'_, Addr>, StorageError>>
+ use<'_, Addr, Client, T, KeyParts>,
+ use<'_, Addr, Client, T, KeyParts>,
StorageError,
> {
let entry = pezkuwi_subxt_core::storage::entry(addr, &self.metadata)?;
@@ -283,7 +283,7 @@ where
key_parts: KeyParts,
) -> Result<
impl futures::Stream<Item = Result<StorageKeyValue<'atblock, Addr>, StorageError>>
+ use<'atblock, Addr, Client, T, KeyParts>,
+ use<'atblock, Addr, Client, T, KeyParts>,
StorageError,
> {
iter(self.inner.clone(), &self.client, self.block_ref.hash(), key_parts).await
@@ -357,7 +357,7 @@ async fn iter<
key_parts: KeyParts,
) -> Result<
impl futures::Stream<Item = Result<StorageKeyValue<'atblock, Addr>, StorageError>>
+ use<'atblock, Addr, Client, T, KeyParts>,
+ use<'atblock, Addr, Client, T, KeyParts>,
StorageError,
> {
let key_bytes = entry.iter_key(key_parts)?;
+1 -1
View File
@@ -13,7 +13,7 @@ mod tx_client;
mod tx_progress;
pub use pezkuwi_subxt_core::tx::{
payload::{DefaultPayload, DynamicPayload, Payload, dynamic},
payload::{dynamic, DefaultPayload, DynamicPayload, Payload},
signer::{self, Signer},
};
pub use tx_client::{
+24 -18
View File
@@ -12,7 +12,7 @@ use crate::{
};
use codec::{Compact, Decode, Encode};
use derive_where::derive_where;
use futures::future::{TryFutureExt, try_join};
use futures::future::{try_join, TryFutureExt};
use pezkuwi_subxt_core::tx::TransactionVersion;
/// A client for working with transactions.
@@ -122,18 +122,20 @@ impl<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
{
let metadata = self.client.metadata();
let tx = match pezkuwi_subxt_core::tx::suggested_version(&metadata)? {
TransactionVersion::V4 =>
TransactionVersion::V4 => {
PartialTransactionInner::V4(pezkuwi_subxt_core::tx::create_v4_signed(
call,
&self.client.client_state(),
params,
)?),
TransactionVersion::V5 =>
)?)
},
TransactionVersion::V5 => {
PartialTransactionInner::V5(pezkuwi_subxt_core::tx::create_v5_general(
call,
&self.client.client_state(),
params,
)?),
)?)
},
};
Ok(PartialTransaction { client: self.client.clone(), inner: tx })
@@ -419,10 +421,12 @@ where
signature: &T::Signature,
) -> SubmittableTransaction<T, C> {
let tx = match &mut self.inner {
PartialTransactionInner::V4(tx) =>
tx.sign_with_account_and_signature(account_id.clone(), signature),
PartialTransactionInner::V5(tx) =>
tx.sign_with_account_and_signature(account_id, signature),
PartialTransactionInner::V4(tx) => {
tx.sign_with_account_and_signature(account_id.clone(), signature)
},
PartialTransactionInner::V5(tx) => {
tx.sign_with_account_and_signature(account_id, signature)
},
};
SubmittableTransaction { client: self.client.clone(), inner: tx }
@@ -509,22 +513,24 @@ where
// If we get a bad status or error back straight away then error, else return the hash.
match sub.next().await {
Some(Ok(status)) => match status {
TransactionStatus::Validated |
TransactionStatus::Broadcasted |
TransactionStatus::InBestBlock { .. } |
TransactionStatus::NoLongerInBestBlock |
TransactionStatus::InFinalizedBlock { .. } => Ok(ext_hash),
TransactionStatus::Validated
| TransactionStatus::Broadcasted
| TransactionStatus::InBestBlock { .. }
| TransactionStatus::NoLongerInBestBlock
| TransactionStatus::InFinalizedBlock { .. } => Ok(ext_hash),
TransactionStatus::Error { message } => Err(
ExtrinsicError::TransactionStatusError(TransactionStatusError::Error(message)),
),
TransactionStatus::Invalid { message } =>
TransactionStatus::Invalid { message } => {
Err(ExtrinsicError::TransactionStatusError(TransactionStatusError::Invalid(
message,
))),
TransactionStatus::Dropped { message } =>
)))
},
TransactionStatus::Dropped { message } => {
Err(ExtrinsicError::TransactionStatusError(TransactionStatusError::Dropped(
message,
))),
)))
},
},
Some(Err(e)) => Err(ExtrinsicError::TransactionStatusStreamError(e)),
None => Err(ExtrinsicError::UnexpectedEndOfTransactionStatusStream),
+1 -1
View File
@@ -347,11 +347,11 @@ mod test {
use pezkuwi_subxt_core::client::RuntimeVersion;
use crate::{
BizinikiwConfig,
backend::{StreamOfResults, TransactionStatus},
client::{OfflineClientT, OnlineClientT},
config::{Config, HashFor},
tx::TxProgress,
BizinikiwConfig,
};
type MockTxProgress = TxProgress<BizinikiwConfig, MockClient>;
+3 -3
View File
@@ -5,9 +5,9 @@
//! Miscellaneous utility helpers.
pub use pezkuwi_subxt_core::utils::{
AccountId32, Encoded, Era, H160, H256, H512, KeyedVec, MultiAddress, MultiSignature,
PhantomDataSendSync, Static, UncheckedExtrinsic, WrapperKeepOpaque, Yes, bits,
strip_compact_prefix, to_hex,
bits, strip_compact_prefix, to_hex, AccountId32, Encoded, Era, KeyedVec, MultiAddress,
MultiSignature, PhantomDataSendSync, Static, UncheckedExtrinsic, WrapperKeepOpaque, Yes, H160,
H256, H512,
};
pub use pezkuwi_subxt_rpcs::utils::url_is_secure;
+1 -1
View File
@@ -8,7 +8,7 @@ mod view_function_types;
mod view_functions_client;
pub use pezkuwi_subxt_core::view_functions::payload::{
DynamicPayload, Payload, StaticPayload, dynamic,
dynamic, DynamicPayload, Payload, StaticPayload,
};
pub use view_function_types::ViewFunctionsApi;
pub use view_functions_client::ViewFunctionsClient;