Skip to content

Commit

Permalink
chore: format cargo tomls and add ci check (#1691)
Browse files Browse the repository at this point in the history
Suggested by @xgreenx to be moved to a separate PR away from the
regenesis work.

---------

Co-authored-by: MujkicA <32431923+MujkicA@users.noreply.github.com>
Co-authored-by: MujkicA <ahmedmujkic2@gmail.com>
  • Loading branch information
3 people committed Feb 21, 2024
1 parent 8cee77a commit 7d49387
Show file tree
Hide file tree
Showing 26 changed files with 168 additions and 99 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ jobs:
run: cargo binstall --no-confirm cargo-sort
- name: Run Cargo.toml sort check
run: cargo sort -w --check
- name: Install Prettier and TOML Plugin
run: |
# prettier has issues with global installation and plugin discovery. The temporary `package.json` created by `npm init -y` is a workaround.
npm init -y > /dev/null 2>&1
npm install prettier prettier-plugin-toml
- name: Check format of Cargo.toml files
run: |
if ! npx prettier --check "**/Cargo.toml"; then
npx prettier --write "**/Cargo.toml" > /dev/null 2>&1
echo "Changes required:"
git --no-pager diff
exit 1
fi
- uses: FuelLabs/.github/.github/actions/slack-notify-template@master
if: always() && github.ref == 'refs/heads/master'
with:
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-toml"]
}
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ serde_json = "1.0"
strum = "0.25"
strum_macros = "0.25"
# enable cookie store to support L7 sticky sessions
reqwest = { version = "0.11.16", default-features = false, features = ["rustls-tls", "cookies"] }
reqwest = { version = "0.11.16", default-features = false, features = [
"rustls-tls",
"cookies",
] }
mockall = "0.11"
test-case = "2.2"
test-strategy = "0.3"
Expand Down
19 changes: 15 additions & 4 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,30 @@ version = "0.0.0"
anyhow = { workspace = true }
async-trait = { workspace = true }
clap = { workspace = true, features = ["derive"] }
criterion = { version = "0.5", features = ["html_reports", "async", "async_tokio"] }
criterion = { version = "0.5", features = [
"html_reports",
"async",
"async_tokio",
] }
ctrlc = "3.2.3"
ed25519-dalek = { version = "2.0", features = ["rand_core"] }
ethnum = "1.3"
fuel-core = { path = "../crates/fuel-core", default-features = false, features = ["rocksdb-production"] }
fuel-core = { path = "../crates/fuel-core", default-features = false, features = [
"rocksdb-production",
] }
fuel-core-chain-config = { workspace = true }
fuel-core-database = { path = "./../crates/database" }
fuel-core-services = { path = "./../crates/services" }
fuel-core-storage = { path = "./../crates/storage" }
fuel-core-sync = { path = "./../crates/services/sync", features = ["benchmarking"] }
fuel-core-sync = { path = "./../crates/services/sync", features = [
"benchmarking",
] }
fuel-core-types = { path = "./../crates/types", features = ["test-helpers"] }
futures = "0.3"
p256 = { version = "0.13", default-features = false, features = ["digest", "ecdsa"] }
p256 = { version = "0.13", default-features = false, features = [
"digest",
"ecdsa",
] }
primitive-types = { workspace = true, default-features = false }
quanta = "0.12"
rand = { workspace = true }
Expand Down
5 changes: 4 additions & 1 deletion benches/benches-outputs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ license = "BUSL-1.1"
publish = false

[dependencies]
fuel-core-types = { path = "../../crates/types", default-features = false, features = ["random", "test-helpers"] }
fuel-core-types = { path = "../../crates/types", default-features = false, features = [
"random",
"test-helpers",
] }

[workspace]
4 changes: 3 additions & 1 deletion bin/e2e-test-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ toml = { version = "0.5" }

[dev-dependencies]
assert_cmd = "2.0"
e2e_client = { path = ".", features = ["dev-deps"], package = "fuel-core-e2e-client", default-features = false }
e2e_client = { path = ".", features = [
"dev-deps",
], package = "fuel-core-e2e-client", default-features = false }
fuel-core-trace = { path = "../../crates/trace" }
insta = { workspace = true }
tempfile = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion bin/fuel-core-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ fuel-core-client = { workspace = true }
fuel-core-types = { workspace = true, features = ["serde"] }
serde_json = { workspace = true, features = ["raw_value"] }
tokio = { workspace = true, features = ["macros"] }

6 changes: 3 additions & 3 deletions bin/fuel-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ tikv-jemallocator = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = [
"ansi",
"env-filter",
"json",
"ansi",
"env-filter",
"json",
] }
url = { version = "2.2", optional = true }

Expand Down
2 changes: 2 additions & 0 deletions ci_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
# - Rust `1.75.0`
# - Nightly rust formatter
# - `cargo install cargo-sort`
# - `npm install prettier prettier-plugin-toml`

npx prettier --check "**/Cargo.toml" &&
cargo +nightly fmt --all -- --check &&
cargo sort -w --check &&
source .github/workflows/scripts/verify_openssl.sh &&
Expand Down
9 changes: 7 additions & 2 deletions crates/chain-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ description = "Fuel Chain config types"
anyhow = { workspace = true }
bech32 = "0.9.0"
fuel-core-storage = { workspace = true }
fuel-core-types = { workspace = true, default-features = false, features = ["serde"] }
fuel-core-types = { workspace = true, default-features = false, features = [
"serde",
] }
hex = { version = "0.4", features = ["serde"] }
itertools = { workspace = true }
postcard = { workspace = true, features = ["alloc"] }
Expand All @@ -25,7 +27,10 @@ serde_with = "1.11"
tracing = "0.1"

[dev-dependencies]
fuel-core-types = { workspace = true, default-features = false, features = ["random", "serde"] }
fuel-core-types = { workspace = true, default-features = false, features = [
"random",
"serde",
] }
insta = { workspace = true }
rand = { workspace = true }
serde_json = { version = "1.0", features = ["raw_value"] }
Expand Down
10 changes: 8 additions & 2 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ fuel-core-types = { workspace = true, features = ["serde"] }
futures = { workspace = true, optional = true }
hex = "0.4"
# Included to enable webpki in the eventsource client
hyper-rustls = { version = "0.24", features = ["webpki-tokio"], optional = true }
hyper-rustls = { version = "0.24", features = [
"webpki-tokio",
], optional = true }
itertools = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true, features = ["derive"] }
Expand All @@ -29,7 +31,11 @@ thiserror = "1.0"
tracing = "0.1"

[dev-dependencies]
fuel-core-types = { workspace = true, features = ["serde", "std", "test-helpers"] }
fuel-core-types = { workspace = true, features = [
"serde",
"std",
"test-helpers",
] }
insta = { workspace = true }

