Skip to content

refactor(sns): Remove different sns init behavior when cfg(feature = "test") - #1609

Merged
anchpop merged 1 commit into
masterfrom
@anchpop/remove-test-init-param
Sep 25, 2024
Merged

anchpop merged 1 commit into
masterfrom
@anchpop/remove-test-init-param

Conversation

@anchpop

@anchpop anchpop commented Sep 20, 2024 •

Copy link
Copy Markdown
Contributor

Next PR →

Problem

ic-sns-init has :init and :init--test-feature targets, which makes our dependency situation very hairy due to the viral nature of test features. It should be removed, but first ic-sns-init needs to not have any differential behavior between the test and normal configurations.

Solution

Remove the code that ran when cfg(feature = "test") was true. This was code that set up ledger with a principal with a ton of tokens.

This was probably needed at first, but is no longer, because the test configuration of the SNS Gov canister has a mint_tokens API that can be used instead. If this breaks anyone, I will help them switch over to the new API. I think the nns_dapp has already switched to the new API.

Comment thread rs/sns/init/src/lib.rs Resolved
@anchpop
anchpop added this pull request to the merge queue Sep 25, 2024
Merged via the queue into master with commit 5610c60 Sep 25, 2024
@anchpop
anchpop deleted the @anchpop/remove-test-init-param branch September 25, 2024 17:50
github-merge-queue Bot pushed a commit that referenced this pull request Sep 25, 2024
…test_feature configurations (#1606)

[← Previous PR](#1609)

There are two reasons to have a --test_feature target:

1. The crate itself has different functionality when cfg(feature =
"test") is true
2. The crate is a library that depends on crate that has a
--test_feature target, and needs to give the choice to its consumer
whether the dependency has --test_feature enabled.

The second rule is "viral" which has lead to a massive outbreak of
crates with a `--test_feature` target. In fact most of our crates that
had a --test_feature target were in the second category.

The root cause of most of these was that SNS Governance's library had a
`--test_feature` target. This PR:

1. Moves the logic for determining whether we are in "test mode" to the
canister crate (from the library crate)
2. Remove's SNS Governance's library's --test-feature target
3. Remove's SNS Init's --test-feature target, which did nothing after
#1609
4. Reverses the viral outbreak of --test-feature now that these two
crates no longer needed it. The following crates have had their
--test-feature removed entirely:
   1. `//rs/sns/init:init--test_feature`
   2. `//rs/sns/governance:governance--test_feature`
   4. `//rs/nns/governance/api:api--test_feature`
   5. `//rs/nns/sns-wasm:sns-wasm--test_feature`
   6.  `//rs/sns/cli:cli--test_feature`
   7.  `//rs/sns/swap:swap--test_feature`
   8.  `//rs/nns/governance/init:init--test_feature`
   8.  `//rs/nns/gtc:gtc--test_feature`

And some others no longer depend on any --test_feature crates, which is
useful for development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants