Home / Input Output / ce-netsim
Feb 27, 6-7 PM (0)
Feb 27, 7-8 PM (0)
Feb 27, 8-9 PM (0)
Feb 27, 9-10 PM (0)
Feb 27, 10-11 PM (0)
Feb 27, 11-12 AM (0)
Feb 28, 12-1 AM (0)
Feb 28, 1-2 AM (0)
Feb 28, 2-3 AM (0)
Feb 28, 3-4 AM (0)
Feb 28, 4-5 AM (0)
Feb 28, 5-6 AM (0)
Feb 28, 6-7 AM (0)
Feb 28, 7-8 AM (0)
Feb 28, 8-9 AM (0)
Feb 28, 9-10 AM (0)
Feb 28, 10-11 AM (0)
Feb 28, 11-12 PM (0)
Feb 28, 12-1 PM (0)
Feb 28, 1-2 PM (0)
Feb 28, 2-3 PM (0)
Feb 28, 3-4 PM (0)
Feb 28, 4-5 PM (0)
Feb 28, 5-6 PM (0)
Feb 28, 6-7 PM (0)
Feb 28, 7-8 PM (0)
Feb 28, 8-9 PM (0)
Feb 28, 9-10 PM (73)
Feb 28, 10-11 PM (0)
Feb 28, 11-12 AM (0)
Mar 01, 12-1 AM (0)
Mar 01, 1-2 AM (0)
Mar 01, 2-3 AM (0)
Mar 01, 3-4 AM (0)
Mar 01, 4-5 AM (0)
Mar 01, 5-6 AM (0)
Mar 01, 6-7 AM (0)
Mar 01, 7-8 AM (0)
Mar 01, 8-9 AM (0)
Mar 01, 9-10 AM (0)
Mar 01, 10-11 AM (0)
Mar 01, 11-12 PM (0)
Mar 01, 12-1 PM (0)
Mar 01, 1-2 PM (0)
Mar 01, 2-3 PM (0)
Mar 01, 3-4 PM (0)
Mar 01, 4-5 PM (0)
Mar 01, 5-6 PM (0)
Mar 01, 6-7 PM (0)
Mar 01, 7-8 PM (0)
Mar 01, 8-9 PM (0)
Mar 01, 9-10 PM (0)
Mar 01, 10-11 PM (0)
Mar 01, 11-12 AM (0)
Mar 02, 12-1 AM (0)
Mar 02, 1-2 AM (0)
Mar 02, 2-3 AM (0)
Mar 02, 3-4 AM (0)
Mar 02, 4-5 AM (0)
Mar 02, 5-6 AM (0)
Mar 02, 6-7 AM (0)
Mar 02, 7-8 AM (0)
Mar 02, 8-9 AM (0)
Mar 02, 9-10 AM (0)
Mar 02, 10-11 AM (0)
Mar 02, 11-12 PM (0)
Mar 02, 12-1 PM (0)
Mar 02, 1-2 PM (0)
Mar 02, 2-3 PM (0)
Mar 02, 3-4 PM (0)
Mar 02, 4-5 PM (0)
Mar 02, 5-6 PM (0)
Mar 02, 6-7 PM (0)
Mar 02, 7-8 PM (0)
Mar 02, 8-9 PM (0)
Mar 02, 9-10 PM (0)
Mar 02, 10-11 PM (0)
Mar 02, 11-12 AM (0)
Mar 03, 12-1 AM (0)
Mar 03, 1-2 AM (0)
Mar 03, 2-3 AM (0)
Mar 03, 3-4 AM (0)
Mar 03, 4-5 AM (0)
Mar 03, 5-6 AM (0)
Mar 03, 6-7 AM (0)
Mar 03, 7-8 AM (0)
Mar 03, 8-9 AM (0)
Mar 03, 9-10 AM (0)
Mar 03, 10-11 AM (0)
Mar 03, 11-12 PM (0)
Mar 03, 12-1 PM (0)
Mar 03, 1-2 PM (0)
Mar 03, 2-3 PM (0)
Mar 03, 3-4 PM (0)
Mar 03, 4-5 PM (0)
Mar 03, 5-6 PM (0)
Mar 03, 6-7 PM (0)
Mar 03, 7-8 PM (0)
Mar 03, 8-9 PM (0)
Mar 03, 9-10 PM (0)
Mar 03, 10-11 PM (0)
Mar 03, 11-12 AM (0)
Mar 04, 12-1 AM (0)
Mar 04, 1-2 AM (0)
Mar 04, 2-3 AM (0)
Mar 04, 3-4 AM (0)
Mar 04, 4-5 AM (0)
Mar 04, 5-6 AM (0)
Mar 04, 6-7 AM (0)
Mar 04, 7-8 AM (0)
Mar 04, 8-9 AM (0)
Mar 04, 9-10 AM (0)
Mar 04, 10-11 AM (0)
Mar 04, 11-12 PM (0)
Mar 04, 12-1 PM (0)
Mar 04, 1-2 PM (0)
Mar 04, 2-3 PM (0)
Mar 04, 3-4 PM (0)
Mar 04, 4-5 PM (0)
Mar 04, 5-6 PM (0)
Mar 04, 6-7 PM (0)
Mar 04, 7-8 PM (0)
Mar 04, 8-9 PM (0)
Mar 04, 9-10 PM (0)
Mar 04, 10-11 PM (0)
Mar 04, 11-12 AM (0)
Mar 05, 12-1 AM (0)
Mar 05, 1-2 AM (0)
Mar 05, 2-3 AM (0)
Mar 05, 3-4 AM (0)
Mar 05, 4-5 AM (0)
Mar 05, 5-6 AM (0)
Mar 05, 6-7 AM (0)
Mar 05, 7-8 AM (0)
Mar 05, 8-9 AM (0)
Mar 05, 9-10 AM (0)
Mar 05, 10-11 AM (0)
Mar 05, 11-12 PM (0)
Mar 05, 12-1 PM (0)
Mar 05, 1-2 PM (0)
Mar 05, 2-3 PM (0)
Mar 05, 3-4 PM (0)
Mar 05, 4-5 PM (0)
Mar 05, 5-6 PM (0)
Mar 05, 6-7 PM (0)
Mar 05, 7-8 PM (0)
Mar 05, 8-9 PM (0)
Mar 05, 9-10 PM (0)
Mar 05, 10-11 PM (0)
Mar 05, 11-12 AM (0)
Mar 06, 12-1 AM (0)
Mar 06, 1-2 AM (0)
Mar 06, 2-3 AM (0)
Mar 06, 3-4 AM (0)
Mar 06, 4-5 AM (0)
Mar 06, 5-6 AM (0)
Mar 06, 6-7 AM (0)
Mar 06, 7-8 AM (0)
Mar 06, 8-9 AM (0)
Mar 06, 9-10 AM (0)
Mar 06, 10-11 AM (0)
Mar 06, 11-12 PM (0)
Mar 06, 12-1 PM (0)
Mar 06, 1-2 PM (0)
Mar 06, 2-3 PM (0)
Mar 06, 3-4 PM (0)
Mar 06, 4-5 PM (0)
Mar 06, 5-6 PM (0)
Mar 06, 6-7 PM (0)
73 commits this week Feb 27, 2026 - Mar 06, 2026
fix leptos router base path for GitHub Pages deployment
The Router's route matching failed on GitHub Pages because the app is
served from /ce-netsim/ but routes were defined relative to /. Set the
Router's base prop via a compile-time env var (LEPTOS_BASE_PATH) so
it works both locally (defaults to "") and on GitHub Pages (/ce-netsim).
validate PacketLoss rate at construction; add Display and FromStr
PacketLoss::Rate now wraps a PacketLossRate newtype enforcing 0.0..=1.0.
PacketLoss::rate(f64) rejects NaN, negative, and >1.0 values with a
typed PacketLossRateError. Display formats as percentage (e.g. "5%",
"12.30%") and FromStr parses back. Error types use thiserror.
fix Bandwidth parsing overflow and improve Display formatting
Replace saturating_mul with checked_mul in Bandwidth::FromStr so that
values exceeding u64::MAX (e.g. "99999999999gbps") return a clear error
instead of silently clamping to Bandwidth::MAX.

