Skip to content

Commit 85c7132

Browse files
prism_serde
1 parent 184e8c1 commit 85c7132

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

crates/common/src/account.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
use anyhow::{anyhow, Result};
22
use prism_keys::{Signature, SigningKey, VerifyingKey};
3+
use prism_serde::raw_or_b64;
34
use serde::{Deserialize, Serialize};
45

56
use crate::{
67
operation::{Operation, ServiceChallenge},
78
transaction::Transaction,
89
};
910

11+
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
12+
pub struct SignedData(pub VerifyingKey, #[serde(with = "raw_or_b64")] pub Vec<u8>);
13+
1014
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Default)]
1115
/// Represents an account or service on prism, making up the values of our state
1216
/// tree.
@@ -23,7 +27,7 @@ pub struct Account {
2327

2428
/// Arbitrary signed data associated with the account, used for bookkeeping
2529
/// externally signed data from keys that don't live on Prism.
26-
signed_data: Vec<(VerifyingKey, Vec<u8>)>,
30+
signed_data: Vec<SignedData>,
2731

2832
/// The service challenge for the account, if it is a service.
2933
service_challenge: Option<ServiceChallenge>,
@@ -42,7 +46,7 @@ impl Account {
4246
&self.valid_keys
4347
}
4448

45-
pub fn signed_data(&self) -> &[(VerifyingKey, Vec<u8>)] {
49+
pub fn signed_data(&self) -> &[SignedData] {
4650
&self.signed_data
4751
}
4852

@@ -161,7 +165,10 @@ impl Account {
161165
data,
162166
data_signature,
163167
} => {
164-
self.signed_data.push((data_signature.verifying_key.clone(), data.clone()));
168+
self.signed_data.push(SignedData(
169+
data_signature.verifying_key.clone(),
170+
data.clone(),
171+
));
165172
}
166173
Operation::CreateAccount { id, key, .. } => {
167174
self.id = id.clone();

elf/riscv32im-succinct-zkvm-elf

-30.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)