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

isQuorumSetSane: Add error string parameter #2725

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

AndrejMitrovic
Copy link
Contributor

Please feel free to suggest improvements. Thanks!

Resolves #2723

Comment on lines 250 to 254
if (errString != nullptr)
{
std::string msg(errString);
CLOG(DEBUG, "SCP") << msg;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can someone suggest a way to inline this into the previous CLOG call?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would just write this as
CLOG(DEBUG, "SCP") << "Invalid quorum set received : " << (errString?errString:"<empty>"); and be done with it (also avoids a new variable).

Copy link
Contributor

@MonsieurNicolas MonsieurNicolas left a comment

Choose a reason for hiding this comment

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

thanks. just a couple suggestions

"between {} and 100)",
UNSAFE_QUORUM ? 1 : 51);
std::string msg(errString);
LOG(FATAL) << "Invalid QUORUM_SET: " << msg;
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just keep fmt::format("Invalid QUORUM_SET: {}", errString)

Comment on lines 250 to 254
if (errString != nullptr)
{
std::string msg(errString);
CLOG(DEBUG, "SCP") << msg;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just write this as
CLOG(DEBUG, "SCP") << "Invalid quorum set received : " << (errString?errString:"<empty>"); and be done with it (also avoids a new variable).

@MonsieurNicolas
Copy link
Contributor

Also, before we can merge your changes, please fill in the agreement per https://github.com/stellar/.github/blob/master/CONTRIBUTING.md#submitting-changes

@AndrejMitrovic
Copy link
Contributor Author

Thanks! I've filled in the agreement and applied the changes.

@MonsieurNicolas
Copy link
Contributor

Thank you!

@MonsieurNicolas
Copy link
Contributor

r+ 8e2a98896b95de94acf99a6ab92fe9e878b08695

@AndrejMitrovic
Copy link
Contributor Author

I've re-run clang formatter on the code. Sorry about that!

@MonsieurNicolas
Copy link
Contributor

r+ e44e88a11c22db126481d303911781db70bdd7d0

@AndrejMitrovic
Copy link
Contributor Author

It looks like Travis uses clag-format 5, and I used the one installed with brew (v10) which has a slightly different output. I'll try to get v5 installed and re-run the formatter.

If the quorum is considered invalid then the 'errString'
parameter will contain the string explaning the reason
why the quorum is considered invalid.

Resolves stellar#2723
@AndrejMitrovic
Copy link
Contributor Author

Installing clang-format 5 seems to be tediously slow (tried https://gist.github.com/ffeu/6ffb75d8e8c7d92c0fbeb4b036599c33), so I applied to diff manually based on the results from Travis.

@Geod24
Copy link
Contributor

Geod24 commented Oct 4, 2020

@MonsieurNicolas : Since you got Travis set up, I wonder, why doesn't it trigger on PRs? Not having the CI trigger before approval (and only once per committer's approval) can make contributing quite tedious.

@MonsieurNicolas
Copy link
Contributor

@AndrejMitrovic yes this is the way to do it, the error message is an actual patch that can be applied if you don't have clang-format-5 installed. Let's see if it works this time around...

@MonsieurNicolas
Copy link
Contributor

@Geod24 good idea. I just enabled it for future PRs, from what I remember it was just too slow (we had it enabled a long time ago), but maybe it's not that bad now.

@MonsieurNicolas
Copy link
Contributor

r+ cbefaa9

@latobarita latobarita merged commit 077574b into stellar:master Oct 5, 2020
@AndrejMitrovic AndrejMitrovic deleted the sanity-reason branch October 6, 2020 00:58
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.

Making isQuorumSetSane more informative
4 participants