taikoxyz / raiko

Multi-proofs for Taiko. SNARKS, STARKS and Trusted Execution Enclave. Our previous ZK-EVM circuits are deprecated.
Apache License 2.0
96 stars 75 forks source link

feat(task db): implement a task DB #208

Open mratsim opened 1 month ago

mratsim commented 1 month ago

Overview

When dealing with provers we need to be able to persist state of proving requests in case of network failure or hardware restart or cancellations.

In particular for Bonsai, without storing state, we would be unable to know how many tasks are in the queue, risking waiting in vain if there were none, or overloading the queue by mistake.

Usage

The DB introduced in this PR should be used either in front of Raiko, from taiko-geth or taiko-reth. Or after raiko. It can be either integrated in an existing product or as a microservice, for example as a daemon or a server.

Note

This PR currently has no doc as I need to leave it 95% finished due to personal reasons.

For @petarvujovic98, as discussed please review the error model so that it fits Raiko with anyhow, thiserror, ....

I might not be able to update it for several days so feel free to take over.

API

For now this provides

This will need a way to clear the GuestInput/Payload with "older than Duration" parameter, default 18 days (EIP-4844 blobs expiry) as those are several megabytes.