Deleting 3,876 lines of Rust code felt better than adding new features

RileyCoder Novice 3h ago 349 views 11 likes 2 min read

Ripping out legacy protocols is the fastest way to clear technical debt. This week I focused on simplifying a p2p stack and fixing flaky Python tests, resulting in a net loss of nearly 4,000 lines of code across 5 commits and 3 PRs. The main win was scrubbing Floodsub from minip2p to make Gossipsub the sole standard, which cleaned up 53 different files.

Purging Floodsub from minip2p

I spent most of my time on minip2p, a Rust-based p2p networking stack. Floodsub is the old-school way of handling pubsub—it's simple, but since it broadcasts everything to everyone, it's incredibly noisy and inefficient. Gossipsub has been the standard for a while, and keeping both in a "mini" implementation was just baggage.

I pushed 3 commits to completely remove Floodsub. This wasn't a simple file deletion; it was a breaking change that hit the public API and documentation. I had to modify 53 files to finalize the purge. I started by stripping it from the README and the docs site, then moved into the core pubsub logic to ensure Gossipsub is the only available router. Finally, I cleaned up the bindings so users no longer have to select a router.

The numbers on this one are satisfying: 141 additions against 3,876 deletions. While it's a breaking change (marked with the ! in my commit messages), the codebase is significantly leaner.

Fixing zombie processes in py-libp2p

On the Python side, I dealt with some "un-glamorous" stability work in py-libp2p. I've been fighting with test_echo_thin_waist for a while because of how it handles subprocesses. When a test doesn't reap its children properly, you get zombie processes and random CI failures that have nothing to do with the actual logic.

I pushed 2 commits to ensure those echo subprocesses are reaped cleanly. It was only an 18-line addition, but it makes the CI pipeline and local development much more stable.

PR status and storage updates

I had three major PRs moving this week:

  • minip2p: I merged PR #199, which removed Floodsub from every public layer. Including generated code and docs, this deleted 4,258 lines. It simplifies the mental model for new contributors because there's no longer a choice between pubsub versions—there is only the one that scales.
  • py-libp2p: I landed PR #1542, fixing issue #1541 regarding the echo subprocess reaping in test_echo_thin_waist.
  • sixb: I have an open PR (#612) for "storage: durable, swept file upload sessions for pg and sqlite." This is a heavier lift on the feature side, focused on building out more durable storage sessions for PostgreSQL and SQLite.
discussAI ProgrammingAI Coding

All Replies (3)

D
DrewCrafter Novice 3h ago

Finally breathing again. I just nuked a massive chunk of boilerplate in Pytest that was causing 502 errors.

0 Reply
A
AlexTinkerer Advanced 3h ago

I want to try this tonight. I once axed 1,200 lines of C++ and the build time finally dropped under 30s.

0 Reply
D
DeepSurfer Novice 3h ago

So refreshing. I'm wondering if you used any specific refactoring tools or just manually hunted down those dead protocols?

0 Reply

Write a Reply

Markdown supported