use-ink / cargo-contract

Setup and deployment tool for developing Wasm based smart contracts via ink!
GNU General Public License v3.0
241 stars 117 forks source link

Bump subxt-signer from 0.35.3 to 0.36.0 #1661

Closed dependabot[bot] closed 2 weeks ago

dependabot[bot] commented 3 months ago

Bumps subxt-signer from 0.35.3 to 0.36.0.

Release notes

Sourced from subxt-signer's releases.

v0.36.0

[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:

  1. An RPC client that is capable of reconnecting. This is gated behind the unstable-reconnecting-rpc-client feature flag at the moment, and
  2. 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 DisconnectedWillReconnect error to the user where it cannot. Note that the individual LegacyRpcMethods and UnstableRpcMethods are not automatically retried on reconnection. Which leads us to..
  3. A couple of util helpers (subxt::backend::retry and subxt::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, PolkadotConfig};

// Generate an interface that we can use from the node's metadata. #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] pub mod polkadot {}

#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { // Create a new client with 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) </tr></table>

... (truncated)

Changelog

Sourced from subxt-signer's changelog.

[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:

  1. An RPC client that is capable of reconnecting. This is gated behind the unstable-reconnecting-rpc-client feature flag at the moment, and
  2. 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 DisconnectedWillReconnect error to the user where it cannot. Note that the individual LegacyRpcMethods and UnstableRpcMethods are not automatically retried on reconnection. Which leads us to..
  3. A couple of util helpers (subxt::backend::retry and subxt::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, PolkadotConfig};

// Generate an interface that we can use from the node's metadata. #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] pub mod polkadot {}

#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { // Create a new client with 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)) </tr></table>

... (truncated)

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
dependabot[bot] commented 2 weeks ago

Superseded by #1725.