chopsticks
chopsticks copied to clipboard
refactor RPC context to provide RPC specific storages (e.g. subscriptions)
One downside about global variables is that for some use cases, we need to handle chopsticks instances running at a same time (e.g. unit tests) so need to ensure they don't interfere with each other.
In this particular case, it is fine as everything is indexed by a unique random ID. The only drawback I can see is potential memory leak (i.e. destroy a chopsticks instance will not clear entry here). But that's not a very big deal here. So this is ok for now. Maybe later refactor this into context somehow.
Originally posted by @xlc in https://github.com/AcalaNetwork/chopsticks/pull/838#discussion_r1802044117