Skip to content

[CHIA-4279] parse ProofOfSpace - #1474

Merged
arvidn merged 1 commit into
release/0.45.1from
proof-of-space-parsing
Jun 30, 2026
Merged

[CHIA-4279] parse ProofOfSpace#1474
arvidn merged 1 commit into
release/0.45.1from
proof-of-space-parsing

Conversation

@arvidn

@arvidn arvidn commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

make parsing of ProofOfSpace more strict and less maleable, like the original Option<> parsing


Note

High Risk
Changes consensus-relevant ProofOfSpace deserialization; stricter parsing could reject previously accepted (malleable) encodings on the wire.

Overview
Tightens ProofOfSpace wire parsing so the packed pool_contract prefix byte is interpreted like a normal Option<> prefix (only bits 0–1 are meaningful), reducing malleability on the network.

Parse change: version is derived with prefix >> 1 instead of treating only bit 1 as a boolean. Non-canonical prefixes that set higher bits now surface as unknown versions and fail with InvalidPoS, rather than being accepted as v0/v1 with altered optional semantics.

Tests: Adds helpers and expands coverage for serialize/parse round-trips (v0 lenient pool/contract combinations, v1 size collapsing to 0), explicit rejections (v1 must have exactly one of pool pk vs contract, unknown version on serialize), and regression that bits 2–7 on the prefix byte are rejected for both versions.

Reviewed by Cursor Bugbot for commit 3a65f0e. Bugbot is set up for automated code reviews on this repo. Configure here.

@arvidn
arvidn requested a review from AmineKhaldi June 30, 2026 13:37
@danieljperry danieljperry changed the title parse ProofOfSpace [CHIA-4279] parse ProofOfSpace Jun 30, 2026
@coveralls-official

Copy link
Copy Markdown

Coverage Report for CI Build 28447616578

Warning

No base build found for commit de5c8b3 on release/0.45.1.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 80.971%

Details

  • Patch coverage: 20 of 20 lines across 1 file are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 18603
Covered Lines: 15063
Line Coverage: 80.97%
Coverage Strength: 12135899.61 hits per line

💛 - Coveralls

@arvidn
arvidn merged commit dc1b96d into release/0.45.1 Jun 30, 2026
80 of 81 checks passed
@arvidn
arvidn deleted the proof-of-space-parsing branch June 30, 2026 14:27
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.

2 participants