Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve lovelace parser failure in the cli #2079

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

Jimbo4350
Copy link
Contributor

@Jimbo4350 Jimbo4350 commented Nov 12, 2020

Closes #2063

Improved failure:

cabal exec cardano-cli -- shelley transaction build-raw --tx-in 91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0 --tx-out addr1v9wmu83pzajplrtpsq6tsqdgwr98x888trpmah2u0ezznsge7del3+18446744073709551616 --fee 1000 --ttl 1234 --out-file test
option --tx-out: Failed reading: 18446744073709551616 lovelace exceeds the Word64 upper bound

@intricate intricate self-requested a review November 12, 2020 13:14
i <- Atto.decimal
if i > toInteger (maxBound :: Word64)
then fail $ show i <> " lovelace exceeds the Word64 upper bound"
else return $ Lovelace i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is lovelace allowed to be negative for the cases intended here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked. decimal parses unsigned, so I think this is good.

@Jimbo4350
Copy link
Contributor Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 8, 2020

@iohk-bors iohk-bors bot merged commit 7a709d7 into master Dec 8, 2020
@iohk-bors iohk-bors bot deleted the jordan/fix-cli-out-of-bounds branch December 8, 2020 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better handling of "out of bounds" error in CLI
4 participants