Skip to content

Persistent constraints cacheΒ #747

@mempirate

Description

@mempirate

Context

Currently, constraints are stored in memory. If the sidecar shuts down / restarts, they will be lost. We should write constraints to disk with the following atomicity guarantee:

ONLY sign a commitment if we were able to write the constraint to disk, otherwise we risk "losing" the commitment

When starting up, we should read these constraints into our local block template.

Note that the persistent cache functions as a backup: it should only be read at startup time, and be written to whenever a new commitment is made. The block template / simulation should still happen in memory. This means we need atomicity between making a commitment & constraint, storing it on disk, and storing it in memory, to make sure we always have consistency.

Stack

  • Use an embedded DB with JSON serialization (or some binary encoding scheme, but let's keep it boring)
  • Embedded DB options:
    • redb: pure rust, active maintenance, but self-proclaimed beta (although used in Lighthouse)
    • rocksdb: probably most well known but wraps a C library and thus has some annoying dependencies

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions