Skip to content

Commit

Permalink
Merge pull request #387 from paritytech/same-metadata-for-chains
Browse files Browse the repository at this point in the history
remove chain specific macros and one metadata file for all chains
  • Loading branch information
niklasad1 authored Oct 5, 2022
2 parents 83b3608 + e9ffc85 commit d5515bb
Show file tree
Hide file tree
Showing 21 changed files with 1,480 additions and 1,248 deletions.
287 changes: 219 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ tokio = { version = "1.21", features = ["macros", "rt-multi-thread", "sync", "si
pin-project-lite = "0.2"

# subxt
subxt = { git = "https://github.com/paritytech/subxt" }
subxt = "0.24.0"
scale-value = "0.6.0"

# substrate
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,32 @@
WARNING this library is under active development DO NOT USE IN PRODUCTION.

The library is a re-write of [polkadot staking miner](https://github.com/paritytech/polkadot/tree/master/utils/staking-miner) using [subxt](https://github.com/paritytech/subxt)
to avoid hard dependency to each runtime version.
to avoid hard dependency to each runtime version. It's using a static metadata (metadata.scale) file to generate rust types, instructions how to update metadata can be found [here](#update-metadata)

The intention is that this library will "only break" once the [pallet-election-provider-multi-phase](https://crates.parity.io/pallet_election_provider_multi_phase/index.html) breaks i.e, not on every runtime upgrade.



You can check the help with:
```
staking-miner --help
```

## Update metadata

The static metadata file is stored at [`artifacts/metadata.scale`]
To update the metadata you need to connect to a polkadot, kusama or westend node

```bash
# Install subxt-cli
$ cargo install --locked subxt-cli
# Download metadata from local node and replace the current metadata
# See `https://github.com/paritytech/subxt/tree/master/cli` for further documentation of the `subxt-cli` tool.
$ subxt metadata -f bytes > artifacts/metadata.scale
# Inspect the generated code
$ subxt codegen --file artifacts/metadata.scale | rustfmt +nightly > code.rs
```


## Building

Expand Down
Binary file removed artifacts/kusama.scale
Binary file not shown.
File renamed without changes.
Binary file removed artifacts/westend.scale
Binary file not shown.
Loading

0 comments on commit d5515bb

Please sign in to comment.