Skip to content

Commit

Permalink
tests + test messages + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspofford-dfinity committed Oct 31, 2023
1 parent d27650d commit b4f2cc6
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 111 deletions.
14 changes: 10 additions & 4 deletions ic-agent/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,11 @@ impl<'agent> QueryBuilder<'agent> {
sender,
canister_id,
method_name,
arg
} = content else { unreachable!() };
arg,
} = content
else {
unreachable!()
};
Ok(SignedQuery {
ingress_expiry,
sender,
Expand Down Expand Up @@ -1372,8 +1375,11 @@ impl<'agent> UpdateBuilder<'agent> {
sender,
canister_id,
method_name,
arg
} = content else { unreachable!() };
arg,
} = content
else {
unreachable!()
};
Ok(SignedUpdate {
nonce,
ingress_expiry,
Expand Down
8 changes: 6 additions & 2 deletions ic-transport-types/src/request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ impl SerializeStructVariant for StructVariantSerializer {
SerializeStruct::serialize_field(&mut self.struct_ser, key, value)
}
fn end(self) -> Result<Self::Ok, Self::Error> {
let Some(inner_struct_hash) = SerializeStruct::end(self.struct_ser)? else { return Ok(None) };
let Some(inner_struct_hash) = SerializeStruct::end(self.struct_ser)? else {
return Ok(None);
};
let outer_struct = StructSerializer {
field_name: <_>::default(),
fields: vec![(Sha256::digest(self.name).into(), inner_struct_hash)],
Expand All @@ -482,7 +484,9 @@ impl SerializeTupleVariant for TupleVariantSerializer {
SerializeSeq::serialize_element(&mut self.seq_ser, value)
}
fn end(self) -> Result<Self::Ok, Self::Error> {
let Some(inner_seq_hash) = SerializeSeq::end(self.seq_ser)? else { return Ok(None) };
let Some(inner_seq_hash) = SerializeSeq::end(self.seq_ser)? else {
return Ok(None);
};
let outer_struct = StructSerializer {
field_name: <_>::default(),
fields: vec![(Sha256::digest(self.name).into(), inner_seq_hash)],
Expand Down
Loading

0 comments on commit b4f2cc6

Please sign in to comment.