Skip to content

write config.toml with all defaults & improve config doc #733

Merged
zramsay merged 5 commits intoconfigfrom
705-config-docs
Oct 26, 2017
Merged

write config.toml with all defaults & improve config doc #733
zramsay merged 5 commits intoconfigfrom
705-config-docs

Conversation

@zramsay
Copy link
Contributor

@zramsay zramsay commented Oct 10, 2017

closes #705
links to: #709, #636

Running tendermint init used to produce the following config.toml:

# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml

proxy_app = "tcp://127.0.0.1:46658"
moniker = "anonymous"
fast_sync = true
db_backend = "leveldb"
log_level = "state:info,*:error"

[rpc]
laddr = "tcp://0.0.0.0:46657"

[p2p]
laddr = "tcp://0.0.0.0:46656"
seeds = ""

which did not provide all that much information about the many config options. Now, the config.toml looks like:

# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml

##### main base config options #####

# TCP or UNIX socket address of the ABCI application,
# or the name of an ABCI application compiled in with the Tendermint binary
proxy_app = "tcp://127.0.0.1:46658"

# A custom human readable name for this node
moniker = "anonymous"

# If this node is many blocks behind the tip of the chain, FastSync
# allows them to catchup quickly by downloading blocks in parallel
# and verifying their commits
fast_sync = true

# Database backend: leveldb | memdb
db_backend = "leveldb"

# Database directory
db_path = "data"

# Output level for logging
log_level = "state:info,*:error"

##### additional base config options #####

# The ID of the chain to join (should be signed with every transaction and vote)
chain_id = ""

# Path to the JSON file containing the initial validator set and other meta data
genesis_file = "genesis.json"

# Path to the JSON file containing the private key to use as a validator in the consensus protocol
priv_validator_file = "priv_validator.json"

# Mechanism to connect to the ABCI application: socket | grpc
abci = "socket"

# TCP or UNIX socket address for the profiling server to listen on
prof_laddr = ""

# If true, query the ABCI app on connecting to a new peer
# so the app can decide if we should keep the connection or not
filter_peers = false

# What indexer to use for transactions
tx_index = "kv"


[rpc]

# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://0.0.0.0:46657"

# TCP or UNIX socket address for the gRPC server to listen on
# NOTE: This server only supports /broadcast_tx_commit
grpc_laddr = ""

# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
unsafe = false


[p2p]

# Address to listen for incoming connections
laddr = "tcp://0.0.0.0:46656"

# Comma separated list of seed nodes to connect to
seeds = ""

# Path to address book
addr_book_file = "addrbook.json"

# Set true for strict address routability rules
addr_book_strict = true

# Time to wait before flushing messages out on the connection, in ms
flush_throttle_timeout = 100

# Maximum number of peers to connect to
max_num_peers = 50

# Maximum size of a message packet payload, in bytes
max_msg_packet_payload_size = 1024

# Rate at which packets can be sent, in bytes/second
send_rate = 512000

# Rate at which packets can be received, in bytes/second
recv_rate = 512000


[mempool]

recheck = true
recheck_empty = true
broadcast = true
wal_dir = "data/mempool.wal"


[consensus]

wal_file = "data/cs.wal/wal"
wal_light = false

# All timeouts are in milliseconds
timeout_propose = 3000
timeout_propose_delta = 500
timeout_prevote = 1000
timeout_prevote_delta = 500
timeout_precommit = 1000
timeout_precommit_delta = 500
timeout_commit = 1000

# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
skip_timeout_commit = false

# BlockSize
max_block_size_txs = 10000
max_block_size_bytes = 1

# EmptyBlocks mode and possible interval between empty blocks in seconds
create_empty_blocks = true
create_empty_blocks_interval = 0

# Reactor sleep duration parameters are in milliseconds
peer_gossip_sleep_duration = 100
peer_query_maj23_sleep_duration = 2000

and the documentation for the config.toml now shows the full config file, replacing this:
screenshot from 2017-10-10 14-33-13
with this:
screenshot from 2017-10-10 14-34-00

@zramsay zramsay requested a review from ebuchman as a code owner October 10, 2017 17:10
@ebuchman ebuchman mentioned this pull request Oct 10, 2017
5 tasks
@codecov-io
Copy link

codecov-io commented Oct 10, 2017

Codecov Report

Merging #733 into config will decrease coverage by 0.48%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##           config     #733      +/-   ##
==========================================
- Coverage   57.85%   57.37%   -0.49%     
==========================================
  Files          82       82              
  Lines        8436     8441       +5     
==========================================
- Hits         4881     4843      -38     
- Misses       3142     3176      +34     
- Partials      413      422       +9

@zramsay zramsay changed the title WIP: write full config.toml with all defaults write config.toml with all defaults & improve config doc Oct 10, 2017
fast_sync = true
db_backend = "leveldb"
log_level = "state:info,*:error"
##### main base config options #####
Copy link
Contributor

Choose a reason for hiding this comment

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

ok, this is amazing, but here's my crazy question .... can we get this code autogenerated from the config struct during a build process so we don't have to worry about redundant commentary here and in the structs?? is that a crazy thing to ask for :P

Copy link
Contributor Author

@zramsay zramsay Oct 11, 2017

Choose a reason for hiding this comment

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

maybe, in the future? I agree with the sentiment but have noticed that generally autogenerated codestuffs get mangled in one way or another. I'll add notices in the appropriate locations + does this code get updated all that much?

@melekes
Copy link
Contributor

melekes commented Oct 11, 2017

}

// XXX: this func should probably be called by cmd/tendermint/commands/init.go
// alongside the writing of the genesis.json and priv_validator.json
Copy link
Contributor Author

Choose a reason for hiding this comment

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

thoughts? seems awkward to not have the config.toml be initialized alongside genesis.json and priv_validator.json here

@zramsay zramsay changed the base branch from develop to config October 11, 2017 13:04
@zramsay zramsay force-pushed the 705-config-docs branch 2 times, most recently from 9308a03 to ab4b6ad Compare October 11, 2017 14:17
ensureFiles(t, rootDir, "data", "genesis.json", "priv_validator.json")
}

const defaultConfigHardcoded = `# This is a TOML config file.
Copy link
Contributor

@melekes melekes Oct 12, 2017

Choose a reason for hiding this comment

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

does it mean we'll have to change this every time we change the config so the tests could pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea.

Copy link
Contributor

Choose a reason for hiding this comment

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

can't we generate it on the fly or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's only used by the test. The actual config is generated on the fly, but then the test would be redundant, no? Could use a strings.Contains instead to check that key elements of the config are present; something like:

var elems = []string{"moniker", "seeds", "proxy_app", "fast_sync", "create_empty_blocks"}
for _, e := range elems {
        if !strings.Contains(configFile, e) {
                t.Fail()
       }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Could use a strings.Contains instead to check that key elements of the config are present

I am in favor of doing this

@zramsay zramsay changed the base branch from config to develop October 14, 2017 16:03
@zramsay zramsay changed the base branch from develop to config October 14, 2017 16:04
@ebuchman ebuchman added the C:docs Component: Documentation label Oct 23, 2017
@zramsay zramsay added this to the 0.12.0 milestone Oct 26, 2017
@zramsay
Copy link
Contributor Author

zramsay commented Oct 26, 2017

merging to config branch

@zramsay zramsay merged commit b5235e2 into config Oct 26, 2017
@zramsay zramsay deleted the 705-config-docs branch October 26, 2017 14:18
@zramsay zramsay mentioned this pull request Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:docs Component: Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants