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

refactor(simapp,confix): change example of custom app.toml extension #18496

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Nov 17, 2023

Description

Backporting to eventually tag a future version of confix later when we have more new features/fixes.

Closes: #18494


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Features

    • Introduced a new log level configuration to enhance the default logging behavior, focusing on error logs.
  • Bug Fixes

    • Removed invalid non-SDK configurations from app.toml migration templates to prevent potential issues during migrations.
  • Refactor

    • Updated the initialization process to include a custom configuration structure for better customization and control.

@julienrbrt julienrbrt added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Nov 17, 2023
@julienrbrt julienrbrt requested a review from a team as a code owner November 17, 2023 12:18
Copy link
Contributor

coderabbitai bot commented Nov 17, 2023

Walkthrough

The recent updates involve refining the application's logging behavior and configuration management. A new log level setting has been introduced to minimize the output to error logs by default, with specific exclusions for peer-to-peer and state logs. Additionally, there's an enhancement in the application configuration setup, incorporating a custom configuration structure. The changes also include cleanup in the configuration migration templates by removing non-SDK related configurations.

Changes

File Summary
simapp/simd/cmd/config.go Introduced error-only default log level, added custom configuration field, and updated initAppConfig to handle a new custom config struct.
tools/confix/CHANGELOG.md Documented the removal of invalid non-SDK config entries from app.toml migration templates.

🐇 In the fall of code, we hop to the log, 🍂
Where errors alone speak, and configs are bespoke.
With each careful commit, our software takes flight,
On this day in history, our code grows more tight. 🚀


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

@julienrbrt julienrbrt changed the title refactor(simapp,config): change example of custom app.toml extension refactor(simapp,confix): change example of custom app.toml extension Nov 17, 2023
@github-actions github-actions bot added the C:Confix Issues and PR related to Confix label Nov 17, 2023
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a27cfa0 and 48da887.
Files ignored due to filter (4)
  • tools/confix/data/v0.45-app.toml
  • tools/confix/data/v0.46-app.toml
  • tools/confix/data/v0.47-app.toml
  • tools/confix/data/v0.50-app.toml
Files selected for processing (2)
  • simapp/simd/cmd/config.go (4 hunks)
  • tools/confix/CHANGELOG.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • tools/confix/CHANGELOG.md
Additional comments: 4
simapp/simd/cmd/config.go (4)
  • 15-23: The changes to the initCometBFTConfig function set a default log level that displays error logs by default, except for p2p and state which are set to info. This is a sensible default for many applications as it reduces the verbosity of the logs, focusing on errors which are typically more important for monitoring and debugging. However, it's important to ensure that this change is communicated to users who may rely on more verbose logging for their use cases.

  • 73-89: The introduction of a CustomConfig struct within the initAppConfig function allows for extending the app.toml configuration with additional custom fields. This is a flexible approach that enables developers to add custom configuration options without modifying the core configuration structs. It's important to ensure that the documentation is updated to reflect how developers can use and extend this custom configuration.

  • 98-104: The comment explains the implications of setting srvCfg.MinGasPrices to an empty string versus a non-empty value. This is a critical configuration that must be clearly documented, as it affects validator node startup and operation. The choice to set MinGasPrices to "0stake" in simapp is appropriate for a simulation application, but it's crucial that this is not used as a default in production environments where it could lead to spam transactions if validators do not override it.

  • 108-125: The CustomAppConfig struct is set up with a default CustomField value of "anything". This serves as an example for developers on how to set up and use custom fields. The appended custom app template includes the custom field in the configuration file, which is a good practice for making the configuration extensible. It's important to ensure that the parsing and usage of this custom field are properly implemented and tested.

@@ -15,6 +15,9 @@ import (
func initCometBFTConfig() *cmtcfg.Config {
cfg := cmtcfg.DefaultConfig()

// only display only error logs by default except for p2p and state
cfg.LogLevel = "*:error,p2p:info,state:info"
Copy link
Member Author

@julienrbrt julienrbrt Nov 17, 2023

Choose a reason for hiding this comment

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

Thought you may like this @tac0turtle as a default for a prettier simapp logger, but does not change the SDK default.=

@tac0turtle
Copy link
Member

is there a need to backport this?

@julienrbrt
Copy link
Member Author

julienrbrt commented Nov 17, 2023

is there a need to backport this?

Yes, later on we can tag a new version of Confix with the updated templates. And Confix is tagged from v0.50 branch

@tac0turtle
Copy link
Member

is there a need to backport this?

Yes, later on we can tag a new version of Confix with the updated templates. And Confix is tagged from v0.50 branch

why does confix need to be aware of this change? this is an example or it has been bleeding elsewhere?

@tac0turtle tac0turtle added this pull request to the merge queue Nov 17, 2023
Merged via the queue into main with commit c0ebebb Nov 17, 2023
63 of 65 checks passed
@tac0turtle tac0turtle deleted the julien/custom-cfg branch November 17, 2023 14:47
mergify bot pushed a commit that referenced this pull request Nov 17, 2023
…18496)

(cherry picked from commit c0ebebb)

# Conflicts:
#	simapp/simd/cmd/config.go
#	tools/confix/CHANGELOG.md
@julienrbrt
Copy link
Member Author

is there a need to backport this?

Yes, later on we can tag a new version of Confix with the updated templates. And Confix is tagged from v0.50 branch

why does confix need to be aware of this change? this is an example or it has been bleeding elsewhere?

When I created the SDK default config for Confix, I used simapp, which had this config in its app.toml
Look https://github.com/cosmos/cosmos-sdk/pull/18496/files#diff-b52afdf0ede16bcbe24efbcdec60bd97673b6e3c13554762bc04d888881f82d3, which means confix migrate will add those, while it isn't necessary.

julienrbrt added a commit that referenced this pull request Nov 17, 2023
@webmaster128
Copy link
Member

🌷 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release C:Confix Issues and PR related to Confix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove outdated example [wasm] config
3 participants