Skip to content

Cyclic dependencies slowing analyzer #894

Open
@vlopes11

Description

@vlopes11

Summary

We currently have cyclic dependencies on some tests

Steps to reproduce

$ rust-analyzer diagnostics .
[ERROR project_model::workspace] cyclic deps: demo_nft_module(Idx::<CrateData>(145)) -> demo_nft_module(Idx::<CrateData>(145)), alternative path: demo_nft_module(Idx::<CrateData>(145))
[ERROR project_model::workspace] cyclic deps: demo_stf(Idx::<CrateData>(149)) -> demo_stf(Idx::<CrateData>(149)), alternative path: demo_stf(Idx::<CrateData>(149))
[ERROR project_model::workspace] cyclic deps: module_template(Idx::<CrateData>(335)) -> module_template(Idx::<CrateData>(335)), alternative path: module_template(Idx::<CrateData>(335))
[ERROR project_model::workspace] cyclic deps: sov_attester_incentives(Idx::<CrateData>(564)) -> sov_attester_incentives(Idx::<CrateData>(564)), alternative path: sov_attester_incentives(Idx::<CrateData>(564))
[ERROR project_model::workspace] cyclic deps: sov_blob_storage(Idx::<CrateData>(571)) -> sov_blob_storage(Idx::<CrateData>(571)), alternative path: sov_blob_storage(Idx::<CrateData>(571))
[ERROR project_model::workspace] cyclic deps: sov_chain_state(Idx::<CrateData>(575)) -> sov_chain_state(Idx::<CrateData>(575)), alternative path: sov_chain_state(Idx::<CrateData>(575))
[ERROR project_model::workspace] cyclic deps: sov_cli(Idx::<CrateData>(577)) -> demo_stf(Idx::<CrateData>(149)), alternative path: demo_stf(Idx::<CrateData>(149)) -> sov_cli(Idx::<CrateData>(577))
[ERROR project_model::workspace] cyclic deps: sov_evm(Idx::<CrateData>(591)) -> sov_evm(Idx::<CrateData>(591)), alternative path: sov_evm(Idx::<CrateData>(591))
[ERROR project_model::workspace] cyclic deps: sov_modules_api(Idx::<CrateData>(595)) -> sov_bank(Idx::<CrateData>(565)), alternative path: sov_bank(Idx::<CrateData>(565)) -> sov_modules_api(Idx::<CrateData>(595))
[ERROR project_model::workspace] cyclic deps: sov_modules_api(Idx::<CrateData>(595)) -> sov_modules_api(Idx::<CrateData>(595)), alternative path: sov_modules_api(Idx::<CrateData>(595))
[ERROR project_model::workspace] cyclic deps: sov_modules_macros(Idx::<CrateData>(597)) -> sov_bank(Idx::<CrateData>(565)), alternative path: sov_bank(Idx::<CrateData>(565)) -> sov_modules_api(Idx::<CrateData>(595)) -> sov_modules_macros(Idx::<CrateData>(597))
[ERROR project_model::workspace] cyclic deps: sov_modules_macros(Idx::<CrateData>(597)) -> sov_modules_api(Idx::<CrateData>(595)), alternative path: sov_modules_api(Idx::<CrateData>(595)) -> sov_modules_macros(Idx::<CrateData>(597))
[ERROR project_model::workspace] cyclic deps: sov_modules_macros(Idx::<CrateData>(597)) -> sov_modules_macros(Idx::<CrateData>(597)), alternative path: sov_modules_macros(Idx::<CrateData>(597))
[ERROR project_model::workspace] cyclic deps: sov_prover_incentives(Idx::<CrateData>(601)) -> sov_prover_incentives(Idx::<CrateData>(601)), alternative path: sov_prover_incentives(Idx::<CrateData>(601))
[ERROR project_model::workspace] cyclic deps: sov_sequencer_registry(Idx::<CrateData>(608)) -> sov_sequencer_registry(Idx::<CrateData>(608)), alternative path: sov_sequencer_registry(Idx::<CrateData>(608))
[ERROR project_model::workspace] cyclic deps: sov_zk_cycle_macros(Idx::<CrateData>(616)) -> sov_zk_cycle_macros(Idx::<CrateData>(616)), alternative path: sov_zk_cycle_macros(Idx::<CrateData>(616))

Expected Result

There should be no cyclic dependencies as these might slow down the analyzer.

Actual Result

The reason we have that is to enable features for tests:

https://github.com/Sovereign-Labs/sovereign-sdk/blob/ed92c8115cfbd9fc18479de2a587c93aa837d959/module-system/module-implementations/sov-attester-incentives/Cargo.toml#L18C1-L18C1

Ideally, those features should be enabled by the caller (i.e. cargo test --features native). It is possible to achieve that by declaring an integrated test and using the required-features of the manifest file. With that, the tests that requires native would run only if the feature is enabled, allowing the user to test the routines without such feature. The Cargo.toml would look like this:

[[test]]
name = "foo"
required-features = ["native"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    SmallUse this label for quick cleanup and maintenance tasksgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions