White-Whale-Defi-Platform / white-whale-core

Core contracts for White Whale, The Interchain Liquidity Protocol for the Cosmos.
https://whitewhale.money
MIT License
36 stars 23 forks source link

Remove circular dependencies #290

Closed kaimen-sano closed 6 months ago

kaimen-sano commented 6 months ago

Description and Motivation

rust-analyzer does not play well with circular dependencies. See https://github.com/rust-lang/rust-analyzer/issues/14167 for comments from many rust-analyzer maintainers around this issue.

Fundamentally, Cargo has (fragile) support for dev-dependencies having circular dependencies. This works because Cargo makes a distinction between the integration tests and the actual contract code. This allows us to not have circular dependencies when building our code, even though they may exist without an implementation akin to the Cargo build system.

Since rust-analyzer (and likely other tools in the Rust ecosystem) don't fare well with circular dependencies, we lift the relevant code up to separate crates (which only contain tests) to ensure there is no cyclic dependencies.

In the future, we could take a look at removing white-whale-testing, since it does not provide much value (and likely will lead to a higher chance of circular deps).

Related Issues


Checklist:

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 96.85535% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 88.25%. Comparing base (dea7605) to head (6850e45). Report is 66 commits behind head on release/v2_contracts.

Files Patch % Lines
...dity_hub/pool-network/incentive/src/tests/suite.rs 75.00% 3 Missing :warning:
...acts/liquidity_hub/pool-manager/src/tests/suite.rs 83.33% 1 Missing :warning:
...ol-network/incentive/src/tests/mock_instantiate.rs 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/v2_contracts #290 +/- ## ======================================================== - Coverage 94.68% 88.25% -6.44% ======================================================== Files 240 249 +9 Lines 26854 23823 -3031 ======================================================== - Hits 25427 21025 -4402 - Misses 1427 2798 +1371 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kaimen-sano commented 6 months ago

reviewers: I would recommend filtering the commits when reviewing to only review the primary two commits. Use this link to do so!