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

NumScript max operator doesn't work correctly when source account has negative balance #473

Open
edwardmp opened this issue Dec 19, 2023 · 2 comments · May be fixed by #474
Open

NumScript max operator doesn't work correctly when source account has negative balance #473

edwardmp opened this issue Dec 19, 2023 · 2 comments · May be fixed by #474
Labels
bug Something isn't working

Comments

@edwardmp
Copy link
Contributor

Describe the bug
When using the max operator in NumScript, it doesn't actually take anything from the source account if the balance is negative, even though I use allowing unbounded overdraft.

To Reproduce
Steps to reproduce the behavior:

send [EUR/2 20] (
  source = @somewhere allowing unbounded overdraft
  destination = @world
)

send [EUR/2 100] (
  source = {
    # Due to above @somewhere has a negative balance of -20
    max [EUR/2 10] from @somewhere allowing unbounded overdraft
    @somewhere_else allowing unbounded overdraft
  }

  destination = @final_destination
)

Expected behavior
I expect that it will take 10 from @somewhere and 90 from @somewhere_else.
But I observe that 100 is taken from @somewhere

Environment (please complete the following information):

  • Numary Version v1.10.14
@edwardmp edwardmp added the bug Something isn't working label Dec 19, 2023
@flemzord
Copy link
Member

Thanks for the bug report! We're looking into reproducing and fixing asap on our end!

@edwardmp
Copy link
Contributor Author

Hey @flemzord

Thanks! I actually just discovered that the negative balance is not the culprit.
Even if @somewhere has a positive balance it happens. So likely it's the combination of max and allowing unbounded overdraft that is the issue.

With other words, this example suffices to reproduce as well:

send [EUR/2 2000] (
  source = @world
  destination = @somewhere
)

send [EUR/2 100] (
  source = {
    max [EUR/2 10] from @somewhere allowing unbounded overdraft
    @somewhere_else allowing unbounded overdraft
  }

  destination = @final_destination
)

Changing max [EUR/2 10] from @somewhere allowing unbounded overdraft to max [EUR/2 10] from @somewhere solves the issue, but is obviously not necessarily what you want.

@Azorlogh Azorlogh linked a pull request Dec 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants