Toml-sort (#69)

* run toml sort and add script for it

* add ci

* try patch

* try fix

* add file permissions

* check if installation state persists or starts from scratch every time

* Revert "check if installation state persists or starts from scratch every time"

This reverts commit 45e7aae8d2f18cbe1a78482d234b98fcfbe8b6ae.

* Apply suggestions from code review

* clean

* fix

* try revert

* fix
This commit is contained in:
Amar Singh
2023-12-20 19:05:36 -05:00
committed by GitHub
parent b734abf5eb
commit 7d53d4f679
8 changed files with 137 additions and 73 deletions
+9
View File
@@ -57,6 +57,15 @@ jobs:
- name: install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install toml-sort
run: cargo install --git https://github.com/4meta5/toml_sort
- name: Add file permissions for toml-sort
run: chmod +x ./scripts/toml-sort.sh
- name: Add file permissions for check-toml-sorted
run: chmod +x ./scripts/check-toml-sorted.sh
- name: Check Cargo.toml files are formatted using toml_sort
run: ./scripts/check-toml-sorted.sh
- name: Check format
run: cargo fmt --all -- --check
+26 -27
View File
@@ -1,43 +1,36 @@
[workspace]
members = [
"node",
"pallets/template",
"runtime",
"node",
"pallets/template",
"runtime",
]
resolver = "2"
[workspace.package]
authors = [ "OpenZeppelin" ]
repository = "https://github.com/OpenZeppelin/polkadot-runtime-template"
description = "Runtime template(s) for Polkadot Para{chains, cores}"
edition = "2021"
license = "GPL-3.0-only"
description = "Runtime template(s) for Polkadot Para{chains, cores}"
[workspace.lints.clippy]
type_complexity = "allow"
too_many_arguments = "allow"
large_enum_variant = "allow"
repository = "https://github.com/OpenZeppelin/polkadot-runtime-template"
[workspace.dependencies]
clap = { version = "4.4.6", features = ["derive"] }
clap = { version = "4.4.6", features = [ "derive" ] }
color-print = "0.3.4"
futures = "0.3.28"
hex-literal = "0.4.1"
jsonrpsee = { version = "0.16.2", features = [ "server" ] }
log = { version = "0.4.20", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [
"derive",
] }
futures = "0.3.28"
hex-literal = "0.4.1"
jsonrpsee = { version = "0.16.2", features = ["server"] }
log = { version = "0.4.20", default-features = false }
scale-info = { version = "2.10.0", default-features = false }
smallvec = "1.11.0"
serde = { version = "1.0.188", default-features = false }
smallvec = "1.11.0"
# Local
pallet-template = { path = "pallets/template", default-features = false }
# Substrate
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
@@ -50,23 +43,23 @@ pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "re
pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
@@ -79,10 +72,10 @@ sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
@@ -90,16 +83,18 @@ sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
# Polkadot
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", features = [
"rococo-native",
] }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
@@ -119,11 +114,16 @@ cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/pol
cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
[workspace.lints.clippy]
large_enum_variant = "allow"
too_many_arguments = "allow"
type_complexity = "allow"
[profile.production]
codegen-units = 1
@@ -134,4 +134,3 @@ lto = true
[profile.release]
opt-level = 3
panic = "unwind"
+11 -12
View File
@@ -1,21 +1,21 @@
[package]
name = "parachain-template-node"
version = "0.1.0"
authors = { workspace = true }
description = "Node compatible with parachain runtime template."
license = { workspace = true }
repository = { workspace = true }
edition = "2021"
build = "build.rs"
description = "Node compatible with parachain runtime template."
edition = { workspace = true }
license = { workspace = true }
publish = false
repository = { workspace = true }
version = "0.1.0"
[dependencies]
clap = { workspace = true }
futures = { workspace = true }
jsonrpsee = { workspace = true, features = [ "server" ] }
log = { workspace = true }
parity-scale-codec = { workspace = true }
serde = { workspace = true, features = ["derive"] }
jsonrpsee = { workspace = true, features = [ "server" ] }
futures = { workspace = true }
serde = { workspace = true, features = [ "derive" ] }
# Local
parachain-template-runtime = { path = "../runtime" }
@@ -28,11 +28,11 @@ sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-offchain = { workspace = true }
sc-consensus = { workspace = true }
sc-executor = { workspace = true }
sc-network = { workspace = true }
sc-network-sync = { workspace = true }
sc-offchain = { workspace = true }
sc-rpc = { workspace = true }
sc-service = { workspace = true }
sc-sysinfo = { workspace = true }
@@ -45,8 +45,8 @@ sp-block-builder = { workspace = true }
sp-blockchain = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
sp-keystore = { workspace = true }
sp-io = { workspace = true }
sp-keystore = { workspace = true }
sp-runtime = { workspace = true }
sp-timestamp = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
@@ -60,6 +60,7 @@ polkadot-primitives = { workspace = true }
xcm = { workspace = true }
# Cumulus
color-print = { workspace = true }
cumulus-client-cli = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
@@ -69,7 +70,6 @@ cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
color-print = { workspace = true }
[build-dependencies]
substrate-build-script-utils = { workspace = true }
@@ -91,6 +91,5 @@ try-runtime = [
"sp-runtime/try-runtime",
]
[lints]
workspace = true
+12 -12
View File
@@ -1,14 +1,14 @@
[package]
name = "pallet-template"
description = "FRAME pallet template"
version = "0.1.0"
authors = { workspace = true }
description = "FRAME pallet template"
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
edition = "2021"
version = "0.1.0"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = [ "x86_64-unknown-linux-gnu" ]
[dependencies]
parity-scale-codec = { workspace = true, features = [ "derive" ] }
@@ -28,19 +28,19 @@ sp-io = { workspace = true }
sp-runtime = { workspace = true }
[features]
default = ["std"]
default = [ "std" ]
std = [
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"parity-scale-codec/std",
"scale-info/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
std = [
"parity-scale-codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
]
try-runtime = [
"frame-support/try-runtime",
]
+21 -22
View File
@@ -1,22 +1,19 @@
[package]
name = "parachain-template-runtime"
version = "0.1.0"
description = "A generic parachain runtime template"
license = { workspace = true }
authors = { workspace = true }
description = "A generic parachain runtime template"
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
edition = "2021"
version = "0.1.0"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[build-dependencies]
substrate-wasm-builder = { workspace = true }
targets = [ "x86_64-unknown-linux-gnu" ]
[dependencies]
parity-scale-codec = { workspace = true, features = [ "derive" ] }
hex-literal = { workspace = true, optional = true }
log = { workspace = true }
parity-scale-codec = { workspace = true, features = [ "derive" ] }
scale-info = { workspace = true, features = [ "derive" ] }
smallvec = { workspace = true }
@@ -35,13 +32,13 @@ pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-multisig = { workspace = true }
pallet-session = { workspace = true }
pallet-proxy = { workspace = true }
pallet-session = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-utility = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-utility = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-consensus-aura = { workspace = true }
@@ -78,10 +75,12 @@ parachain-info = { workspace = true }
[dev-dependencies]
sp-io = { workspace = true }
[build-dependencies]
substrate-wasm-builder = { workspace = true }
[features]
default = ["std"]
default = [ "std" ]
std = [
"parity-scale-codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"cumulus-pallet-parachain-system/std",
@@ -102,17 +101,17 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-template/std",
"pallet-proxy/std",
"pallet-multisig/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-template/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-utility/std",
"pallet-xcm/std",
"parachain-info/std",
"parity-scale-codec/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"scale-info/std",
@@ -146,17 +145,16 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-template/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-template/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
]
try-runtime = [
@@ -174,17 +172,18 @@ try-runtime = [
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-multisig/try-runtime",
"pallet-template/try-runtime",
"pallet-session/try-runtime",
"pallet-proxy/try-runtime",
"pallet-session/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-template/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-utility/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
"pallet-utility/try-runtime",
]
experimental = ["pallet-aura/experimental"]
experimental = [ "pallet-aura/experimental" ]
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
find . -name "Cargo.toml" -not -path "*/target/*" -exec toml-sort {} \;
CMD="git diff --name-only"
stdbuf -oL $CMD | {
while IFS= read -r line; do
echo$line
if [[ "$line" == *"Cargo.toml" ]]; then
echo "Check fails: $line"
echo "Please run './scripts/toml-sort.sh' to format Cargo.toml files properly."
exit 1
fi
done
}
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# From the workspace directory, run :
# ./scripts/toml-sort.sh
# to format all Cargo.toml files, and
# ./scripts/toml-sort.sh --check
# to only check the formatting.
if ! type "toml-sort" > /dev/null; then
echo "Run 'cargo install --git https://github.com/4meta5/toml_sort'"
else
find . -name "Cargo.toml" -not -path "*/target/*" -exec toml-sort {} $@ \;
fi
+29
View File
@@ -0,0 +1,29 @@
keys = [
"workspace",
"name",
"package",
"bin",
"lib",
"test",
"dependencies",
"dev-dependencies",
"build-dependencies",
"features",
"default",
"std",
]
inline_keys = [
"package",
"workspace",
"path",
"git",
"branch",
"rev",
"version",
"default-features",
"optional",
"features",
]
sort_string_arrays = true