diff --git a/config/config.go b/config/config.go index 20669a5fa..044514ed4 100644 --- a/config/config.go +++ b/config/config.go @@ -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 diff --git a/config/toml.go b/config/toml.go index fa112622d..db2f263ba 100644 --- a/config/toml.go +++ b/config/toml.go @@ -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": { diff --git a/docs/tendermint-core/configuration.md b/docs/tendermint-core/configuration.md index 734aa9c9b..a368f6fc5 100644 --- a/docs/tendermint-core/configuration.md +++ b/docs/tendermint-core/configuration.md @@ -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 diff --git a/light/example_test.go b/light/example_test.go index 7b48616d5..b599778b8 100644 --- a/light/example_test.go +++ b/light/example_test.go @@ -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) } diff --git a/state/state_test.go b/state/state_test.go index 7b2e18529..778bae196 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -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