Rework Bandwidth::Display to always pick the largest SI unit and show up
to 2 decimal places with trailing zeros trimmed (e.g. 1.5kbps, 4.19gbps,
18446744073.71gbps).
fix Bandwidth::capacity() performance by avoiding u128 division
The previous implementation widened to u128 for the multiplication,
then divided by 8_000_000 in u128. On x86-64 the u128 division
compiles to __udivti3 — a slow software routine that caused 17-82%
regressions in the advance benchmarks.

Split the computation into quotient/remainder so all arithmetic stays
in u64: q×µs + (r×µs)/8_000_000. The remainder is always < 8_000_000,
so r×µs fits u64 for steps up to ~26.7 days.

Benchmarks after the fix show 15-49% improvement over the previous
version.
add unit tests across netsim-core and fix edition-2024 issues
Add 22 new tests covering previously-untested code paths:
- node/mod.rs: default settings, upload/download bandwidth and buffer setters
- transit.rs: latency gating, buffer-overflow corruption, sender-buffer-full
  error, zero-byte packet edge case
- route.rs: accessor methods, direction selection based on node ID order
- network/mod.rs: Default, node/link accessors, packets_in_transit, round
  advancement, set_seed determinism, download bandwidth via builder
- download.rs + upload.rs: accessor method delegation

