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

refactor(network): call app.Close() on network cleanup #18249

Merged
merged 4 commits into from
Oct 25, 2023
Merged

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Oct 25, 2023

Description

Closes: #18151

  • call app.Close() on network cleanup
  • delete network/testnet and simapp/internal as these are being unused, and lead to flaky simapp ci failure. They were already removed in v0.50 and still have been untouched since.

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 API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building 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
  • run make lint and make test
  • confirmed all CI checks have passed

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 ! in the type prefix if API or client breaking change
  • 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
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Feature: Enhanced the network cleanup process by ensuring the validator application is properly stopped, improving the overall reliability of the system.
  • Refactor: Updated the logging system to use a constant for module identification, enhancing the consistency and readability of log messages. This change will not affect the end-user experience but will improve system maintenance and troubleshooting.

@julienrbrt julienrbrt added backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release labels Oct 25, 2023
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 25, 2023

Walkthrough

The changes primarily focus on enhancing the Network struct by adding a new app field and ensuring its proper cleanup. Additionally, the logging mechanism has been improved by using a constant for module identification, promoting consistency and reducing potential errors.

Changes

File Summary
testutil/network/network.go Introduced a new app field to the Network struct and added cleanup logic for the validator ABCI application.
testutil/network/util.go Imported "cosmossdk.io/log" package, assigned app field in val struct, and updated logger.With function calls to use log.ModuleKey constant.

🐇

In the land of code, where logic intertwines,

Changes are made, as the moon aligns.

A field is born, in the struct so neat,

And cleanup logic, makes it complete.

The logger now sings, with a constant tone,

In the network of code, no module alone. 🌙


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json

@julienrbrt julienrbrt marked this pull request as ready for review October 25, 2023 09:09
@julienrbrt julienrbrt requested a review from a team as a code owner October 25, 2023 09:10
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2d9cfe4 and c75b568.
Files selected for processing (2)
  • testutil/network/network.go (3 hunks)
  • testutil/network/util.go (3 hunks)
Additional comments: 5
testutil/network/util.go (3)
  • 11-11: The import "cosmossdk.io/log" has been added. Ensure that this package is being used in the code and that it is compatible with the existing logging system.

  • 47-47: The app object is now being assigned to the app field of the val object. This change seems to be part of the effort to improve resource management by ensuring that the ABCI application associated with each validator is properly stopped during network cleanup. However, ensure that this does not introduce any unintended side effects, especially in the context of concurrent operations.

  • 114-114: The logger.With function calls in the servergrpc.StartGRPCServer and api.New functions have been updated to use the log.ModuleKey constant. This change improves consistency in log messages. However, ensure that the log.ModuleKey constant is defined and correctly set to "module".

testutil/network/network.go (2)
  • 295-298: The addition of the app field to the Validator struct is a good move. This allows for better resource management by ensuring that the ABCI application associated with each validator is properly stopped during network cleanup. However, please ensure that this new field is properly initialized and used throughout the codebase.

  • 640-643: The change from using a separate error declaration to an inline error check in the startInProcess function call is a good one. It makes the code more concise and readable.

testutil/network/network.go Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c75b568 and 1f80cd0.
Files selected for processing (1)
  • testutil/network/util.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • testutil/network/util.go

@julienrbrt julienrbrt added this pull request to the merge queue Oct 25, 2023
Merged via the queue into main with commit 139a29e Oct 25, 2023
55 checks passed
@julienrbrt julienrbrt deleted the julien/network branch October 25, 2023 10:15
mergify bot pushed a commit that referenced this pull request Oct 25, 2023
mergify bot pushed a commit that referenced this pull request Oct 25, 2023
(cherry picked from commit 139a29e)

# Conflicts:
#	testutil/network/network.go
#	testutil/network/util.go
julienrbrt added a commit that referenced this pull request Oct 25, 2023
…8249) (#18250)

Co-authored-by: Julien Robert <julien@rbrt.fr>
tac0turtle pushed a commit that referenced this pull request Oct 25, 2023
…8249) (#18251)

Co-authored-by: Julien Robert <julien@rbrt.fr>
@faddat faddat mentioned this pull request Mar 20, 2024
12 tasks
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: simapp and Network do not invoke Close()
2 participants