- Add pezkuwi-subxt crates to vendor/pezkuwi-subxt - Add pezkuwi-zombienet-sdk crates to vendor/pezkuwi-zombienet-sdk - Convert git dependencies to path dependencies - Add vendor crates to workspace members - Remove test/example crates from vendor (not needed for SDK) - Fix feature propagation issues detected by zepter - Fix workspace inheritance for internal dependencies - All 606 crates now in workspace - All 6919 internal dependency links verified correct - No git dependencies remaining
144 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
Added
- Add
system_chain_type()RPC method toLegacyRpcMethods
[0.44.0] - 2025-08-28
This small release primarily fixes a few issues, but also adds the code for a prelease of subxt-historic, a new crate (at the moment) for working with historic blocks and state. Future releases will aim to stabilize this crate to the level of other subxt crates or otherwise merge the logic into subxt itself.
This is a minor version bump because, in theory at least, adding the Clone bound to block headers in (#2047) is a breaking change, although I think it is unlikely that this will impact any users.
Added
- Add prerelease
subxt-historiccrate for accessing historic (non head-of-chain) blocks (#2040)
Changed
Fixed
- Do not panic when encoding call data with invalid fields (#2070)
- Tweak test to reduce chance of failure, and need jsonrpsee/server for tests (#2057)
- Fix 1.89 clippy warnings (#2055)
- Increase reconnecting client request/response size (#2046)
[0.43.0] - 2025-07-17
This is a reasonably small release which is mainly bug fixing, but has a couple of changes I'd like to elaborate on:
Remove codec::Encode and codec::Decode derives from generated APIs by default (#2008)
When generating an API using the #[subxt::subxt(...)] macro (or programatically via subxt-codegen), we had always previously added parity_scale_codec::Encode and parity_scale_codec::Decode derives to all of the generated types. Most places in Subxt have not made use of these for a long time (relying instead on scale_encode::EncodeAsType and scale_decode::DecodeAsType, since they allow encoding and encoding which takes the type information into account and can more gracefully handle incompatibilities).
We eventually hit an issue to which the most appropriate fix was just to remove these derives.
If you still need the parity_scale_codec::Encode or parity_scale_codec::Decode derives on certain types, you have two options:
- Use the
derive_for_typeattr to add them back where needed, eg:#[subxt::subxt( ... derive_for_type( path = "staging_xcm::v3::multilocation::MultiLocation", derive = "parity_scale_codec::Encode, parity_scale_codec::Decode", recursive ) )] - Use the
derive_for_all_typesattr to add them back everywhere, eg:#[subxt::subxt( ... derive_for_all_types = "parity_scale_codec::Encode, parity_scale_codec::Decode" )]
Prefer (1) where possible to reduce the amount of generated code, and reduce the likelihood of running into issues around those derives in certain edge cases.
This PR changes some things around storage keys to remove one last requirement for Encode and Decode derives, and also as a side effect changes api.storage().call_raw() slightly to no longer also try to decode the resulting type via Decode, leaving this to the user (and also meaning it's much easier now for the user to obtain the raw bytes for some storage entry).
In other words, instead of doing something like:
let (compact_len, metadata) = rt
.call_raw::<(Compact<u32>, frame_metadata::RuntimeMetadataPrefixed)>(
"Metadata_metadata",
None,
)
.await?;
You would now do:
let meta_bytes = rt.call_raw("Metadata_metadata", None).await?;
let (compact_len, metadata): (Compact<u32>, frame_metadata::RuntimeMetadataPrefixed) =
Decode::decode(&mut &*meta_bytes)?;
Address some issues around tx mortality (#2025)
Prior to this change, the intended behavior was that any transaction submitted via an OnlineClient would have a mortality of 32 blocks by default, and any transaction submitted via an OfflineClient would be immortal by default. A couple of issues were present or cropped up however:
- If you explicitly configure the mortality via setting params like
PezkuwiExtrinsicParamsBuilder::new().mortal(32).build(), theOfflineClienttransaction would still be immortal, because it didn't have enough information to properly configure the mortality as asked for (by virtue of being offline and unable to fetch it). - The intended behaviour turned out to have been broken, and transactions were being submitted as immortal even via the
OnlineClientby default, unless mortality was explicitly configured. - There was no easy way to actually set the mortality for an
OfflineClienttransaction; you'd have to do something like this:let params = DefaultExtrinsicParamsBuilder::new(); params.5 = CheckMortalityParams::mortal_from_unchecked(for_n_blocks, from_block_n, from_block_hash);
With this PR, transactions are now mortal by default using the OnlineClient, we now return an error if you try to construct a transaction with the OfflineClient and try to use params.mortal(..) when configuring it, and we expose params.mortal_from_unchecked(..) to allow configuration for offline transactions without the ugly code above.
In this PR, we also discovered an issue decoding Eras and fixed this, so that decoding the mortality of a transaction when it is mortal should now work.
Add FFI example (#2037)
I'd like to do a quick shoutout to @wassimans, who submitted an excellent example for how to interact with Subxt via the C FFI in Python and Node.JS. This is something I've wanted to add for a while, so it's lovely to see this new example which highlights one of the strengths of Subxt over Javascript based compatitors in the space.
All of the non-trivial changes in this release are listed below:
Added
- Add FFI example (#2037)
Changed
- Remove
codec::Encodeandcodec::Decodederives from generated APIs by default (#2008) - Address some issues around tx mortality (#2025)
Fixed
- Fix 'subxt explore storage': don't turn keys to bytes (#2038)
- Refactor: improve nonce and block injection in extrinsic params (#2032)
- Improve docs for
at_latest(#2035) - Clippy fixes for latest Rustc (#2033)
- docs: fix minor comment typos (#2027)
- chore: remove redundant backtick in comment (#2020)
- Keep codec attrs even when Encode/Decode not used (#2023)
- Run CI on v0.N.x branches or PRs to them for ease of backporting (#2017)
- De-dup types early in CLI/macro so that derives/substitutes work for de-duped types (#2015)
- If only one hasher, always treat any key as a single and not NMap key, even if it's a tuple. (#2010)
[0.42.1] - 2025-05-12
This patch release reduces the rust-version to 1.85.0, given that we don't use any features newer than this at the moment.
[0.42.0] - 2025-05-09
The primary benefit of this release is introducing support for the about-to-be-stabilised-in-pezkuwi-sdk V16 metadata, and with that, support for calling Pallet View Functions on runtimes which will support this. Pallet View Functions are used much like Runtime APIs, except that they are declared in specific pallets and not declared at the runtime-wide level, allowing pallets to carry their own APIs with them.
Pallet View Functions
Calling a Pallet View Function in this Subxt release will look like:
use runtime::proxy::view_functions::check_permissions::{Call, ProxyType};
// Construct the call, providing the two arguments.
let view_function_call = runtime::view_functions()
.proxy()
.check_permissions(
Call::System(runtime::system::Call::remark { remark: b"hi".to_vec() }),
ProxyType::Any
);
// Submit the call and get back a result.
let _is_call_allowed = api
.view_functions()
.at_latest()
.await?
.call(view_function_call)
.await?;
Like Runtime APIs and others, the dynamic API can also be used to call into Pallet View Functions, which has the advantage of not needing the statically generated interface, but the downside of not being strongly typed. This looks like the following:
use scale_value::value;
let metadata = api.metadata();
// Look up the query ID for the View Function in the node metadata:
let query_id = metadata
.pallet_by_name("Proxy")
.unwrap()
.view_function_by_name("check_permissions")
.unwrap()
.query_id();
// Construct the call, providing the two arguments.
let view_function_call = subxt::dynamic::view_function_call(
*query_id,
vec![
value!(System(remark(b"hi".to_vec()))),
value!(Any())
],
);
// Submit the call and get back a result.
let _is_call_allowed = api
.view_functions()
.at_latest()
.await?
.call(view_function_call)
.await?;
Updated Config trait
Another change to be aware of is that our Config trait has been tweaked. The Hash associated type is no longer needed, as it can be obtained via the Hasher associated type already, and PezkuwiConfig/BizinikiwConfig now set the hasher by default to be DynamicHasher256, which will (when V16 metadata is available for a runtime) automatically select between Keccak256 and BlakeTwo256 hashers depending on what the chain requires.
Other changes
We also solidify our support for V1 archive RPCs, upgrade the codebase to Rust 2024 edition, and a bunch of other changes, the full list of which is here:
Added
- Support v16 metadata and use it by default if it's available (#1999)
- Metadata V16: Implement support for Pallet View Functions (#1981)
- Metadata V16: Be more dynamic over which hasher is used. (#1974)
Changed
- Update to 2024 edition (#2001)
- Update Smoldot to latest version (#1991)
- Update native test timeout to 45 mins (#2002)
- chore(deps): tokio ^1.44.2 (#1989)
- Add DefaultParams to allow more transaction extensions to be used when calling _default() methods (#1979)
- Use wat instead of wabt to avoid CI cmake error (and use supported dep) (#1980)
- Support v1 archive RPCs (#1977)
- Support V16 metadata and refactor metadata code (#1967)
- Allow submitting transactions ignoring follow events (#1962)
- Improve error message regarding failure to extract metadata from WASM runtime (#1961)
- Add docs for subxt-rpcs and fix example (#1954)
Fixed
[0.41.0] - 2025-03-10
This release makes two main changes:
Add subxt-rpcs crate.
Previously, if you wanted to make raw RPC calls but weren't otherwise interested in using the higher level Subxt interface, you still needed to include the entire Subxt crate.
Now, one can depend on subxt-rpcs directly. This crate implements the new RPC-V2 chainHead/transaction endpoints as well as the currently unstable archive endpoints. it also implements various legacy endpoints that Subxt uses as a fallback to the modern ones. It also provides several feature gated clients for interacting with them:
- jsonrpsee: A
jsonrpseebased RPC client for connecting to individual RPC nodes. - unstable-light-client: A Smoldot based light client which connects to multiple nodes in chains via p2p and verifies everything handed back, removing the need to trust any individual nodes.
- reconnecting-rpc-client: Another
jsonrpseebased client which handles reconnecting automatically in the event of network issues. - mock-rpc-client: A mock RPC client that can be used in tests.
Custom clients can be implemented if preferred.
Example usage via jsonrpsee feature:
use subxt_rpcs::{RpcClient, ChainHeadRpcMethods};
// Connect to a local node:
let client = RpcClient::from_url("ws://127.0.0.1:9944").await?;
// Use chainHead/archive V2 methods:
let methods = ChainHeadRpcMethods::new(client);
// Call some RPC methods (in this case a subscription):
let mut follow_subscription = methods.chainhead_v1_follow(false).await.unwrap();
while let Some(follow_event) = follow_subscription.next().await {
// do something with events..
}
Support creating V5 transactions.
Subxt has supported decoding V5 transactions from blocks since 0.38.0, but now it also supports constructing V5 transactions where allowed. Some naming changes have also taken place to align with the Bizinikiwi terminology now around transactions (see #1931 for more!).
The main changes here are:
subxt_corenow contains versioned methods for creating each of the possible types of transaction (V4 unsigned, V4 signed, V5 "bare" or V5 "general"), enabling the APIs to be tailored for each case.subxtexposes higher level wrappers these (ieapi.tx().create_v4_unsigned(..),api.tx().create_v5_bare(..)), but also continues to expose the same standard APIs for creating transactions which will, under the hood, decide what to create based on the chain we're connected to.- APIs like
sign_and_submitnow take aT::AccountIdrather than aT::Addresssince it was found to not be useful to provide the latter, and V5 transactions only expect anT::AccountId. - Signed Extensions are now referred to as Transaction Extensions, and we've tweaked the interface around how these work slightly to accomodate the fact that in V5 transactions, the signature is passed into a transaction extension where applicable (
VerifySignature). - As a side effect, it's simpler to set mortality on transactions; no more block hash needs to be provided; only the number of blocks you would like a transaction to live for.
A full list of the relevant changes is as follows:
Added
- Support constructing and submitting V5 transactions (#1931)
- Add archive RPCs to subxt-rpcs (#1940)
- Document generating interface from Runtime WASM and change feature to
runtime-wasm-path(#1936) - Split RPCs into a separate crate (#1910)
Changed
- Wrap the subxt::events::Events type to avoid exposing subxt_core errors and types unnecessarily (#1948)
- Allow transaction timeout in ChainheadBackend to be configured (#1943)
- refactor: make ExtrinsicEvents::new public for external access (#1933)
[0.40.0] - 2025-03-06
This release reverts the usage of the pezkuwi-sdk umbrella crate, which was causing issues such as an increased number of dependencies in Cargo.lock. For more details, see #1925.
Additionally, this update bumps the Pezkuwi SDK-related dependencies to their latest versions, ensuring compatibility and stability.
Fixed
- Remove usage of pezkuwi-sdk umbrella crate (#1926)
Full Changelog: https://github.com/pezkuwichain/subxt/compare/v0.39.0...v0.40.0
[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 bizinikiwi-compat feature flag (see #1850), which we'll go into more detail about.
The bizinikiwi-compat feature flag has been removed.
The bizinikiwi-compat feature flag essentially provided:
- An implementation of the
subxt::config::Headertrait for anything implementingsp_runtime::traits::Header(here). - Same for
subxt::config::Hasherand anything implementingsp_runtime::traits::Hasher(here). - A
subxt_core::tx::PairSignertype which could be given something implementingsp_core::Pairand then be used to sign transactions (here). - From impls for
sp_runtime::AccountId32and related forsubxt::utils::AccountId32(here). - Likewise for
sp_runtime::MultiAddressandsubxt::utils::MultiAddress(here). - Likewise for
sp_runtime::MultiSignatureandsubxt::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 Bizinikiwi, and communicate via the exposed RPC APIs in order to work across any compatible Bizinikiwi 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 Bizinikiwi signer to sign Subxt transactions.
- Looking at
subxt_signerinstead, 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 Bizinikiwi and Subxt types/traits, for instance:
// Wrap a bizinikiwi 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 Bizinikiwi 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 Bizinikiwi crate versions you are using, at the cost of this code no longer being included behind the bizinikiwi-compat feature flag.
A full list of relevant changes and fixes (nothing was added in this release) is as follows:
Changed
- remove bizinikiwi compat (#1850)
- migrate custom error trait impls to
thiserror(#1856) - re-export
jsonrpseeinsubxt::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: bizinikiwi 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 pezkuwi-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)
[0.38.0] - 2024-10-24
This release doesn't introduce any substantial breaking changes and focuses primarily on incremental improvements, testing and bug fixes. A few of the highlights include:
- #1785: Support decoding V5 extrinsics in blocks (currently Subxt will still submit V4 extrinsics). This also unifies our extrinsic decoding logic into one place.
- #1802: Stabilizing the
subxt::backend::unstable::UnstableBackend(it's now calledsubxt::backend::chain_head::ChainHeadBackend). This backend can be used to interact with the modernchainHeadRPC methods exposed by Smoldot and compliant RPC nodes. See this example. - #1803: Stabilizing the
reconnecting-rpc-client. See this example. - #1720: A nice little QoL improvement if you have the raw runtime WASM and would like to generate an interface directly from that (ie with
#[subx(runtime_path = "path/to/runtime.wasm")]). - #1661: Support loading keys directly from the PezkuwiJS JSON to be used in Subxt.
- #1638: Improve support for Eth style chains by defining a 20-byte account ID type directly in
subxt-core. See this example.
The notable changes in this release are as follows:
Added
- add reconnecting tests for unstable_backend (#1765)
- add support for generating metadata from runtime wasm files (#1720)
- support loading keys from Pezkuwi-JS accounts (#1661)
- allow tx payloads to be boxed (#1690)
- add hash method to ExtrinsicDetails (#1676)
- expose
secret_keymethod forecdsa::Keypairandeth::Keypair(#1628) - add 20-byte account id to subxt_core (#1638)
Changed
- make it clearer which extrinsic failed to decode (#1835)
- chore(deps): bump frame-metadata from 16 to 17 (#1836)
- chore(deps): bump
scale family crates,primitive-typesandimpl-serde(#1832) - chore(deps): replace
instantwithweb-time(#1830) - deps: use pezkuwi-sdk umbrella crate (#1786)
- stabilize reconnecting-rpc-client (#1803)
- stabilize chainhead backend (#1802)
- derive serialize on more types (#1797)
- use frame-decode for core extrinsic decode logic (including v5 support) (#1785)
- reconn-rpc-client: parse URL before connecting (#1789)
- update proc_macro_error to proc_macro_error2 (#1767)
- chore(deps): update Smoldot to the latest version (#1400)
- remove unneeded
?Sizedbound and replace never type with()(#1758) - improve test coverage for legacy
Backendimpl (#1751) - add integration tests for
unstable-reconnecting-rpc-client(#1711) - replace
reconnecting-jsonrpsee-ws-clientwithsubxt-reconnecting-rpc-client(#1705) - allow PartialExtrinsic to be held across await points (#1658)
- chore(deps): bump jsonrpsee from 0.22.5 to 0.23.1 (#1656)
Fixed
- fix stripping metadata in the case where enums like RuntimeCall are handed back (#1774)
- fix:
defalt-feature->default-featuresCargo.toml (#1828) - avoid hang by notifying subscribers when the backend is closed (#1817)
- fix: error message on rpc errors (#1804)
- docs: fix typos (#1776)
- examples: fix reconnecting logging target (#1733)
- docs: fix spelling issues (#1699)
- chore: fix some comments (#1697)
- codegen: Fix decode error by adding
#[codec(dumb_trait_bound)](#1630)
[0.37.0] - 2024-05-28
This release mainly adds support for the sign extension CheckMetadataHash and fixes a regression introduced in v0.36.0
where the type de-duplication was too aggressive and lots of the same type such as BoundedVec was duplicated to
plenty of different types such as BoundedVec1, BoundedVec2, .. BoundedVec.
Added
- Implemented
sign_prehashedforecdsa::Keypairandeth::Keypair(#1598) - Add a basic version of the CheckMetadataHash signed extension (#1590)
Changed
[0.36.1] - 2024-05-28 [YANKED]
Yanked because the typegen changed, it's a breaking change.
[0.36.0] - 2024-05-16
This release adds a few new features, which I'll go over below in more detail.
subxt-core
We now have a brand new subxt-core crate, which is #[no-std] compatible, and contains a lot of the core logic that is needed in Subxt. Using this crate, you can do things in a no-std environment like:
blocks: decode and explore block bodies.constants: access and validate the constant addresses in some metadata.custom_values: access and validate the custom value addresses in some metadata.metadata: decode bytes into the metadata used throughout this library.storage: construct storage request payloads and decode the results you'd get back.tx: construct and sign transactions (extrinsics).runtime_api: construct runtime API request payloads and decode the results you'd get back.events: decode and explore events.
Check out the docs for more, including examples of each case.
A breaking change that comes from migrating a bunch of logic to this new crate is that the ExtrinsicParams trait is now handed &ClientState<T> rather than a Client. ClientState is just a concrete struct containing the state that one needs for things like signed extensions.
Support for reconnecting
We've baked in a bunch of support for automatically reconnecting after a connection loss into Subxt. This comes in three parts:
- An RPC client that is capable of reconnecting. This is gated behind the
unstable-reconnecting-rpc-clientfeature flag at the moment, and - Handling in the subxt Backends such that when the RPC client notifies it that it is reconnecting, the backend will transparently handle this behind the scenes, or else pass on a
DisconnectedWillReconnecterror to the user where it cannot. Note that the individualLegacyRpcMethodsandUnstableRpcMethodsare not automatically retried on reconnection. Which leads us to.. - A couple of util helpers (
subxt::backend::retryandsubxt::backend::retry_stream) which can be used in conjunction with a reconnecting RPC client to make it easy to automatically retry RPC method calls where needed.
We'd love feedback on this reconnecting work! To try it out, enable the unstable-reconnecting-rpc-client feature flag and then you can make use of this like so:
use std::time::Duration;
use futures::StreamExt;
use subxt::backend::rpc::reconnecting_rpc_client::{Client, ExponentialBackoff};
use subxt::{OnlineClient, PezkuwiConfig};
// Generate an interface that we can use from the node's metadata.
#[subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new client with a reconnecting RPC client.
let rpc = Client::builder()
// We can configure the retry policy; here to an exponential backoff.
// This API accepts an iterator of retry delays, and here we use `take`
// to limit the number of retries.
.retry_policy(
ExponentialBackoff::from_millis(100)
.max_delay(Duration::from_secs(10))
.take(3),
)
.build("ws://localhost:9944".to_string())
.await?;
// Use this reconnecting client when instantiating a Subxt client:
let api: OnlineClient<PezkuwiConfig> = OnlineClient::from_rpc_client(rpc.clone()).await?;
Check out the full example here.
Better Ethereum support
We've added built-in support for Ethereum style chains (eg Frontier and Moonbeam) in subxt-signer, making it easier to sign transactions for these chains now.
Check out a full example here.
We plan to improve on this in the future, baking in better Ethereum support if possible so that it's as seamless to use AccountId20 as it is AccountId32.
Stabilizing the new V2 RPCs (#1540, #1539, #1538)
A bunch of the new RPCs are now stable in the spec, and have consequently been stabilized here, bringing the unstable-backend a step closer to being stabilized itself! We'll probably first remove the feature flag and next make it the default backend, in upcoming releases.
All of the notable changes in this release are as follows:
Added
- Add
frontier/ethereumexample (#1557) - Rpc: add full support reconnecting rpc client (#1505)
- Signer: ethereum implementation (#1501)
subxt-corecrate (#1466)
Changed
- Bump scale-decode and related deps to latest (#1583)
- Update Artifacts (auto-generated) (#1577)
- Update deps to use
scale-type-resolver0.2 (#1565) - Stabilize transactionBroadcast methods (#1540)
- Stabilize transactionWatch methods (#1539)
- Stabilize chainHead methods (#1538)
- Rename traits to remove T suffix (#1535)
- Add Debug/Clone/etc for common Configs for convenience (#1542)
- Unstable_rpc: Add transactionBroadcast and transactionStop (#1497)
Fixed
- metadata: Fix cargo clippy (#1574)
- Fixed import in
subxt-signer::eth(#1553) - chore: fix typos and link broken (#1541)
- Make subxt-core ready for publishing (#1508)
- Remove dupe storage item if we get one back, to be compatible with Smoldot + legacy RPCs (#1534)
- fix: bizinikiwi runner libp2p port (#1533)
- Swap BinaryHeap for Vec to avoid Ord constraint issue (#1523)
- storage_type: Strip key proper hash and entry bytes (32 instead of 16) (#1522)
- testing: Prepare light client testing with bizinikiwi binary and add subxt-test macro (#1507)
[0.35.0] - 2024-03-21
This release contains several fixes, adds no_std support to a couple of crates (subxt-signer and subxt-metadata) and introduces a few quality of life improvements, which I'll quickly cover:
Reworked light client (#1475)
This PR reworks the light client interface. The "basic" usage of connecting to a parachain now looks like this:
#[subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
use subxt::lightclient::LightClient;
// Instantiate a light client with the Pezkuwi relay chain given its chain spec.
let (lightclient, pezkuwi_rpc) = LightClient::relay_chain(POLKADOT_SPEC)?;
// Connect the light client to some parachain by giving a chain spec for it.
let asset_hub_rpc = lightclient.parachain(ASSET_HUB_SPEC)?;
// Now, we can create Subxt clients from these Smoldot backed RPC clients:
let pezkuwi_api = OnlineClient::<PezkuwiConfig>::from_rpc_client(pezkuwi_rpc).await?;
let asset_hub_api = OnlineClient::<PezkuwiConfig>::from_rpc_client(asset_hub_rpc).await?;
This interface mirrors the requirement that we must connect to a relay chain before we can connect to a parachain. It also moves the light client specific logic into an RpcClientT implementation, rather than exposing it as a subxt::client::LightClient.
Typed Storage Keys (#1419)
This PR changes the storage interface so that, where possible, we now also decode the storage keys as well as the values when iterating over storage entries:
#[subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a storage query to iterate over account information.
let storage_query = pezkuwi::storage().system().account_iter();
// Get back an iterator of results (here, we are fetching 10 items at
// a time from the node, but we always iterate over one at a time).
let mut results = api.storage().at_latest().await?.iter(storage_query).await?;
while let Some(Ok(kv)) = results.next().await {
// We used to get a tuple of key bytes + value. Now we get back a
// `kv` struct containing the bytes and value as well as the actual
// decoded keys:
println!("Decoded key(s): {:?}", kv.keys);
println!("Key bytes: 0x{}", hex::encode(&kv.key_bytes));
println!("Value: {:?}", kv.value);
}
When using the static interface, keys come back as a tuple of values corresponding to the different hashers used in constructing the key. When using a dynamic interface, keys will be encoded/decoded from the type given so long as it implements subxt::storage::StorageKey, eg Vec<scale_value::Value>.
Extrinsic Params Refinement (#1439)
Prior to this PR, one could configure extrinsic signed extensions by providing some params like so:
// Configure the transaction parameters; we give a small tip and set the
// transaction to live for 32 blocks from the `latest_block` above:
let tx_params = Params::new()
.tip(1_000)
.mortal(latest_block.header(), 32)
.build();
let hash = api.tx().sign_and_submit(&tx, &from, tx_params).await?;
If you want to customize the account nonce, you'd use a different call like create_signed_with_nonce instead.
One of the downsides of the above approach is that, if you don't provide any explicit params, transactions will be immortal by default (because the signed extensions didn't have the information to do any better).
Now, with the help of a RefineParams trait, transactions will default to being mortal and living for 32 blocks unless an explicit mortality is provided as above.
One notable change is that the offline-only create_signed_with_nonce and create_partial_signed_with_nonce functions have lost the _with_nonce suffix. Since we can't discover nonce/mortality settings offline, you should now provide Params and set an explicit nonce (and mortality, if you like) when using these calls, otherwise the nonce will be set to 0 and the mortality to Immortal.
For a full list of changes, please see the following:
Added
- Reworked light client (#1475)
no_stdcompatibility forsubxt-signer(#1477)- Typed Storage Keys (#1419)
- Extrinsic Params Refinement (#1439)
- Make storage_page_size for the LegacyBackend configurable (#1458)
no_stdcompatibility forsubxt-metadata(#1401)- Experimental
reconnecting-rpc-client(#1396)
Changed
scale-type-resolverintegration (#1460)- subxt: Derive
std::cmptraits for subxt payloads and addresses (#1429) - CLI: Return error on wrongly specified type paths (#1397)
- rpc v2: chainhead support multiple finalized block hashes in
FollowEvent::Initialized(#1476) - rpc v2: rename transaction to transactionWatch (#1399)
Fixed
- Avoid a panic in case we try decoding naff bytes (#1444)
- Fix error mapping to wrong transaction status (#1445)
- Update DispatchError to match latest in pezkuwi-sdk (#1442)
- Handle errors when fetching storage keys from Unstablebackend (#1440)
- Swap type aliases around to be semantically correct (#1441)
[0.34.0] - 2024-01-23
This release introduces a bunch of features that make subxt easier to use. Let's look at a few of them.
Codegen - Integrating scale-typegen and adding type aliases (#1249)
We rewrote the code generation functionality of subxt and outsourced it to the new scale-typegen crate, which serves a more general purpose.
Since a lot of types used in bizinikiwi are rich with generics, this release introduces type aliases into the generated code. A type alias is generated for the arguments/keys or each call, storage entry, and runtime API method (#1249).
Macro - Errors for misspecified type paths (#1339)
The subxt macro provides attributes to specify custom derives, attributes, and type substitutions on a per-type basis. Previously we did not verify that the provided type paths are part of the metadata. This is now fixed: If you provide an invalid type path, the macro will tell you so. It also suggests similar type paths, you might have meant instead.
#[subxt::subxt(
runtime_metadata_path = "metadata.scale",
derive_for_type(path = "Junctions", derive = "Clone")
)]
pub mod pezkuwi {}
This gives you a compile-time error like this:
Type `Junctions` does not exist at path `Junctions`
A type with the same name is present at:
xcm::v3::junctions::Junctions
xcm::v2::multilocation::Junctions
Macro - Recursive derives and attributes (#1379)
Previously adding derives on a type containing other types was also cumbersome, see this example:
#[subxt::subxt(
runtime_metadata_path = "metadata.scale",
derive_for_type(path = "xcm::v2::multilocation::MultiLocation", derive = "Clone"),
derive_for_type(path = "xcm::v2::multilocation::Junctions", derive = "Clone"),
derive_for_type(path = "xcm::v2::junction::Junction", derive = "Clone"),
derive_for_type(path = "xcm::v2::NetworkId", derive = "Clone"),
derive_for_type(path = "xcm::v2::BodyId", derive = "Clone"),
derive_for_type(path = "xcm::v2::BodyPart", derive = "Clone"),
derive_for_type(
path = "bounded_collections::weak_bounded_vec::WeakBoundedVec",
derive = "Clone"
)
)]
pub mod pezkuwi {}
We introduced a recursive flag for custom derives and attributes that automatically inserts the specified derives on all child types:
#[subxt::subxt(
runtime_metadata_path = "metadata.scale",
derive_for_type(path = "xcm::v2::multilocation::MultiLocation", derive = "Clone", recursive),
)]
pub mod pezkuwi {}
Subxt CLI - New features and usability improvements (#1290, #1336, and #1379)
Our CLI tool now allows you to explore runtime APIs and events (#1290). We also fully integrated with scale-typegen-description, a crate that can describe types in a friendly way and provide type examples. The output is also color-coded to be easier on the eyes. Get started with these commands:
# Show details about a runtime API call:
subxt explore --url wss://zagros-rpc.pezkuwi.io api StakingAPI nominations_quota
# Execute a runtime API call from the CLI:
subxt explore --url wss://zagros-rpc.pezkuwi.io api core version -e
# Discover what events a pallet can emit:
subxt explore --url wss://zagros-rpc.pezkuwi.io pallet Balances events
All CLI commands that take some metadata via --file or --url, can now also read the metadata directly from stdin with --file - (#1336).
This allows you to pipe in metadata from other processes like in this command chain:
parachain-node export-metadata | subxt codegen --file - | rustfmt > main.rs
Similar to the macro, the subxt codegen command can now also use recursive flags:
subxt codegen --derive-for-type xcm::v2::multilocation::MultiLocation=Clone,recursive
subxt codegen --attributes-for-type "xcm::v2::multilocation::MultiLocation=#[myerror],recursive"
Minor changes and things to be aware of
- Using insecure connections is now an explicit opt-in in many places (#1309)
- When decoding extrinsics from a block into a static type, we now return it's details (e.g. signature, signed extensions, raw bytes) alongside the statically decoded extrinsic itself (#1376)
We also made a few fixes and improvements around the unstable backend and the lightclient, preparing them for more stable usage in the future.
Added
- Errors for misspecified type paths + suggestions (#1339)
- CLI: Recursive derives and attributes (#1379)
- CLI: Explore runtime APIs and events, colorized outputs, scale-typegen integration for examples (#1290)
- Add chainflip to real world usage section of README (#1351)
- CLI: Allow using
--file -to read metadata from stdin (#1336) - Codegen: Generate type aliases for better API ergonomics (#1249)
Changed
- Return Pending rather than loop around if no new finalized hash in submit_transaction (#1378)
- Return
ExtrinsicDetailsalongside decoded static extrinsics (#1376) - Improve Signed Extension and Block Decoding Examples/Book (#1357)
- Use
scale-typegenas a backend for the codegen (#1260) - Using insecure connections is now opt-in (#1309)
Fixed
- Ensure lightclient chainSpec is at least one block old (#1372)
- Typo fix in docs (#1370)
- Don't unpin blocks that may show up again (#1368)
- Runtime upgrades in unstable backend (#1348)
- Generate docs for feature gated items (#1332)
- Backend: Remove only finalized blocks from the event window (#1356)
- Runtime updates: wait until upgrade on chain (#1321)
- Cache extrinsic events (#1327)
[0.33.0] - 2023-12-06
This release makes a bunch of small QoL improvements and changes. Let's look at the main ones.
Add support for configuring multiple chains (#1238)
The light client support previously provided a high level interface for connecting to single chains (ie relay chains). This PR exposes a "low level" interface which allows smoldot (the light client implementation we use) to be configured somewhat more arbitrarily, and then converted into a valid subxt OnlineClient to be used.
See this example for more on how to do this.
We'll likely refine this over time and add a slightly higher level interface to make common operations much easier to do.
Support decoding signed extensions (#1209 and #1235)
This PR makes it possible to decode the signed extensions in extrinsics. This looks something like:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Get blocks; here we just subscribe to them:
let mut blocks_sub = api.blocks().subscribe_finalized().await?;
while let Some(block) = blocks_sub.next().await {
let block = block?;
// Fetch the extrinsics in the block:
let extrinsics = block.extrinsics().await?;
// Iterate over them:
for extrinsic in extrinsics.iter() {
// Returns None if the extrinsic isn't signed, so no signed extensions:
let Some(signed_exts) = extrinsic.signed_extensions() else {
continue;
};
// We can ask for a couple of common values, None if not found:
println!("Tip: {:?}", signed_exts.tip());
println!("Nonce: {:?}", signed_exts.tip());
// Or we can find and decode into a static signed extension type
// (Err if we hit a decode error first, then None if it's not found):
if let Ok(Some(era)) = signed_exts.find::<CheckMortality<PezkuwiConfig>>() {
println!("Era: {era:?}");
}
// Or we can iterate over the signed extensions to work with them:
for signed_ext in signed_exts {
println!("Signed Extension name: {}", signed_ext.name());
// We can try to statically decode each one:
if let Ok(Some(era)) = signed_ext.as_signed_extension::<CheckMortality<PezkuwiConfig>>() {
println!("Era: {era:?}");
}
// Or we can dynamically decode it into a `scale_value::Value`:
if let Ok(value) = signed_ext.value() {
println!("Decoded extension: {value}");
}
}
}
}
See the API docs for more.
ChargeAssetTxPayment: Add support for generic AssetId
Still on the topic of signed extensions, the ChargeAssetTxPayment extension was previously not able to be used with a generic AssetId, which prohibited it from being used on the Asset Hub (which uses a MultiLocation instead). To address this, we added an AssetId type to our subxt::Config, which can now be configured.
One example of doing that can be found here.
This example uses a generated MultiLocation type to be used as the AssetId. Currently it requires a rather hideous set of manual clones like so:
#[subxt::subxt(
runtime_metadata_path = "../artifacts/pezkuwi_metadata_full.scale",
derive_for_type(path = "xcm::v2::multilocation::MultiLocation", derive = "Clone"),
derive_for_type(path = "xcm::v2::multilocation::Junctions", derive = "Clone"),
derive_for_type(path = "xcm::v2::junction::Junction", derive = "Clone"),
derive_for_type(path = "xcm::v2::NetworkId", derive = "Clone"),
derive_for_type(path = "xcm::v2::BodyId", derive = "Clone"),
derive_for_type(path = "xcm::v2::BodyPart", derive = "Clone"),
derive_for_type(
path = "bounded_collections::weak_bounded_vec::WeakBoundedVec",
derive = "Clone"
)
)]
This is something we plan to address in the next version of Subxt.
Change SignedExtension matching logic (#1283)
Before this release, each signed extension had a unique name (SignedExtension::NAME). We'd use this name to figure out which signed extensions to apply for a given chain inside the signed_extensions::AnyOf type.
However, we recently ran into a new signed extension in Bizinikiwi called SkipCheckIfFeeless. This extension would wrap another signed extension, but maintained its own name. It has since been "hidden" from the public Bizinikiwi interface again, but a result of encountering this is that we have generalised the way that we "match" on signed extensions, so that we can be smarter about it going forwards.
So now, for a given signed extension, we go from:
impl<T: Config> SignedExtension<T> for ChargeAssetTxPayment<T> {
const NAME: &'static str = "ChargeAssetTxPayment";
type Decoded = Self;
}
To:
impl<T: Config> SignedExtension<T> for ChargeAssetTxPayment<T> {
type Decoded = Self;
fn matches(identifier: &str, type_id: u32, types: &PortableRegistry) -> bool {
identifier == "ChargeAssetTxPayment"
}
}
On the whole, we continue matching by name, as in the example above, but this allows an author to inspect the type of the signed extension (and subtypes of it) too if they want the signed extension to match (and thus be used) only in certain cases.
Remove wait_for_in_block helper method (#1237)
One can no longer use tx.wait_for_in_block to wait for a transaction to enter a block. The reason for this removal is that, especially when we migrate to the new chainHead APIs, we will no longer be able to reliably obtain any details about the block that the transaction made it into.
In other words, the following sort of thing would often fail:
tx.wait_for_in_block()
.await?
.wait_for_success()
.await?;
The reason for this is that the block announced in the transaction status may not have been "pinned" yet in the new APIs. In the old APIs, errors would occasionally be encountered because the block announced may have been pruned by the time we ask for details for it. Overall; having an "unreliable" higher level API felt like a potential foot gun.
That said, you can still achieve the same via the lower level APIs like so:
while let Some(status) = tx.next().await {
match status? {
TxStatus::InBestBlock(tx_in_block) | TxStatus::InFinalizedBlock(tx_in_block) => {
// now, we can attempt to work with the block, eg:
tx_in_block.wait_for_success().await?;
},
TxStatus::Error { message } | TxStatus::Invalid { message } | TxStatus::Dropped { message } => {
// Handle any errors:
println!("Error submitting tx: {message}");
},
// Continue otherwise:
_ => continue,
}
}
Subxt-codegen: Tidy crate interface (#1225)
The subxt-codegen crate has always been a bit of a mess because it wasn't really supposed to be used outside of the subxt crates, which had led to issues like https://github.com/pezkuwichain/subxt/issues/1211.
This PR tidies up the interface to that crate so that it's much easier now to programmatically generate the Subxt interface. Now, we have three properly supported ways to do this, depending on your needs:
- Using the
#[subxt]macro. - Using the
subxt codegenCLI command. - Programmatically via the
subxt-codegencrate.
Each method aims to expose a similar and consistent set of options.
If you were previously looking to use parts of the type generation logic to, for instance, generate runtime types but not the rest of the Subxt interface, then the https://github.com/pezkuwichain/scale-typegen crate will aim to fill this role eventually.
That sums up the most significant changes. A summary of all of the relevant changes is as follows:
Added
- CLI: Add command to fetch chainSpec and optimize its size (#1278)
- Add legacy RPC usage example (#1279)
- impl RpcClientT for
Arc<T>andBox<T>(#1277) - RPC: Implement legacy RPC system_account_next_index (#1250)
- Lightclient: Add support for configuring multiple chains (#1238)
- Extrinsics: Allow static decoding of signed extensions (#1235)
- Extrinsics: Support decoding signed extensions (#1209)
- ChargeAssetTxPayment: Add support for generic AssetId (eg
u32orMultiLocation) (#1227) - Add Clone + Debug on Payloads/Addresses, and compare child storage results (#1203)
Changed
- Lightclient: Update smoldot to
0.14.0and smoldot-light to0.12.0(#1307) - Cargo: Switch to workspace lints (#1299)
- Update bizinikiwi-* and signer-related dependencies (#1297)
- Change SignedExtension matching logic and remove SkipCheckIfFeeless bits (#1283)
- Update the README with the new location of node-cli (#1282)
- Generalize
bizinikiwi-compatimpls to accept any valid hasher/header impl (#1265) - Extrinsics: Remove
wait_for_in_blockhelper method (#1237) - Subxt-codegen: Tidy crate interface (#1225)
- Lightclient: Update usage docs (#1223)
- Wee tidy to subxt-signer flags (#1200)
- Batch fetching storage values again to improve performance (#1199)
- Add
subxtfeature insubxt-signercrate to default features (#1193)
Fixed
- Trimmed metadata hash comparison fails in
is_codegen_valid_for(#1306) - Sync tx submission with chainHead_follow (#1305)
- Storage: Fix partial key storage iteration (#1298)
- Lightclient: Fix wasm socket closure called after being dropped (#1289)
- Fix parachain example (#1228)
[0.32.1] - 2023-10-05
This is a patch release, mainly to deploy the fix #1191, which resolves an issue around codegen when runtime API definitions have an argument name "_".
We also expose an API, api.blocks().at(block_hash).account_nonce(account_id), which allows one to obtain the account nonce for some account at any block hash, and not just at the latest finalized block hash as is possible via api.tx().account_nonce(..).
The main changes are:
- fix for when runtime API field name is _ (#1191)
- allow getting account nonce at arbitrary blocks, too (#1182)
- chore: improve some error messages (#1183)
[0.32.0] - 2023-09-27
This is a big release that adds quite a lot, and also introduces some slightly larger breaking changes. Let's look at the main changes:
The Backend trait and the UnstableBackend and LegacyBackend impls.
See #1126, #1137 and #1161 for more information.
The overarching idea here is that we want Subxt to be able to continue to support talking to nodes/light-clients using the "legacy" RPC APIs that are currently available, but we also want to be able to support using only the new RPC APIs once they are stabilized.
Until now, the higher level APIs in Subxt all had access to the RPCs and could call whatever they needed. Now, we've abstracted away which RPCs are called (or even that RPCs are used at all) behind a subxt::backend::Backend trait. Higher level APIs no longer have access to RPC methods and instead have access to the current Backend implementation. We then added two Backend implementations:
subxt::backend::legacy::LegacyBackend: This uses the "legacy" RPCs, as we've done to date, to obtain the information we need. This is still the default backend that Subxt will use.subxt::backend::unstable::UnstableBackend: This backend relies on the new (and currently still unstable)chainHeadbased RPC APIs to obtain the information we need. This could break at any time as the RPC methods update, until they are fully stabilized. One day, this will be the default backend.
One of the significant differences between backends is that the UnstableBackend can only fetch further information about blocks that are "pinned", ie that we have signalled are still in use. To that end, the backend now hands back BlockRefs instead of plain block hashes. As long as a BlockRef exists for some block, the backend (and node) will attempt to keep it available. Thus, Subxt will keep hold of these internally as needed, and also allows you to obtain them from a Block with block.reference(), in case you need to try and hold on to any blocks for longer.
One of the main breaking changes here is in how you can access and call RPC methods.
Previously, you could access them directly from the Subxt client, since it exposed the RPC methods itself, eg:
let genesis_hash = client.rpc().genesis_hash().await?;
Now, the client only knows about a Backend (ie it has a .backend() method instead of .rpc()), and doesn't know about RPCs, but you can still manually create an RpcClient to call RPC methods like so:
use subxt::{
config::BizinikiwConfig,
backend::rpc::RpcClient,
backend::legacy::LegacyRpcMethods,
};
// Instantiate an RPC client pointing at some URL.
let rpc_client = RpcClient::from_url("ws://localhost:9944").await?;
// We could also call unstable RPCs with `backend::unstable::UnstableRpcMethods`:
let rpc_methods = LegacyRpcMethods::<BizinikiwConfig>::new(rpc_client);
// Use it to make RPC calls, here calling the legacy genesis_hash method.
let genesis_hash = rpc_methods.genesis_hash().await?
If you'd like to share a single client for RPCs and Subxt usage, you can clone this RPC client and run OnlineClient::<BizinikiwConfig>::from_rpc_client(rpc_client) to create a Subxt client using it.
Another side effect of this change is that RPC related things have moved from subxt::rpc::* to subxt::backend::rpc::* and some renaming has happened along the way.
A number of smaller breaking changes have also been made in order to expose details that are compatible with both sets of RPCs, and to generally move Subxt towards working well with the new APIs and exposing things in a consistent way:
- The storage methods
fetch_keysis renamed tofetch_raw_keys(this just for consistency withfetch_raw). - The storage method
iterno longer accepts apage_sizeargument, and each item returned is now anOption<Result<(key, val)>>instead of aResult<Option<(key, val)>>(we now return a validStreamimplementation for storage entry iteration). See this example. - The events returned when you manually watch a transaction have changed in order to be consistent with the new RPC APIs (the new events can be seen here), and
next_item=>next. If you rely on higher level calls likesign_and_submit_then_watch, nothing has changed. - Previously, using
.at_latest()in various places would mean that calls would run against the latest best block. Now, all such calls will run against the latest finalized block. The latest best block is subject to changing or being pruned entirely, and can differ between nodes. .at(block_hash)should continue to work as-is, but can now also accept aBlockRef, to keep the relevant block around while you're using the associated APIs.- To fetch the extrinsics in a block, you used to call
block.body().await?.extrinsics(). This has now been simplified toblock.extrinsics().await?.
Making ExtrinsicParams more flexible with SignedExtensions.
See #1107 for more information.
When configuring Subxt to work against a given chain, you needed to configure the ExtrinsicParams associated type to encode exactly what was required by the chain when submitting transactions. This could be difficult to get right.
Now, we have "upgraded" the ExtrinsicParams trait to give it access to metadata, so that it can be smarter about how to encode the correct values. We've also added a subxt::config::SignedExtension trait, and provided implementations of it for all of the "standard" signed extensions (though we have a little work to do still).
How can you use SignedExtensions? Well, subxt::config::signed_extensions::AnyOf<T, Params> is a type which can accept any tuple of SignedExtensions, and itself implements ExtrinsicParams. It's smart, and will use the metadata to know which of the signed extensions that you provided to actually use on a given chain. So, AnyOf makes it easy to compose whichever SignedExtensions you need to work with a chain.
Finally, we expose subxt::config::{ DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder }; the former just uses AnyOf to automatically use any of the "standard" signed extensions as needed, and the latter provided a nice builder interface to configure any parameters for them. This is now the default type used in BizinikiwConfig and PezkuwiConfig, so long story short: those configurations (and particularly their ExtrinsicParams) are more likely to Just Work now across default chains.
See this example for how to create and use custom signed extensions, or this example for how to implement custom ExtrinsicParams if you'd prefer to ignore SignedExtensions entirely.
As a result of using the new DefaultExtrinsicParams in BizinikiwConfig and PezkuwiConfig, the interface to configure transactions has changed (and in fact been generally simplified). Configuring a mortal transaction with a small tip ƒor instance used to look like:
use subxt::config::pezkuwi::{Era, PlainTip, PezkuwiExtrinsicParamsBuilder as Params};
let tx_params = Params::new()
.tip(PlainTip::new(1_000))
.era(Era::mortal(32, latest_block.header().number()), latest_block.header().hash());
let hash = api.tx().sign_and_submit(&tx, &from, tx_params).await?;
And now it will look like this:
use subxt::config::pezkuwi::PezkuwiExtrinsicParamsBuilder as Params;
let tx_params = Params::new()
.tip(1_000)
.mortal(latest_block.header(), 32)
.build();
let hash = api.tx().sign_and_submit(&tx, &from, tx_params).await?;
Check the docs for PezkuwiExtrinsicParamsBuilder and the ExtrinsicParams trait for more information.
Storage: Allow iterating storage entries at different depths
See (#1079) for more information.
Previously, we could statically iterate over the root of some storage map using something like:
// Build a storage query to iterate over account information.
let storage_query = pezkuwi::storage().system().account_root();
// Get back an iterator of results (here, we are fetching 10 items at
// a time from the node, but we always iterate over one at a time).
let mut results = api.storage().at_latest().await?.iter(storage_query, 10).await?;
Now, the suffix _root has been renamed to _iter, and if the storage entry is for instance a double map (or greater depth), we'll also now generate _iter2, iter3 and so on, each accepting the keys needed to access the map at that depth to iterate the remainder. The above example now becomes:
// Build a storage query to iterate over account information.
let storage_query = pezkuwi::storage().system().account_iter();
// Get back an iterator of results
let mut results = api.storage().at_latest().await?.iter(storage_query).await?;
Note also that the pagination size no longer needs to be provided; that's handled internally by the relevant Backend.
Custom values
This is not a breaking change, but just a noteworthy addition; see #1106, #1117 and #1147 for more information.
V15 metadata allows chains to insert arbitrary information into a new "custom values" hashmap (see this). Subxt has now added APIs to allow accessing these custom values a little like how constants can be accessed.
Dynamically accessing custom values looks a bit like this:
// Obtain the raw bytes for some entry:
let custom_value_bytes: Vec<u8> = client.custom_values().bytes_at("custom-value-name")?;
// Obtain a representation of the value that we can attempt to decode:
let custom_value = client.custom_values().at("custom-value-name")?;
// Decode it into a runtime Value if possible:
let value: Value = custom_value.to_value()?;
// Or attempt to decode it into a specific type:
let value: Foo = custom_value.as_type()?;
We can also use codegen to statically access values, which makes use of validation and returns a known type whenever possible, for the added compile time safety this brings:
#[subxt::subxt(runtime_metadata_path = "metadata.scale")]
pub mod runtime {}
// The generated interface also exposes any custom values with known types and sensible names:
let value_addr = runtime::custom().custom_value_name();
// We can use this address to access and decode the relevant value from metadata:
let static_value = client.custom_values().at(&value_addr)?;
// Or just ask for the bytes for it:
let static_value_bytes = client.custom_values().bytes_at(&value_addr)?;
That sums up the most significant changes. All of the key commits in this release can be found here:
Added
UnstableBackend: Add a chainHead based backend implementation (#1161)UnstableBackend: Expose the chainHead RPCs (#1137)- Introduce Backend trait to allow different RPC (or other) backends to be implemented (#1126)
- Custom Values: Fixes and tests for "custom values" (#1147)
- Custom Values: Add generated APIs to statically access custom values in metadata (#1117)
- Custom Values: Support dynamically accessing custom values in metadata (#1106)
- Add
storage_version()andruntime_wasm_code()to storage (#1111) - Make ExtrinsicParams more flexible, and introduce signed extensions (#1107)
Changed
subxt-codegen: Add "web" feature for WASM compilation that works withjsonrpsee(#1175)subxt-codegen: support compiling to WASM (#1154)- CI: Use composite action to avoid dupe use-bizinikiwi code (#1177)
- Add custom
Debugimpl forDispatchErrorto avoid huge metadata output (#1153) - Remove unused start_key that new RPC API may not be able to support (#1148)
- refactor(rpc): Use the default port if one isn't provided (#1122)
- Storage: Support iterating over NMaps with partial keys (#1079)
Fixed
- metadata: Generate runtime outer enums if not present in V14 (#1174)
- Remove "std" feature from
sp-arithmeticto help bizinikiwi compat. (#1155) - integration-tests: Increase the number of events we'll wait for (#1152)
- allow 'latest' metadata to be returned from the fallback code (#1127)
- chainHead: Propagate results on the
chainHead_follow(#1116)
[0.31.0] - 2023-08-02
This is a small release whose primary goal is to bump the versions of scale-encode, scale-decode and scale-value being used, to benefit from recent changes in those crates.
scale-decode changes how compact values are decoded as part of #1103. A compact encoded struct should now be properly decoded into a struct of matching shape (which implements DecodeAsType). This will hopefully resolve issues around structs like Perbill. When decoding the SCALE bytes for such types into scale_value::Value, the Value will now be a composite type wrapping a value, and not just the value.
We've also figured out how to sign extrinsics using browser wallets when a Subxt app is compiled to WASM; see #1067 for more on that!
The key commits:
Added
- Add browser extension signing example (#1067)
Changed
- Bump to latest scale-encode/decode/value and fix test running (#1103)
- Set minimum supported
rust-versionto1.70(#1097)
Fixed
- Tests: support 'bizinikiwi-node' too and allow multiple binary paths (#1102)
[0.30.1] - 2023-07-25
This patch release fixes a small issue whereby using runtime_metadata_url in the Subxt macro would still attempt to download unstable metadata, which can fail at the moment if the chain has not updated to stable V15 metadata yet (which has a couple of changes from the last unstable version). Note that you're generally encouraged to use runtime_metadata_path instead, which does not have this issue.
Fixes
- codegen: Fetch and decode metadata version then fallback (#1092)
[0.30.0] - 2023-07-24
This release beings with it a number of exciting additions. Let's cover a few of the most significant ones:
Light client support (unstable)
This release adds support for light clients using Smoldot, both when compiling native binaries and when compiling to WASM to run in a browser environment. This is unstable for now while we continue testing it and work on making use of the new RPC APIs.
Here's how to use it:
use subxt::{
client::{LightClient, LightClientBuilder},
PezkuwiConfig
};
use subxt_signer::sr25519::dev;
// Create a light client:
let api = LightClient::<PezkuwiConfig>::builder()
// You can also pass a chain spec directly using `build`, which is preferred:
.build_from_url("ws://127.0.0.1:9944")
.await?;
// Working with the interface is then the same as before:
let dest = dev::bob().public_key().into();
let balance_transfer_tx = pezkuwi::tx().balances().transfer(dest, 10_000);
let events = api
.tx()
.sign_and_submit_then_watch_default(&balance_transfer_tx, &dev::alice())
.await?
.wait_for_finalized_success()
.await?;
At the moment you may encounter certain things that don't work; please file an issue if you do!
V15 Metadata
This release stabilizes the metadata V15 interface, which brings a few changes but primarily allows you to interact with Runtime APIs via an ergonomic Subxt interface:
// We can use the static interface to interact in a type safe way:
#[subxt::subxt(runtime_metadata_path = "path/to/metadata.scale")]
pub mod pezkuwi {}
let runtime_call = pezkuwi::apis()
.metadata()
.metadata_versions();
// Or we can use the dynamic interface like so:
use subxt::dynamic::Value;
let runtime_call = subxt::dynamic::runtime_api_call(
"Metadata",
"metadata_versions",
Vec::<Value<()>>::new()
);
This is no longer behind a feature flag, but if the chain you're connecting to doesn't use V15 metadata yet then the above will be unavailable.
subxt-signer
The new subxt-signer crate provides the ability to sign transactions using either sr25519 or ECDSA. It's WASM compatible, and brings in fewer dependencies than using sp_core/sp_keyring does, while having an easy to use interface. Here's an example of signing a transaction using it:
use subxt::{OnlineClient, PezkuwiConfig};
use subxt_signer::sr25519::dev;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build the extrinsic; a transfer to bob:
let dest = dev::bob().public_key().into();
let balance_transfer_tx = pezkuwi::tx().balances().transfer(dest, 10_000);
// Sign and submit the balance transfer extrinsic from Alice:
let from = dev::alice();
let events = api
.tx()
.sign_and_submit_then_watch_default(&balance_transfer_tx, &from)
.await?
.wait_for_finalized_success()
.await?;
Dev keys should only be used for tests since they are publicly known. Actual keys can be generated from URIs, phrases or raw entropy, and derived using soft/hard junctions:
use subxt_signer::{ SecretUri, sr25519::Keypair };
use std::str::FromStr;
// From a phrase (see `bip39` crate on generating phrases):
let phrase = bip39::Mnemonic::parse(phrase).unwrap();
let keypair = Keypair::from_phrase(&phrase, Some("Password")).unwrap();
// Or from a URI:
let uri = SecretUri::from_str("//Alice").unwrap();
let keypair = Keypair::from_uri(&uri).unwrap();
// Deriving a new key from an existing one:
let keypair = keypair.derive([
DeriveJunction::hard("Alice"),
DeriveJunction::soft("stash")
]);
Breaking changes
A few small breaking changes have occurred:
- There is no longer a need for an
Indexassociated type in yourConfigimplementations; we now work it out dynamically where needed. - The "bizinikiwi-compat" feature flag is no longer enabled by default.
subxt-signeradded native signing support and can be used instead of bringing in Bizinikiwi dependencies to sign transactions now. You can still enable this feature flag as before to make use of them if needed.- Note: Be aware that Bizinikiwi crates haven't been published in a while and have fallen out of date, though. This will be addressed eventually, and when it is we can bring the Bizinikiwi crates back uptodate here.
For anything else that crops up, the compile errors and API docs will hopefully point you in the right direction, but please raise an issue if not.
For a full list of changes, see below:
Added
- Example: How to connect to parachain (#1043)
- ECDSA Support in signer (#1064)
- Add
subxt_signercrate for native & WASM compatible signing (#1016) - Add light client platform WASM compatible (#1026)
- light-client: Add experimental light-client support (#965)
- Add
diffcommand to CLI tool to visualize metadata changes (#1015) - CLI: Allow output to be written to file (#1018)
Changed
- Remove
bizinikiwi-compatdefault feature flag (#1078) - runtime API: Substitute
UncheckedExtrinsicwith custom encoding (#1076) - Remove
Indextype from Config trait (#1074) - Utilize Metadata V15 (#1041)
- chain_getBlock extrinsics encoding (#1024)
- Make tx payload details public (#1014)
- CLI tool tests (#977)
- Support NonZero numbers (#1012)
- Get account nonce via state_call (#1002)
- add
#[allow(rustdoc::broken_intra_doc_links)]to subxt-codegen (#998)
Fixed
- remove parens in hex output for CLI tool (#1017)
- Prevent bugs when reusing type ids in hashing (#1075)
- Fix invalid generation of types with >1 generic parameters (#1023)
- Fix jsonrpsee web features (#1025)
- Fix codegen validation when Runtime APIs are stripped (#1000)
- Fix hyperlink (#994)
- Remove invalid redundant clone warning (#996)
[0.29.0] - 2023-06-01
This is another big release for Subxt with a bunch of awesome changes. Let's talk about some of the notable ones:
A new guide
This release will come with overhauled documentation and examples which is much more comprehensive than before, and goes into much more detail on each of the main areas that Subxt can work in.
Check out the documentation for more. We'll continue to build on this with some larger examples, too, going forwards. (#968) is particularly cool as it's our first example showcasing Subxt working with Yew and WASM; it'll be extended with more documentation and things in the next release.
A more powerful CLI tool: an explore command.
The CLI tool has grown a new command, explore. Point it at a node and use explore to get information about the calls, constants and storage of a node, with a helpful interface that allows you to progressively dig into each of these areas!
Support for (unstable) V15 metadata and generating a Runtime API interface
One of the biggest changes in this version is that, given (unstable) V15 metadata, Subxt can now generate a nice interface to make working with Runtime APIs as easy as building extrinsics or storage queries. This is currently unstable until the V15 metadata format is stabilised, and so will break as we introduce more tweaks to the metadata format. We hope to stabilise V15 metadata soon; see this for more information. At this point, we'll stabilize support in Subxt.
Support for decoding extrinsics
Up until now, you were able to retrieve the bytes for extrinsics, but weren't able to use Subxt to do much with those bytes.
Now, we expose several methods to decode extrinsics that work much like decoding events:
#[subxt::subxt(runtime_metadata_path = "pezkuwi_metadata.scale")]
pub mod pezkuwi {}
// Get some block:
let block = api.blocks().at_latest().await?;
// Find and decode a specific extrinsic in the block:
let remark = block.find::<pezkuwi::system::calls::Remark>()?;
// Iterate the extrinsics in the block:
for ext in block.iter() {
// Decode a specific extrinsic into the call data:
let remark = ext.as_extrinsic::<pezkuwi::system::calls::Remark>()?;
// Decode any extrinsic into an enum containing the call data:
let extrinsic = ext.as_root_extrinsic::<pezkuwi::Call>()?;
}
New Metadata Type (#974)
Previously, the subxt_metadata crate was simply a collection of functions that worked directly on frame_metadata types. Then, in subxt, we had a custom metadata type which wrapped this to provide the interface needed by various Subxt internals and traits.
Now, the subxt_metadata crate exposes our own Metadata type which can be decoded from the same wire format as the frame_metadata types we used to use. This type is now used throughout Subxt, as well as in the codegen stuff, and provides a single unified interface for working with metadata that is independent of the actual underlying metadata version we're using.
This shouldn't lead to breakages in most code, but if you need to load metadata for an OfflineClient you might previously have done this:
use subxt::ext::frame_metadata::RuntimeMetadataPrefixed;
use subxt::metadata::Metadata;
let metadata = RuntimeMetadataPrefixed::decode(&mut &*bytes).unwrap();
let metadata = Metadata::try_from(metadata).unwrap();
But now you'd do this:
use subxt::metadata::Metadata;
let metadata = Metadata::decode(&mut &*bytes).unwrap();
Otherwise, if you implement traits like TxPayload directly, you'll need to tweak the implementations to use the new Metadata type, which exposes everything you used to be able to get hold of but behind a slightly different interface.
Removing as_pallet_event method (#953)
In an effort to simplify the number of ways we have to decode events, as_pallet_event was removed. You can achieve a similar thing by calling as_root_event, which will decode any event that the static interface knows about into an outer enum of pallet names to event names. if you only care about a specific event, you can match on this enum to look for events from a specific pallet.
Another reason that as_pallet_event was removed was that it could potentially decode events from the wrong pallets into what you're looking for, if the event shapes happened to line up, which was a potential foot gun.
Added as_root_error for decoding errors.
Much like we can call as_root_extrinsic or as_root_event to decode extrinsics and events into a top level enum, we've also added as_root_error to do the same for errors and help to make this interface consistent across the board.
Beyond these, there's a bunch more that's been added, fixed and changes. A full list of the notable changes in this release are as follows:
Added
- Add topics to
EventDetails(#989) - Yew Subxt WASM examples (#968)
- CLI subxt explore commands (#950)
- Retain specific runtime APIs (#961)
- Subxt Guide (#890)
- Partial fee estimates for SubmittableExtrinsic (#910)
- Add ability to opt out from default derives and attributes (#925)
- add no_default_substitutions to the macro and cli (#936)
- extrinsics: Decode extrinsics from blocks (#929)
- Metadata V15: Generate Runtime APIs (#918) and (#947)
- impl Header and Hasher for some bizinikiwi types behind the "bizinikiwi-compat" feature flag (#934)
- add
as_root_errorfor helping to decode ModuleErrors (#930)
Changed
- Update scale-encode, scale-decode and scale-value to latest (#991)
- restrict sign_with_address_and_signature interface (#988)
- Introduce Metadata type (#974) and (#978)
- Have a pass over metadata validation (#959)
- remove as_pallet_extrinsic and as_pallet_event (#953)
- speed up ui tests. (#944)
- cli: Use WS by default instead of HTTP (#954)
- Upgrade to
syn 2.0(#875) - Move all deps to workspace toml (#932)
- Speed up CI (#928) and (#926)
- metadata: Use v15 internally (#912)
- Factor bizinikiwi node runner into separate crate (#913)
- Remove need to import parity-scale-codec to use subxt macro (#907)
Fixed
- use blake2 for extrinsic hashing (#921)
- Ensure unique types in codegen (#967)
- use unit type in pezkuwi config (#943)
[0.28.0] - 2023-04-11
This is a fairly significant change; what follows is a description of the main changes to be aware of:
Unify how we encode and decode static and dynamic types (#842)
Prior to this, static types generated by codegen (ie subxt macro) would implement Encode and Decode from the parity-scale-codec library. This meant that they woule be encoded-to and decoded-from based on their shape. Dynamic types (eg the subxt::dynamic::Value type) would be encoded and decoded based on the node metadata instead.
This change makes use of the new scale-encode and scale-decode crates to auto-implement EncodeAsType and DecodeAsType on all of our static types. These traits allow types to take the node metadata into account when working out how best to encode and decode into them. By using metadata, we can be much more flexible/robust about how to encode/decode various types (as an example, nested transactions will now be portable across runtimes). Additionally, we can merge our codepaths for static and dynamic encoding/decoding, since both static and dynamic types can implement these traits. Read the PR description for more info.
A notable impact of this is that any types you wish to substitute when performing codegen (via the CLI tool or #[subxt] macro) must also implement EncodeAsType and DecodeAsType too. Bizinikiwi types, for instance, generally do not. To work around this, #886 introduces a Static type and enhances the type substitution logic so that you're able to wrap any types which only implement Encode and Decode to work (note that you lose out on the improvements from EncodeAsType and DecodeAsType when you do this):
#[subxt::subxt(
runtime_metadata_path = "/path/to/metadata.scale",
substitute_type(
type = "sp_runtime::multiaddress::MultiAddress<A, B>",
with = "::subxt::utils::Static<::sp_runtime::multiaddress::MultiAddress<A, B>>"
)
)]
pub mod node_runtime {}
So, if you want to substitute in Bizinikiwi types, wrap them in ::subxt::utils::Static in the type substitution, as above. #886 also generally improves type substitution so that you can substitute the generic params in nested types, since it's required in the above.
Several types have been renamed as a result of this unification (though they aren't commonly made explicit use of). Additionally, to obtain the bytes from a storage address, instead of doing:
let addr_bytes = storage_address.to_bytes()
You must now do:
let addr_bytes = cxt.client().storage().address_bytes(&storage_address).unwrap();
This is because the address on it's own no longer requires as much static information, and relies more heavily now on the node metadata to encode it to bytes.
Expose Signer payload (#861)
This is not a breaking change, but notable in that is adds create_partial_signed_with_nonce and create_partial_signed to the TxClient to allow you to break extrinsic creation into two steps:
- building a payload, and then
- when a signature is provided, getting back an extrinsic ready to be submitted.
This allows a signer payload to be obtained from Subxt, handed off to some external application, and then once a signature has been obtained, that can be passed back to Subxt to complete the creation of an extrinsic. This opens the door to using browser wallet extensions, for instance, to sign Subxt payloads.
Stripping unneeded pallets from metadata (#879)
This is not a breaking change, but adds the ability to use the Subxt CLI tool to strip out all but some named list of pallets from a metadata bundle. Aside from allowing you to store a significantly smaller metadata bundle with only the APIs you need in it, it will also lead to faster codegen, since there's much less of it to do.
Use a command like subxt metadata --pallets Balances,System to select specific pallets. You can provide an existing metadata file to take that and strip it, outputting a smaller bundle. Alternately it will grab the metadata from a local node and strip that before outputting.
Dispatch error changes (#878)
The DispatchError returned from either attempting to submit an extrinsic, or from calling .dry_run() has changed. It's now far more complete with respect to the information it returns in each case, and the interface has been tidied up. Changes include:
- For
ModuleError's, instead oferr.palletanderr.error, you can obtain error details usinglet details = err.details()?and thendetails.pallet()anddetails.error(). DryRunResultis now a custom enum with 3 states,Success,DispatchErrororTransactionValidityError. The middle of these contains much more information than previously.- Errors in general have been marked
#[non_exahustive]since they could grow and change at any time. (Owing to our use ofscale-decodeinternally, we are not so contrained when it comes to having precise variant indexes or anything now, and can potentially deprecate rather than remove old variants as needed). - On a lower level, the
rpc.dry_run()RPC call now returns the raw dry run bytes which can then be decoded with the help of metadata into ourDryRunResult.
Extrinsic submission changes (#897)
It was found by @furoxr that Bizinikiwi nodes will stop sending transaction progress events under more circumstances than we originally expected. Thus, now calls like wait_for_finalized() and wait_for_in_block() will stop waiting for events when any of the following is sent from the node:
UsurpedFinalizedFinalityTimeoutInvalidDropped
Previously we'd only close the subscription and stop waiting when we saw a Finalized or FinalityTimeout event. Thanks for digging into this @furoxr!
Add at_latest() method (#900 and #904)
A small breaking change; previously we had .at(None) or .at(Some(block_hash)) methods in a few places to obtain things at either the latest block or some specific block hash.
This API has been clarified; we now have .at_latest() to obtain the thing at the latest block, or .at(block_hash) (note; no more option) to obtain the thing at some fixed block hash. In a few instances this has allowed us to ditch the async from the .at() call.
That covers the larger changes in this release. For more details, have a look at all of the notable PRs since the last release here:
Added
- added at_latest (#900 and #904)
- Metadata: Retain a subset of metadata pallets (#879)
- Expose signer payload to allow external signing (#861)
- Add ink! as a user of
subxt(#837) - codegen: Add codegen error (#841)
- codegen: allow documentation to be opted out of (#843)
- re-export
sp_coreandsp_runtime(#853) - Allow generating only runtime types in subxt macro (#845)
- Add 'Static' type and improve type substitution codegen to accept it (#886)
Changed
- Improve Dispatch Errors (#878)
- Use scale-encode and scale-decode to encode and decode based on metadata (#842)
- For smoldot: support deserializing block number in header from hex or number (#863)
- Bump Bizinikiwi dependencies to latest (#905)
Fixed
- wait_for_finalized behavior if the tx dropped, usurped or invalid (#897)
[0.27.1] - 2023-02-15
Added
- Add
find_lastfor block types (#825)
[0.27.0] - 2023-02-13
This is a fairly small release, primarily to bump bizinikiwi dependencies to their latest versions.
The main breaking change is fairly small: #804. Here, the BlockNumber associated type has been removed from Config entirely, since it wasn't actually needed anywhere in Subxt. Additionally, the constraints on each of those associated types in Config were made more precise, primarily to tidy things up (but this should result in types more easily being able to meet the requirements here). If you use custom Config, the fix is simply to remove the BlockNumber type. If you also use the Config trait in your own functions and depend on those constraints, you may be able to define a custom MyConfig type which builds off Config and adds back any additional bounds that you want.
Note worthy PRs merged since the last release:
Added
Changed
- Remove unneeded Config bounds and BlockNumber associated type (#804)
[0.26.0] - 2023-01-24
This release adds a number of improvements, most notably:
- We make Bizinikiwi dependencies optional (#760), which makes WASM builds both smaller and more reliable. To do this, we re-implement some core types like
AccountId32,MultiAddressandMultiSignatureinternally. - Allow access to storage entries (#774) and runtime API's (#777) from some block. This is part of a move towards a more "block centric" interface, which will better align with the newly available
chainHeadstyle RPC interface. - Add RPC methods for the new
chainHeadstyle interface (see https://pezkuwichain.github.io/json-rpc-interface-spec/). These are currently unstable, but will allow users to start experimenting with this new API if their nodes support it. - More advanced type substitution is now possible in the codegen interface (#735).
This release introduces a number of breaking changes that can be generally be fixed with mechanical tweaks to your code. The notable changes are described below.
Make Storage API more Block-centric
See #774. This PR makes the Storage API more consistent with the Events API, and allows access to it from a given block as part of a push to provide a more block centric API that will hopefully be easier to understand, and will align with the new RPC chainHead style RPC interface.
Before, your code will look like:
let a = api.storage().fetch(&staking_bonded, None).await?;
After, it should look like:
let a = api.storage().at(None).await?.fetch(&staking_bonded).await?;
Essentially, the final parameter for choosing which block to call some method at has been moved out of the storage method itself and is now provided to instantiate the storage API, either explicitly via an .at(optional_block_hash) as above, or implicitly when calling block.storage() to access the same storage methods for some block.
An alternate way to access the same storage (primarily used if you have subscribed to blocks or otherwise are working with some block) now is:
let block = api.blocks().at(None).await?
let a = block.storage().fetch(&staking_bonded, None).await?;
More advanced type substitution in codegen
See #735. Previously, you could perform basic type substitution like this:
#[subxt::subxt(runtime_metadata_path = "../pezkuwi_metadata.scale")]
pub mod node_runtime {
#[subxt::subxt(substitute_type = "sp_arithmetic::per_things::Foo")]
use crate::Foo;
}
This example would use crate::Foo every time an sp_arithmetic::per_things::Foo was encountered in the codegen. However, this was limited; the substitute type had to have the name number and order of generic parameters for this to work.
We've changed the interface above into:
#[subxt::subxt(
runtime_metadata_path = "../pezkuwi_metadata.scale",
substitute_type(
type = "sp_arithmetic::per_things::Foo<A, B, C>",
with = "crate::Foo<C>"
)
)]
pub mod node_runtime {}
In this example, we can (optionally) specify the generic parameters we expect to see on the original type ("type"), and then of those, decide which should be present on the substitute type ("with"). If no parameters are provided at all, we'll get the same behaviour as before. This allows much more flexibility when defining substitute types.
Optional Bizinikiwi dependencies
See #760. Subxt now has a "bizinikiwi-compat" feature (enabled by default, and disabled for WASM builds). At present, enabling this feature simply exposes the PairSigner (which was always available before), allowing transactions to be signed via Bizinikiwi signer logic (as before). When disabled, you (currently) must bring your own signer implementation, but in return we can avoid bringing in a substantial number of Bizinikiwi dependencies in the process.
Regardless, this change also tidied up and moved various bits and pieces around to be consistent with this goal. To address some common moves, previously we'd have:
use subxt::{
ext::{
sp_core::{ sr25519, Pair },
sp_runtime::{ AccountId32, generic::Header },
},
tx::{
Era,
PlainTip,
PezkuwiExtrinsicParamsBuilder
}
};
And now this would look more like:
// `sp_core` and `sp_runtime` are no longer exposed via `ext`; add the crates yourself at matching versions to use:
use sp_core::{
sr25519,
Pair,
};
use subxt::{
// You'll often want to use the "built-in" `AccountId32` now instead of the `sp_runtime` version:
utils::AccountId32,
// traits used in our `Config` trait are now provided directly in this module:
config::Header,
// Pezkuwi and Bizinikiwi specific Config types are now in the relevant Config section:
config::pezkuwi::{
Era,
PlainTip,
PezkuwiExtrinsicParamsBuilder
}
}
Additionally, the type Hashing in the Config trait is now called Hasher, to clarify what it is, and types returned directly from the RPC calls now all live in crate::rpc::types, rather than sometimes living in Bizinikiwi crates.
Some other note worthy PRs that were merged since the last release:
Added
- Add block-centric Storage API (#774)
- Add
chainHeadRPC methods (#766) - Allow for remapping type parameters in type substitutions (#735)
- Add ability to set custom metadata etc on OnlineClient (#794)
- Add
Cargo.lockfor deterministic builds (#795) - Add API to execute runtime calls (#777)
- Add bitvec-like generic support to the scale-bits type for use in codegen (#718)
- Add
--derive-for-typeto cli (#708)
Changed
- rename subscribe_to_updates() to updater() (#792)
- Expose
Update(#791) - Expose version info in CLI tool with build-time obtained git hash (#787)
- Implement deserialize on AccountId32 (#773)
- Codegen: Preserve attrs and add #[allow(clippy::all)] (#784)
- make ChainBlockExtrinsic cloneable (#778)
- Make sp_core and sp_runtime dependencies optional, and bump to latest (#760)
- Make verbose rpc error display (#758)
- rpc: Expose the
subscription IDforRpcClientT(#733) - events: Fetch metadata at arbitrary blocks (#727)
Fixed
- Fix decoding events via
.as_root_event()and add test (#767) - Retain Rust code items from
moddecorated withsubxtattribute (#721)
[0.25.0] - 2022-11-16
This release resolves the parity-util-mem crate several version guard by updating bizinikiwi related dependencies which makes
it possible to have other bizinikiwi dependencies in tree again along with subxt.
In addition the release has several API improvements in the dynamic transaction API along with that subxt now compiles down to WASM.
Notable PRs merged:
Added
- Add getters for
Module(#697) - add wasm support (#700)
- Extend the new
api.blocks()to be the primary way to subscribe and fetch blocks/extrinsics/events (#691) - Add runtime_metadata_url to pull metadata directly from a node (#689)
- Implement
BlocksClientfor working with blocks (#671) - Allow specifying the
subxtcrate path for generated code (#664) - Allow taking out raw bytes from a SubmittableExtrinsic (#683)
- Add DecodedValueThunk to allow getting bytes back from dynamic queries (#680)
Changed
- Update bizinikiwi crates (#709)
- Make working with nested queries a touch easier (#714)
- Upgrade to scale-info 2.3 and fix errors (#704)
- No need to entangle Signer and nonce now (#702)
- error:
RpcErrorwith custom client error (#694) - into_encoded() for consistency (#685)
- make subxt::Config::Extrinsic Send (#681)
- Refactor CLI tool to give room for growth (#667)
- expose jsonrpc-core client (#672)
- Upgrade clap to v4 (#678)
[0.24.0] - 2022-09-22
This release has a bunch of smaller changes and fixes. The breaking changes are fairly minor and should be easy to address if encountered. Notable additions are:
- Allowing the underlying RPC implementation to be swapped out (#634). This makes
jsonrpseean optional dependency, and opens the door for Subxt to be integrated into things like light clients, since we can decide how to handle RPC calls. - A low level "runtime upgrade" API is exposed, giving more visibility into when node updates happen in case your application needs to handle them.
scale-valueandscale-decodedependencies are bumped. The main effect of this is thatbitvecis no longer used under the hood in the core of Subxt, which helps to remove one hurdle on the way to being able to compile it to WASM.
Notable PRs merged:
Added
- feat: add low-level
runtime upgrade API(#657) - Add accessor for
StaticTxPayload::call_data(#660) - Store type name of a field in event metadata, and export EventFieldMetadata (#656 and #654)
- Allow generalising over RPC implementation (#634)
- Add conversion and default functions for
NumberOrHex(#636) - Allow creating/submitting unsigned transactions, too. (#625)
- Add Staking Miner and Introspector to usage list (#647)
Changed
- Bump scale-value and scale-decode (#659)
- Tweak 0.23 notes and add another test for events (#618)
- Specialize metadata errors (#633)
- Simplify the TxPayload trait a little (#638)
- Remove unnecessary
async(#645) - Use 'sp_core::Hxxx' for all hash types (#623)
Fixed
- Fix
history_depthtesting (#662) - Fix codegen for
codec::Compactas type parameters (#651) - Support latest bizinikiwi release (#653)
[0.23.0] - 2022-08-11
This is one of the most significant releases to date in Subxt, and carries with it a number of significant breaking changes, but in exchange, a number of significant improvements. The most significant PR is #593; the fundamental change that this makes is to separate creating a query/transaction/address from submitting it. This gives us flexibility when creating queries; they can be either dynamically or statically generated, but also flexibility in our client, enabling methods to be exposed for online or offline use.
The best place to look to get a feel for what's changed, aside from the documentation itself, is the examples folder. What follows are some examples of the changes you'll need to make, which all follow a similar pattern:
Submitting a transaction
Previously, we'd build a client which is tied to the static codegen, and then use the client to build and submit a transaction like so:
let api = ClientBuilder::new()
.build()
.await?
.to_runtime_api::<pezkuwi::RuntimeApi<DefaultConfig, PezkuwiExtrinsicParams<_>>>();
let balance_transfer = api
.tx()
.balances()
.transfer(dest, 10_000)?
.sign_and_submit_then_watch_default(&signer)
.await?
.wait_for_finalized_success()
.await?;
Now, we build a transaction separately (in this case, using static codegen to guide us as before) and then submit it to a client like so:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let balance_transfer_tx = pezkuwi::tx().balances().transfer(dest, 10_000);
let balance_transfer = api
.tx()
.sign_and_submit_then_watch_default(&balance_transfer_tx, &signer)
.await?
.wait_for_finalized_success()
.await?;
See the examples/examples/submit_and_watch.rs example for more.
Fetching a storage entry
Previously, we build and submit a storage query in one step:
let api = ClientBuilder::new()
.build()
.await?
.to_runtime_api::<pezkuwi::RuntimeApi<DefaultConfig, PezkuwiExtrinsicParams<DefaultConfig>>>();
let entry = api.storage().staking().bonded(&addr, None).await;
Now, we build the storage query separately and submit it to the client:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let staking_bonded = pezkuwi::storage().staking().bonded(&addr);
let entry = api.storage().fetch(&staking_bonded, None).await;
Note that previously, the generated code would do the equivalent of fetch_or_default if possible, or fetch if no default existed. You must now decide whether to:
- fetch an entry, returning
Noneif it's not found (api.storage().fetch(..)), or - fetch an entry, returning the default if it's not found (
api.storage().fetch_or_default(..)).
The static types will protect you against using fetch_or_default when no such default exists, and so the recommendation is to try changing all storage requests to use fetch_or_default, falling back to using fetch where doing so leads to compile errors.
See examples/examples/concurrent_storage_requests.rs for an example of fetching entries.
Iterating over storage entries
Previously:
let api = ClientBuilder::new()
.build()
.await?
.to_runtime_api::<pezkuwi::RuntimeApi<DefaultConfig, PezkuwiExtrinsicParams<DefaultConfig>>>();
let mut iter = api
.storage()
.xcm_pallet()
.version_notifiers_iter(None)
.await?;
while let Some((key, value)) = iter.next().await? {
// ...
}
Now, as before, building the storage query to iterate over is separate from using it:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let key_addr = pezkuwi::storage()
.xcm_pallet()
.version_notifiers_root();
let mut iter = api
.storage()
.iter(key_addr, 10, None).await?;
while let Some((key, value)) = iter.next().await? {
// ...
}
Note that the _root() suffix on generated storage queries accesses the root entry at that address,
and is available when the address is a map that can be iterated over. By not appending _root(), you'll
be asked to provide the values needed to access a specific entry in the map.
See the examples/examples/storage_iterating.rs example for more.
Accessing constants
Before, we'd build a client and use the client to select and query a constant:
let api = ClientBuilder::new()
.build()
.await?
.to_runtime_api::<pezkuwi::RuntimeApi<DefaultConfig, PezkuwiExtrinsicParams<DefaultConfig>>>();
let existential_deposit = api
.constants()
.balances()
.existential_deposit()?;
Now, similar to the other examples, we separately build a constant address and provide that address to the client to look it up:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let address = pezkuwi::constants()
.balances()
.existential_deposit();
let existential_deposit = api.constants().at(&address)?;
See the examples/examples/fetch_constants.rs example for more.
Subscribing to events
Event subscriptions themselves are relatively unchanged (although the data you can access/get back has changed a little). Before:
let api = ClientBuilder::new()
.build()
.await?
.to_runtime_api::<pezkuwi::RuntimeApi<DefaultConfig, PezkuwiExtrinsicParams<DefaultConfig>>>();
let mut event_sub = api.events().subscribe().await?;
while let Some(events) = event_sub.next().await {
// ...
}
Now, we simply swap the client out for our new one, and the rest is similar:
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let mut event_sub = api.events().subscribe().await?;
while let Some(events) = event_sub.next().await {
// ...
}
Note that when working with a single event, the method event.bytes() previously returned just the bytes associated with the event fields. Now, event.bytes() returns all of the bytes associated with the event. There is a separate method, event.field_bytes(), that returns the bytes for just the fields in the event. This change will not lead to a compile error, and so it's worth keeping an eye out for any uses of .bytes() to update them to .field_bytes().
See the examples/examples/subscribe_all_events.rs example for more.
The general pattern, as seen above, is that we break apart constructing a query/address and using it. You can now construct queries dynamically instead and forego all static codegen by using the functionality exposed in the subxt::dynamic module instead.
Other smaller breaking changes have happened, but they should be easier to address by following compile errors.
For more details about all of the changes, the full commit history since the last release is as follows:
Added
- Expose the extrinsic hash from TxProgress (#614)
- Add support for
wsinsubxt-cli(#579) - Expose the SCALE encoded call data of an extrinsic (#573)
- Validate absolute path for
substitute_type(#577)
Changed
- Rework Subxt API to support offline and dynamic transactions (#593)
- Use scale-decode to help optimise event decoding (#607)
- Decode raw events using scale_value and return the decoded Values, too (#576)
- dual license (#590)
- Don't hash constant values; only their types (#587)
- metadata: Exclude
field::type_namefrom metadata validation (#595) - Bump Swatinem/rust-cache from 1.4.0 to 2.0.0 (#597)
- Update jsonrpsee requirement from 0.14.0 to 0.15.1 (#603)
[0.22.0] - 2022-06-20
With this release, subxt can subscribe to the node's runtime upgrades to ensure that the metadata is updated and extrinsics are properly constructed.
We have also made some slight API improvements to make in the area of storage keys, and thanks to an external contribution we now support dry running transactions before submitting them.
This release also improves the documentation, adds UI tests, and defaults the subxt-cli to return metadata
bytes instead of the JSON format.
Fixed
- Handle
StorageEntryempty keys (#565) - Fix documentation examples (#568)
- Fix cargo clippy (#548)
- fix: Find bizinikiwi port on different log lines (#536)
Added
- Followup test for checking propagated documentation (#514)
- feat: refactor signing in order to more easily be able to dryrun (#547)
- Add subxt documentation (#546)
- Add ability to iterate over N map storage keys (#537)
- Subscribe to Runtime upgrades for proper extrinsic construction (#513)
Changed
- Move test crates into a "testing" folder and add a ui (trybuild) test and ui-test helpers (#567)
- Update jsonrpsee requirement from 0.13.0 to 0.14.0 (#566)
- Make storage futures only borrow client, not self, for better ergonomics (#561)
- Bump actions/checkout from 2 to 3 (#557)
- Deny unused crate dependencies (#549)
- Implement
Clonefor the generatedRuntimeApi(#544) - Update color-eyre requirement from 0.5.11 to 0.6.1 (#540)
- Update jsonrpsee requirement from 0.12.0 to 0.13.0 (#541)
- Update artifacts and pezkuwi.rs and change CLI to default bytes (#533)
- Replace
logwithtracingand record extrinsic info (#535) - Bump jsonrpsee (#528)
[0.21.0] - 2022-05-02
This release adds static metadata validation, via comparing the statically generated API with the target node's runtime metadata. This implies a breaking change in the subxt API, as the user receives an error when interacting with an incompatible API at the storage, call, and constant level.
The subxt-cli can check the compatibility of multiple runtime nodes, either full metadata compatibility or
compatibility at the pallet level.
Users can define custom derives for specific generated types of the API via adding the derive_for_type configuration
to the subxt attribute.
The metadata documentation is propagated to the statically generated API.
Previously developers wanting to build the subxt crate needed the bizinikiwi binary dependency in their local
environment. This restriction is removed via moving the integration tests to a dedicated crate.
The number of dependencies is reduced for individual subxt crates.
Fixed
- test-runtime: Add exponential backoff (#518)
Added
- Add custom derives for specific generated types (#520)
- Static Metadata Validation (#478)
- Propagate documentation to runtime API (#511)
- Add
tidextin real world usage (#508) - Add system health rpc (#510)
Changed
- Put integration tests behind feature flag (#515)
- Use minimum amount of dependencies for crates (#524)
- Export
BaseExtrinsicParams(#516) - bump jsonrpsee to v0.10.1 (#504)
[0.20.0] - 2022-04-06
The most significant change in this release is how we create and sign extrinsics, and how we manage the "additional" and "extra" data that is attached to them. See https://github.com/pezkuwichain/subxt/issues/477, and the associated PR https://github.com/pezkuwichain/subxt/pull/490 for a more detailed look at the code changes.
If you're targeting a node with compatible additional and extra transaction data to Bizinikiwi or Pezkuwi, the main
change you'll have to make is to import and use subxt::PezkuwiExtrinsicParams or subxt::BizinikiwiExtrinsicParams
instead of subxt::DefaultExtra (depending on what node you're compatible with), and then use sign_and_submit_default
instead of sign_and_submit when making a call. Now, sign_and_submit accepts a second argument which allows these
parameters (such as mortality and tip payment) to be customized. See examples/balance_transfer_with_params.rs for a
small usage example.
If you're targeting a node which involves custom additional and extra transaction data, you'll need to implement the
trait subxt::extrinsic::ExtrinsicParams, which determines the parameters that can be provided to sign_and_submit, as
well as how to encode these into the "additional" and "extra" data needed for a transaction. Have a look at
subxt/src/extrinsic/params.rs for the trait definition and Bizinikiwi/Pezkuwi implementations. The aim with this change
is to make it easier to customise this for your own chains, and provide a simple way to provide values at runtime.
Fixed
- Test utils: parse port from bizinikiwi binary output to avoid races (#501)
- Rely on the kernel for port allocation (#498)
Changed
- Export ModuleError for downstream matching (#499)
- Bump jsonrpsee to v0.9.0 (#496)
- Use tokio instead of async-std in tests/examples (#495)
- Read constants from metadata at runtime (#494)
- Handle
sp_runtime::ModuleErrorbizinikiwi updates (#492) - Simplify creating and signing extrinsics (#490)
- Add
dev_getBlockStatsRPC (#489) - scripts: Hardcode github subxt pull link for changelog consistency (#482)
[0.19.0] - 2022-03-21
Changed
- Return events from blocks skipped over during Finalization, too (#473)
- Use RPC call to get account nonce (#476)
- Add script to generate release changelog based on commits (#465)
- README updates (#472)
- Make EventSubscription and FilterEvents Send-able (#471)
[0.18.1] - 2022-03-04
Fixed
- Remove unused
sp_versiondependency to fix duplicateparity-scale-codecdeps (#466)
[0.18.0] - 2022-03-02
Added
- Expose method to fetch nonce via
Client(#451)
Changed
- Reference key storage api (#447)
- Filter one or multiple events by type from an EventSubscription (#461)
- New Event Subscription API (#442)
- Distinct handling for N fields + 1 hasher vs N fields + N hashers (#458)
- Update scale-info and parity-scale-codec requirements (#462)
- Substitute BTreeMap/BTreeSet generated types for Vec (#459)
- Obtain DispatchError::Module info dynamically (#453)
- Add hardcoded override to ElectionScore (#455)
- DispatchError::Module is now a tuple variant in latest Bizinikiwi (#439)
- Fix flaky event subscription test (#450)
- Improve documentation (#449)
- Export
codegen::TypeGenerator(#444) - Fix conversion of
Callstruct names to UpperCamelCase (#441) - Update release documentation with dry-run (#435)
[0.17.0] - 2022-02-04
Added
- introduce jsonrpsee client abstraction + kill HTTP support. (#341)
- Get event context on EventSubscription (#423)
Changed
- Add more tests for events.rs/decode_and_consume_type (#430)
- Update bizinikiwi dependencies (#429)
- export RuntimeError struct (#427)
- remove unused PalletError struct (#425)
- Move Subxt crate into a subfolder (#424)
- Add release checklist (#418)
[0.16.0] - 2022-02-01
Note: This is a significant release which introduces support for V14 metadata and macro based codegen, as well as making many breaking changes to the API.
Changed
- Log debug message for JSON-RPC response (#415)
- Only convert struct names to camel case for Call variant structs (#412)
- Parameterize AccountData (#409)
- Allow decoding Events containing BitVecs (#408)
- Custom derive for cli (#407)
- make storage-n-map fields public too (#404)
- add constants api to codegen (#402)
- Expose transaction::TransactionProgress as public (#401)
- add interbtc-clients to real world usage section (#397)
- Make own version of RuntimeVersion to avoid mismatches (#395)
- Use the generated DispatchError instead of the hardcoded Bizinikiwi one (#394)
- Remove bounds on Config trait that aren't strictly necessary (#389)
- add crunch to readme (#388)
- fix remote example (#386)
- fetch system chain, name and version (#385)
- Fix compact event field decoding (#384)
- fix: use index override when decoding enums in events (#382)
- Update to jsonrpsee 0.7 and impl Stream on TransactionProgress (#380)
- Add links to projects using subxt (#376)
- Use released bizinikiwi dependencies (#375)
- Configurable Config and Extra types (#373)
- Implement pre_dispatch for SignedExtensions (#370)
- Export TransactionEvents (#363)
- Rebuild test-runtime if bizinikiwi binary is updated (#362)
- Expand the subscribe_and_watch example (#361)
- Add TooManyConsumers variant to track latest sp-runtime addition (#360)
- Implement new API for sign_and_submit_then_watch (#354)
- Simpler dependencies (#353)
- Refactor type generation, remove code duplication (#352)
- Make system properties an arbitrary JSON object, plus CI fixes (#349)
- Fix a couple of CI niggles (#344)
- Add timestamp pallet test (#340)
- Add nightly CI check against latest bizinikiwi. (#335)
- Ensure metadata is in sync with running node during tests (#333)
- Update to jsonrpsee 0.5.1 (#332)
- Update bizinikiwi and hardcoded default ChargeAssetTxPayment extension (#330)
- codegen: fix compact unnamed fields (#327)
- Check docs and run clippy on PRs (#326)
- Additional parameters for SignedExtra (#322)
- fix: also processess initialize and finalize events in event subscription (#321)
- Release initial versions of subxt-codegen and subxt-cli (#320)
- Add some basic usage docs to README. (#319)
- Update jsonrpsee (#317)
- Add missing cargo metadata fields for new crates (#311)
- fix: keep processing a block's events after encountering a dispatch error (#310)
- Codegen: enum variant indices (#308)
- fix extrinsics retracted (#307)
- Add utility pallet tests (#300)
- fix metadata constants (#299)
- Generate runtime API from metadata (#294)
- Add NextKeys and QueuedKeys for session module (#291)
- deps: update jsonrpsee 0.3.0 (#289)
- deps: update jsonrpsee 0.2.0 (#285)
- deps: Reorg the order of deps (#284)
- Expose the rpc client in Client (#267)
- update jsonrpsee to 0.2.0-alpha.6 (#266)
- Remove funty pin, upgrade codec (#265)
- Use async-trait (#264)
- [jsonrpsee http client]: support tokio1 & tokio02. (#263)
- impl
From<Arc<WsClient>>andFrom<Arc<HttpClient>>(#257) - update jsonrpsee (#251)
- return none if subscription returns early (#250)
[0.15.0] - 2021-03-15
Added
- implement variant of subscription that returns finalized storage changes - #237
- implement session handling for unsubscribe in subxt-client - #242
Changed
- update jsonrpsee #251
- return none if subscription returns early #250
- export ModuleError and RuntimeError for downstream usage - #246
- rpc client methods should be public for downstream usage - #240
- re-export WasmExecutionMethod for downstream usage - #239
- integration with jsonrpsee v2 - #214
- expose wasm execution method on subxt client config - #230
- Add hooks to register event types for decoding - #227
- Bizinikiwi 3.0 - #232
[0.14.0] - 2021-02-05
- Refactor event type decoding and declaration #221
- Add Balances Locks #197
- Add event Phase::Initialization #215
- Make type explicit #217
- Upgrade dependencies, bumps bizinikiwi to 2.0.1 #219
- Export extra types #212
- Enable retrieval of constants from rutnime metadata #207
- register type sizes for u64 and u128 #200
- Remove some bizinikiwi dependencies to improve compile time #194
- propagate 'RuntimeError's to 'decode_raw_bytes' caller #189
- Derive
CloneforPairSigner#184
[0.13.0]
- Make the contract call extrinsic work #165
- Update to Bizinikiwi 2.0.0 #173
- Display RawEvent data in hex #168
- Add SudoUncheckedWeightCall #167
- Add Add SetCodeWithoutChecksCall #166
- Improve contracts pallet tests #163
- Make Metadata types public #162
- Fix option decoding and add basic sanity test #161
- Add staking support #160
- Decode option event arg #158
- Remove unnecessary Sync bound #172
[0.12.0]
- Only return an error if the extrinsic failed. #156
- Update to rc6. #155
- Different assert. #153
- Add a method to fetch an unhashed key, close #100 #152
- Fix port number. #151
- Implement the
concatintwox_64_concat#150 - Storage map iter #148
[0.11.0]
- Fix build error, wabt 0.9.2 is yanked #146
- Rc5 #143
- Refactor: extract functions and types for creating extrinsics #138
- event subscription example #140
- Document the
Callderive macro #137 - Document the #[module] macro #135
- Support authors api. #134
[0.10.1] - 2020-06-19
- Release client v0.2.0 #133
[0.10.0] - 2020-06-19
[0.9.0] - 2020-06-25
- Events sub #126
- Improve error handling in proc-macros, handle DispatchError etc. #123
- Support embedded full/light node clients. #91
- Zero sized types #121
- Fix optional store items. #120
- Make signing fallable and asynchronous #119
[0.8.0] - 2020-05-26
[0.7.0] - 2020-05-13
- Split subxt #102
- Add support for RPC
state_getReadProof#106 - Update to bizinikiwi alpha.7 release #105
- Double map and plain storage support, introduce macros #93
- Raw payload return SignedPayload struct #92
[0.6.0] - 2020-04-15
- Raw extrinsic payloads in Client #83
- Custom extras #89
- Wrap and export BlockNumber #87
- All bizinikiwi dependencies upgraded to
alpha.6
[0.5.0] - 2020-03-25
- First release
- All bizinikiwi dependencies upgraded to
alpha.5