Skip to content

fix: validate restore birthday height as integer with lower bound - #2157

Open
umeeSthein wants to merge 1 commit into
zodl-inc:mainfrom
umeeSthein:fix/restore-birthday-height-validation
Open

fix: validate restore birthday height as integer with lower bound#2157
umeeSthein wants to merge 1 commit into
zodl-inc:mainfrom
umeeSthein:fix/restore-birthday-height-validation

Conversation

@umeeSthein

Copy link
Copy Markdown

Summary

This change hardens birthday height validation in the restore flow.

Problem

The restore birthday height screen accepted user input as BigDecimal and converted it with toLong(). That left a few bad cases:

  • decimal values could be interpreted incorrectly instead of being rejected
  • very large values could fail conversion in an unsafe way
  • invalid input did not surface a clear user-facing error
  • values below saplingActivationHeight were not explained well to the user

Solution

This PR:

  • adds a dedicated birthday height validator
  • accepts only whole-number input
  • uses exact long conversion so fractional and overflow values are rejected
  • enforces the lower bound at saplingActivationHeight
  • shows explicit error text in the restore birthday height field
  • adds tests for empty input, separator-only input, decimal input, lower bound, boundary values, and overflow

Notes

  • upper-bound validation against the current network height is intentionally left out to keep this PR small and focused
  • tests were added, but local execution may depend on Java/Android environment availability

@umeeSthein
umeeSthein force-pushed the fix/restore-birthday-height-validation branch from 27a8698 to e68c7ae Compare April 22, 2026 08:43
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