[build-dependencies]
Expand Down
8 changes: 7 additions & 1 deletion crates/database/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ authors = { workspace = true }
categories = ["cryptography::cryptocurrencies"]
edition = { workspace = true }
homepage = { workspace = true }
keywords = ["blockchain", "cryptocurrencies", "fuel-core", "fuel-client", "fuel-database"]
keywords = [
"blockchain",
"cryptocurrencies",
"fuel-core",
"fuel-client",
"fuel-database",
]
license = { workspace = true }
repository = { workspace = true }
description = "The crates contains databases used by Fuel core protocol."
Expand Down
10 changes: 4 additions & 6 deletions crates/fuel-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ version = { workspace = true }
[dependencies]
anyhow = { workspace = true }
async-graphql = { version = "4.0", features = [
"tracing",
"tracing",
], default-features = false }
async-trait = { workspace = true }
axum = { workspace = true }
Expand All @@ -34,18 +34,16 @@ fuel-core-services = { workspace = true }
fuel-core-storage = { workspace = true }
fuel-core-sync = { workspace = true, optional = true }
fuel-core-txpool = { workspace = true }
fuel-core-types = { workspace = true, features = [
"serde",
] }
fuel-core-types = { workspace = true, features = ["serde"] }
futures = { workspace = true }
hex = { version = "0.4", features = ["serde"] }
hyper = { workspace = true }
itertools = { workspace = true }
num_cpus = { version = "1.16.0", optional = true }
rand = { workspace = true }
rocksdb = { version = "0.21", default-features = false, features = [
"lz4",
"multi-threaded-cf",
"lz4",
"multi-threaded-cf",
], optional = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["raw_value"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/services/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fuel-core-types = { workspace = true, features = ["test-helpers"] }
default = ["std"]
std = ["fuel-core-chain-config/default", "fuel-core-types/default"]
test-helpers = [
"fuel-core-types/test-helpers",
"fuel-core-storage/test-helpers"
"fuel-core-types/test-helpers",
"fuel-core-storage/test-helpers",
]
35 changes: 15 additions & 20 deletions crates/services/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,24 @@ fuel-core-chain-config = { workspace = true }
fuel-core-metrics = { workspace = true } # TODO make this a feature
fuel-core-services = { workspace = true }
fuel-core-storage = { workspace = true }
fuel-core-types = { workspace = true, features = [
"serde",
] }
fuel-core-types = { workspace = true, features = ["serde"] }
futures = { workspace = true }
hex = "0.4"
ip_network = "0.4"
libp2p = { version = "0.53.2", default-features = false, features = [
"dns",
"gossipsub",
"identify",
"kad",
"macros",
"mdns",
"noise",
"request-response",
"secp256k1",
"tcp",
"tokio",
"yamux",
"websocket",
"dns",
"gossipsub",
"identify",
"kad",
"macros",
"mdns",
"noise",
"request-response",
"secp256k1",
"tcp",
"tokio",
"yamux",
"websocket",
] }
libp2p-mplex = "0.41.0"
postcard = { workspace = true, features = ["use-std"] }
Expand All @@ -56,10 +54,7 @@ void = "1"
ctor = "0.1"
fuel-core-p2p = { path = ".", features = ["test-helpers"] }
fuel-core-trace = { path = "../../trace" }
fuel-core-types = { path = "../../types", features = [
"serde",
"test-helpers"
] }
fuel-core-types = { path = "../../types", features = ["serde", "test-helpers"] }
rand = { workspace = true }
tokio = { workspace = true, features = ["full", "test-util"] }
tracing-attributes = { workspace = true }
Expand Down
18 changes: 9 additions & 9 deletions crates/services/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ async-trait = { workspace = true }
bytes = { version = "1.1", optional = true }
enum-iterator = { workspace = true }
ethers-contract = { version = "2", default-features = false, features = [
"abigen",
"abigen",
] }
ethers-core = { version = "2", default-features = false }
ethers-providers = { version = "2", default-features = false, features = [
"ws",
"rustls",
"ws",
"rustls",
] }
fuel-core-services = { workspace = true }
fuel-core-storage = { workspace = true }
Expand Down Expand Up @@ -49,10 +49,10 @@ tokio = { workspace = true, features = ["macros", "test-util"] }

[features]
test-helpers = [
"bytes",
"parking_lot",
"serde",
"serde_json",
"thiserror",
"fuel-core-types/test-helpers"
"bytes",
"parking_lot",
"serde",
"serde_json",
"thiserror",
"fuel-core-types/test-helpers",
]
9 changes: 3 additions & 6 deletions crates/services/txpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ mockall = { workspace = true }
proptest = { workspace = true }
rstest = "0.15"
test-strategy = { workspace = true }
tokio = { workspace = true, features = [
"sync",
"test-util",
] }
tokio = { workspace = true, features = ["sync", "test-util"] }

[features]
test-helpers = [
"fuel-core-types/test-helpers",
"fuel-core-storage/test-helpers",
"fuel-core-types/test-helpers",
"fuel-core-storage/test-helpers",
]
20 changes: 13 additions & 7 deletions crates/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ description = "Storage types and primitives used by Fuel core protocol."
edition = { workspace = true }
homepage = { workspace = true }
keywords = [
"blockchain",
"cryptocurrencies",
"fuel-client",
"fuel-core",
"fuel-storage",
"blockchain",
"cryptocurrencies",
"fuel-client",
"fuel-core",
"fuel-storage",
]
license = { workspace = true }
name = "fuel-core-storage"
Expand All @@ -20,7 +20,9 @@ version = { workspace = true }
anyhow = { workspace = true }
derive_more = { workspace = true }
enum-iterator = { workspace = true }
fuel-core-types = { workspace = true, default-features = false, features = ["serde"] }
fuel-core-types = { workspace = true, default-features = false, features = [
"serde",
] }
fuel-vm-private = { workspace = true, default-features = false }
impl-tools = "0.10"
itertools = { workspace = true }
Expand All @@ -35,7 +37,11 @@ strum_macros = { workspace = true }

[dev-dependencies]
fuel-core-storage = { path = ".", features = ["test-helpers"] }
fuel-core-types = { workspace = true, default-features = false, features = ["serde", "random", "test-helpers"] }
fuel-core-types = { workspace = true, default-features = false, features = [
"serde",
"random",
"test-helpers",
] }

[features]
test-helpers = ["dep:mockall", "dep:rand"]
12 changes: 6 additions & 6 deletions crates/trace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ description = "A Tokio tracing initializer for testing"
edition = { workspace = true }
homepage = { workspace = true }
keywords = [
"blockchain",
"cryptocurrencies",
"fuel-client",
"fuel-core",
"fuel-tracing",
"tracing",
"blockchain",
"cryptocurrencies",
"fuel-client",
"fuel-core",
"fuel-tracing",
"tracing",
]
license = { workspace = true }
name = "fuel-core-trace"
Expand Down
Loading

2 comments on commit 7d49387

@eczacim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@sirchinos1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Please sign in to comment.