Merge pull request #70 from Xahau/governance_hook_l2

Governance hook l2
This commit is contained in:
RichardAH
2023-06-26 15:10:46 +02:00
committed by GitHub
38 changed files with 1472 additions and 284 deletions

View File

@@ -752,7 +752,7 @@ voteAndCheck(
std::size_t expect,
PreVote const& pre = defaultPreVote)
{
NegativeUNLVote vote(myId, history.env.journal);
NegativeUNLVote vote(myId, history.env.journal, history.env.app());
pre(vote);
auto txSet = std::make_shared<SHAMap>(
SHAMapType::TRANSACTION, history.env.app().getNodeFamily());
@@ -773,7 +773,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
jtx::Env env(*this);
NodeID myId(0xA0);
NegativeUNLVote vote(myId, env.journal);
NegativeUNLVote vote(myId, env.journal, env.app());
// one add, one remove
auto txSet = std::make_shared<SHAMap>(
@@ -797,7 +797,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
jtx::Env env(*this);
NodeID myId(0xA0);
NegativeUNLVote vote(myId, env.journal);
NegativeUNLVote vote(myId, env.journal, env.app());
uint256 pad_0(0);
uint256 pad_f = ~pad_0;
@@ -834,7 +834,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
if (history.goodHistory)
{
NegativeUNLVote vote(
history.UNLNodeIDs[3], history.env.journal);
history.UNLNodeIDs[3], history.env.journal, history.env.app());
BEAST_EXPECT(!vote.buildScoreTable(
history.lastLedger(),
history.UNLNodeIDSet,
@@ -849,7 +849,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
if (history.goodHistory)
{
NegativeUNLVote vote(
history.UNLNodeIDs[3], history.env.journal);
history.UNLNodeIDs[3], history.env.journal, history.env.app());
BEAST_EXPECT(!vote.buildScoreTable(
history.lastLedger(),
history.UNLNodeIDSet,
@@ -872,7 +872,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
history.UNLNodeIDs[idx] == myId &&
l->seq() % 2 == 0);
});
NegativeUNLVote vote(myId, history.env.journal);
NegativeUNLVote vote(myId, history.env.journal, history.env.app());
BEAST_EXPECT(!vote.buildScoreTable(
history.lastLedger(),
history.UNLNodeIDSet,
@@ -915,7 +915,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
history.validations.add(badNode, v2);
}
NegativeUNLVote vote(myId, history.env.journal);
NegativeUNLVote vote(myId, history.env.journal, history.env.app());
// local node still on wrong chain, can build a scoreTable,
// but all other nodes' scores are zero
@@ -954,7 +954,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
[&](std::shared_ptr<Ledger const> const& l,
std::size_t idx) -> bool { return true; });
NegativeUNLVote vote(
history.UNLNodeIDs[3], history.env.journal);
history.UNLNodeIDs[3], history.env.journal, history.env.app());
auto scoreTable = vote.buildScoreTable(
history.lastLedger(),
history.UNLNodeIDSet,
@@ -1031,7 +1031,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
for (auto const& n : history.UNLNodeIDs)
goodScoreTable[n] = NegativeUNLVote::negativeUNLHighWaterMark + 1;
NegativeUNLVote vote(history.UNLNodeIDs[0], history.env.journal);
NegativeUNLVote vote(history.UNLNodeIDs[0], history.env.journal, history.env.app());
{
// all good scores
@@ -1165,7 +1165,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
jtx::Env env(*this);
NodeID myId(0xA0);
NegativeUNLVote vote(myId, env.journal);
NegativeUNLVote vote(myId, env.journal, env.app());
std::array<std::uint32_t, 3> unlSizes = {34, 35, 80};
std::array<std::uint32_t, 3> nUnlPercent = {0, 50, 100};
@@ -1338,7 +1338,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
jtx::Env env(*this);
NodeID myId(0xA0);
NegativeUNLVote vote(myId, env.journal);
NegativeUNLVote vote(myId, env.journal, env.app());
// test cases:
// newValidators_ of the NegativeUNLVote empty, add one
@@ -1451,7 +1451,7 @@ class NegativeUNLVoteScoreTable_test : public beast::unit_test::suite
return add_50 || add_100 || add_me;
});
NegativeUNLVote vote(myId, history.env.journal);
NegativeUNLVote vote(myId, history.env.journal, history.env.app());
auto scoreTable = vote.buildScoreTable(
history.lastLedger(),
history.UNLNodeIDSet,