Update to 2024 edition (#2001)

* Update to 2024 edition

* Update to 2024 edition; fmt, use<> and remove refs

* async functions
This commit is contained in:
James Wilson
2025-05-09 16:12:18 +01:00
committed by GitHub
parent 98c1d153b6
commit 23c62f3d5d
120 changed files with 399 additions and 322 deletions
+7 -3
View File
@@ -7,7 +7,7 @@
use crate::metadata::{DecodeWithMetadata, Metadata};
use core::fmt::Debug;
use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType, TypeResolver};
use scale_decode::{DecodeAsType, TypeResolver, visitor::DecodeAsTypeResult};
use std::{borrow::Cow, marker::PhantomData};
@@ -73,7 +73,9 @@ pub enum TokenError {
#[error("Funds are unavailable.")]
FundsUnavailable,
/// Some part of the balance gives the only provider reference to the account and thus cannot be (re)moved.
#[error("Some part of the balance gives the only provider reference to the account and thus cannot be (re)moved.")]
#[error(
"Some part of the balance gives the only provider reference to the account and thus cannot be (re)moved."
)]
OnlyProvider,
/// Account cannot exist with the funds that would be given.
#[error("Account cannot exist with the funds that would be given.")]
@@ -327,7 +329,9 @@ impl DispatchError {
module_bytes[4],
]
} else {
tracing::warn!("Can't decode error sp_runtime::DispatchError: bytes do not match known shapes");
tracing::warn!(
"Can't decode error sp_runtime::DispatchError: bytes do not match known shapes"
);
// Return _all_ of the bytes; every "unknown" return should be consistent.
return Err(super::Error::Unknown(bytes.to_vec()));
};
+6 -2
View File
@@ -170,7 +170,9 @@ pub enum BlockError {
#[error("Could not find a block with hash {0} (perhaps it was on a non-finalized fork?)")]
NotFound(String),
/// Leftover bytes found after decoding the extrinsic.
#[error("After decoding the exntrinsic at index {extrinsic_index}, {num_leftover_bytes} bytes were left, suggesting that decoding may have failed")]
#[error(
"After decoding the exntrinsic at index {extrinsic_index}, {num_leftover_bytes} bytes were left, suggesting that decoding may have failed"
)]
LeftoverBytes {
/// Index of the extrinsic that failed to decode.
extrinsic_index: usize,
@@ -222,7 +224,9 @@ impl BlockError {
pub enum TransactionError {
/// The block hash that the transaction was added to could not be found.
/// This is probably because the block was retracted before being finalized.
#[error("The block containing the transaction can no longer be found (perhaps it was on a non-finalized fork?)")]
#[error(
"The block containing the transaction can no longer be found (perhaps it was on a non-finalized fork?)"
)]
BlockNotFound,
/// An error happened on the node that the transaction was submitted to.
#[error("Error handling transaction: {0}")]