From 8087785204a85d643bc18e701fe304ee1d70af33 Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Thu, 10 Jul 2025 14:25:39 +0200 Subject: [PATCH] changes selection parameters and number of untrusted slots Simulation results revealed that by requiring a minimum number of peers to send a message, valdiations will stop propagating, as the servers that are directly connected to peers will receive a unique message from only a single peer, the validator. Therefore, they will fail to select a slot. Furthermore, by increasing untrusted slots to 30 we guarantee that some validators will propagate through most of the network. --- src/xrpld/overlay/ReduceRelayCommon.h | 2 +- src/xrpld/overlay/detail/Slot.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/xrpld/overlay/ReduceRelayCommon.h b/src/xrpld/overlay/ReduceRelayCommon.h index 7bfdcca900..4535d188cd 100644 --- a/src/xrpld/overlay/ReduceRelayCommon.h +++ b/src/xrpld/overlay/ReduceRelayCommon.h @@ -55,7 +55,7 @@ static constexpr uint16_t MAX_MESSAGE_THRESHOLD = 20; static constexpr uint16_t MAX_SELECTED_PEERS = 5; // Max number of untrusted slots the server will maintain -static constexpr uint16_t MAX_UNTRUSTED_SLOTS = 5; +static constexpr uint16_t MAX_UNTRUSTED_SLOTS = 30; // The maximum of seconds an untrusted validator can go without sending a // validation message. After this, a validator may be squelched diff --git a/src/xrpld/overlay/detail/Slot.cpp b/src/xrpld/overlay/detail/Slot.cpp index 0cfb8e6a28..6e4ac74d0b 100644 --- a/src/xrpld/overlay/detail/Slot.cpp +++ b/src/xrpld/overlay/detail/Slot.cpp @@ -98,8 +98,8 @@ Slot::update( JLOG(journal_.trace()) << "update: existing peer " << Slice(validator) << " " << id - << " slot state " << static_cast(state_) << " peer state " - << static_cast(peer.state) << " count " << peer.count << " last " + << " slot state " << to_string(state_) << " peer state " + << to_string(peer.state) << " count " << peer.count << " last " << duration_cast(now - peer.lastMessage).count() << " pool " << considered_.size() << " threshold " << reachedThreshold_; @@ -530,8 +530,7 @@ Slots::updateConsideredValidator(PublicKey const& validator, Peer::id_t peer) ++it->second.count; // if the validator has not met selection criteria yet - if (it->second.count < reduce_relay::MAX_MESSAGE_THRESHOLD || - it->second.peers.size() < reduce_relay::MAX_SELECTED_PEERS) + if (it->second.count < reduce_relay::MAX_MESSAGE_THRESHOLD) return std::nullopt; auto const key = it->first;