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

why is Validate::No hardcoded in some impls? #816

Open
a-stevan opened this issue Apr 3, 2024 · 3 comments
Open

why is Validate::No hardcoded in some impls? #816

a-stevan opened this issue Apr 3, 2024 · 3 comments

Comments

@a-stevan
Copy link

a-stevan commented Apr 3, 2024

hello there 👋

i was looking through the code of ark-serialize and found a few places where, even though a validate: Validate is passed as argument to a serialization function, it is hardcoded to Validate::No regardless of the value passed by the caller and passed down the line.

this looks like a bug to me, especially given the fact that compress: Compress is passed as-is to sub calls, but maybe there is a reason where the validation should be disabled in some places? 😮

hope this helps in some way 😇
cheers 😊

locations i found in the code

T::deserialize_with_mode(&mut reader, compress, Validate::No).unwrap()

Validate::No,

Validate::No,

Validate::No,

@a-stevan
Copy link
Author

a-stevan commented Apr 3, 2024

and if it's confirmed to be unintentional, i'd be happy to help you fix this issue in a PR 😉

@slumber
Copy link
Contributor

slumber commented Apr 3, 2024

Your links refer to implementations for collections, after deserializing without validation, impls do

if let Validate::Yes = validate {
    T::batch_check(values.iter())?
}

Which is correct.

@a-stevan
Copy link
Author

a-stevan commented Apr 4, 2024

ooooh, i see!

so each value is not validated individually, but if the user provides Validate::Yes, then all the values are validated at the end in a batch, is that correct?

thanks for the answer 🙏

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

2 participants