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

Ibft now handles failing sign operations #831

Merged
merged 1 commit into from
May 6, 2020

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented May 3, 2020

IbftRound has been updated to handle Signing errors (eg no signature supplier available) and
continue operating if possible.

Signed-off-by: Trent Mohay trent.mohay@consensys.net

@rain-on rain-on requested review from usmansaleem and jframe May 3, 2020 23:48
@rain-on rain-on force-pushed the sign_failure branch 4 times, most recently from b8e917b to 00b7f80 Compare May 4, 2020 05:22
final Prepare localPrepareMessage =
messageFactory.createPrepare(getRoundIdentifier(), block.getHash());
peerIsPrepared(localPrepareMessage);
transmitter.multicastPrepare(
Copy link
Member

Choose a reason for hiding this comment

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

you have changed the operations order from previous logic? i.e. Previously it was multiCastPrepare then peerIsPrepared. Now it is peerIsPrepared then multicastPrepare? Is that by mistake or it doesn't matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that shouldn't matter in this instance.

Copy link
Member

@usmansaleem usmansaleem left a comment

Choose a reason for hiding this comment

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

Minor clarification, otherwise looks good to me.


final ProposalMessageData message = ProposalMessageData.create(data);
final ProposalMessageData message = ProposalMessageData.create(data);
Copy link
Contributor

Choose a reason for hiding this comment

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

The try/catch only needs to be around the messageFactory.create method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be thinner, but didn't seem to add a lot of value to do so.

}

public void multicastPrepare(final ConsensusRoundIdentifier roundIdentifier, final Hash digest) {
final Prepare data = messageFactory.createPrepare(roundIdentifier, digest);
try {
final Prepare data = messageFactory.createPrepare(roundIdentifier, digest);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above for the all the other messages in the message transmitter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed - but so long as we don't transmit, then we've done what we need to.

localPrepareMessage.getRoundIdentifier(), localPrepareMessage.getDigest());
peerIsPrepared(localPrepareMessage);
try {
final Prepare localPrepareMessage =
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it only the createPrepare that can fail with a SecurityModuleException? Don't think this try/catch needs to be around the peerIsPrepared or multicastPrepare

roundState.addCommitMessage(localCommitMessage);
} catch (final SecurityModuleException e) {
LOG.warn("Failed to create signed Commit message; {}", e.getMessage());
return blockAccepted;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be returning true in this case, as this will result in a prepare message being created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From where this is called - the return value implies the block is good, and that this node should try and send a prepare message - which, regardless of this failure, is still true.

@jframe
Copy link
Contributor

jframe commented May 5, 2020

What should happen with the SecurityModule.getPublicKey? It can also fail with a SecurityModuleException, perhaps it shouldn't though?

Tests are not yet written, however IbftRound has been updated to
accept Signing errors (eg no signature supplier available) and
continue operating if possible.

This also catches failures in signing and ECDH Key agreement
creation during discovery and handshaking.

Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
@rain-on rain-on merged commit 0917f89 into hyperledger:master May 6, 2020
@rain-on rain-on deleted the sign_failure branch May 6, 2020 06:45
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.

3 participants