Skip to content

Instantly share code, notes, and snippets.

@justmoon
Created December 19, 2017 16:45
Show Gist options
  • Save justmoon/7612998c5afdfa356c3f687839029168 to your computer and use it in GitHub Desktop.
Save justmoon/7612998c5afdfa356c3f687839029168 to your computer and use it in GitHub Desktop.
Avoiding a combinatorial explosion while migrating to LPI2

We are currently in the middle of a fairly major refactoring which includes a lot of internal APIs changing and a few aspects of the wire format changing as well.

API changes

Wire format changes

  • Switching from ILP packet 1.0 to "forwarded payment packets" (no amount)
  • Switching from ILP error 1.0 to "ILP rejection packets"
  • Switching from plugin addressing (plugin.getAccount) to IL-DCP
  • Switching from plugin messaging (plugin.sendRequest) to zero-amount local transfers for routing etc.

Migration strategy

We can easily update all the internal APIs without breaking anything, we just need to make sure we update every package. Maintaining compatibility between old and new versions (e.g. ILP Kit 4 to 5) is trickier.

My proposal is put all of the wire format conversion logic in ilp-compat-plugin. That would mean that an LPI1 plugin can only talk to another LPI1 plugin and an LPI2 plugin can only talk to an LPI2 plugin, but we can still have a connector that connects the LPI1 with the LPI2 world simply by using the latest connector code and having it have both native LPI2 plugins and some LPI1 plugins wrapped in ilp-compat-plugin. That way we don't have a million different combinations that can happen. If a plugin is LPI2 it should use the new wire format (ILP rejections, IL-DCP, etc.) and if it is LPI1, it should use the old wire format.

Note that this is mostly necessary because of the error changes and the plugin messaging changes. Trying to come up with a way to consistently encapsulate ILP rejections in LPI1 error calls in a backwards-compatible way made my head hurt and having to do that for routing etc. for every plugin... no thanks. I hope this is an acceptable compromise between backwards compatibility (we can still connect the old network to the new) and making progress towards what we think a real-money network needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment