feat(gossip): implement epidemic broadcast fanout in run_gossip_loop (#82) - #84
Open
ZuLu0890 wants to merge 1 commit into
Open
Conversation
…tellarConduit#82) - Add GossipState parameter to run_gossip_loop so the loop has access to the active message queue and macro-merge backlog - On each round tick: drain the active queue, calculate fanout target using FanoutCalculator (log-scale with min/max clamp), randomly select peer subset, and send each buffered message to selected peers - Anti-entropy tick now picks one random peer and sends a SyncRequest generated from the current GossipState - Add FanoutCalculator::calculate_target and select_random<T> methods (generic over any Clone type) to satisfy integration test surface - Add BloomFilter public type wrapping a sliding two-window bloom filter with a &[u8] API and rotation on capacity - Add RoundScheduler public wrapper around GossipScheduler exposing get_interval() and advance_time() for test-friendly virtual-clock use - Fix pre-existing compile error in message_format_validation_test.rs (missing topology_flags field in TopologyUpdate initializer) All 33 gossip unit tests and 9 gossip integration tests pass.
Contributor
|
@ZuLu0890 fix cicd error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #82.
Implements the epidemic broadcast fanout logic in
run_gossip_loopthat was previously stubbed with aTODO.Changes
src/gossip/protocol.rsrun_gossip_loopnow acceptsstate: Arc<Mutex<GossipState>>as a parameterFanoutCalculator(logarithmic scaling, clamped to MIN/MAX), selects a random peer subset withselect_random_peers, and sends each message to each selected peerSyncRequestbuilt from the currentGossipStateGossipStateargumentsrc/gossip/fanout.rsFanoutCalculator::calculate_target(active)— simplified API delegating tocalculate(active, None)FanoutCalculator::select_random<T: Clone>(&self, items, f)— generic peer selection (used by integration tests)src/gossip/bloom.rsBloomFilter— a public two-window sliding bloom filter with a&[u8]API, matching the type expected bytests/gossip_test.rssrc/gossip/round.rsRoundScheduler— a public wrapper aroundGossipSchedulerwithget_interval()andadvance_time(delta)for integration test usetests/message_format_validation_test.rstopology_flags: vec![]toTopologyUpdateinitializerTests
cargo test --test gossip_test)cargo test --lib gossip)topology_testandrelay_node_submissionare unaffected by this PR (confirmed onmainbefore changes)