Skip to content

double_key! macro requires serde feature in downstream crates #928

@netrome

Description

@netrome

Problem:

During the 1.85.0 bump, I got this error when building fuel-core:

error: unexpected `cfg` condition value: `serde`
  --> crates/fuel-core/src/graphql_api/storage/balances.rs:26:1
   |
26 | double_key!(CoinBalancesKey, Address, address, AssetId, asset_id);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `backup`, `default`, `fault-proving`, `fuel-core-parallel-executor`, `p2p`, `parallel-executor`, `relayer`, `rocksdb`, `rocksdb-production`, `shared-sequencer`, `smt`, `test-helpers`, and `wasm-executor`
   = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
   = help: try referring to `double_key` crate for guidance on how handle this unexpected cfg
   = help: the macro `double_key` may come from an old version of the `fuel_vm` crate, try updating your dependency with `cargo update -p fuel_vm`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

The problem is that the double_key macro contains a #[cfg(feature = "serde")] attribute, requiring any downstream crate using it to have a serde feature.

See slack thread for more context and solution proposals.

Definition of Done

The macro has been reworked so that we don't require serde for downstream crates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions