merge master

This commit is contained in:
James Wilson
2024-01-17 17:38:34 +00:00
18 changed files with 233 additions and 52 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ pub enum TransactionStatus<Hash> {
/// Number of peers it's been broadcast to.
num_peers: u32,
},
/// Transaciton is no longer in a best block.
/// Transaction is no longer in a best block.
NoLongerInBestBlock,
/// Transaction has been included in block with given hash.
InBestBlock {
@@ -241,7 +241,7 @@ impl<Hash: BlockHash> Shared<Hash> {
}
}
// Keep our buffer of ready/block events uptodate:
// Keep our buffer of ready/block events up-to-date:
match item {
FollowStreamMsg::Ready(sub_id) => {
// Set new subscription ID when it comes in.
@@ -212,7 +212,7 @@ impl<Hash: BlockHash> Stream for FollowStreamUnpin<Hash> {
FollowStreamMsg::Event(FollowEvent::Stop)
}
// These events aren't intresting; we just forward them on:
// These events aren't interesting; we just forward them on:
FollowStreamMsg::Event(FollowEvent::OperationBodyDone(details)) => {
FollowStreamMsg::Event(FollowEvent::OperationBodyDone(details))
}
@@ -370,7 +370,7 @@ impl<Hash: BlockHash> FollowStreamUnpin<Hash> {
// Any new futures pushed above need polling to start. We could
// just wait for the next stream event, but let's wake the task to
// have it polled sooner, just incase it's slow to receive things.
// have it polled sooner, just in case it's slow to receive things.
waker.wake_by_ref();
}
}
+1 -1
View File
@@ -542,7 +542,7 @@ pub enum StorageResultType {
ClosestDescendantMerkleValue(Bytes),
}
/// The method respose of `chainHead_body`, `chainHead_call` and `chainHead_storage`.
/// The method response of `chainHead_body`, `chainHead_call` and `chainHead_storage`.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(tag = "result")]
+26 -3
View File
@@ -248,13 +248,36 @@ async fn build_client_from_rpc<T: Config>(
/// Fetch the chain spec from the URL.
#[cfg(feature = "jsonrpsee")]
async fn fetch_url(url: impl AsRef<str>) -> Result<serde_json::Value, Error> {
use jsonrpsee::core::client::ClientT;
use jsonrpsee::core::client::{ClientT, SubscriptionClientT};
use jsonrpsee::rpc_params;
use serde_json::value::RawValue;
let client = jsonrpsee_helpers::client(url.as_ref()).await?;
client
let result = client
.request("sync_state_genSyncSpec", jsonrpsee::rpc_params![true])
.await
.map_err(|err| Error::Rpc(crate::error::RpcError::ClientError(Box::new(err))))
.map_err(|err| Error::Rpc(crate::error::RpcError::ClientError(Box::new(err))))?;
// Subscribe to the finalized heads of the chain.
let mut subscription = SubscriptionClientT::subscribe::<Box<RawValue>, _>(
&client,
"chain_subscribeFinalizedHeads",
rpc_params![],
"chain_unsubscribeFinalizedHeads",
)
.await
.map_err(|err| Error::Rpc(crate::error::RpcError::ClientError(Box::new(err))))?;
// We must ensure that the finalized block of the chain is not the block included
// in the chainSpec.
// This is a temporary workaround for: https://github.com/smol-dot/smoldot/issues/1562.
// The first finalized block that is received might by the finalized block could be the one
// included in the chainSpec. Decoding the chainSpec for this purpose is too complex.
let _ = subscription.next().await;
let _ = subscription.next().await;
Ok(result)
}
cfg_jsonrpsee_native! {
+1 -1
View File
@@ -100,7 +100,7 @@ impl<T: Config> DefaultExtrinsicParamsBuilder<T> {
self
}
/// Provide a tip to the block auther using the token denominated by the `asset_id` provided. This
/// Provide a tip to the block author using the token denominated by the `asset_id` provided. This
/// is not applicable on chains which don't use the `ChargeAssetTxPayment` signed extension; in this
/// case, no tip will be given.
pub fn tip_of(mut self, tip: u128, asset_id: T::AssetId) -> Self {