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

BalanceWaitgroup can not smaller than 0 #700

Closed
1 of 3 tasks
ThanhNhann opened this issue Oct 13, 2023 · 2 comments · Fixed by #719
Closed
1 of 3 tasks

BalanceWaitgroup can not smaller than 0 #700

ThanhNhann opened this issue Oct 13, 2023 · 2 comments · Fixed by #719

Comments

@ThanhNhann
Copy link
Contributor

Summary of Bug

balance_waitgroup's type is uint32 so that it's smallest value will be zero and we don't need to check the value below 0 but if we continue decrease BalanceWaitgroup's when it equal to 0, BalanceWaitgroup's value will = 4294967295 (max uint32)

if a.BalanceWaitgroup <= 0 {
return errors.New("unable to decrement the balance waitgroup below 0")

Expected Behaviour

Discuss in case BalanceWaitgroup = 0 and we keep decreasing it and update the stateless

Steps to Reproduce


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@joe-bowman
Copy link
Contributor

So we originally had this throw an error if it went below 0, but it can legitimately happen (e.g. if there is a backlog of icq queries that exist from the previous epoch that suddenly get resolved). So it can, and does go below zero, although a review of these cases and checking to see if there is a better way to resolve them would be a good point of investigation.

This is something that batched queries might go some way to resolving also.

@joe-bowman
Copy link
Contributor

Oh, I see what you mean - as a uint it will never be below zero! Yes, you are quite right, a simple == here would suffice.

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 a pull request may close this issue.

2 participants