-
Notifications
You must be signed in to change notification settings - Fork 296
Conversation
// generate order of peers | ||
EXPECT_CALL(*peer_orderer, getOrdering(_)).WillOnce(Return(order)); | ||
|
||
// ya consensus |
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.
yac
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.
Since YAC stands for Yet Another Consensus, "yac consensus" is yet another consensus consensus ^^
irohad/network/proposal_gate.hpp
Outdated
* Vote for proposal | ||
* @param vote - structure with optional proposal and round number | ||
*/ | ||
virtual void vote(ProposalVote vote) = 0; |
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.
Can it be const ref?
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.
Probably yes, but semantic will be different. Because vote contains a unique pointer, value argument means that vote should be moved inside proposal gate. It is done because vote is stored inside proposal gate for commit comparison.
auto order = orderer_->getOrdering(hash); | ||
if (not order) { | ||
log_->error("ordering doesn't provide peers => pass round"); | ||
return; |
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.
What is the execution flow in failure case? Will Iroha available to vote after it?
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.
This behavior is defined by the caller. Method will return Result
, which wil allow to distinguish bad outcomes.
[&](RejectMessage reject) -> ProposalOutcomeType { | ||
return ProposalReject{model_hash.round}; | ||
}); | ||
current_proposal_.reset(); |
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.
What is the point to reset here? As I expected, we have to change current_proposal on commit\reject of the block and reject of proposals, isn't it?
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.
Probably naming is not the best, because it represents "last voted value", which is reset after consensus outcome is received.
* @param hash - for converting | ||
* @return proposal information | ||
*/ | ||
virtual ProposalInfo toModelHash(const YacHash &hash) const = 0; |
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.
Model
here a little bit misleading. Maybe rename it somehow?
irohad/network/proposal_gate.hpp
Outdated
namespace iroha { | ||
namespace network { | ||
|
||
struct ProposalVote { |
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.
Add documentation for this structure, the structure below and type name.
decltype(f(*t))>::type { | ||
if (t) { | ||
return f(*t); | ||
auto operator|(T &&t, Transform &&f) -> std::enable_if_t< |
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.
Nowadays, operator bind seems very complicated. I suggest to add documentation about sfinae here.
|
||
/** | ||
* @given non-empty proposal optional and round number | ||
* @when proposal, round -> yac hash -> proposal info |
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.
->
is not so understandable here, maybe rework it with a verb?
6a98ae4
to
4581ff0
Compare
auto hash = hash_provider_->makeHash(vote); | ||
log_->info("vote for proposal ({}, {}, {})", | ||
vote.proposal ? vote.proposal.value()->hash().toString() : "''", | ||
vote.round.first, | ||
vote.round.second); | ||
auto order = orderer_->getOrdering(hash); | ||
if (not order) { | ||
log_->error("ordering doesn't provide peers => pass round"); | ||
return; | ||
return expected::makeError("ordering doesn't provide peers => pass round"); |
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.
"=> pass round" is redundant because a strategy is provided by outer scope.
auto hash = hash_provider_->makeHash(vote); | ||
log_->info("vote for proposal ({}, {}, {})", | ||
vote.proposal ? vote.proposal.value()->hash().toString() : "''", | ||
vote.round.first, | ||
vote.round.second); | ||
auto order = orderer_->getOrdering(hash); | ||
if (not order) { | ||
log_->error("ordering doesn't provide peers => pass round"); | ||
return; | ||
return expected::makeError("ordering doesn't provide peers => pass round"); |
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.
"=> pass round" is redundant because a strategy is provided by outer scope.
4d8a994
to
9f56b34
Compare
9f56b34
to
11b8362
Compare
Signed-off-by: Andrei Lebedev <[email protected]>
11b8362
to
a5b00be
Compare
SonarQube analysis reported 2 issues
|
Description of the Change
YAC proposal gate implementation:
Unrelated changes note
Bind operator
operator|
was updated to allow non-copyable objects. "Legacy" code in old model and iroha-cli was not compliant with changes and had to be updated.