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

Divide by 0 in gas computation of (concat) #1316

Closed
CryptoPascal31 opened this issue Nov 4, 2023 · 2 comments
Closed

Divide by 0 in gas computation of (concat) #1316

CryptoPascal31 opened this issue Nov 4, 2023 · 2 comments

Comments

@CryptoPascal31
Copy link
Contributor

CryptoPascal31 commented Nov 4, 2023

Issue description

When using (concat) with an empty list, a divide by 0 error is thrown here:

(fromIntegral nChars * charCost) `div` fromIntegral nStrings

This bug as been introduced in Pact 4.8 by: #1269

Steps to reproduce

pact> (concat [])
""

OK


but:

pact> (env-gasmodel "table")
pact> (env-gaslimit 10000)
"Set gas limit to 10000"
pact> (concat [])
<interactive>:1:0:Error: divide by zero

And of course, the error occurs on-chain too.

@rsoeldner
Copy link
Member

Good catch, thank you @CryptoPascal31

@CryptoPascal31
Copy link
Contributor Author

#1317

CryptoPascal31 added a commit to CryptoPascal31/pact-util-lib that referenced this issue Nov 11, 2023
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

No branches or pull requests

2 participants