Skip to content

Conversation

@soul022
Copy link
Contributor

@soul022 soul022 commented Dec 3, 2025

Added a framework to test block decode for both historic and storage types blocks across multiple chains and their types file

command: test
args: --examples --workspace

decode-tester:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of running with every commit, let's aim to have the CI run only when the specific types files are changed (since I expect these tests will be fairly slow, and types hopefully won't change very often).

ie when polkadot_types.yaml changes, we just want to test that file and nothing else. Same for each other file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

To do this we could have a feature flag per file so that we only run the tests for a specific file when it changes, and then call something like cargo test -p frame-decode-tester --featrues kusama-assethub

BlockNotFound(u64),
}

impl fmt::Display for Error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use thiserror; avoids needing to manually impl these things :)

Comment on lines +22 to +24
use subxt::backend::legacy::LegacyRpcMethods;
use subxt::backend::legacy::rpc_methods::{Bytes, NumberOrHex};
use subxt::backend::rpc::RpcClient;
Copy link
Collaborator

@jsdw jsdw Dec 3, 2025

Choose a reason for hiding this comment

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

use subxt_rpcs directly; let's try and limit any dependency on Subxt.

(if you impl subxt_rpcs::RpcConfig you can probably avoid Subxt entirely; something I'd like to do for the historic decode tool, but that existed before subxt_rpcs was a thing so it's still depending too much on Subxt itself :))


let result: String = self
.client
.request("state_getMetadata", params)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use the already-typed RPC call for this too:

https://github.com/paritytech/subxt/blob/master/rpcs/src/methods/legacy.rs#L98


/// Builder for configuring block tests.
pub struct TestBlocksBuilder {
url: Option<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's ultimately support multiple URLs; each can become a client which is passed to the round robin client to help parallelise things.

@jsdw
Copy link
Collaborator

jsdw commented Dec 3, 2025

This looks like a good start to me! I left some comments, but I think it's on the right track!

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