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

Fix panic in FundManager #4808

Merged
merged 1 commit into from
Nov 11, 2020
Merged

Fix panic in FundManager #4808

merged 1 commit into from
Nov 11, 2020

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Nov 11, 2020

I believe the issue can occur in this scenario:

1. Deal A adds 5 to addr1:                     reserved  0 ->  5    available  0 ->  5
2. Deal B adds 7 to addr1:                     reserved  5 -> 12    available  5 -> 12
3. Deal B completes, reducing addr1 by 7:      reserved 12 -> 12    available 12 ->  5
4. Deal A releases 5 from addr1:               reserved 12 ->  7    available  5 ->  5

In step 4: reserved (7) - available (5) > 0 and len(toAdd) == 0

@jsign
Copy link
Contributor

jsign commented Nov 11, 2020

I can confirm that the pipeline I ran to discover this stopped panicking, so looks good.

Copy link
Contributor

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

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

I am a bit anxious about the sequence of things that gets us to this condition -- how would we end up with a reserved > available but no toAdd messages? Worth possible further investigation. That said, no panic is better than panic.

Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

Makes sense

@arajasek arajasek merged commit bc7eaee into master Nov 11, 2020
@arajasek arajasek deleted the fix/fund-mgr-panic branch November 11, 2020 21:43
@dirkmc
Copy link
Contributor Author

dirkmc commented Nov 12, 2020

Updated the description with a scenario in which this panic can occur

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.

4 participants