Skip to content

Reject identity points when decoding a PublicKey - #321

Open
HDauven wants to merge 3 commits into
phoenix/released-stackfrom
phoenix/decoder-identity
Open

HDauven wants to merge 3 commits into
phoenix/released-stackfrom
phoenix/decoder-identity

Conversation

@HDauven

@HDauven HDauven commented Oct 10, 2026

Copy link
Copy Markdown
Member

Stacked on #320.

  • PublicKey::from_bytes rejects an A or B that is the identity, as the stealth-address decoder already does for its points.
  • The StealthAddress::from_bytes_checked docs now name only the checks it performs.
  • Adds the decoder tests from Add tests for legacy-compatible Phoenix decode paths #287: strict against legacy-compatible decoding of honest notes and transaction skeletons, and Sender::from_bytes_legacy_compat. Since dusk-jubjub 0.15.2 the two paths are no longer equivalent. They agree on honest bytes, and the legacy-compatible decoders keep points that the strict ones reject; the tests pin both.

Resolves #312
Resolves #287

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The validation is correctly implemented, documented, and covered across relevant decoding paths.

0 open findings

What changed in this PR

Strengthens Phoenix public-key decoding by rejecting identity points and documents/tests strict versus legacy-compatible decoding.

Changes:

  • Rejects identity components in PublicKey::from_bytes.
  • Adds identity and legacy-decoder regression tests.
  • Updates decoder documentation and changelog.
File Description
core/​src/​keys/​public.rs Validates decoded public-key points.
core/​src/​stealth_address.rs Clarifies checked-decoder guarantees.
core/​tests/​keys.rs Tests identity-point rejection.
core/​tests/​legacy_decode.rs Tests strict and legacy-compatible decoding.
core/​CHANGELOG.md Records the decoding fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@HDauven
HDauven force-pushed the phoenix/decoder-identity branch from 7357001 to 493b42e Compare October 10, 2026 23:13
@HDauven

HDauven commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

Force-pushed: rebased on the amended #320. No changes.

@HDauven
HDauven force-pushed the phoenix/decoder-identity branch from 493b42e to f3280db Compare October 11, 2026 01:32
@HDauven

HDauven commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

Force-pushed: rebased on the amended #320. No changes.

@HDauven
HDauven marked this pull request as ready for review October 11, 2026 02:02

@moCello moCello left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

APPROVE — the identity check on PublicKey::from_bytes is correct, the serde path inherits it, and the new tests pin both decoder paths; two small notes below ask for nothing.

  • The sources disagree on the legacy decoders: #287 asks the tests to assert that strict and legacy-compatible decoding are equivalent and that the legacy path is dormant, and the PR description and tests state that the two paths diverge since dusk-jubjub 0.15.2.

Comment thread core/src/keys/public.rs Outdated
Comment thread core/tests/keys.rs Outdated
Add the coverage #287 asks for: `Sender::from_bytes_legacy_compat`,
which no test exercised, and strict against legacy-compatible decoding
of the bytes of honestly created notes and transaction skeletons, next
to the existing `StealthAddress` cases.

#287 expects the two decoders to be equivalent, with the legacy path
dormant until a dependency diverges. That has not held since
dusk-jubjub 0.15.2, whose point decoder, behind the strict decoders,
rejects a point with a small-order component. The tests pin both
halves: the decoders agree on honest bytes, whose points are
torsion-free, and the legacy-compatible ones keep a small-order
component in any point of a note byte for byte, where the strict ones
reject it. Both reject an unknown sender tag and an invalid point
encoding.
@HDauven
HDauven force-pushed the phoenix/decoder-identity branch from f3280db to b2f546f Compare October 11, 2026 17:43
@HDauven

HDauven commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

#287 now states the divergence the tests pin: since dusk-jubjub 0.15.2 the two paths agree on honest bytes, and the legacy-compatible decoders keep points the strict ones reject.

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.

Reject identity points when decoding a PublicKey Add tests for legacy-compatible Phoenix decode paths

3 participants