Skip to content

fuzz resource manager#4527

Draft
elnosh wants to merge 15 commits intolightningdevkit:mainfrom
elnosh:resource-mgr-fuzz
Draft

fuzz resource manager#4527
elnosh wants to merge 15 commits intolightningdevkit:mainfrom
elnosh:resource-mgr-fuzz

Conversation

@elnosh
Copy link
Copy Markdown
Contributor

@elnosh elnosh commented Mar 31, 2026

fuzz the DefaultResourceManager introduced in #4409

@ldk-reviews-bot
Copy link
Copy Markdown

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

elnosh and others added 15 commits March 31, 2026 16:35
Implements a decaying average over a rolling window. It will be
used in upcoming commits by the resource manager to track
reputation and revenue of channels.
The AggregatedWindowAverage implemented here will be used in
upcoming commits to track the incoming revenue that channels have
generated through HTLC forwards.
Resources available in the channel will be divided into general,
congestion and protected resources. Here we implement the general
bucket with basic denial of service protections.

Co-authored-by: Carla Kirk-Cohen <kirkcohenc@gmail.com>
Resources available in the channel will be divided into general,
congestion and protected resources. Here we implement the bucket
resources that will be used for congestion and protected.
The Channel struct introduced here has the core information that
will be used by the resource manager to make forwarding decisions
on HTLCs:

- Reputation that this channel has accrued as an outgoing link
in HTLC forwards.

- Revenue (forwarding fees) that the channel has earned us as an
incoming link.

- Pending HTLCs this channel is currently holding as an outgoing link.

- Bucket resources that are currently in use in general, congestion
and protected.
Introduces the DefaultResourceManager struct. The core of methods
that will be used to inform the HTLC forward decisions are
add/resolve_htlc.

- add_htlc: Based on resource availability and reputation, it
evaluates whehther to forward or fail the HTLC.

- resolve_htlc: Releases the bucket resources used from a HTLC
previously added and updates the channel's reputation based on HTLC
fees and resolution times.
Adds write and read implementations to persist the
DefaultResourceManager.
When adding a new channel, return an error instead of debug_assert
if the allocated values for the buckets are invalid.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@elnosh elnosh force-pushed the resource-mgr-fuzz branch from 8077c89 to 7983986 Compare March 31, 2026 20:38
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.

2 participants