Skip to content

Commit

Permalink
increase maximim nesting level to allow for HIGH -> LOW validators
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsieurNicolas committed Aug 16, 2019
1 parent 1b3adee commit aa45d9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/scp/QuorumSetUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QuorumSetSanityChecker::QuorumSetSanityChecker(SCPQuorumSet const& qSet,
bool
QuorumSetSanityChecker::checkSanity(SCPQuorumSet const& qSet, int depth)
{
if (depth > 2)
if (depth > 3)
return false;

if (qSet.threshold < 1)
Expand Down
43 changes: 20 additions & 23 deletions src/scp/test/QuorumSetTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,49 +151,46 @@ TEST_CASE("sane quorum set", "[scp][quorumset]")
check(containingSet, true, validMultipleNodesNormalized);
}

SECTION("{ t: 1, v0, { t: 1, v1, { t: 1, v2 } } } -> { t: 1, v0, { t: 1, "
"v1, v2 } }")
SECTION("{ t: 1, v0, { t: 1, v1, { t: 1, v2 , {t: 1, v3} } } } -> { t: 1, "
"v0, { t: 1, "
"v1, { t:1, v2, v3} } }")
{
auto qSet = makeSingleton(keys[0]);
auto qSet1 = makeSingleton(keys[1]);
auto qSet2 = makeSingleton(keys[2]);
auto qSet3 = makeSingleton(keys[3]);
qSet2.innerSets.push_back(qSet3);
qSet1.innerSets.push_back(qSet2);
qSet.innerSets.push_back(qSet1);

auto qSelfSet = SCPQuorumSet{};
qSelfSet.threshold = 1;
qSelfSet.validators.push_back(keys[0]);
qSelfSet.innerSets.push_back({});
qSelfSet.innerSets.back().threshold = 1;
qSelfSet.innerSets.back().validators.push_back(keys[1]);
qSelfSet.innerSets.back().validators.push_back(keys[2]);
// normalized: v3 gets moved next to v2
auto qSelfSet = qSet;
auto& qSet2b = qSelfSet.innerSets.back().innerSets.back();
qSet2b.validators.emplace_back(keys[3]);
qSet2b.innerSets.clear();

check(qSet, true, qSelfSet);
}

SECTION(
"{ t: 1, v0, { t: 1, v1, { t: 1, v2, { t: 1, v3 } } } } -> too deep")
SECTION("{ t: 1, v0, { t: 1, v1, { t: 1, v2, { t: 1, v3 , { t: 1, v4} } } "
"} } -> too deep")
{
auto qSet = makeSingleton(keys[0]);
auto qSet1 = makeSingleton(keys[1]);
auto qSet2 = makeSingleton(keys[2]);
auto qSet3 = makeSingleton(keys[3]);
auto qSet4 = makeSingleton(keys[4]);
qSet3.innerSets.push_back(qSet4);
qSet2.innerSets.push_back(qSet3);
qSet1.innerSets.push_back(qSet2);
qSet.innerSets.push_back(qSet1);

auto qSelfSet = SCPQuorumSet{};
qSelfSet.threshold = 1;
qSelfSet.validators.push_back(keys[0]);
qSelfSet.innerSets.push_back({});
qSelfSet.innerSets.back().threshold = 1;
qSelfSet.innerSets.back().validators.push_back(keys[1]);
qSelfSet.innerSets.back().innerSets.push_back({});
qSelfSet.innerSets.back().innerSets.back().threshold = 1;
qSelfSet.innerSets.back().innerSets.back().validators.push_back(
keys[2]);
qSelfSet.innerSets.back().innerSets.back().validators.push_back(
keys[3]);
// normalized: v4 gets moved next to v3
auto qSelfSet = qSet;
auto& qSet3b =
qSelfSet.innerSets.back().innerSets.back().innerSets.back();
qSet3b.validators.emplace_back(keys[4]);
qSet3b.innerSets.clear();

check(qSet, false, qSelfSet);
}
Expand Down

5 comments on commit aa45d9e

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

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

saw approval from MonsieurNicolas
at MonsieurNicolas@aa45d9e

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

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

merging MonsieurNicolas/stellar-core/fixQuorumChecksStartupAndAutoExamples = aa45d9e into auto

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

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

MonsieurNicolas/stellar-core/fixQuorumChecksStartupAndAutoExamples = aa45d9e merged ok, testing candidate = 545dadb

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

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

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

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

fast-forwarding master to auto = 545dadb

Please sign in to comment.