Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add struct/enum attr to relax bounds #290

Open
kpp opened this issue Apr 12, 2024 · 0 comments
Open

Add struct/enum attr to relax bounds #290

kpp opened this issue Apr 12, 2024 · 0 comments

Comments

@kpp
Copy link

kpp commented Apr 12, 2024

Example

https://github.com/penumbra-zone/jmt/blob/9ba90718d36cdf376630fa036b5a54c35447982c/src/types/proof/definition.rs#L514

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

BorshSerialize is implemented for Vec<SparseMerkleProof<H>> for all H. Yes, it is possible to do a #[borsh(bound(deserialize = "", serialize = ""))] trick in this particular case, but for enums its not obvious.

Possible solution

#[borsh(relax = "T")
enum/struct A<T> {
...

Linked issue: penumbra-zone/jmt#113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant