-
Notifications
You must be signed in to change notification settings - Fork 12
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
Organize Configuration #538
Comments
A new configuration draftGoal
Node configuration filesconfig.yml will contain a node's configuration for host and modules. For modules' configurations, we will use parameter names used in param-default section in link descriptor. Examplehost:
mining:
mem_pool_mem_limit: 512
apps:
thread-pool-size: 16
account-check-tx: "full" CLI argsCLI args can change configurations set by the "Node configuration file". For modules' configurations, it will use the names described in param-default section in the lik descriptor. Example$ foundry --mem-pool-mem-limit 512 --thread-pool-size 16 --account-check-tx full Expected problemsMerging CLI argument config files looks difficult. foundry.yml that contains CLI arguments information: App descriptorThe app descriptor will have the same configuration except for imports and exports. Examplemodules:
module-account:
genesis-config:
- 0a6902
tags:
previliged: true
...
host:
tendermint:
"timeoutPropose": 10000,
"timeoutProposeDelta": 5000,
"timeoutPrevote": 10000,
"timeoutPrevoteDelta": 5000,
"timeoutPrecommit": 10000,
"timeoutPrecommitDelta": 5000,
"timeoutCommit": 10000
genesis:
"seal":
"tendermint":
"prev_view": "0x0",
"cur_view": "0x0",
"precommits": [ ... ]
author: "xxdd",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x"
transactions:
account: module-account
stamp: module-stamp
token: module-token [modules.module-account]
genesis-config = ["0a6902"]
tags = { privileged = true }
[host.tendermint]
timeoutPropose = 10000
timeoutProposeDelta = 5000
timeoutPrevote = 10000
timeoutPrevoteDelta = 5000
timeoutPrecommit = 10000
timeoutPrecommitDelta = 5000
timeoutCommit = 10000
[host.genesis]
author = "xxdd"
timestamp = "0x00"
parentHash = "0x0000000000000000000000000000000000000000000000000000000000000000"
extraData = "0x"
[host.genesis.seal.tendermint]
prev_view = "0x0"
cur_view = "0x0"
precommits = []
[transactions]
account = "module-account"
stamp = "module-stamp"
token = "module-token" Concerns
Link descriptorThe link descriptor contains imports and exports of modules. The link descriptor does not contain any blockchain concepts. It can be used outisde of blockchain context. Param alias and default valueA module receives init-config parameters to customize it's behavior. To make config file and CLI argument be able to override the values, app descriptor file should have the parameter in param-aliases and param-defaults. Let's asume that the module "module-account" has "some-configuration" parameter. We can alias it to "hello" using the config below: modules:
module-account:
init-config: ["some-configuration"]
param-aliases:
module-account:
some-configuration: hello [modules.module-account]
init-config = ["some-configuration"]
[param-aliases.module-account]
some-configuration = "hello" Now a user can use configuration file or CLI argument "--hello" to set module-account's "some-configuration". Exampledefault-sandboxer: single-process
modules:
module-account:
hash: a010000000012345678901234567890123456789012345678901234567890123
init-config: [
"some-configuration"
]
exports:
stateful:
stateful: {}
tx-owner:
tx-owner: {}
account-manager:
account-manager: {}
get-account-and-seq:
get-account-and-seq: {}
handle-graphql-request:
handle-graphql-request: {}
imports:
token-manager: module-token/token-manager
param-aliases:
module-accout:
some-configuration: hello
param-defaults:
hello: Annyeong Haseyo default-sandboxer = "single-process"
[modules.module-account]
hash = "a010000000012345678901234567890123456789012345678901234567890123"
init-config = ["some-configuration"]
exports.stateful.stateful = {}
exports.tx-owner.tx-owner = {}
exports.account-manager.account-manager = {}
exports.get-account-and-seq.get-account-and-seq = {}
exports.handle-graphql-request.handle-graphql-request = {}
imports.token-manager = "module-token/token-manager"
[param-aliases.module-accout]
some-configuration = "hello"
[param-defaults]
hello = "Annyeong Haseyo" Plan
|
@majecty I have some comments.
|
In my opinion, the config may also contain overrides for app descriptor under a section designated so. Also I agree with @majecty on the complexity of the code merging CLI options into the config. By sacrificing a bit of type safety in merging them and postponing type checking to a later stage (for instance, when actually stuffing out structs representing the config with serde), I think it is more or less possible to reduce the complexity. |
Another comment. If we have module hashes in link descriptor, then the corresponding app descriptor may use names assigned in the link descriptor. |
|
I think I need to think a bit more about where tags will be specified. Tags are conceived as metadata for some parties (definitely the coordinator) to check as prerequisites for assigning previleges to some modules (that's the "express-that-you-know-what-you-do" thing). Since tags are not actually used yet, I will need to think a bit more. Let me come back with details soon. |
@majecty |
Do you mean the the node configuration can override values in app descriptor? I thought CLI arguments are only for node configuration. Changing a network's configuration using CLI args makes user easy to make mistakes. Could you give me an example parameter that described in the app descriptor and configurable in CLI? |
I agree with you. We can make it work first and enhance it later. Merging configs perfectly need too much work than it's benefit. |
Looks good idea. I've updated it. |
@junha1 There are two properties in configurations.
The goal of this draft is to split configurations of node and network. If you don't agree with the goal, let's make a consensus on the goal first. |
Let's discuss on meeting. |
The TOML versions look good to me. |
DONE
|
Configuration Files
TOML configuration file
All configurations described in the TOML configuration file can be customized in CLI arguments.
It has configurations for a node. Each node can change the values in the TOML configuration file freely. It does not affect network behavior.
For example, you can change the port number or data directory in the TOML configuration file.
Scheme file
Contains configurations for a network. It contains Tendermint parameters and Genesis block information. All nodes in a network should have the same scheme file.
App descriptor
Contains configurations for modules. It contains information that which modules are used in a network. It contains configurations for modules.
Some configuration in the app descriptor must be the same in a network. For example, which modules are used. How they are connected must be the same in a network. Some configurations like the number of threads do not affect network behavior.
Splitting App descriptor to App descriptor and Link descriptor
We have a plan to split the app descriptor file: Foundry configuration (genesis config, transaction services) and general linking instructions (export, import, init config). Let's say the latter as a 'link descriptor'.
See #512
Removing Scheme file
We can think of the content of the scheme file is configurations for the host in the app descriptor. The app descriptor contains the genesis configuration of modules. The scheme file contains the genesis header's information. We don't need to have two configuration files for a genesis block.
Configuration for network or for node
The current app descriptor has two types of configurations. As I said before, some configurations are for the network, some configurations are for a node.
We didn't discuss yet whether should we split them or how do we split them.
The text was updated successfully, but these errors were encountered: