Skip to content

ldk wrapper - #136

Merged
carlaKC merged 2 commits into
carlaKC:masterfrom
elnosh:ldk-impl
Jul 22, 2026
Merged

ldk wrapper#136
carlaKC merged 2 commits into
carlaKC:masterfrom
elnosh:ldk-impl

Conversation

@elnosh

@elnosh elnosh commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

I've ran a couple simulations with it. Will do some more testing before moving out of draft.

It is using changes from this branch which mostly added added methods needed to impl the ReputationManager.

@elnosh
elnosh marked this pull request as ready for review July 15, 2026 20:12

@carlaKC carlaKC left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, just a few nits then this is ready to go.

Were the main changed needed for the LDK branch just utilities to get snapshots etc?

Also did you run any of the existing attacks with this, interested to know if there are any behavior changes.

Comment thread ln-simln-jamming/src/ldk_manager.rs Outdated
Comment on lines +68 to +85
fn params_to_config(params: &ForwardManagerParams) -> ResourceManagerConfig {
ResourceManagerConfig {
general_allocation_pct: params.general_slot_portion,
congestion_allocation_pct: params.congestion_slot_portion,
resolution_period: params.reputation_params.resolution_period,
revenue_window: params.reputation_params.revenue_window,
reputation_multiplier: params.reputation_params.reputation_multiplier,
}
}

fn bucket_from_snapshot(snapshot: BucketSnapshot) -> BucketResources {
BucketResources {
slots_used: snapshot.slots_used,
slots_available: snapshot.slots_available,
liquidity_used_msat: snapshot.liquidity_used_msat,
liquidity_available_msat: snapshot.liquidity_available_msat,
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement From or Into?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't do it because BucketSnapshot and ResourceManagerConfig come from ldk

self.inner.add_channel_with_reputation(
channel_id,
max_in_flight,
MAX_ACCEPTED_HTLCS,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use the graph's max_htlc_count rather than a hard set default?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we fix separately? we use that hard default in ForwardManager too

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah separately is good 👍

Comment thread ln-simln-jamming/src/ldk_manager.rs Outdated
@elnosh

elnosh commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Were the main changed needed for the LDK branch just utilities to get snapshots etc?

yes, main reasons were:

  • bucket snapshot that we return from get_allocation_snapshot
  • list channels call that we use to get channel snapshots
  • simulation helpers to mark general and congestion as jammed

elnosh and others added 2 commits July 22, 2026 15:03
Wraps LDK's DefaultResourceManager and implements the
simulator's ReputationManager trait so that the LDK resource manager
can be used in the simulator.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Makes ReputationInterceptor generic over the resource manager and adds
an ldk-resource-manager feature to select the LDK implementation at
compile time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@elnosh

elnosh commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Also did you run any of the existing attacks with this, interested to know if there are any behavior changes.

I ran slow jam attack and saw similar results. Although that does not touch general and congestion functionality as those are hard set to "jammed"

@carlaKC

carlaKC commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Although that does not touch general and congestion functionality as those are hard set to "jammed"

That's the case for most of the attacks, so I think it's fine! Thanks for re-running

@carlaKC
carlaKC merged commit a3923b3 into carlaKC:master Jul 22, 2026
2 checks passed
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