Skip to content

Commit

Permalink
feat(lib): adjust IdStore
Browse files Browse the repository at this point in the history
  • Loading branch information
keroro520 committed Jan 15, 2025
1 parent 99d8831 commit 14f56a6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl TryFrom<Vec<TransactionSigned>> for TaikoGuestInput {
}
}

#[derive(Clone, Debug, Serialize, Deserialize, Default)]
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[serde(rename_all = "snake_case")]
pub enum BlobProofType {
/// Guest runs through the entire computation from blob to Kzg commitment
Expand Down
6 changes: 4 additions & 2 deletions lib/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ pub type ProverResult<T, E = ProverError> = core::result::Result<T, E>;
pub type ProverConfig = serde_json::Value;
pub type ProofKey = (ChainId, u64, B256, u8);

#[derive(Clone, Debug, Serialize, ToSchema, Deserialize, Default, PartialEq, Eq, Hash)]
#[derive(
Clone, Debug, Serialize, ToSchema, Deserialize, Default, PartialEq, Eq, PartialOrd, Ord, Hash,
)]
/// The response body of a proof request.
pub struct Proof {
/// The proof either TEE or ZK.
Expand All @@ -50,7 +52,7 @@ pub trait IdWrite: Send {

#[async_trait::async_trait]
pub trait IdStore: IdWrite {
async fn read_id(&self, key: ProofKey) -> ProverResult<String>;
async fn read_id(&mut self, key: ProofKey) -> ProverResult<String>;
}

#[allow(async_fn_in_trait)]
Expand Down
2 changes: 1 addition & 1 deletion taskdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl<T: TaskManager> IdWrite for TaskManagerWrapper<T> {

#[async_trait::async_trait]
impl<T: TaskManager> IdStore for TaskManagerWrapper<T> {
async fn read_id(&self, key: ProofKey) -> ProverResult<String> {
async fn read_id(&mut self, key: ProofKey) -> ProverResult<String> {
self.manager.read_id(key).await
}
}
Expand Down
2 changes: 1 addition & 1 deletion taskdb/src/mem_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl IdWrite for InMemoryTaskManager {

#[async_trait::async_trait]
impl IdStore for InMemoryTaskManager {
async fn read_id(&self, key: ProofKey) -> ProverResult<String> {
async fn read_id(&mut self, key: ProofKey) -> ProverResult<String> {
let mut db = self.db.lock().await;
db.read_id(key)
.map_err(|e| ProverError::StoreError(e.to_string()))
Expand Down

0 comments on commit 14f56a6

Please sign in to comment.