Skip to content

[DoS] Reject BitName registrations without a matching reservation - #37

Merged
Ash-L2L merged 2 commits into
LayerTwo-Labs:masterfrom
1440000bytes:fix/registration-reservation-check
Jun 16, 2026
Merged

[DoS] Reject BitName registrations without a matching reservation#37
Ash-L2L merged 2 commits into
LayerTwo-Labs:masterfrom
1440000bytes:fix/registration-reservation-check

Conversation

@1440000bytes

Copy link
Copy Markdown
Contributor

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_reservations only 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_registration panics while connecting the block. Because block connection runs inside the block-application write txn with no catch_unwind, this crashes the node.

Fix

  • validate_bitnames now requires a spent reservation whose commitment matches the registration's implied commitment, returning a new NoReservationForRegistration error otherwise.
  • apply_registration returns that error instead of .expect()-panicking, so no connection path can crash even if validation were bypassed.

Test

validate_bitnames_rejects_registration_without_matching_reservation builds a registration spending a reservation that commits to a different name and asserts it is rejected with NoReservationForRegistration, 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.

@Ash-L2L
Ash-L2L force-pushed the fix/registration-reservation-check branch from 56b4e5c to 317d2a5 Compare June 16, 2026 17:59
@Ash-L2L
Ash-L2L merged commit c2c00b3 into LayerTwo-Labs:master Jun 16, 2026
8 of 9 checks passed
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