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

test(testnode): configure custom min gas price #3680

Merged
merged 18 commits into from
Jul 16, 2024

Conversation

rootulp
Copy link
Collaborator

@rootulp rootulp commented Jul 13, 2024

Context: celestiaorg/celestia-node#3453 (comment)

Fix testnode so that it is possible to query the local min gas price again. I plan on backporting this to v2.x to fix celestia-node integration tests which query local min gas price.

@rootulp rootulp self-assigned this Jul 13, 2024
@rootulp
Copy link
Collaborator Author

rootulp commented Jul 14, 2024

The sdk context on v1.x is populated with a min gas price but on main it isn't. I think this regression was caused by a refactor to testnode b/c the v1.x testnode sets min gas price here but on main, it uses the default app creator which doesn't set it.

encodingConfig, //encoding config
0, // upgrade height v2
simapp.EmptyAppOptions{},
baseapp.SetMinGasPrices(fmt.Sprintf("%v%v", appconsts.DefaultMinGasPrice, app.BondDenom)),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this line is the fix

Copy link
Member

Choose a reason for hiding this comment

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

when did this break? out of curiosity

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It works on v1.x but it is broken on main / v2.x. I think it broken during a refactor to testnode, potentially https://github.com/celestiaorg/celestia-app/pull/1991/files#diff-1408d16ad448ff1be464a1eb5af128736aca3302ba3a5d7fbebd7de86473a478R107

@rootulp rootulp added the backport:v2.x PR will be backported automatically to the v2.x branch upon merging label Jul 14, 2024
@rootulp rootulp marked this pull request as ready for review July 15, 2024 20:15
@rootulp rootulp requested a review from a team as a code owner July 15, 2024 20:15
@rootulp rootulp requested review from cmwaters and evan-forbes and removed request for a team July 15, 2024 20:15
Copy link
Contributor

coderabbitai bot commented Jul 15, 2024

Walkthrough

Walkthrough

Recent changes enhance testing within the project by introducing new test cases and updating the test infrastructure. New test cases for querying minimum gas prices are added, and transaction handling in tests is refined. Additionally, configuration for test nodes is expanded with customizable application creators.

Changes

File Change Summary
app/test/testnode_test.go Added imports for new packages (v2, minfee, nodeservice, assert, require) and new test cases.
pkg/user/tx_client_test.go Modified test environment setup, transaction handling, and assertions for transaction submission.
test/util/testnode/config.go Added imports, replaced cmd.NewAppServer with DefaultAppCreator(), and added DefaultAppCreator() and CustomAppCreator(minGasPrice string) functions.

Sequence Diagram(s)

sequenceDiagram
    participant Tester as Test Suite
    participant Config as Configurator
    participant Network as Test Network
    participant TxClient as Transaction Client

    Tester->>Config: Load Default Config
    Config->>Network: Create Test Network with Config
    Network->>Tester: Provide Test Context

    Tester->>TxClient: Submit Transaction with Custom Gas Limit
    TxClient->>Network: Process Transaction
    Network->>TxClient: Return Response
    TxClient->>Tester: Assert Gas Limit in Response
Loading
sequenceDiagram
    participant Tester as Test Suite
    participant Config as Configurator
    participant Network as Test Network
    participant MinFeeClient as Min Gas Price Client

    Tester->>Config: Load Config with Custom App Creator
    Config->>Network: Create Test Network with Custom App
    Network->>Tester: Provide Test Context

    Tester->>MinFeeClient: Query Network Min Gas Price
    MinFeeClient->>Network: Request Min Gas Price
    Network->>MinFeeClient: Return Min Gas Price
    MinFeeClient->>Tester: Validate Min Gas Price
Loading

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies 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 testing code 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 and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rootulp rootulp enabled auto-merge (squash) July 15, 2024 20:19
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.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
app/test/testnode_test.go (1)

34-42: New test case: Query local minimum gas price

This test case initializes a network, creates a service client, and checks the local minimum gas price against a hardcoded expected value. The test logic is clear, and the use of require.NoError and assert.Equal ensures proper error handling and value checking. However, the hardcoded minimum gas price value might need revisions if the configuration changes.

Consider externalizing the hardcoded gas price value to a configuration or constant for easier maintenance.

@celestia-bot celestia-bot requested a review from a team July 16, 2024 17:34
@rootulp rootulp merged commit 5b27eba into celestiaorg:main Jul 16, 2024
34 checks passed
mergify bot pushed a commit that referenced this pull request Jul 16, 2024
Context:
celestiaorg/celestia-node#3453 (comment)

Fix testnode so that it is possible to query the local min gas price
again. I plan on backporting this to v2.x to fix celestia-node
integration tests which query local min gas price.

(cherry picked from commit 5b27eba)

# Conflicts:
#	app/test/testnode_test.go
@rootulp rootulp deleted the rp/test-testnode-gas-price branch July 16, 2024 20:59
rootulp added a commit that referenced this pull request Jul 17, 2024
Context:
celestiaorg/celestia-node#3453 (comment)

Fix testnode so that it is possible to query the local min gas price
again. I plan on backporting this to v2.x to fix celestia-node
integration tests which query local min gas price.<hr>This is an
automatic backport of pull request #3680 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Rootul P <rootulp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:v2.x PR will be backported automatically to the v2.x branch upon merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants