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 default impl for Storage::range #2197

Merged
merged 3 commits into from
Jul 30, 2024
Merged

Conversation

chipshort
Copy link
Collaborator

first step of #2193

@aumetra
Copy link
Member

aumetra commented Jul 30, 2024

Should we return an empty range or should we panic with unimplemented!() like we do in, for example, the cryptography APIs?

fn bls12_381_aggregate_g1(&self, g1s: &[u8]) -> Result<[u8; 48], VerificationError> {
// Support for BLS12-381 is added in 2.1, i.e. we can't add a compile time requirement for new function.
// Any implementation of the Api trait which does not implement this function but tries to call it will
// panic at runtime. We don't assume such cases exist.
// See also https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-default-item
unimplemented!()
}

I'm not sure how I feel about silently failing with a technically incorrect default value, we should probably crash loudly, letting them know something's up

@webmaster128
Copy link
Member

Yeah let's create a panicking implementation. We might even want to use a helpful panic message if it is optimized out if iterator is set.

@chipshort
Copy link
Collaborator Author

Good point. I agree it's probably better to panic here.

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a CHANGELOG entry, but change looks good to me

@chipshort chipshort merged commit cc71eae into main Jul 30, 2024
11 of 32 checks passed
@chipshort chipshort deleted the co/iterator-default-impl branch July 30, 2024 10:36
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

Successfully merging this pull request may close these issues.

3 participants