Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: only allow chains with at least one active validator to launch #2399

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

insumity
Copy link
Contributor

@insumity insumity commented Nov 13, 2024

Description

Closes: #2397

Testing
Introduced an interchain test.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Included the correct type prefix in the PR title
  • Added ! to the type prefix if the change is state-machine breaking
  • Confirmed this PR does not introduce changes requiring state migrations, OR migration code has been added to consumer and/or provider modules
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Followed the guidelines for building SDK modules
  • Included the necessary unit and integration tests
  • Added a changelog entry to CHANGELOG.md
  • Included comments for documenting Go code
  • Updated the relevant documentation or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed
  • If this PR is library API breaking, bump the go.mod version string of the repo, and follow through on a new major release

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! the type prefix if the change is state-machine breaking
  • confirmed this PR does not introduce changes requiring state migrations, OR confirmed migration code has been added to consumer and/or provider modules
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage

@github-actions github-actions bot added the C:x/provider Assigned automatically by the PR labeler label Nov 13, 2024
@insumity insumity force-pushed the insumity/at-least-one-active-validator branch 2 times, most recently from 151a2b1 to bcc9dd0 Compare November 13, 2024 10:19
@insumity insumity force-pushed the insumity/at-least-one-active-validator branch from bcc9dd0 to 0083f15 Compare December 2, 2024 16:14
@github-actions github-actions bot added the C:Testing Assigned automatically by the PR labeler label Dec 2, 2024
@insumity insumity requested review from stana-miric and mpoke December 2, 2024 16:15
@insumity insumity marked this pull request as ready for review December 2, 2024 16:15
@insumity insumity requested a review from a team as a code owner December 2, 2024 16:15
Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic LGTM. Just one comment about the tests.

TestWalletsNumber = 15 // Ensure that test accounts are used in a way that maintains the mutual independence of tests
// ValidatorCount is set to 2, so we have one active and one inactive (i.e., outside the active set) validator.
// Note that the provider has at most 1 validator (see `chain_spec_provider.go`).
ValidatorCount = 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this done for al the tests or only for the new one introduced? We should avoid adding complexity to all tests. If you need multiple validators for a certain test, we should just add a new configuration.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will affect all tests in the suite that use this specification, i.e., the entire ProviderSuite. We could create a separate suite to support running tests on a suite with multiple nodes while keeping the existing suite where the provider chain has only one node (ProviderSuite, ProviderMultiNodeSuite).
Another option is to keep it as Karolos implemented and handle the optional nodes in the suite setup, so tests that need additional nodes can simply start the extra validator(s) as the interchaintest framework supports that.
The difference is that with separate suites, we don’t need to start/stop nodes dynamically, but the provider chain will be started twice. I'm not sure what the optimal solution would be.
If you'd like, we can leave it as Karolos implemented in this PR, and I can split it or add dynamic node management in a follow-up PR. I also plan to improve how "independent" test accounts are fetched, so I can handle everything in that PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Let's do that.
Regarding what option to choose, go with the one easier to implement.

// Scenario 1: Inactive validators opts in, the chain does not launch.
// Scenario 2: Active validator opts in, the chain launches.
func (s *ProviderSuite) TestOptInChainCanOnlyStartIfActiveValidatorOptedIn() {
testAcc := s.Provider.TestWallets[2].FormattedAddress()
Copy link
Collaborator

@stana-miric stana-miric Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a separate PR so that we don't have to be aware of which index is in use during the tests, and it will be handled under the hood. For now, I would use an account that isn't used in other tests, for example, account s.Provider.TestWallets[12] (just to avoid possible an error where an invalid account number is sent if 2 tests send the tx in the same time). I'll try to fix this as soon as possible since the current solution isn't the most elegant.

@mpoke mpoke added this pull request to the merge queue Dec 3, 2024
Merged via the queue into main with commit 331c1c9 Dec 3, 2024
18 checks passed
@mpoke mpoke deleted the insumity/at-least-one-active-validator branch December 3, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Testing Assigned automatically by the PR labeler C:x/provider Assigned automatically by the PR labeler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Require one active validator to opt-in for a consumer chain to launch
3 participants