diff --git a/crates/common/src/account.rs b/crates/common/src/account.rs index 5af82a2a..41290922 100644 --- a/crates/common/src/account.rs +++ b/crates/common/src/account.rs @@ -9,7 +9,11 @@ use crate::{ }; #[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] -pub struct SignedData(pub VerifyingKey, #[serde(with = "raw_or_b64")] pub Vec); +pub struct SignedData { + pub key: VerifyingKey, + #[serde(with = "raw_or_b64")] + pub data: Vec, +} #[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Default)] /// Represents an account or service on prism, making up the values of our state @@ -169,19 +173,19 @@ impl Account { data, data_signature, } => { - self.signed_data.push(SignedData( - data_signature.verifying_key.clone(), - data.clone(), - )); + self.signed_data.push(SignedData { + key: data_signature.verifying_key.clone(), + data: data.clone(), + }); } Operation::SetData { data, data_signature, } => { - self.signed_data = vec![SignedData( - data_signature.verifying_key.clone(), - data.clone(), - )]; + self.signed_data = vec![SignedData { + key: data_signature.verifying_key.clone(), + data: data.clone(), + }]; } Operation::CreateAccount { id, key, .. } => { self.id = id.clone(); diff --git a/crates/node_types/prover/src/webserver.rs b/crates/node_types/prover/src/webserver.rs index 95a9df7b..085a8bd6 100644 --- a/crates/node_types/prover/src/webserver.rs +++ b/crates/node_types/prover/src/webserver.rs @@ -76,6 +76,11 @@ pub struct JmtProofResponse { pub siblings: Vec, } +#[derive(Serialize, Deserialize, ToSchema)] +pub struct CommitmentResponse { + commitment: Digest, +} + impl From> for JmtProofResponse { fn from(proof: SparseMerkleProof) -> Self { let leaf_hash = proof.leaf().map(|node| node.hash::()).map(Digest::new); @@ -232,7 +237,7 @@ async fn get_account( )] async fn get_commitment(State(session): State>) -> impl IntoResponse { match session.get_commitment().await { - Ok(commitment) => (StatusCode::OK, Json(commitment)).into_response(), + Ok(commitment) => (StatusCode::OK, Json(CommitmentResponse { commitment })).into_response(), Err(e) => (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response(), } } diff --git a/crates/tree/src/tests.rs b/crates/tree/src/tests.rs index f5b1b4cd..0be2c588 100644 --- a/crates/tree/src/tests.rs +++ b/crates/tree/src/tests.rs @@ -199,8 +199,8 @@ fn test_data_ops(algorithm: CryptoAlgorithm) { assert!(membership_proof.verify_existence(&account).is_ok()); // Verify data contents - assert_eq!(account.signed_data()[0].1, b"test data 1".to_vec()); - assert_eq!(account.signed_data()[1].1, b"test data 2".to_vec()); + assert_eq!(account.signed_data()[0].data, b"test data 1".to_vec()); + assert_eq!(account.signed_data()[1].data, b"test data 2".to_vec()); assert_eq!(account.signed_data().len(), 2); // Ensure that setData replaces, not appends @@ -221,7 +221,7 @@ fn test_data_ops(algorithm: CryptoAlgorithm) { }; // Verify data contents - should only have latest value - assert_eq!(account.signed_data()[0].1, b"replacement data".to_vec()); + assert_eq!(account.signed_data()[0].data, b"replacement data".to_vec()); assert_eq!(account.signed_data().len(), 1); // Ensure incorrectly signed data leads to error diff --git a/elf/riscv32im-succinct-zkvm-elf b/elf/riscv32im-succinct-zkvm-elf index bcfc7f1f..f1bbc113 100755 Binary files a/elf/riscv32im-succinct-zkvm-elf and b/elf/riscv32im-succinct-zkvm-elf differ