Repository navigation
refactor(sns): Remove different sns init behavior when cfg(feature = "test") - #1609
Merged
Merged
Conversation
anchpop
marked this pull request as ready for review
September 20, 2024 23:31
anchpop
enabled auto-merge
September 24, 2024 20:13
max-dfinity
reviewed
Sep 25, 2024
max-dfinity
approved these changes
Sep 25, 2024
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
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.
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_tokensAPI that can be used instead. If this breaks anyone, I will help them switch over to the new API. I think thenns_dapphas already switched to the new API.