diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44c49febb95..8199344ab01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000..511892dcdd3 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "plugins": ["prettier-plugin-toml"] +} diff --git a/Cargo.toml b/Cargo.toml index 4d232af4cad..9e8f40fc18c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 51c8642deb2..65f7958ea37 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -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 } diff --git a/benches/benches-outputs/Cargo.toml b/benches/benches-outputs/Cargo.toml index b643003b928..47610ae295b 100644 --- a/benches/benches-outputs/Cargo.toml +++ b/benches/benches-outputs/Cargo.toml @@ -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] diff --git a/bin/e2e-test-client/Cargo.toml b/bin/e2e-test-client/Cargo.toml index b9587955f4c..7076e8197c9 100644 --- a/bin/e2e-test-client/Cargo.toml +++ b/bin/e2e-test-client/Cargo.toml @@ -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 } diff --git a/bin/fuel-core-client/Cargo.toml b/bin/fuel-core-client/Cargo.toml index 75c2a287a7e..45e568d5a33 100644 --- a/bin/fuel-core-client/Cargo.toml +++ b/bin/fuel-core-client/Cargo.toml @@ -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"] } - diff --git a/bin/fuel-core/Cargo.toml b/bin/fuel-core/Cargo.toml index f9f7c500622..f2b55c81090 100644 --- a/bin/fuel-core/Cargo.toml +++ b/bin/fuel-core/Cargo.toml @@ -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 } diff --git a/ci_checks.sh b/ci_checks.sh index 6138a5d4583..dc029e4dac7 100755 --- a/ci_checks.sh +++ b/ci_checks.sh @@ -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 && diff --git a/crates/chain-config/Cargo.toml b/crates/chain-config/Cargo.toml index d5b89a84bed..8a9f5ef1b16 100644 --- a/crates/chain-config/Cargo.toml +++ b/crates/chain-config/Cargo.toml @@ -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"] } @@ -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"] } diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index ac5aa411602..9253b9d1700 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -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"] } @@ -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] diff --git a/crates/database/Cargo.toml b/crates/database/Cargo.toml index 793d6d1d5ba..268beb08026 100644 --- a/crates/database/Cargo.toml +++ b/crates/database/Cargo.toml @@ -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." diff --git a/crates/fuel-core/Cargo.toml b/crates/fuel-core/Cargo.toml index 2fcbb29594a..6cd1d126e9e 100644 --- a/crates/fuel-core/Cargo.toml +++ b/crates/fuel-core/Cargo.toml @@ -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 } @@ -34,9 +34,7 @@ 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 } @@ -44,8 +42,8 @@ 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"] } diff --git a/crates/services/executor/Cargo.toml b/crates/services/executor/Cargo.toml index 595826ceca6..496dc05e7af 100644 --- a/crates/services/executor/Cargo.toml +++ b/crates/services/executor/Cargo.toml @@ -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", ] diff --git a/crates/services/p2p/Cargo.toml b/crates/services/p2p/Cargo.toml index 3183235a7d2..ac3a8f328de 100644 --- a/crates/services/p2p/Cargo.toml +++ b/crates/services/p2p/Cargo.toml @@ -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"] } @@ -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 } diff --git a/crates/services/relayer/Cargo.toml b/crates/services/relayer/Cargo.toml index 086ae8ecc9a..85189feca7a 100644 --- a/crates/services/relayer/Cargo.toml +++ b/crates/services/relayer/Cargo.toml @@ -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 } @@ -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", ] diff --git a/crates/services/txpool/Cargo.toml b/crates/services/txpool/Cargo.toml index fa0cee10746..296cfeedf5f 100644 --- a/crates/services/txpool/Cargo.toml +++ b/crates/services/txpool/Cargo.toml @@ -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", ] diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 7380c559905..b40f2488fdd 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -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" @@ -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 } @@ -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"] diff --git a/crates/trace/Cargo.toml b/crates/trace/Cargo.toml index d64230bc028..b21182e0c53 100644 --- a/crates/trace/Cargo.toml +++ b/crates/trace/Cargo.toml @@ -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" diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index 586408ab50e..3b49badf909 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -5,11 +5,11 @@ description = "The primitives and types use by Fuel core protocol." edition = { workspace = true } homepage = { workspace = true } keywords = [ - "blockchain", - "cryptocurrencies", - "fuel-client", - "fuel-core", - "fuel-types", + "blockchain", + "cryptocurrencies", + "fuel-client", + "fuel-core", + "fuel-types", ] license = { workspace = true } name = "fuel-core-types" @@ -21,7 +21,9 @@ anyhow = { workspace = true } bs58 = "0.5" derivative = { version = "2" } derive_more = { version = "0.99" } -fuel-vm-private = { workspace = true, default-features = false, features = ["alloc"] } +fuel-vm-private = { workspace = true, default-features = false, features = [ + "alloc", +] } rand = { workspace = true, optional = true } secrecy = "0.8" serde = { workspace = true, features = ["derive"], optional = true } diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 9faa23ec731..cda33bb75d3 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -21,18 +21,24 @@ anyhow = { workspace = true } async-trait = { workspace = true } cynic = { workspace = true } ethers = "2" -fuel-core = { path = "../crates/fuel-core", default-features = false, features = ["test-helpers"] } +fuel-core = { path = "../crates/fuel-core", default-features = false, features = [ + "test-helpers", +] } fuel-core-benches = { path = "../benches" } fuel-core-client = { path = "../crates/client", features = ["test-helpers"] } fuel-core-executor = { workspace = true } -fuel-core-p2p = { path = "../crates/services/p2p", features = ["test-helpers"], optional = true } +fuel-core-p2p = { path = "../crates/services/p2p", features = [ + "test-helpers", +], optional = true } fuel-core-poa = { path = "../crates/services/consensus_module/poa" } fuel-core-relayer = { path = "../crates/services/relayer", features = [ - "test-helpers", + "test-helpers", ], optional = true } fuel-core-storage = { path = "../crates/storage", features = ["test-helpers"] } fuel-core-trace = { path = "../crates/trace" } -fuel-core-txpool = { path = "../crates/services/txpool", features = ["test-helpers"] } +fuel-core-txpool = { path = "../crates/services/txpool", features = [ + "test-helpers", +] } fuel-core-types = { path = "../crates/types", features = ["test-helpers"] } futures = "0.3" hyper = { workspace = true, features = ["server"] } @@ -47,9 +53,9 @@ tempfile = "3.3" test-case = { workspace = true } test-helpers = { path = "./test-helpers" } tokio = { workspace = true, features = [ - "macros", - "rt-multi-thread", - "test-util", + "macros", + "rt-multi-thread", + "test-util", ] } [features] diff --git a/tests/test-helpers/Cargo.toml b/tests/test-helpers/Cargo.toml index f648bb0a9c1..5789739bd0a 100644 --- a/tests/test-helpers/Cargo.toml +++ b/tests/test-helpers/Cargo.toml @@ -8,16 +8,24 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -fuel-core = { path = "../../crates/fuel-core", default-features = false, features = ["test-helpers"] } +fuel-core = { path = "../../crates/fuel-core", default-features = false, features = [ + "test-helpers", +] } fuel-core-client = { path = "../../crates/client", features = ["test-helpers"] } -fuel-core-p2p = { path = "../../crates/services/p2p", features = ["test-helpers"], optional = true } +fuel-core-p2p = { path = "../../crates/services/p2p", features = [ + "test-helpers", +], optional = true } fuel-core-poa = { path = "../../crates/services/consensus_module/poa" } fuel-core-relayer = { path = "../../crates/services/relayer", features = [ - "test-helpers", + "test-helpers", ], optional = true } -fuel-core-storage = { path = "../../crates/storage", features = ["test-helpers"] } +fuel-core-storage = { path = "../../crates/storage", features = [ + "test-helpers", +] } fuel-core-trace = { path = "../../crates/trace" } -fuel-core-txpool = { path = "../../crates/services/txpool", features = ["test-helpers"] } +fuel-core-txpool = { path = "../../crates/services/txpool", features = [ + "test-helpers", +] } fuel-core-types = { path = "../../crates/types", features = ["test-helpers"] } itertools = { workspace = true } -rand = { workspace = true } \ No newline at end of file +rand = { workspace = true } diff --git a/version-compatibility/0.14.1-0.15.0/fuel-core-0.14.1-client-0.15.0/Cargo.toml b/version-compatibility/0.14.1-0.15.0/fuel-core-0.14.1-client-0.15.0/Cargo.toml index 3fa319eb9d7..bc5dc821fdc 100644 --- a/version-compatibility/0.14.1-0.15.0/fuel-core-0.14.1-client-0.15.0/Cargo.toml +++ b/version-compatibility/0.14.1-0.15.0/fuel-core-0.14.1-client-0.15.0/Cargo.toml @@ -11,4 +11,4 @@ path = "test.rs" [dev-dependencies] f_core = { version = "=0.14.1", package = "fuel-core" } fuel-gql-client = { version = "=0.15", features = ["test-helpers"] } -tokio = { version = "1.21", features = ["macros", "rt-multi-thread"] } \ No newline at end of file +tokio = { version = "1.21", features = ["macros", "rt-multi-thread"] } diff --git a/version-compatibility/0.14.1-0.15.0/fuel-core-0.15.0-client-0.14.1/Cargo.toml b/version-compatibility/0.14.1-0.15.0/fuel-core-0.15.0-client-0.14.1/Cargo.toml index b7e7e3c8a96..f6db4a48428 100644 --- a/version-compatibility/0.14.1-0.15.0/fuel-core-0.15.0-client-0.14.1/Cargo.toml +++ b/version-compatibility/0.14.1-0.15.0/fuel-core-0.15.0-client-0.14.1/Cargo.toml @@ -9,6 +9,8 @@ publish = false path = "test.rs" [dev-dependencies] -f-client = { version = "=0.14.1", package = "fuel-gql-client", features = ["test-helpers"] } +f-client = { version = "=0.14.1", package = "fuel-gql-client", features = [ + "test-helpers", +] } fuel-core = { version = "=0.15" } -tokio = { version = "1.21", features = ["macros", "rt-multi-thread"] } \ No newline at end of file +tokio = { version = "1.21", features = ["macros", "rt-multi-thread"] } diff --git a/version-compatibility/Cargo.toml b/version-compatibility/Cargo.toml index cbef3b8f313..792fe5d51bf 100644 --- a/version-compatibility/Cargo.toml +++ b/version-compatibility/Cargo.toml @@ -1,12 +1,12 @@ [workspace] resolver = "2" members = [ - # Add new versions here when testing backwards compatibility between fuel-core-client and fuel-core - "placeholder" + # Add new versions here when testing backwards compatibility between fuel-core-client and fuel-core + "placeholder", ] # exclude previous versions no longer maintained exclude = [ - "0.14.1-0.15.0/fuel-core-0.14.1-client-0.15.0", - "0.14.1-0.15.0/fuel-core-0.15.0-client-0.14.1" + "0.14.1-0.15.0/fuel-core-0.14.1-client-0.15.0", + "0.14.1-0.15.0/fuel-core-0.15.0-client-0.14.1", ] diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index c2635fffcf7..b7f83056d59 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -8,7 +8,9 @@ publish = false [dependencies] clap = { workspace = true, features = ["env", "derive"] } -fuel-core = { path = "../crates/fuel-core", default-features = false, features = ["test-helpers"] } +fuel-core = { path = "../crates/fuel-core", default-features = false, features = [ + "test-helpers", +] } [features] default = ["fuel-core/default"]