Skip to content
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

Add and configure asset registry pallet #276

Merged
merged 23 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
97c658d
Add asset_registry.rs to runtime/common
ebma Jul 14, 2023
80ec897
Add asset registry pallet to Foucoco runtime
ebma Jul 14, 2023
c722147
Add asset registry pallet to Amplitude runtime
ebma Jul 14, 2023
f726d18
Add asset registry pallet to Pendulum runtime
ebma Jul 14, 2023
4468422
Add benchmarking logic for orml_asset_registry.rs to runtime/common
ebma Jul 17, 2023
66e2947
Add benchmarked weights for orml-asset-registry
ebma Jul 17, 2023
5a5bd77
Change call filters
ebma Jul 17, 2023
2452fcd
Enable benchmarks for asset registry in all runtimes
ebma Jul 17, 2023
c0e0027
Merge branch 'main' into 275-add-and-configure-asset-registry-pallet
ebma Jul 17, 2023
5455978
Configure asset_registry in chain_spec.rs
ebma Jul 17, 2023
91b9e52
Update Cargo.lock
ebma Jul 17, 2023
276cb17
Fix missing dependencies of orml_asset_registry.rs
ebma Jul 17, 2023
4d81baa
Configure runtime-common/try-runtime features for runtimes
ebma Jul 17, 2023
9c23c80
Rewrite AssetAuthority type
ebma Jul 18, 2023
15392fc
Add instructions for benchmarking to README.md
ebma Jul 18, 2023
f22ee5b
Use Some(Currency) in benchmarks
ebma Jul 18, 2023
6e6cc00
Generate benchmarks for orml_asset_registry pallet
ebma Jul 18, 2023
ac87d95
Bump spacewalk dependencies
ebma Jul 25, 2023
5088b74
Adjust CustomMetadata struct usage
ebma Jul 25, 2023
767f8da
Add comment to construct_runtime! macros
ebma Jul 25, 2023
5995ad5
Merge branch 'main' into 275-add-and-configure-asset-registry-pallet
ebma Jul 25, 2023
4395e53
Fix misconfiguration in foucoco Cargo.toml
ebma Jul 25, 2023
ee3a5ad
Re-generate benchmark weights for asset registry pallet
ebma Jul 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 54 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 65 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ A successful build will create a binary under `./target/release/pendulum-node`.

### How to Generate Chain Spec

There are 4 different [runtime](runtime)s currently in the repo; **amplitude** for the Amplitude parachain, **foucoco** for the Foucoco testnet (running on Rococo), **pendulum** for the Pendulum parachain and **development** for the local development. Any of these runtimes are used depending on the config. The config is created by generating the chain spec:
There are 4 different [runtime](runtime)s currently in the repo; **amplitude** for the Amplitude parachain, **foucoco**
for the Foucoco testnet (running on Rococo), **pendulum** for the Pendulum parachain and **development** for the local
development. Any of these runtimes are used depending on the config. The config is created by generating the chain spec:

```
./target/release/pendulum-node build-spec --disable-default-bootnode > local-parachain-plain.json
Expand Down Expand Up @@ -105,9 +107,11 @@ An example for Amplitude will look like this:
--execution=wasm --sync fast --pruning archive
```

You can find the kusama.json [here](https://github.com/paritytech/polkadot/blob/master/node/service/chain-specs/kusama.json).
You can find the
kusama.json [here](https://github.com/paritytech/polkadot/blob/master/node/service/chain-specs/kusama.json).

For local testing, you can replace `--name` with predefined keys like `--alice` or `--bob`. You also need to specify the `--bootnode`. Here's an example:
For local testing, you can replace `--name` with predefined keys like `--alice` or `--bob`. You also need to specify
the `--bootnode`. Here's an example:

```
./target/release/pendulum-node \
Expand All @@ -129,6 +133,62 @@ For local testing, you can replace `--name` with predefined keys like `--alice`
```

where `ALICE_NODE_ID` is the peer id of Alice.
You can find the rococo-custom-2-raw.json [here](https://github.com/substrate-developer-hub/substrate-docs/blob/314e9cd3bd0ca9426bbfd381b79c3ef4d06b49c2/static/assets/tutorials/cumulus/chain-specs/rococo-custom-2-raw.json).
You can find the
rococo-custom-2-raw.json [here](https://github.com/substrate-developer-hub/substrate-docs/blob/314e9cd3bd0ca9426bbfd381b79c3ef4d06b49c2/static/assets/tutorials/cumulus/chain-specs/rococo-custom-2-raw.json).

There are prerequisites in running the collator with a local relay chain. Refer to [how to run Pendulum locally](https://pendulum.gitbook.io/pendulum-docs/build/build-environment/local-pendulum-chain-setup).
There are prerequisites in running the collator with a local relay chain. Refer
to [how to run Pendulum locally](https://pendulum.gitbook.io/pendulum-docs/build/build-environment/local-pendulum-chain-setup).

## How to benchmark runtime pallets

Build the node with the `production` profile and the `runtime-benchmarks` feature enabled.

```shell
cargo build --profile=production --features runtime-benchmarks --package pendulum-node
```

Run the benchmarks of a registered pallet.
The pallet has to be added to the list of defined benchmarks that you can find in the `benches` module of each
runtimes `lib.rs` file.

#### Pendulum

```shell
./target/production/pendulum-node benchmark pallet \
--chain pendulum \
--execution=wasm \
--wasm-execution=compiled \
--pallet "*" \
--extrinsic "*" \
--steps 50 \
--repeat 20 \
--output runtime/pendulum/src/weights/
```

#### Amplitude

```shell
./target/production/pendulum-node benchmark pallet \
--chain amplitude \
--execution=wasm \
--wasm-execution=compiled \
--pallet "*" \
--extrinsic "*" \
--steps 50 \
--repeat 20 \
--output runtime/amplitude/src/weights/
```

#### Foucoco

```shell
./target/production/pendulum-node benchmark pallet \
--chain foucoco \
--execution=wasm \
--wasm-execution=compiled \
--pallet "*" \
--extrinsic "*" \
--steps 50 \
--repeat 20 \
--output runtime/foucoco/src/weights/
```
3 changes: 3 additions & 0 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ fn amplitude_genesis(
);

amplitude_runtime::GenesisConfig {
asset_registry: Default::default(),
system: amplitude_runtime::SystemConfig {
code: amplitude_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
Expand Down Expand Up @@ -727,6 +728,7 @@ fn foucoco_genesis(
);

foucoco_runtime::GenesisConfig {
asset_registry: Default::default(),
system: foucoco_runtime::SystemConfig {
code: foucoco_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
Expand Down Expand Up @@ -889,6 +891,7 @@ fn pendulum_genesis(
.collect();

pendulum_runtime::GenesisConfig {
asset_registry: Default::default(),
system: pendulum_runtime::SystemConfig {
code: pendulum_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
Expand Down
Loading
Loading