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

Implement Commit message #1770

Merged
merged 3 commits into from
Sep 11, 2019
Merged

Conversation

majecty
Copy link
Contributor

@majecty majecty commented Sep 9, 2019

See #1768

@majecty majecty added consensus do-not-merge Do not merge (for mergify.io) labels Sep 9, 2019
@majecty majecty changed the title Implementing Commit message [WIP] Implementing Commit message Sep 9, 2019
@majecty majecty force-pushed the f/commit-message branch 2 times, most recently from d006da8 to 44c4034 Compare September 11, 2019 03:24
@majecty majecty changed the title [WIP] Implementing Commit message Implement Commit message Sep 11, 2019
@majecty majecty removed the do-not-merge Do not merge (for mergify.io) label Sep 11, 2019
height,
}) => {
ctrace!(ENGINE, "Received RequestCommit for {} from {:?}", height, token);
let (result, receiver) = crossbeam::unbounded();
Copy link
Contributor

Choose a reason for hiding this comment

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

bounded(1)

votes,
}) => {
ctrace!(ENGINE, "Received Commit for {:?} from {:?}", height, token);
let (result, receiver) = crossbeam::unbounded();
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

@@ -1780,50 +1836,48 @@ impl Worker {
}
}

if peer_vote_step.height == self.height {
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition cannot be removed.

!(self.height < peer_vote_step.height && !self.step.is_commit())
== self.height >= peer_vote_step.height || self.step.is_commit()

#[allow(clippy::cognitive_complexity)]
fn on_commit_message(
&mut self,
height: Height,
Copy link
Contributor

Choose a reason for hiding this comment

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

Height is already in the block

return None
}

if commit_height != self.height {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if commit_height != self.height {
else if commit_height > self.height {


if self.client().block(&BlockId::Hash(block_hash)).is_some() {
cdebug!(ENGINE, "Committed block is already imported {}", block_hash);
self.move_to_step(
Copy link
Contributor

Choose a reason for hiding this comment

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

Pull the common move_to_step out of the conditional statement.

Before this commit, Tendermint extension only requests current height
and view's votes. Handling only the current view's message makes code
simple. However, there may be a commit before the current view. This
creates a liveness problem.

After this commit, a node requests a Commit message if some of its
peer's height is higher than the node. The commit message is not
related to the node's current view. The Commit message fixes the
liveness problem.
@majecty majecty merged commit e096a50 into CodeChain-io:master Sep 11, 2019
@majecty majecty deleted the f/commit-message branch September 11, 2019 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants