Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Implement ViewChange message type #204

Merged
merged 7 commits into from
May 17, 2021

Conversation

sergefdrv
Copy link
Contributor

This pull request introduces and implements ViewChange message type. ViewChange message will be generated when handling ReqViewChange messages (#177).

@sergefdrv sergefdrv added the enhancement New feature or request label May 14, 2021
@sergefdrv sergefdrv added this to the v0.1.0 milestone May 14, 2021
@sergefdrv sergefdrv requested review from ynamiki and nhoriguchi and removed request for ynamiki May 14, 2021 22:15
@nhoriguchi nhoriguchi self-assigned this May 16, 2021
Copy link
Contributor

@nhoriguchi nhoriguchi left a comment

Choose a reason for hiding this comment

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

I left one minor comment, but I can't find any critical issue on suggested changes, thank you.

// whereas any valid view-change certificate is
// equivalent to any other valid one. Moreover,
// messages in the message log and view-change
// certificate are authenticated on their own.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I miss something, but It seems to me unclear why we don't have to include message log into signed data. I think that each message has a signature, but the order of messages in the log is not signed, so could a malicious replica intentionally reorder the log and disturb the replay after view change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Messages in the message log are required to be sequential in the counter value assigned by USIG. So any reordering, omission, or duplication of messages in the log will be detected when validating integrity of the ViewChange message.

I will add this explanation to the comment.

Sergey Fedorov added 7 commits May 17, 2021 17:42
This commit defines abstract interface for VIEW-CHANGE message type.
Since the checkpoint feature is to be considered later, the interface
omits a method to get the latest stable checkpoint, for simplicity.
Besides that, ViewChange message is augmented with a quorum of
ReqViewChange messages, dubbed "view-change certificate", for the
following reason.

Whenever a replica decides to terminate the current view and start the
view change operation, it must make sure that other correct replicas
will eventually do the same. Otherwise some other correct replica
might stay in the old view for arbitrary long time, and the replica
that started view change would stop making any progress waiting for
other correct replicas.

A replica terminates the current view and generates its ViewChange
message once it has collected a quorum of valid ReqViewChange messages
from different replicas referring to the subsequent view number. Thus,
a simple way to ensure liveness would be to justify the ViewChange
message with a quorum of ReqViewChange messages. This quorum will
ensure view change is also triggered in any correct replica that
processes the ViewChange message.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
WrapMessage function wraps a Protobuf structure of any message type
into a generic Message structure. It borrows from marshalMessage
function from messages/protobuf package. The new function will help to
convert messages from API into Protobuf representation.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
MessageFromAPI function will help to convert any message from its API
representation into a Protobuf structure of the corresponding type.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
This function will help to convert any message from Protobuf into API
representation.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
The new function will help to convert any message from its API
representation into a Protobuf structure of the corresponding type.
If the message was created by this package, the Protobuf structure is
taken directly from the underlying message structure, falling back
into creating a new Protobuf structure otherwise.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
@sergefdrv sergefdrv force-pushed the view-change-message branch from 5d0f23f to b5ffd9a Compare May 17, 2021 15:43
@sergefdrv
Copy link
Contributor Author

Summary of changes: adjusted comment in messages/authen.go.

@sergefdrv sergefdrv requested a review from nhoriguchi May 17, 2021 15:44
Copy link
Contributor

@nhoriguchi nhoriguchi left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@nhoriguchi nhoriguchi merged commit 60297ae into hyperledger-labs:master May 17, 2021
@sergefdrv sergefdrv deleted the view-change-message branch May 17, 2021 16:43
@sergefdrv
Copy link
Contributor Author

Looks good to me.

@nhoriguchi Thanks for reviewing it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants