Skip to content

Commit 705dc70

Browse files
scarmuegaclaude
andauthored
fix: make serde a non-optional dependency of pallas-primitives (#779)
The crate gated `serde` behind the `json` feature, but used `serde::{Serialize, Deserialize}` unconditionally across the era models, so building with `default-features = false` failed to compile. Since `pallas-codec` and `pallas-crypto` already depend on serde unconditionally, gating it here gave no real benefit anyway. The `json` feature now gates only `serde_json`. A CI job checks pallas-primitives in isolation, since a workspace-wide `--no-default-features` build unifies the feature back on. Fixes #740 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3e1738e commit 705dc70

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@ jobs:
9292
- uses: Swatinem/rust-cache@v2
9393
- run: cargo check --workspace --all-targets ${{ matrix.flags }}
9494

95+
isolated-features:
96+
name: Isolated no-default-features
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v4
100+
with:
101+
submodules: true
102+
- uses: dtolnay/rust-toolchain@stable
103+
- uses: Swatinem/rust-cache@v2
104+
# A workspace-wide --no-default-features build unifies features across
105+
# members, so it always pulls pallas-primitives in with `json` enabled.
106+
# Check the crate in isolation to catch missing serde feature gating.
107+
- run: cargo check -p pallas-primitives --no-default-features
108+
95109
msrv:
96110
name: MSRV (1.88)
97111
runs-on: ubuntu-latest

pallas-primitives/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ authors.workspace = true
1515
hex.workspace = true
1616
pallas-crypto.workspace = true
1717
pallas-codec.workspace = true
18-
serde = { workspace = true, optional = true }
18+
serde = { workspace = true }
1919
serde_json = { workspace = true, optional = true }
2020

2121
[dev-dependencies]
2222
proptest = { workspace = true, features = ["alloc"] }
2323
test-case = "3.3.1"
2424

2525
[features]
26-
json = ["serde", "serde_json"]
26+
json = ["serde_json"]
2727
default = ["json"]
2828
relaxed = ["pallas-crypto/relaxed"]

0 commit comments

Comments
 (0)