From 58e6a15b26cee949b1a8fc420c3ca57bb6f03ac1 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi <106849+romac@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:22:09 +0200 Subject: [PATCH 1/3] Make `serde` an optional dependency, only enabled with the `serde` feature --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fb0c2b9a..0b29ee46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ all-features = true prost = { version = "0.11", default-features = false } bytes = { version = "1.2", default-features = false } tonic = { version = "0.9", default-features = false, optional = true } -serde = { version = "1.0", default-features = false } +serde = { version = "1.0", default-features = false, optional = true } schemars = { version = "0.8", optional = true } subtle-encoding = { version = "0.5", default-features = false } base64 = { version = "0.21", default-features = false, features = ["alloc"] } @@ -54,7 +54,7 @@ default-features = false [features] default = ["std", "client"] std = ["prost/std", "bytes/std", "subtle-encoding/std", "base64/std", "flex-error/std", "ics23/std"] -serde = ["ics23/serde"] +serde = ["dep:serde", "ics23/serde"] client = ["std", "tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] json-schema = ["std", "schemars"] server = ["std", "tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] From a927d551edc3dc04aa46d7283c2c4897c14e0576 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi <106849+romac@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:22:45 +0200 Subject: [PATCH 2/3] Clean up features definition --- Cargo.toml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0b29ee46..458dc0c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,17 +36,16 @@ schemars = { version = "0.8", optional = true } subtle-encoding = { version = "0.5", default-features = false } base64 = { version = "0.21", default-features = false, features = ["alloc"] } flex-error = { version = "0.4", default-features = false } +ics23 = { version = "0.10.2" , default-features = false } -## for codec encode or decode +## Optional: enabled with `features = ["parity-scale-codec"]` parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true } scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true } -## for borsh encode or decode -## need tracking anchor-lang and near-sdk-rs borsh version +## Optional: enabled with `features = ["borsh"]` +## Need tracking anchor-lang and near-sdk-rs borsh version borsh = { version = "0.10", default-features = false, optional = true } -ics23 = { version = "0.10.2" , default-features = false } - [dependencies.tendermint-proto] version = "0.33" default-features = false @@ -55,9 +54,9 @@ default-features = false default = ["std", "client"] std = ["prost/std", "bytes/std", "subtle-encoding/std", "base64/std", "flex-error/std", "ics23/std"] serde = ["dep:serde", "ics23/serde"] -client = ["std", "tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] -json-schema = ["std", "schemars"] -server = ["std", "tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] +client = ["std", "dep:tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] +json-schema = ["std", "serde", "dep:schemars"] +server = ["std", "dep:tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info"] borsh = ["dep:borsh"] proto-descriptor = [] From 722b5d8c5a0e3ac3cf0d1d3fa138548257689f70 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi <106849+romac@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:38:57 +0200 Subject: [PATCH 3/3] Use `check` instead of `clippy` when checking that the powerset of all features compiles The former is slightly faster than the later, which speeds up the CI. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7154214e..f93962bb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -85,7 +85,7 @@ jobs: override: true - uses: taiki-e/install-action@cargo-hack - uses: Swatinem/rust-cache@v1 - - run: cargo hack clippy --feature-powerset --no-dev-deps + - run: cargo hack check --feature-powerset --no-dev-deps test-stable: runs-on: ubuntu-latest