Skip to content

Comments

config: apply default value if it is not set in config.toml#2987

Closed
zzzckck wants to merge 1 commit intobnb-chain:developfrom
zzzckck:config_default_value
Closed

config: apply default value if it is not set in config.toml#2987
zzzckck wants to merge 1 commit intobnb-chain:developfrom
zzzckck:config_default_value

Conversation

@zzzckck
Copy link
Collaborator

@zzzckck zzzckck commented Mar 25, 2025

Description

To simplify the configuration of config.toml file, node operators can just leave some options empty if they just want the default behavior.
For more background, pls refer: #2986

Rationale

R1: Why use pointer instead of zero value check
Generally, pointer value is preferable to avoid initialising unset variable. It will be nil pointer, instead of a zero-value.
Sometime we just can't tell if the zero-value decoded from the TOML file was set by user specifically or not.
For example, Alice sets the "maxPoolSize" to "0" in config.toml to disable the pool, it's better not to be taken as Alice want the default value.

Example

NA

Changes

NA

@zzzckck zzzckck marked this pull request as draft March 25, 2025 08:45
@zzzckck zzzckck force-pushed the config_default_value branch from f6efa14 to 97cea4b Compare March 26, 2025 07:08
@zzzckck zzzckck marked this pull request as ready for review March 26, 2025 07:22
@zzzckck zzzckck marked this pull request as draft March 28, 2025 06:45
@zzzckck zzzckck force-pushed the config_default_value branch from 6053def to 7563d75 Compare April 14, 2025 06:38
@zzzckck
Copy link
Collaborator Author

zzzckck commented Apr 14, 2025

implemented by #3022

@zzzckck zzzckck closed this Apr 14, 2025
@zzzckck zzzckck deleted the config_default_value branch May 14, 2025 06:11
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.

1 participant