Skip to content

[#843] Use tagged decoder for Address

Nikolay Yakimov requested to merge lierdakil/#843-tagged-decoder-address into master

Description

Problem: Currently, Morley.Tezos.Address.parseAddressRaw uses ad-hoc splitAt-based bytestring parsing. However, we have a generic way of parsing tagged data, namely Morley.Util.Binary.TaggedDecoder. Would be nice to rewrite parseAddressRaw using TaggedDecoder and reusing functions from Morley.Tezos.Crypto.

Solution: First, generalize TaggedDecoder machinery to allow for custom errors, then rewrite address parser using this generalized machinery.

NB: I went the road of "use structured exceptions where possible", but we could also go the way of "just use binary fail", that would've simplified things a bit at the cost of specificity. We don't actually use any of that specificity, mind, so either approach is workable.

Related issue(s)

Resolves #843 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Nikolay Yakimov

Merge request reports