Notes from Boltz integration #689
Replies: 3 comments
-
I believe @thebrandonlucas is going to be champion of this payjoin-cli recoverable error handling, but I don't think this concrete explanation of the issue has been brought up yet. Glad you chose to persist it too. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for writing this up! Couple comments
In the Session Event Log (SEL) design, things work a bit differently. The persister trait still only accepts specific values—namely, session events. However, for external metadata that is application-specific, we recommend storing that in the database representation of the session. For example, in To query session-specific details, we’ve created a In a SQL setup, I imagine this would take the form of a
This is a good point. I think we can extract that value and store it in
This is something I’m also unclear on and hoping to clarify with SEL. After skimming the list of receiver replayable errors, many seem like terminal errors where the only viable action is to broadcast the fallback transaction. For example, The sender could repost a new original proposal that might resolve the issue, but as you mentioned, we don’t implement this in our reference, and I’m not sure if reposting is even a good idea. Regarding the fallback transaction: in SEL, we want to design it so that (1) we log this as a session event and (2) mark the session as closed. |
Beta Was this translation helpful? Give feedback.
-
Notes from call this afternoon May 8 on this topic
No. Load sessions in until they're marked closed in db using the
@nothingmuch: the application would still be responsible for grouping these together. Main
At the time of close, you could read view details into history and save it to DB. BUT that's an optimization over just reading the Receiver into memory and using that for data.
@0xBEEFCAF3
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've hit some roadblocks in the Boltz <> Payjoin integration.
The first major one is that I'm no longer able to run the Boltz environment locally after a machine restart...
The second set of issues relates to implementing session persistence for Boltz using the 0.23 Persister design and fitting it into Boltz's backend architecture. I know #675 already addresses some (maybe all?) of these points but Dan suggested I document my developer experience somewhere, and maybe this can help inform design decisions for 0.24 persistence
The current
Persistertrait design creates several constraints.save(&mut self, value: Receiver)only takes aReceivervalue, any external data that needs to be saved alongside the receiver session must live on the struct itself. For example, in Boltz we want to save a swap ID for a given Receiver session. This requires introducing an intermediate Manager for individual payjoin sessions, which exposes external data such as swap_id on itself (note that the reference implementation doesn't do this, and instead provides one generic Persister for all sessions).Persister's constraints. It's tempting to bypass the payjoin Persister by using the NoopPersister and to simply initiatePayjoinSessionand make the DB insert call inreceive_payjoin:Also, this design doesn't lend itself to storing specific attributes, e.g. an
expires_afterfield that could be used to cleanup expired sessions with SQL UPDATE, because the session context on Receiver is private. It generally seems to assume simple k-v storage where implementers are expected to serialize the Receiver as a whole and store it as a single value.Although
loadis presumably the "right" way to construct aReceiver, there are common cases where it's undesirable to do so. For example, bulk resuming all active sessions from the database by callingloadon every session individually would be inefficient, and it would be better to load all Receiver's in a single SELECT.Finally, some other thoughts not related to persistence directly but rather to our reference implementation and the purpose it serves. I think it should provide much better error handling examples, since hard panics are unacceptable in most contexts (e.g. running an exchange). It improved in this this area with recoverable error handling, but doesn't provide examples of a) what to do after responding with a recoverable error b) when should a receiver give up on a payjoin and broadcast the fallback tx c) what should the sender do with a recoverable error...
Beta Was this translation helpful? Give feedback.
All reactions