You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed with @dvdplm@jsdw and @insipx last week, we should aim to merge #294 as soon as possible in an incomplete state, then continue work on it on the master branch with smaller PRs to complete the remaining todos.
Here is an unordered and non-exhaustive list of the code todos (these can be promoted and fleshed out in separate issues as required). We need to further triage these to decide what we require before making a release.
Allow user to define default Extra implementation for additional signed data, or auto-generate from the metadata. At the moment this is hardcoded in the macro generated code.
Currently the AccountData storage type is hardcoded, which is required for fetching the nonce for constructing the Extra data for an Extrinsic. It assumes the presence of the system pallet and that the AccountData type has a nonce field. So we should consider whether this should be made configurable, or at least detect if the system pallet is not present with that Storage entry. Currently we are assuming it is always there (note: also true of DispatchError).
Revisit handling of compact type codegen, does it work in all cases, can it be improved?
Sudo pallet, can/should we handle calls in a non-strongly typed way, i.e allow opaque encoded calls? Strongly typed calls could fail if static metadata used to generated enums is different from runtime metadata of the node. 06a6ddf
[converted to issue] Add validation to check if static metadata used to generate API differs from the metadata fetched from the running node at runtime. (suggested by @dvdplm). We could configure how permissive to be here e.g. allow txs as long as the structure of the specific call is the same, but the runtime is a newer version (possibly because of another pallet having been updated). Static metadata validation #398
Documentation and Testing
Main README needs updating
More module level code docs
All public types and functions to be documented
Add more examples and tests for other FRAME pallets
Add more unit tests e.g. for codegen
Add documentation about distinction between usage of metadata at compile time to generate the API, and metadata at runtime used to construct extrinsic indices and decode events
More general refactoring and tidy up of codegen module.
Role of Client now? I removed lots of pass through rpc methods there, maybe it can be removed/refactored away.
There are some types copied from substrate lying around e.g. Phase and WrapperTypeOpaque. This is to avoid depending on big heavy crates just to use one or two types that are fairly static. These could be grouped together in their own files, so it is clear they have been copied. Further, we could possibly even test whether they are still compatible with the original types by using the scale-info metadata fetched from a running test node.
API improvements.
API construction
Currently relies on using some types generated by the macro to construct the runtime API, which is not very user friendly. How can we improve this?
let api = ClientBuilder::new().build().await?
.to_runtime_api::<polkadot::RuntimeApi<polkadot::DefaultConfig>>();// <-- using RuntimeApi and DefaultConfig from macro generated code
As discussed with @dvdplm @jsdw and @insipx last week, we should aim to merge #294 as soon as possible in an incomplete state, then continue work on it on the
masterbranch with smaller PRs to complete the remaining todos.Here is an unordered and non-exhaustive list of the code todos (these can be promoted and fleshed out in separate issues as required). We need to further triage these to decide what we require before making a release.
todos extracted from code:
Rustcode items from the decoratedmod. At the moment they will be erased. Possibly by implementingToTokensonItemMod. 6306b9f Retain Rust code items frommoddecorated withsubxtattribute #346Configruntime types as part of mod annotated withsubxtmacro.subxt/codegen/src/api/mod.rs
Line 227 in 5dd6cf9
Configruntime types as part of mod annotated withsubxtmacro #347Extraimplementation for additional signed data, or auto-generate from the metadata. At the moment this is hardcoded in the macro generated code.subxt/codegen/src/api/mod.rs
Line 245 in fc30e90
Extra#331AccountDatastorage type is hardcoded, which is required for fetching the nonce for constructing theExtradata for an Extrinsic. It assumes the presence of the system pallet and that theAccountDatatype has a nonce field. So we should consider whether this should be made configurable, or at least detect if thesystempallet is not present with thatStorageentry. Currently we are assuming it is always there (note: also true of DispatchError).subxt/codegen/src/api/mod.rs
Line 248 in 63bb5ea
frame_system::AccountData#348Boxtypesubxt/codegen/src/types/type_def.rs
Line 203 in 63641b4
Boxtypes scale-info#82PR feedback
Extracted to #419
Misc
Documentation and Testing
Refactoring and code cleanup
codegen/types/type_defandcodegen/struct_deffor generating composite types. Refactor duplication for generation of composite fields #328codegenmodule.Clientnow? I removed lots of pass throughrpcmethods there, maybe it can be removed/refactored away.PhaseandWrapperTypeOpaque. This is to avoid depending on big heavy crates just to use one or two types that are fairly static. These could be grouped together in their own files, so it is clear they have been copied. Further, we could possibly even test whether they are still compatible with the original types by using thescale-infometadata fetched from a running test node.API improvements.
API construction
Currently relies on using some types generated by the macro to construct the runtime API, which is not very user friendly. How can we improve this?