Skip to content

test(data_store): lock in InstanceU128/InstanceI128 discriminant fix - #501

Merged
abayomicornelius merged 1 commit into
SO4-Markets:mainfrom
leojay-net:fix/issue-351-duplicate-instance-u128-variant
Jul 25, 2026
Merged

test(data_store): lock in InstanceU128/InstanceI128 discriminant fix#501
abayomicornelius merged 1 commit into
SO4-Markets:mainfrom
leojay-net:fix/issue-351-duplicate-instance-u128-variant

Conversation

@leojay-net

Copy link
Copy Markdown
Contributor

Summary

  • data_store: duplicate InstanceU128 enum variant makes the crate fail to compile #351 (duplicate InstanceU128 enum variant): confirmed the DataKey enum in contracts/data_store/src/lib.rs no longer declares InstanceU128(BytesN<32>) twice — the duplicate was already removed as a side effect of an unrelated earlier commit, so cargo check -p data-store currently compiles clean. This PR locks that fix in properly instead of leaving it as an untested accident:
    • Added instance_u128_and_i128_do_not_collide_on_same_key, a regression test that writes both an InstanceU128 and an InstanceI128 value under the same raw BytesN<32> key and asserts they read back independently. This is the exact property a re-merged/duplicated discriminant would silently break (values from one variant clobbering the other) instead of failing to build — so it guards against a future regression of the same bug class, not just the compile error itself.
    • Regenerated Cargo.lock, which was out of sync with market_util_reader/Cargo.toml's dev-dependencies (data-store, deposit-handler, deposit-vault, gmx-math, market-token, oracle, role-store). This is exactly the kind of transitive breakage the issue description called out for dev-dependents of data-store.

Verification

  • cargo check --workspace — clean
  • cargo test -p data-store — 17 passed, 0 failed
  • cargo clippy -p data-store -- -D warnings — clean
  • python3 scripts/gen_auth_audit.py --check — in sync

Note: cargo fmt --all -- --check and the WASM Size Budget build currently fail on main itself (pre-existing, unrelated formatting drift and a wasm32-unknown-unknown / soroban-sdk toolchain-version incompatibility affecting every recent PR in this repo) — neither is touched or worsened by this change.

Closes #351

… sync Cargo.lock

Issue SO4-Markets#351 reported that the DataKey enum in contracts/data_store/src/lib.rs
declared the InstanceU128(BytesN<32>) variant twice, which failed to compile
and broke every crate that depends on data-store (directly or as a
dev-dependency), including market_util_reader's tests.

The duplicate variant was already removed as an incidental side effect of an
unrelated commit, so the crate currently compiles. This change locks that fix
in and finishes closing out the issue:

- Add instance_u128_and_i128_do_not_collide_on_same_key, a regression test
  that writes both an InstanceU128 and an InstanceI128 value under the same
  raw BytesN<32> key and asserts they read back independently. This is the
  property a re-merged/duplicated discriminant would silently break (instead
  of failing to build), so it guards against a future regression of the same
  class of bug.
- Regenerate Cargo.lock so market-util-reader's dev-dependencies (data-store,
  deposit-handler, deposit-vault, gmx-math, market-token, oracle, role-store)
  declared in its Cargo.toml are actually reflected in the lockfile — the
  stale lockfile was exactly the kind of transitive breakage the issue
  description warned about for dev-dependents of data-store.

Verified: cargo check --workspace, cargo test -p data-store (17 passed),
cargo clippy -p data-store -- -D warnings, and
python3 scripts/gen_auth_audit.py --check all pass clean.

Closes SO4-Markets#351
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@leojay-net Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data_store: duplicate InstanceU128 enum variant makes the crate fail to compile

2 participants