Skip to content

Commit

Permalink
Merge pull request #31 from Metaquity-Network/fix/sbp-m1-review-sugge…
Browse files Browse the repository at this point in the history
…stions

Apply SBP-M1 reviewer's suggestions
  • Loading branch information
khssnv authored Dec 11, 2023
2 parents 151d383 + 377165f commit 05027c7
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 400 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pallet-timestamp = { version = "23.0.0", default-features = false }
pallet-transaction-payment = { version = "24.0.0", default-features = false }
pallet-transaction-payment-rpc = { version = "26.0.0" }
pallet-transaction-payment-rpc-runtime-api = { version = "24.0.0", default-features = false }
pallet-treasury = { version = "23.0.0", default-features = false}
pallet-utility = { version = "24.0.0", default-features = false }
sc-basic-authorship = { version = "0.30.0" }
sc-chain-spec = { version = "23.0.0" }
Expand Down Expand Up @@ -136,8 +137,5 @@ xcm = { package = "staging-xcm", version = "3.0.0", default-features = false }
xcm-builder = { package = "staging-xcm-builder", version = "3.0.0", default-features = false }
xcm-executor = { package = "staging-xcm-executor", version = "3.0.0", default-features = false }

# SBP-M1 review: as noted, the template used for this project is based on the `substrate-node-template` which is for building a solo chain rather than a parachain.
# SBP-M1 review: Cumulus (https://github.com/paritytech/polkadot-sdk/tree/master/cumulus) is the parachain SDK which should be used instead to build a parachain, with a starter template available at https://github.com/substrate-developer-hub/substrate-parachain-template
# SBP-M1 review: finally, the Extended Parachain Template (https://github.com/paritytech/extended-parachain-template) builds on the above and is recommended for a new parachain project.

# SBP-M1 review: add integration tests to ensure runtime functionality works as expected. Suggested tools include zombienet, parachains-integration-tests, chopsticks as applicable.
# TODO (@khssnv): zombienet added, consider parachains-integration-tests and chopsticks
77 changes: 2 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,3 @@
# Extended Parachain Template
# Metaquity Network

The **Extended Parachain Template** is a ready-to-use parachain template, pre-configured with the [Assets](https://paritytech.github.io/substrate/master/pallet_assets/index.html) pallet, a simple Governance system ([Collective](https://paritytech.github.io/substrate/master/pallet_collective/index.html) & [Motion](https://github.com/paritytech/extended-parachain-template/tree/main/pallets/motion) pallets), and other useful base features.

This is a solid starting point for most Parachain projects as it is a more feature-rich alternative to the base [Substrate Parachain Template](https://github.com/substrate-developer-hub/substrate-parachain-template) (which it is derived from).

This template is maintained by the **Delivery Services** team at **Parity**.

## Getting Started

### Rust Setup

First, complete the [basic Rust setup instructions](./docs/rust-setup.md).

### Build

Clone the extended parachain template repository:

```sh
git clone https://github.com/paritytech/extended-parachain-template
```

Use the following command to build the node without launching it:

```sh
cargo build --release
```

Next you will need a compatible release of [Polkadot](https://github.com/paritytech/polkadot) to run a testnet. You may also want to use [Zombienet (available for Linux and MacOS)](https://github.com/paritytech/zombienet/releases) for spinning up a testnet:


You can find linux and macOS executables of the Zombienet CLI here:

https://github.com/paritytech/zombienet/releases
Download the Zombienet CLI according to your operating system.

Tip: If you want the executable to be available system-wide then you can follow these steps (otherwise just download the executable to your working directory):
```sh
wget https://github.com/paritytech/zombienet/releases/download/v1.3.30/zombienet-macos
chmod +x zombienet-macos
cp zombienet-macos /usr/local/bin
```
Make sure Zombienet CLI is installed correctly:
```sh
./zombienet-macos --help
```
You should see some similar output:
```sh
Usage: zombienet [options] [command]

Options:
-c, --spawn-concurrency <concurrency> Number of concurrent spawning process to launch, default is 1
-p, --provider <provider> Override provider to use (choices: "podman", "kubernetes", "native")
-m, --monitor Start as monitor, do not auto cleanup network
-h, --help display help for command

Commands:
spawn <networkConfig> [creds] Spawn the network defined in the config
test <testFile> [runningNetworkSpec] Run tests on the network defined
setup <binaries...> Setup is meant for downloading and making dev environment of Zombienet ready
version Prints zombienet version
help [command] display help for command

```

### Setting up Zombienet config

You may use a reference implementation from the folder `zombienet-config` or make your own. More instructions here: [Simulate parachains in a test network
](https://docs.substrate.io/test/simulate-parachains/)

👉 Learn more about parachains [here](https://wiki.polkadot.network/docs/learn-parachains), and
parathreads [here](https://wiki.polkadot.network/docs/learn-parathreads).


🧙 Learn about how to use this template and run your own parachain testnet for it in the
[Devhub Cumulus Tutorial](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/).
The World's First Permissioned Blockchain Network and DeFi Protocol for Real World Assets (RWA).
1 change: 0 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ targets = ["x86_64-unknown-linux-gnu"]
[[bin]]
name = "metaquity-network"

# SBP-M1 review: consider updating dependencies to new monorepo at https://github.com/paritytech/polkadot-sdk (where applicable, and when ready to move to 1.0)
[dependencies]
clap = { workspace = true }
color-print = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ pub mod devnet {
..Default::default()
},
transaction_payment: Default::default(),
treasury: Default::default(),
}
}
}
Expand Down Expand Up @@ -461,6 +462,7 @@ pub mod mainnet {
..Default::default()
},
transaction_payment: Default::default(),
treasury: Default::default(),
}
}
}
3 changes: 0 additions & 3 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ pub type Nonce = u32;
/// up by `pallet_aura` to implement `fn slot_duration()`.
///
/// Change this to adjust the block time.
// SBP-M1 review: consider effects of block time increasing when migrating from solo chain to parachain (if applicable): https://github.com/paritytech/extended-parachain-template/blob/3bec37d7844880d13e0a1f3253d1402500f83789/runtime/common/src/lib.rs#L22
// SBP-M1 review: note also that `asynchronous backing` is set to reduce parachain block times to 6
// seconds once available
pub const MILLISECS_PER_BLOCK: u64 = 12000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
Expand Down
6 changes: 5 additions & 1 deletion runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ scale-info = { workspace = true, default-features = false, features = [
smallvec = { workspace = true }

# Local
runtime-common = { path = "../common", default-features = false }
runtime-common = { workspace = true, default-features = false }

# Substrate
frame-benchmarking = { workspace = true, default-features = false, optional = true }
Expand All @@ -52,6 +52,7 @@ pallet-sudo = { workspace = true, default-features = false }
pallet-timestamp = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-transaction-payment-rpc-runtime-api = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
sp-api = { workspace = true, default-features = false }
sp-block-builder = { workspace = true, default-features = false }
Expand Down Expand Up @@ -123,6 +124,7 @@ std = [
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"pallet-xcm/std",
"parachain-info/std",
Expand Down Expand Up @@ -167,6 +169,7 @@ runtime-benchmarks = [
"pallet-preimage/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
Expand Down Expand Up @@ -198,6 +201,7 @@ try-runtime = [
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
Expand Down
Loading

0 comments on commit 05027c7

Please sign in to comment.