{"id":13603994,"url":"https://github.com/paritytech/substrate-debug-kit","last_synced_at":"2025-04-11T22:32:19.586Z","repository":{"id":46035507,"uuid":"212818473","full_name":"paritytech/substrate-debug-kit","owner":"paritytech","description":"A collection of debug tools, scripts and libraries on top of substrate. ","archived":true,"fork":false,"pushed_at":"2021-11-18T16:11:01.000Z","size":6685,"stargazers_count":96,"open_issues_count":5,"forks_count":31,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-09T10:49:03.961Z","etag":null,"topics":["kusama","polkadot","rust","substrate"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paritytech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-04T13:13:50.000Z","updated_at":"2024-10-18T16:47:59.000Z","dependencies_parsed_at":"2022-09-14T11:13:00.889Z","dependency_job_id":null,"html_url":"https://github.com/paritytech/substrate-debug-kit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsubstrate-debug-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsubstrate-debug-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsubstrate-debug-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsubstrate-debug-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paritytech","download_url":"https://codeload.github.com/paritytech/substrate-debug-kit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248489809,"owners_count":21112644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kusama","polkadot","rust","substrate"],"created_at":"2024-08-01T19:00:37.774Z","updated_at":"2025-04-11T22:32:16.804Z","avatar_url":"https://github.com/paritytech.png","language":"Rust","funding_links":[],"categories":["Libraries","Tools"],"sub_categories":["Multisig Wallets"],"readme":"# Substrate debug-kit 🛠⚙️\n\nA collection of debug tools and libraries around substrate chains.\n\n\u003e This project has evolved from the historical name **`offline-phragmen`**. I first created this repo\n\u003e prior to [Kusama](https://kusama.network/)'s NPoS enabling as a tool to predict the outcome. Henceforth, it has evolved\n\u003e into this repo. This functionality is still provided in the [`offline-elections`](https://github.com/paritytech/offline-phragmen/tree/master/offline-election) crate.\n\n\n# DEPRECATED 🚨 \n\nAlmost all of the tools in this repository are no longer maintained. Some are moved to substrate (e.g. [`remote-externalities`](https://github.com/paritytech/substrate/tree/master/utils/frame/remote-externalities). Some are being re-worked in [Typescript](https://github.com/kianenigma/polkadot-scripts/), and some are scheduled to be re-done with Frame's new [Metadata](https://github.com/paritytech/substrate/pull/8615).\n\n## Overview\n\n- **`sub-storage`**: This is the backbone of all of the crates in this repo. It provides a minimal\n  wrapper around substrate's storage rpc call for easier use. It provides all you need to read any\n  module's storage items, constants, and metadata. All of this is independent of any chain or pallet\n  and should work in any substrate chain. Additionally, it provide some pallet-dependent helpers as\n  well under the `helpers` feature (such as reading identity of an account).\n- **`sub-du`**: a [**d**isk-**u**sage](https://en.wikipedia.org/wiki/Du_(Unix))-like tool that prints the storage usage of a chain. It reads all the info\n  it needs from metadata, so independent chain or runtime. Arguably not super useful, but I find it\n  cool.\n- **`offline-elections`**: The historical main purpose of this repo. It can scrape the staking\n  module's info and run election algorithms of `sp-npos-elections` offline. **Given the correct\n  parameters**, it can be used to predict the next validator set. It also provide other election\n  related functionalities. See the sub-commands for more info.\n- **`remote-externalities`**: It provides the ability to write simple rust unit tests over a\n  specific state of a chain. It can be very useful to debug breaking changes and storage migrations.\n- **`tokens`**: Quite a dumb and small crate that provides wrappers for easy pretty-printing tokens\n  like `DOT`. Somewhat similar to the `toHuman()` interface of the javascript API.\n- **`laboratory`**: This is where I try new stuff.\n\n## Build Substrate Debug Kit\n- `git clone https://github.com/paritytech/substrate-debug-kit/`\n- `cd substrate-debug-kit`\n- `cargo build --release`\n\n## Example commands for the debug tools\n##### Note: Run local Polkadot or Kusama node, or start local development node e.g. `polkadot --dev --tmp`\n- The sub-du command to read all of the chain storage usage `./target/release/sub-du`\n- The offline-election tool for staking `./target/release/offline-election staking -i 10 -r`\n- The offline-election tool to review a validator `./target/release/offline-election validator-check --who CpYNXnYC1mPPRSXMHvm9EUuhEqHjvj6kCN4kshqMdEpPYSF`\n\n## Brain Dump 🧠\n\n- **Substrate module sidecar**: A wrapper around remote-externalities that allows you to run a\n  substrate module in a TextExternalities environment and constantly feed the new block data into\n  it. Would need to listen to new blocks, upon each block:\n  1. call `Module::on_initialize()`.\n  2. scan for any transaction in that block that might be targeted to this module (how? call\n     matching), call them directly\n  3. call `Module::on_finalize()`.\n  4. Wipe the state and update it to the new state of the newly imported block.\n\nNotes: will probably be a pain to do because of rust dependency clashes. Using wasm would make this easier, but then debugging will become harder. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fsubstrate-debug-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparitytech%2Fsubstrate-debug-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fsubstrate-debug-kit/lists"}