Skip to content

feat(simulator): implement PacketSimulator for deterministic simulator#2769

Merged
numinnex merged 3 commits intoapache:masterfrom
krishvishal:network-sim
Feb 27, 2026
Merged

feat(simulator): implement PacketSimulator for deterministic simulator#2769
numinnex merged 3 commits intoapache:masterfrom
krishvishal:network-sim

Conversation

@krishvishal
Copy link
Contributor

Summary:

  • Adds a PacketSimulator that models a full network fault-injection layer: per-path latency (exponential distribution), packet loss, link capacity limits with random eviction, automatic network partitioning with configurable lifecycle, and per-path clogging.
  • Adds a ReadyQueue — a min-heap priority queue with reservoir-sampled random ready removal, used to order packets by delivery tick and uniformly select among simultaneously ready items.
  • Partition modes: UniformSize, UniformPartition, IsolateSingle, all guarantee at least one node in each partition. Supports symmetric and asymmetric partitions.

Note:

  • Pull-based batch delivery: step() returns all ready packets for the current tick in a single Vec. Packets delivered in the same tick cannot trigger chain reactions within
    that tick. This was done because its difficult to do self-referential structs in Rust and even with using dynamic dispatch we have to fight the borrow checker since we would need mutable access to different fields at the same time.

@krishvishal krishvishal changed the title feat(simulator): Impl PacketSimulator for deterministic network feat(simulator): Impl PacketSimulator for deterministic simulator Feb 18, 2026
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 72.67525% with 191 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.63%. Comparing base (6f01169) to head (1e9caf7).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
core/simulator/src/packet.rs 79.13% 103 Missing and 3 partials ⚠️
core/simulator/src/network.rs 0.00% 55 Missing ⚠️
core/simulator/src/ready_queue.rs 77.94% 24 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2769      +/-   ##
============================================
+ Coverage     67.58%   67.63%   +0.05%     
  Complexity      708      708              
============================================
  Files          1027     1030       +3     
  Lines         83147    83846     +699     
  Branches      60004    60714     +710     
============================================
+ Hits          56195    56711     +516     
- Misses        24612    24775     +163     
- Partials       2340     2360      +20     
Flag Coverage Δ
csharp 67.06% <ø> (-0.19%) ⬇️
go 6.84% <ø> (ø)
java 54.02% <ø> (ø)
node 92.26% <ø> (-0.07%) ⬇️
python 0.00% <ø> (ø)
rust 69.69% <72.67%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
core/common/src/types/consensus/header.rs 13.97% <ø> (ø)
core/simulator/src/lib.rs 0.00% <ø> (ø)
core/simulator/src/ready_queue.rs 77.94% <77.94%> (ø)
core/simulator/src/network.rs 0.00% <0.00%> (ø)
core/simulator/src/packet.rs 79.13% <79.13%> (ø)

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@numinnex numinnex changed the title feat(simulator): Impl PacketSimulator for deterministic simulator feat(simulator): implement PacketSimulator for deterministic simulator Feb 20, 2026
@krishvishal
Copy link
Contributor Author

I think both of these are flaky integration tests.

  • integration::mod cli::personal_access_token::test_pat_login_options::should_be_successful
  • integration::mod cli::system::test_cli_session_scenario::should_be_successful

numinnex
numinnex previously approved these changes Feb 25, 2026
@krishvishal krishvishal requested a review from numinnex February 27, 2026 04:52
@numinnex numinnex merged commit 3432714 into apache:master Feb 27, 2026
71 checks passed
@krishvishal krishvishal deleted the network-sim branch February 27, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants