-
Notifications
You must be signed in to change notification settings - Fork 14
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
Update to latest scale-codec & V13 type definitions + metadata #41
Conversation
Removal of this struct simplifies `RustTypeMarker`/`SubstrateType`
- Json Objects/arrays/Null fields are seperated based on tuple/struct/enum representation - add better error handling
03be6ea
to
aa5e49d
Compare
NotFound(String), | ||
#[error("Could not parse {0} into type")] | ||
TypeError(String), | ||
#[error("type is not possible in the context of rust")] |
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.
This needs to be more specific
// if an enum is an array, it's a unit enum (stateless) | ||
rust_enum.push(unit.as_str().expect("Will be string according to polkadot-js defs").to_string()) | ||
fn parse_enum(value: &Value) -> Result<RustTypeMarker, Error> { | ||
if value.is_array() { |
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 Match
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.
Looks interesting! Let me know when it's ready for a full review. :)
|
||
|
||
The goal of TxDecoder is to be a handy CLI tool for decoding extrinsics/storage that exist in an archive SQL database. | ||
- Decode all extrinsics of a certain spec (one or multiple or every), and return all those that were not succesful |
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.
"spec"? Spec version?
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.
Yeah, spec version. The idea being that we can debug by runtime-version instead of having a ridiculous amount of tests in integration_tests
#42 is a continuation of this PR, most of the bugfixes are in that PR This PR is mostly fixing around metadata and stuff. #42 will merge into this one before being merged into master The reason for the split is that this PR is gigantic and has alot of changes that don't make it in #42 (like the addition of a legacy |
* make tx-decoder actual cli app * huge refactoring to consolidate cursor and data states * formatting * clippy * progress, missing an increment somewhere causing signatures to fail decoding * some parts of incrementing the cursor is made clearer by DecodeState * make Extrinsic bytes into an iterator, fix more extrinsics in 1020 * fix bug in Vec decoding * all of 1020 decodes * fix all tests * Decode up to 1050 * fix spec 1062 * 2008 decodes * fix definition for ConsensusEngineId * some upgrades to tx decoder * rework tx-decoder to use previous spec version when blocks transition from runtimes, the spec will be `next` but the block extrinsics still use previous spec version * mutex -> rwlock * fix sanitization, v12 metadata conversion - use index in metadata rather than enumerater() iterator - fix type name sanitization to support <T as Trait<\w>> and <T as Config<\w>> * Add tx_decoder to logs * fix runtimes, number => version * do_decode decides on decode_length independently * remove do_decode in favor of decode do_decode is no longer needed since we can inspect the decode length independently. * fix v12, add v13 metadata * Add bitvec type to `SubstrateTypes` * update v11 to scale-codec 2 * update v9 to scale-codec 2 * update v8 to scale-codec 2 * use one DecodeDifferent from frame-metadata * remove dependency on legacy sp-core * update codec to 2 for extras * Add bitvec type remove not-used version7 metadata * Update core/src/decoder.rs * Update core/src/decoder.rs * some cleanup * Update core/src/decoder.rs * log::error -> println * check for upgrade block 0 * check some * fix santiziation of types with empty generic, <()> * remove all extrinsic integration tests * fix remaining integration tests * fix tests/clippy lints * remove solved todos * add back unused * add test for ChunkedExtrinsic * remove println from test * remove unused RustTypeMarker variant 'String' * remove 'impossible' types * remove more impossible types * fix tests * fix comment * add westend, centrifuge and rococo to FromStr impl * FromStr should allow for custom chains * add docs about upgrade blocks * docs * Update README.md fix release docs * Update README.md * Update bin/tx-decoder/src/queries.rs Co-authored-by: Tarik Gul <[email protected]> * Update bin/tx-decoder/src/queries.rs Co-authored-by: Tarik Gul <[email protected]> * Update bin/tx-decoder/src/queries.rs Co-authored-by: Tarik Gul <[email protected]> * rustfmt * minus v14 for now * add StorageKey definition * add readme comment about StorageKey * choose simplest representations for substrate_types * rusfmt Co-authored-by: Tarik Gul <[email protected]>
This should hopefully be one of the last updates before type-decoding lands in Substrate proper via scale-info. Once scale-info is fully functional in substrate proper it can be integrated into Desub and legacy types kept in JSON can be frozen for historical purposes.
Checklist of work left for this PR:
"_fallback"
type identifier in JSONConsider using obake for converting between different metadata versionscloses #40