[DoS] Reject BitName registrations without a matching reservation - #37
Merged
Ash-L2L merged 2 commits intoJun 16, 2026
Merged
Conversation
Ash-L2L
approved these changes
Jun 15, 2026
Ash-L2L
force-pushed
the
fix/registration-reservation-check
branch
from
June 16, 2026 17:59
56b4e5c to
317d2a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A BitName registration is only valid if it burns the reservation that commits to it. The spent reservation whose commitment equals
keyed_hash(revealed_nonce, name_hash). Validation never enforced this:validate_bitnames/validate_reservationsonly check the counts of reservation and bitname inputs vs outputs.As a result, a registration carrying a reservation input with a non-matching commitment (counts still balanced) passes validation, and then
apply_registrationpanics while connecting the block. Because block connection runs inside the block-application write txn with nocatch_unwind, this crashes the node.Fix
validate_bitnamesnow requires a spent reservation whose commitment matches the registration's implied commitment, returning a newNoReservationForRegistrationerror otherwise.apply_registrationreturns that error instead of.expect()-panicking, so no connection path can crash even if validation were bypassed.Test
validate_bitnames_rejects_registration_without_matching_reservationbuilds a registration spending a reservation that commits to a different name and asserts it is rejected withNoReservationForRegistration, then confirms the same registration burning the correct reservation validates.Verified the test fails against the unpatched code (the malicious registration is accepted by validation) and passes with the fix.