Skip to content

feat: improve config and use toml#2047

Merged
tac0turtle merged 55 commits intofeature/exec_apifrom
feat/rollkit-config-toml
Mar 13, 2025
Merged

feat: improve config and use toml#2047
tac0turtle merged 55 commits intofeature/exec_apifrom
feat/rollkit-config-toml

Conversation

@randygrok
Copy link
Copy Markdown
Contributor

Overview

@randygrok randygrok changed the base branch from main to feature/exec_api March 6, 2025 16:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 6, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 generate docstrings to generate docstrings for this 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.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 64.55026% with 134 lines in your changes missing coverage. Please review.

Project coverage is 23.87%. Comparing base (2262207) to head (b3006cc).
Report is 3 commits behind head on feature/exec_api.

Files with missing lines Patch % Lines
node/full.go 16.66% 58 Missing and 2 partials ⚠️
block/manager.go 15.38% 21 Missing and 1 partial ⚠️
cmd/rollkit/commands/run_node.go 54.05% 14 Missing and 3 partials ⚠️
block/sync_service.go 0.00% 10 Missing ⚠️
config/config.go 93.33% 6 Missing and 3 partials ⚠️
cmd/rollkit/commands/toml.go 90.00% 3 Missing and 3 partials ⚠️
config/toml.go 78.94% 3 Missing and 1 partial ⚠️
node/light.go 0.00% 2 Missing ⚠️
node/node.go 0.00% 1 Missing and 1 partial ⚠️
cmd/rollkit/commands/intercept.go 50.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@                 Coverage Diff                  @@
##           feature/exec_api    #2047      +/-   ##
====================================================
- Coverage             24.11%   23.87%   -0.25%     
====================================================
  Files                    52       50       -2     
  Lines                  8231     8433     +202     
====================================================
+ Hits                   1985     2013      +28     
- Misses                 6089     6278     +189     
+ Partials                157      142      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

randygrok added 18 commits March 6, 2025 23:39
This refactoring improves Rollkit’s configuration management with the following changes:
	•	Removes the GetViperConfig() method in favor of direct mapping
	•	Updates mapstructure tags to reflect the configuration structure
	•	Adds new P2P flags and adjusts instrumentation settings
	•	Simplifies the node configuration integration test

The main changes include removing the dependency on Viper for configuration and providing a cleaner structure for handling Rollkit’s configurations.
@Manav-Aggarwal Manav-Aggarwal moved this to In Progress in Evolve Mar 10, 2025
@randygrok randygrok requested review from tac0turtle and tzdybal March 11, 2025 18:39
Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

left some minor comments, overall nice job

Comment on lines -14 to -15
--consensus.create_empty_blocks set this to false to only produce blocks when there are txs or when the AppHash changes (default true)
--consensus.create_empty_blocks_interval string the possible interval between empty blocks (default "0s")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how did this feature work @Manav-Aggarwal or were these flags used?

v.SetConfigType(rollconf.ConfigExtension)
v.AddConfigPath(currentDir)

// Create a map with the configuration structure
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding the fields manually is viper is a bit weird.
Normally, AddConfigPath, BindPFlag, BindEnv, ReadInConfig should be sufficient.
The keys would be the toml key path, matching what this is doing.
Every new field addition would need to be added there otherwise.


// Add search paths in order of precedence
// Current directory
v.AddConfigPath(".")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isn't there a home flag on the cobra command that could be used here?
Feels a bit weird

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, though rollkit config was somehow depending on the file in the root. Let me think about this tomorrow again.

config/config.go Outdated
// FlagEntrypoint is a flag for specifying the entrypoint
FlagEntrypoint = "entrypoint"
// FlagChainConfigDir is a flag for specifying the chain config directory
FlagChainConfigDir = "chain.config_dir"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the difference between this and FlagRootDir?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is related to the way the rollkit intercepts the chain command. For some reason is different than the home, but I did not dig. I can create issue just to verify that it can be merged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle Mar 12, 2025

Choose a reason for hiding this comment

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

@Manav-Aggarwal can you help with this? lets close this out here. Dont want to create issues for simple things and we end up merging techdebt

Copy link
Copy Markdown
Contributor

@yarikbratashchuk yarikbratashchuk Mar 13, 2025

Choose a reason for hiding this comment

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

Seems like it's coming from intercept command rollkitConfig toml config, where chain.config_dir specified which chain config we want to use for intercepted command which essentially mean adding --home flag to the command.
Whereas FlagRootDir specified the directory where rollkit.toml is and is mostly used to check if it's not a rollkit itself, so there is no recursion in intercepting.

### Options inherited from parent commands

```
--home string directory for config and data (default "HOME/.rollkit")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where did home go?

Comment on lines +107 to +108
RootDir string `mapstructure:"home"`
DBPath string `mapstructure:"db_path"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why no toml flag here?

Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle 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, we should add comments and try to use tomlv2 as right now the toml has no comments so the options of what something means is not set

@tac0turtle tac0turtle merged commit 1ea4930 into feature/exec_api Mar 13, 2025
25 checks passed
@tac0turtle tac0turtle deleted the feat/rollkit-config-toml branch March 13, 2025 09:58
@github-project-automation github-project-automation bot moved this from In Progress to Done in Evolve Mar 13, 2025
Manav-Aggarwal pushed a commit that referenced this pull request Mar 20, 2025
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.

NOTE: PR titles should follow semantic commits:
https://www.conventionalcommits.org/en/v1.0.0/
-->

## Overview

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 

Ex: Closes #<issue number>
-->
@tac0turtle tac0turtle removed this from Evolve Apr 24, 2025
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.

6 participants