snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

Store batch proposal to disk on shutdown

Open ljedrz opened this issue 1 year ago • 5 comments

This PR persists the current batch proposal to the disk on shutdown, and loads it on startup when available, deleting it afterwards.

Filing as a draft until it's sufficiently tested.

Closes https://github.com/AleoHQ/snarkOS/issues/3171.

ljedrz avatar Apr 02 '24 11:04 ljedrz

Some open questions:

  • should we distinguish between production and dev modes?
  • should we consider the network IDs?
  • should the creation of the file path be dedicated to a function to deduplicate code a little bit?

ljedrz avatar Apr 02 '24 12:04 ljedrz

The file path should definitely be differentiated by dev_mode and network ID. Especially in the case of local devnets being run.

In addition, snarkos clean should also remove these files.

raychu86 avatar Apr 02 '24 13:04 raychu86

Addressed the points in the previous comment.

ljedrz avatar Apr 02 '24 17:04 ljedrz

This logic may need to be more comprehensive:

Given a scenario where the latest block is at round 50:

  1. A node shuts down and stores its proposal at round 52 (before committing a new block).

  2. On bootup the node will sync up with the ledger blocks and advance storage to round 50.

  3. Then the node will try to load the proposal for round 52, but won't have the certificates in Storage to properly advance to round 52. Nor will it have the certificates used to create the proposal in round 52.

    • The node will need to request the certificates for round 51 from its peers and properly advance to round 52.

raychu86 avatar Apr 03 '24 20:04 raychu86

Rebased.

ljedrz avatar Apr 08 '24 11:04 ljedrz

Closing in favor of https://github.com/AleoHQ/snarkOS/pull/3239

raychu86 avatar May 03 '24 22:05 raychu86