[0.39.0] - 2025-02-04
This release is mostly bug fixes and changes. The only change that should be a breaking change is removing the substrate-compat
feature flag (see #1850), which we'll go into more detail about.
The substrate-compat
feature flag has been removed.
The substrate-compat
feature flag essentially provided:
- An implementation of the
subxt::config::Header
trait for anything implementingsp_runtime::traits::Header
(here). - Same for
subxt::config::Hasher
and anything implementingsp_runtime::traits::Hasher
(here). - A
subxt_core::tx::PairSigner
type which could be given something implementingsp_core::Pair
and then be used to sign transactions (here). - From impls for
sp_runtime::AccountId32
and related forsubxt::utils::AccountId32
(here). - Likewise for
sp_runtime::MultiAddress
andsubxt::utils::MultiAddress
(here). - Likewise for
sp_runtime::MultiSignature
andsubxt::utils::MultiSignature
(here).
While useful, providing these features in Subxt is almost impossible to maintain: we can only support a single version of sp_runtime
/sp_core
at a time, but many versions are in use in the wild. This led to various issues regarding the mismatch between sp_*
crates in use and a given version of Subxt. More generally, the goal of Subxt is to be independent from any specific version of Substrate, and communicate via the exposed RPC APIs in order to work across any compatible Substrate version (or indeed, alternative implementations that follow things like the RPC spec).
As a result, we've taken the decision to remove this compatibility layer from Subxt itself. To migrate away from this feature, we suggest:
- Using the example here to see how to use a Substrate signer to sign Subxt transactions.
- Looking at
subxt_signer
instead, if it's a viable alternative in your case. - Following the "here" links above to see what impls were removed. Impls can generally be recreated as needed using wrapper types which allow converting between Substrate and Subxt types/traits, for instance:
// Wrap a substrate header type in this to impl the subxt Header trait:
struct SubxtHeader<T>(pub T);
// This basically copies the code removed from Subxt, but on a wrapper type:
impl <T> subxt::config::Header for SubxtHeader<T>
where
T: sp_runtime::traits::Header,
<T as sp_runtime::traits::Header>::Number: Into<u64>,
{
type Number = T::Number;
type Hasher = T::Hashing;
fn number(&self) -> Self::Number {
*self.0.number()
}
}
The hope is that this pattern is applicable to any such types that you find useful to share between Substrate and Subxt code. Please raise an issue if you can't find a solution in your case, and we'll endeavour to help!
The result of this is that your code will work against whichever Substrate crate versions you are using, at the cost of this code no longer being included behind the substrate-compat
feature flag.
A full list of relevant changes and fixes (nothing was added in this release) is as follows:
Changed
- remove substrate compat (#1850)
- migrate custom error trait impls to
thiserror
(#1856) - re-export
jsonrpsee
insubxt::ext
(#1843)
Fixed
- don't double hash: use the same hash in ExtrinsicDetails and ExtrinsicDetails (#1917)
- fix and test sr25519 signing in nostd (#1872)
- preserve custom metadata when converting between Subxt metadata and frame_metadata (#1914)
- fix: don't wrap rpc error in DisconnectedWillReconnect in reconnecting rpc client (#1904)
- fix: substrate runner, support new libp2p addr log (#1892)
- update Artifacts (auto-generated) (#1874)
- bump frame-decode and frame-metadata to latest (#1870)
- fix unstable-light-client + ChainHeadBackend tx events (#1865)
- when native feature is enabled, we need polkadot-sdk/std for eg examples to work (#1864)
- load latest metadata version from Wasm blobs. (#1859)
- minor fix - Yew example (#1852)
- update the release notes to work for current releases (#1842)