Skip to content

feat(routing-policy): experimental 'ledbat' delay-based scavenger preset - #4112

Merged
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/policy-preset-ledbat
Aug 23, 2026
Merged

feat(routing-policy): experimental 'ledbat' delay-based scavenger preset#4112
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/policy-preset-ledbat

Conversation

@0pcom

@0pcom 0pcom commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Adds an opt-in routing-policy preset ledbat, a delay-based background/scavenger multipath policy inspired by LEDBAT (RFC 6817). It changes no default — selectable only via preset:ledbat.

decideLedbat provisions a lean symmetric mux=3 over multi-hop with auto byte distribution, re-evaluated every 20s (chat stays single-route). tickLedbat tracks each leg's EWMA-smoothed delay and a per-leg base (running-min) delay and acts on the queuing delay = smoothed − base:

  • Back off (yield): if any active leg's queuing delay exceeds 60ms, demote the highest-queuing-delay non-primary active leg to warm standby, shrinking the active set toward 1. Never parks leg 0, never tears a leg down.
  • Grow: while every active leg reads within 60ms of its base and the active set is below the cap of 3, re-promote one parked leg (reserve only, no fresh dial).

One arbitrated action per tick, integer/float + map state only (no time/rand), so it is deterministic and byte-identical under wazero and native compilation.

Registered in preset.Names, the Decide/OnTick dispatch, and the wasm manifest; bundle.wasm is rebuilt (TinyGo) so the wazero path carries it. Native unit tests cover the decide shape and the back-off / floor / grow tick rules; the native↔wazero decide+tick parity test is extended to ledbat.

go test ./pkg/router/policy/... passes, including the wazero parity test; go build . passes.

… preset

A new opt-in routing-policy preset inspired by LEDBAT (RFC 6817). It changes
no default — you get it only via preset:ledbat.

decideLedbat provisions a lean symmetric mux=3 over multi-hop with "auto" byte
distribution, re-evaluated every 20s (chat stays single-route). tickLedbat is
the scavenger: it tracks each leg's EWMA-smoothed delay and a per-leg base
(running-min) delay, then acts on the queuing delay = smoothed - base.

  - Back off (yield): if any active leg's queuing delay exceeds 60ms, demote the
    highest-queuing-delay non-primary active leg to warm standby, shrinking the
    active set toward 1 (never parks leg 0, never tears down).
  - Grow: while every active leg reads within 60ms of its base and the active set
    is below the mux cap of 3, re-promote one parked leg (reserve only, no fresh
    dial).

One arbitrated action per tick, integer/float + map state only (no time/rand),
so it is deterministic and byte-identical under wazero and native compilation.

Registered in preset.Names, OnTick/Decide dispatch, and the wasm manifest; the
bundle.wasm is rebuilt so the wazero path carries it. Native unit tests cover
the decide shape and the back-off / floor / grow tick rules, and the
native<->wazero decide+tick parity test is extended to ledbat.
@0pcom
0pcom merged commit b94a7cf into skycoin:develop Aug 23, 2026
11 of 16 checks passed
@0pcom
0pcom deleted the feat/policy-preset-ledbat branch August 23, 2026 01:57
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.

1 participant