snarkOS
snarkOS copied to clipboard
Store batch proposal to disk on shutdown
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.
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?
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.
Addressed the points in the previous comment.
This logic may need to be more comprehensive:
Given a scenario where the latest block is at round 50:
-
A node shuts down and stores its proposal at round 52 (before committing a new block).
-
On bootup the node will sync up with the ledger blocks and advance storage to round 50.
-
Then the node will try to load the proposal for round 52, but won't have the certificates in
Storageto 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.
Rebased.
Closing in favor of https://github.com/AleoHQ/snarkOS/pull/3239