farcaster-node icon indicating copy to clipboard operation
farcaster-node copied to clipboard

Discussion: Auto-Restore on startup

Open TheCharlatan opened this issue 3 years ago • 4 comments

Instead of having the option to manually restore checkpoints on startup, farcasterd could automatically trigger a request to restore all swaps once databased is up and running.

@Lederstrumpf and @h4sh3d what are your opinions on this?

TheCharlatan avatar Sep 02 '22 11:09 TheCharlatan

hah! sounds like someone wants to weasel out of #712 ;)

I'm in favor of having checkpoints be restored automatically on startup. I'd make that the default and leave the option to disable automatic restore and restore specific swaps manually.

The reason I currently see for still want the manual option:

  1. if the node's number of running swaps hits the resource constraints of the host and crashes, you'd want to only restore some of them first and work through the backlog progressively to avoid just repeating that scenario.
  2. if the timing of some checkpointed swaps is safety critical (Bob about to be punished), then you may want to restore those first (especially if mempool congested).

Lederstrumpf avatar Sep 02 '22 12:09 Lederstrumpf

hah! sounds like someone wants to weasel out of https://github.com/farcaster-project/farcaster-node/issues/712 ;)

Ackchyually #716

The reason I currently see for still want the manual option

I am apprehensive towards allowing both. This creates quite some engineering effort and code bloat. The first reason you give though is interesting, but I am not sure if this is realistic.

TheCharlatan avatar Sep 02 '22 12:09 TheCharlatan

I am not in favor of automatic restore, at least not yet. I'd prefer warning the user about a list of potential restore in the db than automatically restoring them.

Points @Lederstrumpf brings show how complicated it can be to do it right and I personally prefer when I am responsible for a mess up (the user) than the soft I'm using is doing something that mess up. But that's personal :)

h4sh3d avatar Oct 12 '22 08:10 h4sh3d

I'd prefer warning the user about a list of potential restore in the db than automatically restoring them.

That's a compromise I can live with.

Lederstrumpf avatar Oct 12 '22 14:10 Lederstrumpf

After discussing further that topic and for UX perspective I think auto-restoring swaps on startup is ok. In a perfect world we could expose a flag in config to not do it (for backends doing a lot of swaps where other tooling should manage it) but enable by default (as regular user will probably not do hundreds of swaps concurrently) .

h4sh3d avatar Nov 07 '22 15:11 h4sh3d

I worked on an implementation today, and there is one glaring issue that I overlooked: We cannot report back to the user if the automatic restore was a success or failure. If indeed it was a failure, there is nothing we can do currently to recover from it, or show the user what exactly went wrong. I'll leave the PR open, but in its current form and with our current user reports, it is not easily workable in my eyes.

TheCharlatan avatar Nov 14 '22 11:11 TheCharlatan

Auto restore is implemented and deployed.

TheCharlatan avatar Dec 17 '22 12:12 TheCharlatan