Repository navigation
Conversation
Add onion budget and payload constructors to the internal xpay API. Onion budget computation can be used to know a realistic number of hops that constraints our payment before calling askrene. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
bba4723 to
8598598
Compare
|
I think you may have accidentally rebadged on top of some other branch that is not part of |
8598598 to
3d04549
Compare
3d04549 to
d5d2044
Compare
|
Indeed, that is what @Lagrang3 said in his opening post. Still does not explain why the unrelated commits are in here, if it is supposed to be a clean cherry-pick of mainline commits onto the release branch. |
nGoline
left a comment
There was a problem hiding this comment.
Approved with a few nits:
tests/test_askrene.py: the maxhops tests from master (test_getroutes_maxhops, test_getroutes_maxhops_mpp, test_getroutes_maxhops_binding, test_getroutes_hop_probability, and ideally test_real_data_maxhops) should port with little effort by passing layers=["maxhops=N"]. GenChannel and generate_gossip_store exist on this branch. Right now the backport-only parsing path (bad values rejected, entry removed before layer lookup, applies to every MPP part) and the dial-race early exit have no test.
tests/test_xpay.py: without dev-invoice-blinded-padding, the blinded path branch of check_onion_budget (path discard, the "not a front node" failure, the +1 in get_askrene_onion_budget) has no integration test here. That is acceptable if we rely on master's coverage, but please confirm that this was intended.
Changelog-Changed: xpay: computes a budget for the number of hops in the payment depending on the final payload and blinded paths, it can fail early if the onion packet doesn't fit Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Added an homogeneous and constant cost to every hop in the MCF solver.
test_real_data shows a slight decrease of paths lengths by looking at
the path length histograms
SLOW_MACHINE=0
histogram before {2: 1, 3: 8, 4: 34, 5: 77, 6: 45, 7: 23, 8: 4}
histogram after {2: 2, 3: 59, 4: 110, 5: 5, 6: 5}
SLOW_MACHINE=1
histograms before {2: 1, 3: 3, 4: 11, 5: 15, 6: 6, 7: 6, 8: 3}
histogram after {2: 2, 3: 16, 4: 18, 5: 1, 6: 5}
the most frequent path length moves from 5 to 4 and there aren't more
than 6 hops in any given path.
Another consequence of the additional per hop cost is a slight reduction
in the number paths (or payment parts) per route query. Even though our linear
approximation gives equal cost to 3 paths of length 1 than to 1 path of
length 3.
in test_real_data this is shown by the expected_first_success (the
number of success computations in the first loop) and
expected_total_paths (the total number of parts for those successes,
also the sum of values in the histogram).
For SLOW_MACHINE=0 we get a mean parts per payment of
expected_total_paths / expected_first_success = 192 / 95 = 2.02
that becomes
expected_total_paths / expected_first_success = 181 / 95 = 1.90
For SLOW_MACHINE=1 we get a mean parts per payment of
expected_total_paths / expected_first_success = 45 / 24 = 1.87
that becomes
expected_total_paths / expected_first_success = 42 / 24 = 1.75
Changelog-Changed: askrene-getroutes: penalizes every extra hop in every route with an homogeneous and constant probability of failure of 1%, as a consequence askrene will slightly prefer smaller routes and fewer payment parts.
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Treat all cost features as the same type of variable. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Use cost dials normalized to 1 to combine the cost of different features. This is a generalization of the mu factor combination with medians ratio applied to more than 2 features: fees and delays. Just like that fee constraining got slightly better. Before mu (the corresponding fee dial) started at 1% and increased linearly in chunks of 10%. Now every dial is increased by a factor of 2 per iteration and it approximates 1 asymptotically as the dials are renormalized at each iteration. We have a cut-off at 1 - 1e-6, that means 27 iterations until mu reaches the cut-off. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
No updates to the RPC, no need to run as developer. We inject the maxhops value through a layer name. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Fail early if we see detect a suggestion that a pair of cost dials are racing each other. We are not likely to find a solution and we would just waste cycles. This usually means that our method is not able to find a solution that satisfies all given constraints. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Changelog-Fixed: xpay: Clamp the length of the payment routes using askrene's maxhops option aiming at producing routes that fit the data limits in the onion packet. Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
d5d2044 to
7d128d5
Compare
|
Restored askrene tests with the |
Similar to #9627, but with a little hack to call
maxhopson askrene without needing to modify the RPC.It is rebased on top of v26.06.9