Skip to content

Prep to release v0.42.0 #2003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 12, 2025
Merged

Prep to release v0.42.0 #2003

merged 4 commits into from
May 12, 2025

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented May 9, 2025

[0.42.0] - 2025-05-09

The primary benefit of this release is introducing support for the about-to-be-stabilised-in-polkadot-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 PolkadotConfig/SubstrateConfig 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

  • Fix CLI storage diff (#1958)
  • chore: fix some typos (#1997)

@jsdw jsdw requested a review from a team as a code owner May 9, 2025 15:34
@jsdw jsdw requested a review from a team as a code owner May 9, 2025 16:41
@@ -253,6 +253,7 @@ jobs:
name: Check documentation and run doc tests
runs-on: parity-large
needs: [fmt, machete]
timeout-minutes: 30
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incase doc tests hang again!

@@ -40,7 +40,7 @@ pub use syn;
///
/// Generating an interface using all of the defaults:
///
/// ```rust
/// ```rust,standalone_crate
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc tests have been hanging in CI, and even locally, I think since I enabled Rust 2024. Rust 2024 changes how doc tests run and compiles them into a single binary ratehr than 1 per test.

Since many of our doc tests generate a load of code via the subxt macro, I suspect that this was eating up too much memory during compilation and causing the CI machine to hang (locally it went well over 4GB offhand).

Either way, adding standalone_crate to them all reverted to the previous behaviour which seems to work much better for us!

@jsdw jsdw merged commit 7de8d36 into master May 12, 2025
13 checks passed
@jsdw jsdw deleted the release-v0.42.0 branch May 12, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants