test(data_store): lock in InstanceU128/InstanceI128 discriminant fix - #501
Merged
abayomicornelius merged 1 commit intoJul 25, 2026
Conversation
… 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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InstanceU128enum variant makes the crate fail to compile #351 (duplicateInstanceU128enum variant): confirmed theDataKeyenum incontracts/data_store/src/lib.rsno longer declaresInstanceU128(BytesN<32>)twice — the duplicate was already removed as a side effect of an unrelated earlier commit, socargo check -p data-storecurrently compiles clean. This PR locks that fix in properly instead of leaving it as an untested accident:instance_u128_and_i128_do_not_collide_on_same_key, a regression test that writes both anInstanceU128and anInstanceI128value under the same rawBytesN<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.Cargo.lock, which was out of sync withmarket_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 ofdata-store.Verification
cargo check --workspace— cleancargo test -p data-store— 17 passed, 0 failedcargo clippy -p data-store -- -D warnings— cleanpython3 scripts/gen_auth_audit.py --check— in syncNote:
cargo fmt --all -- --checkand the WASM Size Budget build currently fail onmainitself (pre-existing, unrelated formatting drift and awasm32-unknown-unknown/ soroban-sdk toolchain-version incompatibility affecting every recent PR in this repo) — neither is touched or worsened by this change.Closes #351