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

Devnet runs only in-memory #257

Merged
merged 1 commit into from
Oct 17, 2024
Merged

Devnet runs only in-memory #257

merged 1 commit into from
Oct 17, 2024

Conversation

joshklop
Copy link
Collaborator

@joshklop joshklop commented Oct 17, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced development configurations for the Monomer command, allowing for flexible database usage in development mode.
    • New flags introduced for configuring development settings.
  • Bug Fixes

    • Removed the monogen target to streamline the build process, ensuring all other build commands remain functional.
  • Documentation

    • Updated method signatures to reflect new parameters for better clarity on usage in development scenarios.

Copy link
Contributor

coderabbitai bot commented Oct 17, 2024

Walkthrough

The pull request modifies the Makefile by removing the monogen target and its associated build command, while leaving other targets unchanged. Additionally, it enhances the integrations/integrations.go file by updating several functions to support new development configuration flags, specifically for the Monomer command. The changes allow for improved handling of the development network mode and database backend configuration, enhancing the flexibility of the Monomer node during development.

Changes

File Change Summary
Makefile Removed the monogen target and its associated build command.
integrations/integrations.go Updated AddMonomerCommand to include new flags; modified startApp, startMonomerNode, and startCommandHandler to support isDevnet parameter for development configurations.

Possibly related PRs

  • Add monogen tool #213: The main PR removes the monogen target from the Makefile, while this retrieved PR adds a monogen target, indicating a direct relationship in terms of modifications to the Makefile regarding the monogen functionality.
  • Add keplr integration for L2 devnet chain #246: This PR modifies the integrations/integrations.go file, which is also altered in the main PR. Both PRs involve changes to the same file, although the specific changes differ, indicating a potential overlap in the context of the Monomer project.

Suggested reviewers

  • natebeauregard

🐰 In the meadow, I hop with glee,
The monogen target has set me free!
With flags for dev, we dance and play,
Enhancing our code in a joyful way.
So let’s build and run, oh what a sight,
In our rabbit hole, everything’s just right! 🌼


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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6320920 and f7b5f17.

📒 Files selected for processing (2)
  • Makefile (0 hunks)
  • integrations/integrations.go (7 hunks)
💤 Files with no reviewable changes (1)
  • Makefile
🧰 Additional context used
🔇 Additional comments (13)
integrations/integrations.go (13)

121-122: Retrieve the 'dev' flag correctly

The isDevnet variable is correctly set by retrieving the flagDev value from the configuration. This allows the application to determine if it should run in development mode.


123-123: Pass 'isDevnet' to 'startApp' function

Passing the isDevnet flag to the startApp function ensures that the application can adjust its behavior based on the development mode setting.


163-163: Include 'isDevnet' when starting in-process

Passing the isDevnet flag to the startInProcess function propagates the development mode setting, allowing for conditional logic based on this flag within the function.


Line range hint 168-172: Conditionally start OPDevnet in development mode

The code correctly starts the OPDevnet only when isDevnet is true, which is appropriate for distinguishing between development and production environments.


319-325: Add 'devnet' parameter to 'startApp' function

Including the devnet parameter in the startApp function signature allows the function to modify its behavior based on the development mode. This enhances the flexibility of the application during development.


322-325: Override database backend for development mode

The code correctly overrides the backendType to use dbm.MemDBBackend when devnet is true, ensuring that the application uses an in-memory database during development.


354-354: Add 'isDevnet' parameter to 'startInProcess' function

Including the isDevnet parameter in the startInProcess function signature allows the function to operate differently in development mode, which is important for testing and development purposes.


359-359: Pass 'isDevnet' to 'startMonomerNode' function

Passing the isDevnet flag to the startMonomerNode function ensures that any development-specific configurations are applied when initializing the Monomer node.


404-404: Include 'devnet' parameter in 'startMonomerNode' function

Adding the devnet parameter to the startMonomerNode function signature allows the node to adjust its behavior according to the development mode setting.


421-425: Override database backend in Monomer node for development

The code properly overrides the backendType to dbm.MemDBBackend when devnet is true within the startMonomerNode function. Logging this override provides transparency during development.


428-431: Initialize in-memory block store for development mode

When the backendType is dbm.MemDBBackend, the block store is correctly initialized using an in-memory filesystem. This is appropriate for development environments where persistence is not required.


443-445: Initialize transaction database with correct backend

Creating the txdb with the specified backendType ensures consistency in database configurations throughout the application.


449-451: Initialize mempool database with correct backend

The mempooldb is correctly initialized using the specified backendType, aligning with the overall database configuration strategy.

Comment on lines +121 to +123
isDevnet := svrCtx.Viper.GetBool(flagDev)

app, err := startApp(env, svrCtx, appCreator, isDevnet, opts)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Standardize naming of the development mode flag

The variable and parameter names for the development mode flag are inconsistently named (isDevnet and devnet) across functions:

  • isDevnet in startCommandHandler and when passing to startApp and startInProcess.
  • devnet in startApp and startMonomerNode.

For improved code readability and maintainability, consider using a consistent naming convention for this flag throughout the codebase.

Apply this diff to standardize the naming to devnet:

 // In startCommandHandler function
-	isDevnet := svrCtx.Viper.GetBool(flagDev)
+	devnet := svrCtx.Viper.GetBool(flagDev)

-	app, err := startApp(env, svrCtx, appCreator, isDevnet, opts)
+	app, err := startApp(env, svrCtx, appCreator, devnet, opts)

 // Passing to startInProcess
-	if err := startInProcess(..., isDevnet, ...); err != nil {
+	if err := startInProcess(..., devnet, ...); err != nil {

 // In startInProcess function signature
-	func startInProcess(..., isDevnet bool, ...) error {
+	func startInProcess(..., devnet bool, ...) error {

 // Passing to startMonomerNode
-	if err := startMonomerNode(..., isDevnet); err != nil {
+	if err := startMonomerNode(..., devnet); err != nil {

Also applies to: 319-325, 354-354, 359-359, 404-404

@natebeauregard natebeauregard merged commit 4f604e0 into main Oct 17, 2024
16 checks passed
@natebeauregard natebeauregard deleted the joshklop.devnet-in-mem branch October 17, 2024 23:24
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.

2 participants