Fix static mut in packet.rs test (forbidden in edition 2024) by replacing
with AtomicU8. Add #[derive(Debug)] to Transit<T> so it can be used in
Result::unwrap_err().

Coverage: 88.9% → 90.1%+ (node/mod.rs 71→100%, route.rs 78→100%,
network/mod.rs 93→99%).
replace anyhow::Error with typed PacketBuildError in PacketBuilder::build()
PacketBuilder::build() previously used anyhow::bail! for missing-field
errors, making it impossible for callers to match on specific failure
cases. Introduce a PacketBuildError enum (MissingSender, MissingRecipient,
MissingData) via thiserror, consistent with the pattern used by
RouteError, SendError, and PacketLossRateError.

Update the downstream netsim crate's SendToError::FailedToBuildMessage
to wrap PacketBuildError instead of anyhow::Error.
cap link output to receiver's interface speed
Bytes on a wire cannot arrive at the receiver faster than the
receiver's interface speed. When a link's bandwidth exceeds the
downstream node's download bandwidth, excess bytes now remain in
the link's pending buffer (still on the wire) instead of being
pushed to the download channel and triggering false corruption.

- Add `Download::available_capacity()` returning
  `min(channel_remaining, buffer_remaining)`
- Add `max_output` parameter to `LinkChannel::process()` so the
  link only releases what the receiver can absorb
- Wire up flow control in `Transit::advance()`
- Add integration test reproducing the demo topology
  (1 Gbps link → 200 Mbps client, 1 MB packet delivers)
replace stats.rs with direct Network accessors
Delete the broken snapshot-based stats system from both crates.
Network now exposes node(), nodes(), link(), links(),
packets_in_transit(), and round() for direct read-only inspection.
Node/Link internal methods restricted to pub(crate); Link exposes
per-direction bandwidth via forward_bandwidth()/reverse_bandwidth().
fix simple.rs example: add missing configure_link and use realistic bandwidth
The example was broken in two ways: no link was configured between nodes
(causing LinkNotFound on send), and the 1bps upload bandwidth could never
deliver a 12-byte packet in the 12 seconds of simulation time advanced.

Fixed by adding a configure_link call with 50ms latency and 100 Mbps link
bandwidth, and changing upload bandwidth to 10 Mbps. The example now
demonstrates latency gating (packet blocked at 10ms) then delivery (at 100ms).
add Network integration tests
The Network API (send, advance_with, route) had zero test coverage at the
integration level — all existing tests were on individual components. Add
13 tests covering: basic delivery, payload round-trip, latency, bandwidth
saturation, packet loss, all four SendError/RouteError variants, corruption
detection, multiple packets in flight, and bidirectional traffic.
replace anyhow with typed errors in all netsim-core FromStr impls
Migrate every `FromStr` implementation in netsim-core from
`anyhow::Error` to purpose-built error types using `thiserror`:

- `NodeId` → `ParseIntError` (stdlib, no wrapper needed)
- `time::Duration` → `DurationParseError` (5 variants)
- `Latency` → `DurationParseError` (delegates to time module)
- `Bandwidth` → `BandwidthParseError` (5 variants)
- `Latitude/Longitude/Location/PathEfficiency` → `GeoParseError` (6 variants)

Move `anyhow` from `[dependencies]` to `[dev-dependencies]` in
netsim-core since it is now only used by doc test harnesses.

Consolidate all workspace dependency versions in the root `Cargo.toml`
and reference them with `dep.workspace = true` in both crate manifests.

Export the new error types (`BandwidthParseError`, `DurationParseError`,
`GeoError`, `GeoParseError`) from the crate root.