kadena-io / pact

The Pact Smart Contract Language
https://pact-language.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
580 stars 100 forks source link

fix enforce-pact-version decimal parser #1334

Closed emilypi closed 5 months ago

emilypi commented 5 months ago

enforce-pact-version was actually using lexicographic comparison due to the fact that the digit-parser is a stringy parser:

The problem:

П> AP.parseOnly (AP.many1 AP.digit) "10"
Right "10"

Which leads to the following case for the first time in Pact's history, now that it has a double-digit version part:

pact> (enforce-pact-version "4.3.1" "4.10.1")
<interactive>:0:0:Error: Invalid pact version 4.10, minimum allowed: 4.3.1
 at <interactive>:0:0: (enforce-pact-version "4.3.1" "4.10.1")

:tada:

This PR uses integer parsing on the version segments:

pact> (enforce-pact-version "4.3.1" "4.10.1")
true

PR checklist:

Additionally, please justify why you should or should not do the following:

rsoeldner commented 5 months ago

This PR closed #1334

emilypi commented 5 months ago

Fixes #1327