IntersectMBO / cardano-cli

This repository contains sources for the command-line interface (CLI) tool for interacting with the Cardano blockchain.
Apache License 2.0
39 stars 14 forks source link

Avoid using Opt.auto to avoid overflows going silent #864

Closed smelc closed 2 weeks ago

smelc commented 1 month ago

Changelog

- description: |
    Forbid incorrect values in parsers of many Int-like options. Previously those values would overflow and be turned into a random valid value. If this breaks your use case, this means your use case wasn't doing what you expected.
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

We use auto a lot in parsing. auto relies under the hood on Read instances which are known to have problems. Some instances accept wrong values and return out of thin air values. This PR fixes this.

Fixes https://github.com/IntersectMBO/cardano-cli/issues/860

How to trust this PR

Checklist

smelc commented 1 month ago

@carbolymer> I did the changes :+1:

Given your last comment, I assume you're fine with me deploying this to many more code locations? (please don't approve though yet, because I'll extend this PR).