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

Askrene: an EXPERIMENTAL MCF plugin and infrastructure #7517

Merged
merged 28 commits into from
Aug 7, 2024

Commits on Aug 7, 2024

  1. doc: document askrene.

    It's experimental, so API may change, but it definitely does need explanation!
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    0180ad9 View commit details
    Browse the repository at this point in the history
  2. gossmap: don't process channel_announcement until amount is present.

    This simplifies the callers significantly: all channel_announcements now
    have an amount, so gossmap_chan_get_capacity() only fails on a local
    modification.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    1034c6f View commit details
    Browse the repository at this point in the history
  3. libplugin: add data pointer for plugin convenience.

    This avoids globals (and means memleak traverses the variables!): we
    only change over the test plugin though, to avoid unnecessary churn.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    df08615 View commit details
    Browse the repository at this point in the history
  4. common: new parameter parsing routines.

    param_u16 (for delay).
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    ad2ac92 View commit details
    Browse the repository at this point in the history
  5. bitcoin: add short_channel_id_dir_eq.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    60f0189 View commit details
    Browse the repository at this point in the history
  6. common: promote useful routines from renepay.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    cfe5f05 View commit details
    Browse the repository at this point in the history
  7. askrene: skeleton which does JSON API.

    All the infrastructure and interfaces, but it doesn't do anything yet.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    a611ec2 View commit details
    Browse the repository at this point in the history
  8. askrene: add layers infrastructure.

    These are the repositories of all information.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    
    
    Header from folded patch 'layers-fixup.patch':
    
    fixup! askrene: add layers infrastructure.
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    d786110 View commit details
    Browse the repository at this point in the history
  9. askrene: reservation implementation.

    They tell us what paths they're using, so we can adjust capacity estimates
    accordingly.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    
    
    Header from folded patch 'reserve-fixup.patch':
    
    fixup! askrene: reservation implementation.
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    11fd784 View commit details
    Browse the repository at this point in the history
  10. askrene: flesh out getroutes() a little.

    We apply all the gossmods for the layers they specified, and create a
    naive routine to give the capacity of a channel given those layers.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    99ad986 View commit details
    Browse the repository at this point in the history
  11. askrene: always set a dummy constraint when we add a local channel.

    This means we never have to look up a local channel when asked the capacity.
    
    We mark these dummy constraints with an MAX timestamp.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    0e7073b View commit details
    Browse the repository at this point in the history
  12. askrene: fast lookup for capacities.

    We don't know anything about most channels, so we create an array of
    fp16_t containing them.  We zero out ones where we do know something,
    and use the previous code as the slow path.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    f93324e View commit details
    Browse the repository at this point in the history
  13. pytest: test file for askrene.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    15cbc14 View commit details
    Browse the repository at this point in the history
  14. askrene: copy mcf.[ch] from renepay with minimal modifications.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    46d00ed View commit details
    Browse the repository at this point in the history
  15. askrene: simplify minflow()

    We let the caller choose mu, and iterate if necessary: it can also
    check its limits for fees, etc.  Rationalize it to 0-100 inclusive for
    human consumption.
    
    This means we don't loop internally, and in fact there's only one
    failure mode: we cannot find enough capacity.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    5393432 View commit details
    Browse the repository at this point in the history
  16. askrene: copy flow and dijkstra from renepay.

    Still don't actually try compiling them.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    4cd80da View commit details
    Browse the repository at this point in the history
  17. askrene/flow: don't omit initial hop in flow_spend.

    That will be done in the caller, not here.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    19e3495 View commit details
    Browse the repository at this point in the history
  18. askrene: remove code which tries to handle tal failures.

    tal does not fail: the default handler (which we use) aborts.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    a28759b View commit details
    Browse the repository at this point in the history
  19. askrene: simply fail if a flow amount exceeds 64 bits.

    Rather than handling failure, simply report and exit the plugin.
    Simplifies error handling.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    2c92d23 View commit details
    Browse the repository at this point in the history
  20. askrene: make the flow.[ch] files compile.

    This adapts them to their new locations, and copies a few more routines.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    86f5dc5 View commit details
    Browse the repository at this point in the history
  21. askrene: include the mcf and flow routines.

    This make the code use askrene's "struct route_query".
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    10bfb88 View commit details
    Browse the repository at this point in the history
  22. plugins/askrene: remove local contexts.

    In general, we should be using tmpctx unless there's a specific reason not to.
    It's clear, and simplifies the code somewhat.
    
    If tmpctx is not cleaned often enough, we can look at a per-MCF context, but this
    seems like premature optimization.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    79bbb04 View commit details
    Browse the repository at this point in the history
  23. plugins/askrene: attach getroutes call to MCF code.

    Now getroutes actually does something!
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    ee4dba7 View commit details
    Browse the repository at this point in the history
  24. pytest: simple getroutes tests.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    6702563 View commit details
    Browse the repository at this point in the history
  25. plugin/askrene: add "auto.sourcefree" layer.

    This marks all channels around the source node as free (no delay, no fee).  This is normally what we want, if we are calculating a path for ourselves.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    b3b885b View commit details
    Browse the repository at this point in the history
  26. devtools/gossmap-compress: allow setting the nodeid explicitly for ge…

    …nerated nodes.
    
    This lets us make gossip which contains "real" nodes.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    61c314a View commit details
    Browse the repository at this point in the history
  27. askrene: split json_getroutes into two parts.

    This will allow us to call an RPC function in the middle.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    4f6c88e View commit details
    Browse the repository at this point in the history
  28. askrene: add "auto.localchans" layer.

    This populates information on both topology (i.e. unannounced channels) and capacity for the local node using `listpeerchannels`.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    3d3a5f9 View commit details
    Browse the repository at this point in the history