feat: improve config and use toml#2047
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
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.
tac0turtle
left a comment
There was a problem hiding this comment.
left some minor comments, overall nice job
| --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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(".") |
There was a problem hiding this comment.
isn't there a home flag on the cobra command that could be used here?
Feels a bit weird
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
What's the difference between this and FlagRootDir?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
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.
…ollkit into feat/rollkit-config-toml
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --home string directory for config and data (default "HOME/.rollkit") |
| RootDir string `mapstructure:"home"` | ||
| DBPath string `mapstructure:"db_path"` |
tac0turtle
left a comment
There was a problem hiding this comment.
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
<!-- 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> -->
Overview