Skip to content

Commit

Permalink
jmt: remove spurious Hasher: BorshSerialize + BorshDeserialize bounds (
Browse files Browse the repository at this point in the history
…#116)

`borsh` changed their macro logic for bound inference in their 1.0 release. Unforunatley, the change causes borsh to infer spurious bounds on generic types in some cases. This PR removes the unnecessary bounds on types which are generic over a Hasher.
  • Loading branch information
preston-evans98 authored Jun 27, 2024
1 parent fe03c66 commit fd1c8ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/types/proof/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct SparseMerkleProof<H: SimpleHasher> {
siblings: Vec<SparseMerkleNode>,

/// A marker type showing which hash function is used in this proof.
#[borsh(bound(serialize = "", deserialize = ""))]
phantom_hasher: PhantomData<H>,
}

Expand Down Expand Up @@ -511,7 +512,9 @@ impl<H: SimpleHasher> SparseMerkleProof<H> {
}

#[derive(Debug, Serialize, Deserialize, borsh::BorshSerialize, borsh::BorshDeserialize)]
pub struct UpdateMerkleProof<H: SimpleHasher>(Vec<SparseMerkleProof<H>>);
pub struct UpdateMerkleProof<H: SimpleHasher>(
#[borsh(bound(serialize = "", deserialize = ""))] Vec<SparseMerkleProof<H>>,
);

impl<H: SimpleHasher> UpdateMerkleProof<H> {
pub fn new(merkle_proofs: Vec<SparseMerkleProof<H>>) -> Self {
Expand Down

0 comments on commit fd1c8ef

Please sign in to comment.