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: change lock acquire/release in multicall #1233

Merged
merged 5 commits into from
Sep 5, 2021

Conversation

skellet0r
Copy link
Collaborator

@skellet0r skellet0r commented Sep 2, 2021

What I did

Ended up testing 4 some different ways to handle this (some combinations as well).

  • Lock enter/exit of context
  • Lock pending calls access / bytecode swap
  • Add dictionary with per-thread data (pending calls, block number)
  • Add a separate thread for flushing

Easiest and quickest was just locking on enter/exit (we'd need to use a RLock to handle reentrancy within the same thread though, and then also handle more reentrancy issues (like maintaining a queue of block numbers). However, opting for locking on queue/bytecode access + per-thread dictionary was what I ended up going with. For now it gets the job done with the least amount of headache.

Will definitely need to revisit this along with reentrancy in the future.

with the new thread-safety, we must check the
individual values of `_pending_calls`
Copy link
Member

@iamdefinitelyahuman iamdefinitelyahuman left a comment

Choose a reason for hiding this comment

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

gm

@iamdefinitelyahuman iamdefinitelyahuman merged commit 837db7a into eth-brownie:master Sep 5, 2021
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.

2 participants