Skip to content
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

CIP: Coordinated Start Time Intervals #164

Closed
wants to merge 2 commits into from

Conversation

cmwaters
Copy link
Contributor

@cmwaters cmwaters commented Jul 3, 2024

This CIP outlines protocol changes to support more consistent average block times regardless of the size of the blocks (to a point).

Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

I think this can be assigned CIP-23.

How does this compare to https://informal.systems/blog/introducing-proposer-based-timestamps-pbts-in-cometbft?

cips/cip-start-times.md Outdated Show resolved Hide resolved
cips/cip-start-times.md Outdated Show resolved Hide resolved
cips/cip-start-times.md Outdated Show resolved Hide resolved
cips/cip-start-times.md Outdated Show resolved Hide resolved
cips/cip-start-times.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

LGTM, added some comments and questions.

cips/cip-start-times.md Outdated Show resolved Hide resolved
- In the case, that `cs.StartTime` is after the locked or proposal block time, the validator will pick a time that is 1 millisecond later to satisfy the property of increasing block times.
- In the case of the first block, the start time will be the current time.
- Upon receiving 2f + 1 PRECOMMIT votes, each validator calculates the **local** stake-weighted median start time from those votes. It sets the new start time of the next height to be the aforementioned calculated time plus the `TargetInterval`.
- If the nodes local time is after the new start time, then the node will start immediately. This will be the case for heights that require multiple rounds to come to consensus.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it mean there will be cases that the timeout_commit is disregarded? for example, the current time of the node is after the calculated start time of the next block, yet the node has not waited the entire timeout_commit since observing the 2f+1 PRECOMMIT votes, in such cases, the timeout_commit needs to be discarded?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When this mechanism is active, TimeoutCommit is completely disregarded. I've added a line below


## Security Considerations

This modification changes the time located in the block to be the stake-weighted median of the start times of 2f + 1 validators from the previous block. `TargetInterval` is added to this as an approximation of when the current block was actually started. This is different from the how the current block time is calculated, however, this shift in the times is not expected to have any downstream impact.
Copy link
Collaborator

@staheri14 staheri14 Jul 3, 2024

Choose a reason for hiding this comment

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

Could you please elaborate, in the CIP, on the guarantees that the proposal will provide? Specifically, will the new design assure a specific range of block time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a sentence in the Specifications section about the intuition behind achieving consistent start time intervals


This modification changes the time located in the block to be the stake-weighted median of the start times of 2f + 1 validators from the previous block. `TargetInterval` is added to this as an approximation of when the current block was actually started. This is different from the how the current block time is calculated, however, this shift in the times is not expected to have any downstream impact.

Similar with traditional BFT time, a malicious cabal greater than 1/3 can manipulate the block time to be any time in the future.
Copy link
Member

Choose a reason for hiding this comment

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

[Question to understand more]

how far can 1/3rd of the network push time in the future? Indefinitely or there is an upper bound related to the target interval mechanism


| Parameter | Proposed value | Description | Changeable via Governance |
|---------------|---------|------------------------------------------------------------------------------------------------------------------------|---------------------------|
| BlockParams.TargetIntervalMS | 12000 milliseconds (12 seconds) | The target interval between start times in milliseconds | false |
Copy link
Member

Choose a reason for hiding this comment

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

would it make sense to mention that we're confident that this mechanism will allow 12 seconds for blocks <=8mb or whatever the upper bound is?

The upper bound can be defined as the biggest block the network can process in 12 sec if they start processing it right away.

@cmwaters
Copy link
Contributor Author

Closing this solution in favour of #165

@cmwaters cmwaters closed this Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants