Skip to content

Commit d1ca751

Browse files
authored
refactor: AttestedMsg struct should be within quartz-cw and imported (#60)
1 parent 0f7b6d9 commit d1ca751

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

apps/mtcs/enclave/src/mtcs_server.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use mtcs::{
1818
obligation::SimpleObligation, prelude::DefaultMtcs, setoff::SimpleSetoff, Mtcs,
1919
};
2020
use quartz_enclave::attestor::Attestor;
21+
use quartz_cw::msg::execute::attested::RawAttested;
2122
use serde::{Deserialize, Serialize};
2223
use tonic::{Request, Response, Result as TonicResult, Status};
2324

@@ -111,12 +112,12 @@ where
111112

112113
let msg = SubmitSetoffsMsg { setoffs_enc };
113114

114-
let quote = self
115+
let attestation = self
115116
.attestor
116117
.quote(msg.clone())
117118
.map_err(|e| Status::internal(e.to_string()))?;
118119

119-
let attested_msg = AttestedMsg { msg, quote };
120+
let attested_msg = RawAttested { msg, attestation };
120121
let message = serde_json::to_string(&attested_msg).unwrap();
121122
Ok(Response::new(RunClearingResponse { message }))
122123
}

apps/transfers/enclave/src/transfers_server.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ pub type RawCipherText = HexBinary;
99

1010
use ecies::{decrypt, encrypt};
1111
use k256::ecdsa::{SigningKey, VerifyingKey};
12-
use quartz_cw::{msg::execute::attested::HasUserData, state::UserData};
12+
use quartz_cw::{
13+
msg::execute::attested::{HasUserData, RawAttested},
14+
state::UserData,
15+
};
1316
use quartz_enclave::attestor::Attestor;
1417
use serde::{Deserialize, Serialize};
1518
use sha2::{Digest, Sha256};
@@ -52,13 +55,6 @@ impl HasUserData for RunTransfersResponseMessage {
5255
}
5356
}
5457

55-
// TODO: this should probably just be an import from quartz
56-
#[derive(Clone, Debug, Serialize, Deserialize)]
57-
struct AttestedMsg<M> {
58-
msg: M,
59-
quote: Vec<u8>,
60-
}
61-
6258
impl<A> TransfersService<A>
6359
where
6460
A: Attestor,
@@ -182,12 +178,12 @@ where
182178
};
183179

184180
// Attest to message
185-
let quote = self
181+
let attestation = self
186182
.attestor
187183
.quote(msg.clone())
188184
.map_err(|e| Status::internal(e.to_string()))?;
189185

190-
let attested_msg = AttestedMsg { msg, quote };
186+
let attested_msg = RawAttested { msg, attestation };
191187
let message =
192188
serde_json::to_string(&attested_msg).map_err(|e| Status::internal(e.to_string()))?;
193189

cosmwasm/packages/quartz-cw/src/msg/execute/attested.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::{
99

1010
#[derive(Clone, Debug, PartialEq)]
1111
pub struct Attested<M, A> {
12-
msg: M,
13-
attestation: A,
12+
pub msg: M,
13+
pub attestation: A,
1414
}
1515

1616
impl<M, A> Attested<M, A> {

0 commit comments

Comments
 (0)