-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove circular dependencies (#290)
rust-analyzer does not play well with circular dependencies. See rust-lang/rust-analyzer#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).
- Loading branch information
Showing
70 changed files
with
452 additions
and
399 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
contracts/liquidity_hub/fee_collector_integration/.editorconfig
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.rs] | ||
indent_size = 4 |
19 changes: 19 additions & 0 deletions
19
contracts/liquidity_hub/fee_collector_integration/.gitignore
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
artifacts | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# IDEs | ||
.vscode/ | ||
.idea/ | ||
*.iml | ||
|
||
# Auto-gen | ||
.cargo-ok |
42 changes: 42 additions & 0 deletions
42
contracts/liquidity_hub/fee_collector_integration/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[package] | ||
name = "fee_collector_integration" | ||
version = "1.1.4" | ||
authors = ["Kerber0x <[email protected]>"] | ||
edition.workspace = true | ||
description = "Integration tests for the fee_collector contract" | ||
license.workspace = true | ||
repository.workspace = true | ||
homepage.workspace = true | ||
documentation.workspace = true | ||
publish.workspace = true | ||
|
||
exclude = [ | ||
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. | ||
"contract.wasm", | ||
"hash.txt", | ||
] | ||
|
||
[lib] | ||
path = "lib.rs" | ||
|
||
[features] | ||
# for more explicit tests, cargo test --features=backtraces | ||
|
||
[dev-dependencies] | ||
cosmwasm-std.workspace = true | ||
cw2.workspace = true | ||
cw20.workspace = true | ||
cw-multi-test.workspace = true | ||
white-whale-std.workspace = true | ||
fee_collector = { path = "../fee_collector" } | ||
terraswap-router = { path = "../pool-network/terraswap_router" } | ||
terraswap-factory = { path = "../pool-network/terraswap_factory" } | ||
terraswap-pair = { path = "../pool-network/terraswap_pair" } | ||
stableswap-3pool = { path = "../pool-network/stableswap_3pool" } | ||
terraswap-token = { path = "../pool-network/terraswap_token" } | ||
fee_distributor = { path = "../fee_distributor" } | ||
whale-lair = { path = "../whale_lair" } | ||
vault_factory = { version = "1.0.0", path = "../vault-network/vault_factory" } | ||
vault = { version = "1.0.0", path = "../vault-network/vault" } | ||
serde.workspace = true | ||
thiserror.workspace = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Cargo requires us to have a target specified in the manifest. | ||
// | ||
// This is, by default, scanned at `src/lib.rs` and `src/main.rs`, as well as the `[lib]` and `[[bin]]` sections of a `Cargo.toml`. | ||
// | ||
// Since we have none, we must manually create a `lib.rs`. |
14 changes: 14 additions & 0 deletions
14
contracts/liquidity_hub/fee_collector_integration/rustfmt.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# stable | ||
newline_style = "Unix" | ||
hard_tabs = false | ||
tab_spaces = 4 | ||
|
||
# unstable... should we require `rustup run nightly cargo fmt` ? | ||
# or just update the style guide when they are stable? | ||
#fn_single_line = true | ||
#format_code_in_doc_comments = true | ||
#overflow_delimited_expr = true | ||
#reorder_impl_items = true | ||
#struct_field_align_threshold = 20 | ||
#struct_lit_single_line = true | ||
#report_todo = "Always" |
This file contains 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
File renamed without changes.
Oops, something went wrong.