Browse Source

config: set time_iota_ms to timeout_commit in test genesis (#5386)

also, document consensus parameters.
https://forum.cosmos.network/t/consensus-timeouts-explained/1421

Closes #4489
pull/5389/head
Anton Kaliaev 4 years ago
committed by GitHub
parent
commit
4b99502d5b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 11 deletions
  1. +17
    -6
      config/config.go
  2. +27
    -0
      config/toml.go
  3. +9
    -0
      docs/tendermint-core/configuration.md
  4. +1
    -5
      light/example_test.go
  5. +1
    -0
      state/state_test.go

+ 17
- 6
config/config.go View File

@ -813,13 +813,23 @@ type ConsensusConfig struct {
WalPath string `mapstructure:"wal_file"`
walFile string // overrides WalPath if set
TimeoutPropose time.Duration `mapstructure:"timeout_propose"`
TimeoutProposeDelta time.Duration `mapstructure:"timeout_propose_delta"`
TimeoutPrevote time.Duration `mapstructure:"timeout_prevote"`
TimeoutPrevoteDelta time.Duration `mapstructure:"timeout_prevote_delta"`
TimeoutPrecommit time.Duration `mapstructure:"timeout_precommit"`
// How long we wait for a proposal block before prevoting nil
TimeoutPropose time.Duration `mapstructure:"timeout_propose"`
// How much timeout_propose increases with each round
TimeoutProposeDelta time.Duration `mapstructure:"timeout_propose_delta"`
// How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil)
TimeoutPrevote time.Duration `mapstructure:"timeout_prevote"`
// How much the timeout_prevote increases with each round
TimeoutPrevoteDelta time.Duration `mapstructure:"timeout_prevote_delta"`
// How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil)
TimeoutPrecommit time.Duration `mapstructure:"timeout_precommit"`
// How much the timeout_precommit increases with each round
TimeoutPrecommitDelta time.Duration `mapstructure:"timeout_precommit_delta"`
TimeoutCommit time.Duration `mapstructure:"timeout_commit"`
// How long we wait after committing a block, before starting on the new
// height (this gives us a chance to receive some more precommits, even
// though we already have +2/3).
// NOTE: when modifying, make sure to update time_iota_ms genesis parameter
TimeoutCommit time.Duration `mapstructure:"timeout_commit"`
// Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
SkipTimeoutCommit bool `mapstructure:"skip_timeout_commit"`
@ -864,6 +874,7 @@ func TestConsensusConfig() *ConsensusConfig {
cfg.TimeoutPrevoteDelta = 1 * time.Millisecond
cfg.TimeoutPrecommit = 10 * time.Millisecond
cfg.TimeoutPrecommitDelta = 1 * time.Millisecond
// NOTE: when modifying, make sure to update time_iota_ms (testGenesisFmt) in toml.go
cfg.TimeoutCommit = 10 * time.Millisecond
cfg.SkipTimeoutCommit = true
cfg.PeerGossipSleepDuration = 5 * time.Millisecond


+ 27
- 0
config/toml.go View File

@ -373,12 +373,21 @@ version = "{{ .FastSync.Version }}"
wal_file = "{{ js .Consensus.WalPath }}"
# How long we wait for a proposal block before prevoting nil
timeout_propose = "{{ .Consensus.TimeoutPropose }}"
# How much timeout_propose increases with each round
timeout_propose_delta = "{{ .Consensus.TimeoutProposeDelta }}"
# How long we wait after receiving +2/3 prevotes for anything (ie. not a single block or nil)
timeout_prevote = "{{ .Consensus.TimeoutPrevote }}"
# How much the timeout_prevote increases with each round
timeout_prevote_delta = "{{ .Consensus.TimeoutPrevoteDelta }}"
# How long we wait after receiving +2/3 precommits for anything (ie. not a single block or nil)
timeout_precommit = "{{ .Consensus.TimeoutPrecommit }}"
# How much the timeout_precommit increases with each round
timeout_precommit_delta = "{{ .Consensus.TimeoutPrecommitDelta }}"
# How long we wait after committing a block, before starting on the new
# height (this gives us a chance to receive some more precommits, even
# though we already have +2/3).
timeout_commit = "{{ .Consensus.TimeoutCommit }}"
# How many blocks to look back to check existence of the node's consensus votes before joining consensus
@ -486,6 +495,24 @@ var testGenesisFmt = `{
"genesis_time": "2018-10-10T08:20:13.695936996Z",
"chain_id": "%s",
"initial_height": "1",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "10"
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000",
"max_num": 50
},
"validator": {
"pub_key_types": [
"ed25519"
]
},
"version": {}
},
"validators": [
{
"pub_key": {


+ 9
- 0
docs/tendermint-core/configuration.md View File

@ -326,12 +326,21 @@ version = "v0"
wal_file = "data/cs.wal/wal"
# How long we wait for a proposal block before prevoting nil
timeout_propose = "3s"
# How much timeout_propose increases with each round
timeout_propose_delta = "500ms"
# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil)
timeout_prevote = "1s"
# How much the timeout_prevote increases with each round
timeout_prevote_delta = "500ms"
# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil)
timeout_precommit = "1s"
# How much the timeout_precommit increases with each round
timeout_precommit_delta = "500ms"
# How long we wait after committing a block, before starting on the new
# height (this gives us a chance to receive some more precommits, even
# though we already have +2/3).
timeout_commit = "1s"
# How many blocks to look back to check existence of the node's consensus votes before joining consensus


+ 1
- 5
light/example_test.go View File

@ -75,11 +75,7 @@ func ExampleClient_Update() {
time.Sleep(2 * time.Second)
// XXX: 30 * time.Minute clock drift is needed because a) Tendermint strips
// monotonic component (see types/time/time.go) b) single instance is being
// run.
// https://github.com/tendermint/tendermint/issues/4489
h, err := c.Update(context.Background(), time.Now().Add(30*time.Minute))
h, err := c.Update(context.Background(), time.Now())
if err != nil {
stdlog.Fatal(err)
}


+ 1
- 0
state/state_test.go View File

@ -1003,6 +1003,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) {
for i := 1; i < N+1; i++ {
params[i] = *types.DefaultConsensusParams()
params[i].Block.MaxBytes += int64(i)
params[i].Block.TimeIotaMs = 10
}
// Build the params history by running updateState


Loading…
Cancel
Save