Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renepay const prob cost #7540

Merged

Conversation

Lagrang3
Copy link
Collaborator

@Lagrang3 Lagrang3 commented Aug 8, 2024

The probability for a success forward of x amount on a channel is now
computed as:

        P_success(x) = b * P_rene(x)

where P_rene(x) is the probability distribution proposed by @renepickhardt
with a uniform distribution on the known liquidity of the
channel and b is a new parameter we add in this PR, by the name of
"base probability". The "base probability" represents the probability
for a channel in the network chosen at random to be able to forward at
least 1msat, ie. of being alive, non-depleted and with at least one HTLC
slot. We don't know the value of 'b', but for the moment we assume that
it is 0.98 and use that as default.

As a consequence the probability cost becomes non-linear and non-convex
because of the additional constant term:

        Cost(x) = - log P_success(x)
                = - log b   -  log P_rene(x)
                = - log b  +  Cost_rene(x)

We currently don't handle well base fees and neither this additional
"base probability" but we can as a first approximation linearize the
cost function in this way:

        Cost_linear(x) = (- log b)*x  +  Cost_rene_linear(x)

@cdecker
Copy link
Member

cdecker commented Aug 8, 2024

@renepickhardt this sounds a lot like the discussion with a multiplicative factor from Monday :-) Could you recap that discussion briefly here?

@Lagrang3 Lagrang3 marked this pull request as ready for review August 10, 2024 08:22
The probability for a success forward of x amount on a channel is now
computed as:

	P_success(x) = b * P_rene(x)

where P_rene(x) is the probability distribution proposed by Rene
Pickhardt with a uniform distribution on the known liquidity of the
channel and 'b' is a new parameter we add in this PR, by the name of
"base probability". The "base probability" represents the probability
for a channel in the network choosen at random to be able to forward at
least 1msat, ie. of being alive, non-depleted and with at least one HTLC
slot. We don't know the value of 'b', but for the moment we assume that
it is 0.98 and use that as default.

As a consequence the probability cost becomes non-linear and non-convex
because of the additional constant term:

	Cost(x) = - log P_success(x)
	        = - log b  -  - log P_rene(x)
		= - log b  +  Cost_rene(x)

We currently don't handle well base fees and neither this additional
"base probability" but we can as a first approximation linearize the
cost function in this way:

	Cost_linear(x) = (- log b)*x  +  Cost_rene_linear(x)

Changelog-Added: renepay: Add a dev parameter to renepay that represents
a constant probability of availability for all channels in the network.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
@Lagrang3 Lagrang3 added this to the v24.08 milestone Aug 13, 2024
@Lagrang3
Copy link
Collaborator Author

I've seen great improvements in the reliability of the payments after adding this and #7548.
That's why I am flagging this for v24.08. I'll appreciate if it is considered for merging.

As a disclaimer, I have not tools to quantify this improvement, that judgement is only based on my tests on mainnet.

@Lagrang3
Copy link
Collaborator Author

Lagrang3 commented Aug 13, 2024

Rebased to fix conflicts, head is 67ffd8d.

@ShahanaFarooqui ShahanaFarooqui removed this from the v24.08 milestone Aug 13, 2024
@rustyrussell rustyrussell merged commit 7056018 into ElementsProject:master Aug 15, 2024
37 checks passed
@Lagrang3 Lagrang3 deleted the renepay-const-prob-cost branch August 15, 2024 18:37
@ShahanaFarooqui ShahanaFarooqui added this to the v24.08 milestone Aug 23, 2024
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.

4 participants