Prep for v0.34.0 release (#1395)

* getting ready for a 0.34.0 release

* minor change

* fix typos

* bump substrate deps as well
This commit is contained in:
Tadeo Hepperle
2024-01-23 19:02:53 +01:00
committed by GitHub
parent 388ebac993
commit 0ea9c7ede6
6 changed files with 863 additions and 593 deletions
+126
View File
@@ -4,6 +4,132 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [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`](https://github.com/paritytech/scale-typegen) and adding type aliases ([#1249](https://github.com/paritytech/subxt/pull/1249))
We rewrote the code generation functionality of subxt and outsourced it to the new [`scale-typegen`](https://github.com/paritytech/scale-typegen) crate, which serves a more general purpose.
Since a lot of types used in substrate 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](https://github.com/paritytech/subxt/pull/1249)).
### Macro - Errors for misspecified type paths ([#1339](https://github.com/paritytech/subxt/pull/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.
```rust
#[subxt::subxt(
runtime_metadata_path = "metadata.scale",
derive_for_type(path = "Junctions", derive = "Clone")
)]
pub mod polkadot {}
```
This gives you a compile-time error like this:
```md
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](https://github.com/paritytech/subxt/pull/1379))
Previously adding derives on a type containing other types was also cumbersome, see this example:
```rust
#[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 polkadot {}
```
We introduced a `recursive` flag for custom derives and attributes that automatically inserts the specified derives on all child types:
```rust
#[subxt::subxt(
runtime_metadata_path = "metadata.scale",
derive_for_type(path = "xcm::v2::multilocation::MultiLocation", derive = "Clone", recursive),
)]
pub mod polkadot {}
```
### Subxt CLI - New features and usability improvements ([#1290](https://github.com/paritytech/subxt/pull/1290), [#1336](https://github.com/paritytech/subxt/pull/1336), and [#1379](https://github.com/paritytech/subxt/pull/1379))
Our CLI tool now allows you to explore runtime APIs and events ([#1290](https://github.com/paritytech/subxt/pull/1290)). We also fully integrated with [`scale-typegen-description`](https://github.com/paritytech/scale-typegen/tree/master/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:
```sh
# Show details about a runtime API call:
subxt explore --url wss://westend-rpc.polkadot.io api StakingAPI nominations_quota
# Execute a runtime API call from the CLI:
subxt explore --url wss://westend-rpc.polkadot.io api core version -e
# Discover what events a pallet can emit:
subxt explore --url wss://westend-rpc.polkadot.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](https://github.com/paritytech/subxt/pull/1336)).
This allows you to pipe in metadata from other processes like in this command chain:
```sh
parachain-node export-metadata | subxt codegen --file - | rustfmt > main.rs
```
Similar to the macro, the `subxt codegen` command can now also use `recursive` flags:
```sh
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](https://github.com/paritytech/subxt/pull/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](https://github.com/paritytech/subxt/pull/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](https://github.com/paritytech/subxt/pull/1339))
- CLI: Recursive derives and attributes ([#1379](https://github.com/paritytech/subxt/pull/1379))
- CLI: Explore runtime APIs and events, colorized outputs, scale-typegen integration for examples ([#1290](https://github.com/paritytech/subxt/pull/1290))
- Add chainflip to real world usage section of README ([#1351](https://github.com/paritytech/subxt/pull/1351))
- CLI: Allow using `--file -` to read metadata from stdin ([#1336](https://github.com/paritytech/subxt/pull/1336))
- Codegen: Generate type aliases for better API ergonomics ([#1249](https://github.com/paritytech/subxt/pull/1249))
### Changed
- Return Pending rather than loop around if no new finalized hash in submit_transaction ([#1378](https://github.com/paritytech/subxt/pull/1378))
- Return `ExtrinsicDetails` alongside decoded static extrinsics ([#1376](https://github.com/paritytech/subxt/pull/1376))
- Improve Signed Extension and Block Decoding Examples/Book ([#1357](https://github.com/paritytech/subxt/pull/1357))
- Use `scale-typegen` as a backend for the codegen ([#1260](https://github.com/paritytech/subxt/pull/1260))
- Using insecure connections is now opt-in ([#1309](https://github.com/paritytech/subxt/pull/1309))
### Fixed
- Ensure lightclient chainSpec is at least one block old ([#1372](https://github.com/paritytech/subxt/pull/1372))
- Typo fix in docs ([#1370](https://github.com/paritytech/subxt/pull/1370))
- Don't unpin blocks that may show up again ([#1368](https://github.com/paritytech/subxt/pull/1368))
- Runtime upgrades in unstable backend ([#1348](https://github.com/paritytech/subxt/pull/1348))
- Generate docs for feature gated items ([#1332](https://github.com/paritytech/subxt/pull/1332))
- Backend: Remove only finalized blocks from the event window ([#1356](https://github.com/paritytech/subxt/pull/1356))
- Runtime updates: wait until upgrade on chain ([#1321](https://github.com/paritytech/subxt/pull/1321))
- Cache extrinsic events ([#1327](https://github.com/paritytech/subxt/pull/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.
Generated
+274 -229
View File
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -12,7 +12,7 @@ members = [
"metadata",
"signer",
"subxt",
"scripts/artifacts"
"scripts/artifacts",
]
# We exclude any crates that would depend on non mutually
@@ -24,7 +24,7 @@ resolver = "2"
[workspace.package]
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
version = "0.33.0"
version = "0.34.0"
rust-version = "1.74.0"
license = "Apache-2.0 OR GPL-3.0"
repository = "https://github.com/paritytech/subxt"
@@ -119,18 +119,18 @@ instant = { version = "0.1.12", default-features = false }
tokio-util = "0.7.10"
# Substrate crates:
sp-core = { version = "26.0.0", default-features = false }
sp-core-hashing = { version = "13.0.0", default-features = false }
sp-runtime = "29.0.0"
sp-keyring = "29.0.0"
sp-core = { version = "28.0.0", default-features = false }
sp-core-hashing = { version = "15.0.0", default-features = false }
sp-runtime = "31.0.0"
sp-keyring = "31.0.0"
# Subxt workspace crates:
subxt = { version = "0.33.0", path = "subxt", default-features = false }
subxt-macro = { version = "0.33.0", path = "macro" }
subxt-metadata = { version = "0.33.0", path = "metadata" }
subxt-codegen = { version = "0.33.0", path = "codegen" }
subxt-signer = { version = "0.33.0", path = "signer" }
subxt-lightclient = { version = "0.33.0", path = "lightclient", default-features = false }
subxt = { version = "0.34.0", path = "subxt", default-features = false }
subxt-macro = { version = "0.34.0", path = "macro" }
subxt-metadata = { version = "0.34.0", path = "metadata" }
subxt-codegen = { version = "0.34.0", path = "codegen" }
subxt-signer = { version = "0.34.0", path = "signer" }
subxt-lightclient = { version = "0.34.0", path = "lightclient", default-features = false }
test-runtime = { path = "testing/test-runtime" }
substrate-runner = { path = "testing/substrate-runner" }
+6 -6
View File
@@ -2551,7 +2551,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "subxt"
version = "0.33.0"
version = "0.34.0"
dependencies = [
"async-trait",
"base58",
@@ -2585,7 +2585,7 @@ dependencies = [
[[package]]
name = "subxt-codegen"
version = "0.33.0"
version = "0.34.0"
dependencies = [
"frame-metadata 16.0.0",
"heck",
@@ -2604,7 +2604,7 @@ dependencies = [
[[package]]
name = "subxt-lightclient"
version = "0.33.0"
version = "0.34.0"
dependencies = [
"futures",
"futures-util",
@@ -2619,7 +2619,7 @@ dependencies = [
[[package]]
name = "subxt-macro"
version = "0.33.0"
version = "0.34.0"
dependencies = [
"darling 0.20.3",
"parity-scale-codec",
@@ -2632,7 +2632,7 @@ dependencies = [
[[package]]
name = "subxt-metadata"
version = "0.33.0"
version = "0.34.0"
dependencies = [
"frame-metadata 16.0.0",
"parity-scale-codec",
@@ -2643,7 +2643,7 @@ dependencies = [
[[package]]
name = "subxt-signer"
version = "0.33.0"
version = "0.34.0"
dependencies = [
"bip39",
"hex",
+445 -332
View File
File diff suppressed because it is too large Load Diff
-14
View File
@@ -1,14 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "artifacts"
version = "0.1.0"
dependencies = [
"substrate-runner",
]
[[package]]
name = "substrate-runner"
version = "0.33.0"