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

(add-time ) overflow => not documented unexpected results #1301

Open
CryptoPascal31 opened this issue Sep 16, 2023 · 1 comment
Open

(add-time ) overflow => not documented unexpected results #1301

CryptoPascal31 opened this issue Sep 16, 2023 · 1 comment

Comments

@CryptoPascal31
Copy link
Contributor

CryptoPascal31 commented Sep 16, 2023

Issue description

The add-time function can overflow and give unexpected results.

Steps to reproduce

Some examples:

pact> (add-time (time "2016-07-22T12:00:00Z") 10000000000000000000000000000000000)
"-157918-10-27T19:13:49Z" 

pact> (add-time (time "2016-07-22T12:00:00Z") 1000000000000000000000000000000000000000000000000000000000000000000000000)
"2016-07-22T12:00:00Z"

As you can see in some cases:

  • The time wraps around
  • The function doesn't work at all and returns the original time.

Expected Behavior

Either:

  • The function should trigger a transaction failure when an overflow is expected.
  • In the documentation, flag the add-time as "unsafe" without prior boundaries check.
@rsoeldner
Copy link
Member

@CryptoPascal31 thank you, we will look into it

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