-
Notifications
You must be signed in to change notification settings - Fork 326
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
Document clock drift parameters in guide #3420
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cc350ef
Add clock-drift.md file to guide
seanchen1991 a7f54da
Merge branch 'master' into sean/clock-drift-docs
seanchen1991 08c7390
Add section on mis-configuring clock drift
seanchen1991 d04f387
Merge branch 'sean/clock-drift-docs' of https://github.com/informalsy…
seanchen1991 cfdb4fa
Merge branch 'master' into sean/clock-drift-docs
seanchen1991 1cc5206
Update guide/src/advanced/troubleshooting/clock-drift.md
seanchen1991 f8c81f7
Update guide/src/advanced/troubleshooting/clock-drift.md
seanchen1991 19cce87
Remove redundant section
seanchen1991 20163ed
Update guide/src/advanced/troubleshooting/clock-drift.md
seanchen1991 1afc3e4
Merge branch 'master' into sean/clock-drift-docs
seanchen1991 0147acf
Update guide/src/advanced/troubleshooting/clock-drift.md
seanchen1991 d6553e3
Explain what `C` constant represents
seanchen1991 b4ceff2
Merge branch 'master' into sean/clock-drift-docs
seanchen1991 162a34c
Add reference to forward lunatic attack
seanchen1991 c8c9044
Merge branch 'sean/clock-drift-docs' of https://github.com/informalsy…
seanchen1991 5c497cd
Merge branch 'master' into sean/clock-drift-docs
seanchen1991 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Handling Clock Drift | ||
|
||
IBC light client security model requires that the timestamp of a header included in client updates for some `client` is within `[now - client.trusting_period, now + client.max_clock_drift)`. | ||
|
||
The `trusting_period` is a parameter that is configurable under the `[[chains]]` section and its default value is two thirds of the chain `unbonding_period`. | ||
The rest of this section describes the configuration parameters that determine the `max_clock_drift`. | ||
|
||
IBC light client security model requires that the clocks of the reference and host chains are roughly synchronized. Hermes uses the `clock_drift` and `max_block_time` configuration parameters to determine how much clock drift is tolerable between the reference and host chains. | ||
- `clock_drift` is a correction parameter that specifies how far in the future or past a chain's clock may be from the current time.. | ||
- `max_block_time` is the maximum amount of time that can occur before a new block is created on the chain. | ||
|
||
> **Note:** For Cosmos SDK chains, a good approximation for `max_block_time` is `C * (timeout_propose + timeout_commit)`, | ||
where `C` is a constant to allow for variation in block times, mainly due to tx execution time which is outside of | ||
consensus params. To allow for some variance in block times while still detecting [forward lunatic attacks][forward-lunatic], | ||
it is recommended to set `C` to be in the `3..5` range. Hermes uses the default value of `30s` which is a good approximation | ||
for most Cosmos SDK chains that have 6-10sec block times. | ||
|
||
The `clock_drift` parameter values on both the reference and host chains, and `max_block_time` of the host chain are summed to get the `max_clock_drift` when creating a client on the host chain. | ||
This can be summarized more succinctly in the following equation: | ||
``` | ||
client.max_clock_drift = reference.clock_drift + host.max_block_time + host.clock_drift | ||
``` | ||
|
||
Thus, when configuring these values in Hermes' `config.toml`, keep in mind that this is how these | ||
parameters will be used. If the total clock drift is too small, then we run the risk of client | ||
updates being rejected because a new block won't have been created yet. It's better to err on the | ||
side of total clock drift being larger than smaller, however, if this value ends up being _too_ | ||
large, then this becomes a security vulnerability. | ||
|
||
For a more concrete example of what could happen when clock drift is mis-configured, take a look | ||
at the [Mishandling Clock Drift][mishandling-clock-drift] troubleshooting section. | ||
|
||
[forward-lunatic]: https://github.com/cometbft/cometbft/blob/main/docs/architecture/tendermint-core/adr-047-handling-evidence-from-light-client.md#appendix-b | ||
[mishandling-clock-drift]: ./cross-comp-config.md#mishandling-clock-drift |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @DaviRain-Su, I don't believe this is a typo. The
)
on the right-hand side of the range indicates that the max value of the range is exclusive such that it doesn't include the value ofnow + client.max_clock_drift
itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh thx your explain, I missunderstand.