Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bech32 decoder + encoder #312

Merged
merged 8 commits into from
May 24, 2019
Merged

Fix Bech32 decoder + encoder #312

merged 8 commits into from
May 24, 2019

Commits on May 24, 2019

  1. Configuration menu
    Copy the full SHA
    8f6e00a View commit details
    Browse the repository at this point in the history
  2. Add functions to convert DataPart to and from Text, using the Bec…

    …h32 alphabet.
    
    Also add an accompanying `Read` instance for `DataPart` to accompany the
    existing `Show` instance.
    
    This change also adds a QuickCheck property for the following relationship:
    
    >>> read (show (dp :: DataPart)) == dp
    jonathanknowles committed May 24, 2019
    Configuration menu
    Copy the full SHA
    a997218 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0a6957a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ce734e0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5b4d574 View commit details
    Browse the repository at this point in the history
  6. Encode to and decode from Text instead of ByteString.

    Use `Text` as the internal representation for `HumanReadablePart` and
    `DataPart`.
    
    As a side-effect, we can discard the `Read` and `Show` instances for
    `DataPart`.
    jonathanknowles committed May 24, 2019
    Configuration menu
    Copy the full SHA
    ec0b86f View commit details
    Browse the repository at this point in the history
  7. Fix a previously undetected bug in the specification.

    The `encode` function was mistakenly expected (by the specification) to produce
    an invalid Bech32 string, when given an upper-case human readable part. If this
    invalid string is passed to the `decode` function, it fails (unsurprisingly) to
    decode.
    
    This change updates the specification so that the `encode` function is
    now expected to produce a valid Bech32 string.
    jonathanknowles committed May 24, 2019
    Configuration menu
    Copy the full SHA
    d7e9762 View commit details
    Browse the repository at this point in the history
  8. Don't convert to lower-case before calling humanReadablePartFromText.

    In the `Arbitrary` instance for `HumanReadablePart`, we don't need to
    (and shouldn't) convert the generated string to lower-case before
    calling `humanReadablePartFromText`.
    
    The `humanReadablePartFromText` function itself already converts to lower case.
    jonathanknowles committed May 24, 2019
    Configuration menu
    Copy the full SHA
    5617740 View commit details
    Browse the repository at this point in the history