Skip to content

Commit

Permalink
Deserialize derives (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xForerunner authored May 29, 2024
1 parent 471f4a7 commit 8f3941f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/identity_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use semaphore::lazy_merkle_tree::{Derived, LazyMerkleTree};
use semaphore::merkle_tree::Hasher;
use semaphore::poseidon_tree::{PoseidonHash, Proof};
use semaphore::{lazy_merkle_tree, Field};
use serde::Serialize;
use serde::{Deserialize, Serialize};
use sqlx::prelude::FromRow;
use tracing::{info, warn};

Expand Down Expand Up @@ -40,7 +40,7 @@ pub struct TreeItem {
pub leaf_index: usize,
}

#[derive(Debug, Serialize, FromRow)]
#[derive(Debug, Serialize, Deserialize, FromRow)]
#[serde(rename_all = "camelCase")]
pub struct RootItem {
pub root: Field,
Expand All @@ -50,7 +50,7 @@ pub struct RootItem {
pub mined_valid_as_of: Option<chrono::DateTime<Utc>>,
}

#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InclusionProof {
pub status: Status,
Expand Down
14 changes: 7 additions & 7 deletions src/server/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use crate::identity_tree::{
};
use crate::prover::{ProverConfig, ProverType};

#[derive(Serialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(transparent)]
pub struct InclusionProofResponse(pub InclusionProof);

#[derive(Serialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ListBatchSizesResponse(pub Vec<ProverConfig>);

#[derive(Serialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(transparent)]
pub struct VerifySemaphoreProofResponse(pub RootItem);

Expand Down Expand Up @@ -61,7 +61,7 @@ pub enum IdentityHistoryEntryStatus {
Bridged,
}

#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct InsertCommitmentRequest {
Expand Down Expand Up @@ -92,7 +92,7 @@ pub struct RemoveBatchSizeRequest {
pub prover_type: ProverType,
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct InclusionProofRequest {
Expand Down Expand Up @@ -125,15 +125,15 @@ pub struct VerifySemaphoreProofQuery {
pub max_root_age_seconds: Option<i64>,
}

#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct DeletionRequest {
/// The identity commitment to delete.
pub identity_commitment: Hash,
}

#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct RecoveryRequest {
Expand Down

0 comments on commit 8f3941f

Please sign in to comment.