alloy-rs / core

High-performance, well-tested & documented core libraries for Ethereum, in Rust
https://alloy.rs
Apache License 2.0
763 stars 137 forks source link

[Bug] Panic in `Parity::inverted` #630

Closed prestwich closed 3 months ago

prestwich commented 4 months ago

Component

primitives

What version of Alloy are you on?

No response

Operating System

None

Describe the bug

This line needs to handle the 0 case https://github.com/alloy-rs/core/blob/main/crates/primitives/src/signature/parity.rs#L109

jafar75 commented 4 months ago

I can send a PR for this issue just to be ensured, for 0 case, it must return 0?

prestwich commented 4 months ago

for inverted(0) should return 1. even tho this means the inverted operation is no longer symmetrical. we don't expect real users to ever hit this edge case