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

chore: switch from cosmos-sdk/network to testnode package #3118

Merged
merged 8 commits into from
Feb 22, 2024

Conversation

cmwaters
Copy link
Contributor

@cmwaters cmwaters commented Feb 19, 2024

Closes: #829

This refactors the three tests we have that use the CLI commands: mint, blob and blobstream to use the testnode package instead of cosmos-sdk's network package.

The motivating reason for this is that cosmos-sdk's network package doesn't support initialising the ConsensusParams in the genesis file which we need to set the app version correctly

@cmwaters cmwaters self-assigned this Feb 21, 2024
@cmwaters cmwaters marked this pull request as ready for review February 21, 2024 15:27
Copy link
Contributor

coderabbitai bot commented Feb 21, 2024

Walkthrough

Walkthrough

The recent updates focus on enhancing network testing by introducing a more unified and efficient approach, notably through the adoption of a new testnode framework. This revamp includes adjustments to initial balances, API address handling, improved timeout management, and a shift from hardcoded values to constants. Additionally, the integration test suite and various client tests have been overhauled to align with the new testing paradigm, aiming for faster and more reliable network tests.

Changes

Files Change Summary
test/testground/.../consensus_node.go
test/util/testnode/node_interaction_api.go
Added apiAddress parameter and handling.
test/util/genesis/accounts.go
test/util/genesis/document.go
test/util/testnode/config.go
test/util/testnode/utils.go
Introduced and utilized DefaultInitialBalance.
test/util/testnode/network.go Refactored network initialization and cleanup.
test/util/testnode/rpc_client.go Enhanced GRPC server setup and added API server start function.
x/.../client/testutil/integration_test.go
x/.../client/query_test.go
x/.../client/suite_test.go
x/mint/client/testutil/grpc_test.go
x/mint/client/testutil/suite_test.go
Updated test suites and configurations to use testnode.
x/mint/types/constants.go Added initialInflationRateAsLegacyDec and related function.
x/upgrade/legacy_test.go Simplified Tendermint config setup.

Assessment against linked issues

Objective Addressed Explanation
Consolidate network testing code (#829) The changes align with the objectives by integrating the new testnode for network tests, aiming to replace the old cosmos-sdk network tests. This is evident in the refactoring of integration tests and the introduction of CLI execution functionality for testnode.
Decrease in integration test times (#829) While the changes are designed to improve testing efficiency, such as through faster block production, there's no direct evidence in the summary that explicitly confirms a decrease in test times. The expectation is logical, but actual performance metrics are not provided.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your comments unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

rootulp
rootulp previously approved these changes Feb 21, 2024
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the clean up

Comment on lines 42 to 45
func InitialInflationRateAsLegacyDec() math.LegacyDec {
return initialInflationRateAsLegacyDec
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

appears unused so proposal to delete

Suggested change
func InitialInflationRateAsLegacyDec() math.LegacyDec {
return initialInflationRateAsLegacyDec
}

@@ -28,12 +31,18 @@ var (
initialInflationRateAsDec = sdk.NewDecWithPrec(InitialInflationRate*1000, 3)
disinflationRateAsDec = sdk.NewDecWithPrec(DisinflationRate*1000, 3)
targetInflationRateAsDec = sdk.NewDecWithPrec(TargetInflationRate*1000, 3)

initialInflationRateAsLegacyDec = math.LegacyNewDecWithPrec(InitialInflationRate*1000, 3)
Copy link
Collaborator

Choose a reason for hiding this comment

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

appears unused so proposal to delete

Suggested change
initialInflationRateAsLegacyDec = math.LegacyNewDecWithPrec(InitialInflationRate*1000, 3)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was going to

x/upgrade/legacy_test.go Outdated Show resolved Hide resolved
staheri14
staheri14 previously approved these changes Feb 21, 2024
Copy link
Collaborator

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

Looks good!

@cmwaters cmwaters dismissed stale reviews from staheri14 and rootulp via b03fd36 February 22, 2024 10:27
@celestia-bot celestia-bot requested a review from a team February 22, 2024 10:27
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

nice! thanks for doing this!

@cmwaters cmwaters merged commit 62f40dc into main Feb 22, 2024
33 checks passed
@cmwaters cmwaters deleted the cal/refactor-integration-tests branch February 22, 2024 12:48
ninabarbakadze pushed a commit to ninabarbakadze/celestia-app that referenced this pull request Apr 2, 2024
…g#3118)

Closes: celestiaorg#829

This refactors the three tests we have that use the CLI commands:
`mint`, `blob` and `blobstream` to use the `testnode` package instead of
`cosmos-sdk`'s `network` package.

The motivating reason for this is that cosmos-sdk's network package
doesn't support initialising the `ConsensusParams` in the genesis file
which we need to set the app version correctly

---------

Co-authored-by: Rootul P <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate network testing code
4 participants