IntersectMBO / IntersectMBO/cardano-base

Optimize conversion to Natural.

Open
#600 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
105
Forks
54
Avg merge
9d 2h
Merged PRs (30d)
4

Description

Current converters of `ByteString` and `ByteArray` to `Natural` in `Cardano.Crypto.Utils` first unnecessarily convert to `Integer` and the later convert it to `Natural`

There are exactly the same primitve operations available for `Natural` conversion in `GHC.Num.Natural` as there are for `GHC.Num.Integer`, thus such intermediate step can be avoided.

Additional property testing to make sure such switch is safe will be required.

Contributor guide

Open the contributing guide

Research direction

Start in Cardano.Crypto.Utils and inspect the current ByteString and ByteArray conversion paths to Natural, along with the corresponding GHC.Num.Natural and GHC.Num.Integer primitive operations. Add property tests covering the conversion behavior, then confirm the Natural conversions no longer use an intermediate Integer and that the properties pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cryptography
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.