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

Toml-sort #69

Merged
merged 13 commits into from
Dec 21, 2023
Merged
9 changes: 9 additions & 0 deletions .github/workflows/cargo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4meta5 marked this conversation as resolved.
Show resolved Hide resolved
- 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

Expand Down
17 changes: 9 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[workspace]
members = [ "node", "pallets/template", "runtime"]
package.edition = "2021"
package.repository = "https://github.com/paritytech/polkadot-sdk"
members = [ "node", "pallets/template", "runtime" ]
resolver = "2"

[profile.release]
panic = "unwind"
[workspace.package]
edition = "2021"
repository = "https://github.com/paritytech/polkadot-sdk"


[workspace.lints.clippy]
type_complexity = "allow"
too_many_arguments = "allow"
large_enum_variant = "allow"
too_many_arguments = "allow"
type_complexity = "allow"

[profile.release]
panic = "unwind"
28 changes: 15 additions & 13 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
[package]
name = "parachain-template-node"
version = "0.1.0"
authors = ["Anonymous"]
authors = [ "Anonymous" ]
build = "build.rs"
description = "A new Cumulus FRAME-based Substrate Node, ready for hacking together a parachain."
license = "Unlicense"
homepage = "https://substrate.io"
repository.workspace = true
edition.workspace = true
build = "build.rs"
license = "Unlicense"
publish = false
version = "0.1.0"
[package.edition]
workspace = true
[package.repository]
workspace = true

[dependencies]
clap = { version = "4.4.6", features = ["derive"] }
log = "0.4.20"
clap = { version = "4.4.6", features = [ "derive" ] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.188", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
futures = "0.3.28"
jsonrpsee = { version = "0.16.2", features = [ "server" ] }
log = "0.4.20"
serde = { version = "1.0.188", features = [ "derive" ] }

# Local
parachain-template-runtime = { path = "../runtime" }
Expand All @@ -29,11 +31,11 @@ sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", bran
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 }
Expand All @@ -46,8 +48,8 @@ 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-io = { 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-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
Expand All @@ -61,6 +63,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", bran
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }

# Cumulus
color-print = "0.3.4"
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
Expand All @@ -70,7 +73,6 @@ cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", b
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-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
color-print = "0.3.4"

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
Expand Down
36 changes: 19 additions & 17 deletions pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[package]
name = "pallet-parachain-template"
authors = ["Anonymous"]
authors = [ "Anonymous" ]
description = "FRAME pallet template for defining custom runtime logic."
version = "0.1.0"
license = "Unlicense"
homepage = "https://substrate.io"
repository.workspace = true
edition.workspace = true
license = "Unlicense"
version = "0.1.0"
[package.edition]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = [ "x86_64-unknown-linux-gnu" ]
[package.repository]
workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", features = [
"derive",
], default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = [
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
# parity-scale-codec = { version = "3.1.5", default-features = false }
Expand All @@ -25,6 +24,9 @@ scale-info = { version = "2.10.0", default-features = false, features = [
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = [
"derive",
] }

[dev-dependencies]
serde = { version = "1.0.188" }
Expand All @@ -35,13 +37,7 @@ sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }

[features]
default = ["std"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
default = [ "std" ]
std = [
"codec/std",
"frame-benchmarking/std",
Expand All @@ -52,6 +48,12 @@ std = [
"sp-io/std",
"sp-runtime/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
Expand Down
38 changes: 20 additions & 18 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
[package]
name = "parachain-template-runtime"
version = "0.1.0"
authors = ["Anonymous"]
authors = [ "Anonymous" ]
description = "A new Cumulus FRAME-based Substrate Runtime, ready for hacking together a parachain."
license = "Unlicense"
homepage = "https://substrate.io"
repository.workspace = true
edition.workspace = true
license = "Unlicense"
version = "0.1.0"
[package.edition]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", optional = true }
targets = [ "x86_64-unknown-linux-gnu" ]
[package.repository]
workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
Expand Down Expand Up @@ -40,13 +39,13 @@ 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-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 }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-block-builder = { 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 }
Expand Down Expand Up @@ -85,8 +84,11 @@ parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", branch =
[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", optional = true }

[features]
default = ["std"]
default = [ "std" ]
std = [
"codec/std",
"cumulus-pallet-aura-ext/std",
Expand All @@ -109,9 +111,9 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-multisig/std",
"pallet-parachain-template/std",
"pallet-proxy/std",
"pallet-multisig/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
Expand Down Expand Up @@ -155,16 +157,16 @@ runtime-benchmarks = [
"pallet-collator-selection/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-parachain-template/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-sudo/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 = [
Expand All @@ -183,16 +185,16 @@ try-runtime = [
"pallet-collator-selection/try-runtime",
"pallet-multisig/try-runtime",
"pallet-parachain-template/try-runtime",
"pallet-session/try-runtime",
"pallet-proxy/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/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 changes: 16 additions & 0 deletions scripts/check-toml-sorted.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions scripts/toml-sort.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 29 additions & 0 deletions toml-sort.toml
Original file line number Diff line number Diff line change
@@ -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