-
Notifications
You must be signed in to change notification settings - Fork 2
added frame decode tester framework and sample test case #72
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
base: main
Are you sure you want to change the base?
Conversation
| command: test | ||
| args: --examples --workspace | ||
|
|
||
| decode-tester: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 :)
| use subxt::backend::legacy::LegacyRpcMethods; | ||
| use subxt::backend::legacy::rpc_methods::{Bytes, NumberOrHex}; | ||
| use subxt::backend::rpc::RpcClient; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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.
|
This looks like a good start to me! I left some comments, but I think it's on the right track! |
Added a framework to test block decode for both historic and storage types blocks across multiple chains and their types file