Skip to content

Commit

Permalink
fixup! fix: Improve serialization for prime fields
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Sep 4, 2023
1 parent 4217a8a commit f018c0c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/derive/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,12 +714,9 @@ macro_rules! serialize_deserialize_32_byte_primefield {
} else {
<[u8; 32]>::deserialize(deserializer)?
};
match Self::from_repr(bytes).into() {
Some(fq) => Ok(fq),
None => Err(D::Error::custom(
"deserialized bytes don't encode a valid field element",
)),
}
Option::from(Self::from_repr(bytes)).ok_or_else(|| {
D::Error::custom("deserialized bytes don't encode a valid field element")
})
}
}
};
Expand Down

0 comments on commit f018c0c

Please sign in to comment.