+
Skip to content

Conversation

Galoretka
Copy link

The SW compressed encoding defines YIsPositive when y <= -y (i.e., the smaller y in integer order). During deserialization via Affine::from_random_bytes, the boolean from flags was passed directly into get_point_from_x_unchecked as the “greatest” selector, which chooses the larger y. This inverted the intended sign convention only on this code path.
Fix: invert the boolean when reconstructing from flags (pass !y_is_positive to get_point_from_x_unchecked), aligning from_random_bytes with the main serialize/deserialize path.

Added tests:

  • Ensure YIsPositive maps to the smaller y and YIsNegative to the larger y.
  • Ensure PointAtInfinity decodes to identity.

behavior now consistent across all SW serialization/deserialization paths.

@Galoretka Galoretka requested review from a team as code owners September 26, 2025 08:35
@Galoretka Galoretka requested review from Pratyush, mmagician and weikengchen and removed request for a team September 26, 2025 08:35
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.

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载