pokt-network / pocket-core

Official implementation of the Pocket Network Protocol
http://www.pokt.network
MIT License
208 stars 101 forks source link

Improve version string comparison #1556

Closed msmania closed 1 year ago

msmania commented 1 year ago

This patch changes the logic to compare the version strings to see if the network has been upgraded or not. The simple string comparison does not work when the network is upgraded from "0.9" to "0.10". The proposed fix is to convert a version string into a slice of integers before comparison.

Summary generated by Reviewpad on 08 Jun 23 00:08 UTC

This pull request includes two patches. The first patch improves the version string comparison in types/utils.go by adding a new function called CompareVersionStrings. This function compares two version strings as if they are integers and returns negative, positive, or zero if the first string is earlier, later, or equal to the second string respectively. It also includes a new unit test for the function. The second patch addresses some of the previous comments and adds a new test case for the CompareVersionStrings function.