Skip to content

Add more slasher backends (redb, sqlite, postgres) #4424

Closed
@michaelsproul

Description

@michaelsproul

Description

It would be great to have even more choice for slasher database backends beyond LMDB and MDBX. This could also be a good way for us to try out a couple of new DBs to see if they'd be suitable for the beacon node itself (which currently only supports LevelDB).

The candidates I'd like to try are:

I think redb would be the easiest, as it's most similar to the existing backends. Then sqlite, because it can be embedded in process and we already use it in the VC via rusqlite. Most difficult would be postgres, because we'd either need to assume that a postgres server is running (yuck) or run one ourselves in a Docker container or something (also kind of yuck).

Steps to resolve

  1. Add a new variant for the database to the DatabaseBackend enum.
  2. Add a new file in e.g. slasher/src/database/redb_impl.rs, with types named similarly to the other existing backends, see lmdb_impl.rs
  3. Add variants to the enums in interface.rs for the new backend.
  4. Get the slasher tests to pass with the DEFAULT_BACKEND set to the new backend, and cargo test --release -p slasher. We can worry about the feature flag stuff later.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseslasherwaiting-on-authorThe reviewer has suggested changes and awaits thier implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions