Improve the Byzantine validator detector:

This commit expands the detection capabilities of the Byzantine
validation detector. Prior to this commit, only validators that
were on a server's UNL were monitored. Now, all the validations
that a server receives are passed through the detector.
This commit is contained in:
Nik Bougalis
2021-02-19 19:08:52 -08:00
parent 27d978b891
commit b4699c3b46
18 changed files with 360 additions and 235 deletions

View File

@@ -2240,8 +2240,6 @@ PeerImp::onMessage(
void
PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
{
auto const closeTime = app_.timeKeeper().closeTime();
if (m->validation().size() < 50)
{
JLOG(p_journal_.warn()) << "Validation: Too small";
@@ -2251,6 +2249,8 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
try
{
auto const closeTime = app_.timeKeeper().closeTime();
std::shared_ptr<STValidation> val;
{
SerialIter sit(makeSlice(m->validation()));
@@ -2683,16 +2683,16 @@ PeerImp::checkValidation(
std::shared_ptr<STValidation> const& val,
std::shared_ptr<protocol::TMValidation> const& packet)
{
if (!cluster() && !val->isValid())
{
JLOG(p_journal_.debug()) << "Validation forwarded by peer is invalid";
charge(Resource::feeInvalidRequest);
return;
}
// FIXME it should be safe to remove this try/catch. Investigate codepaths.
try
{
// VFALCO Which functions throw?
if (!cluster() && !val->isValid())
{
JLOG(p_journal_.warn()) << "Validation is invalid";
charge(Resource::feeInvalidRequest);
return;
}
if (app_.getOPs().recvValidation(val, std::to_string(id())) ||
cluster())
{