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

void #3247

Closed
ghost opened this issue Feb 14, 2018 · 2 comments
Closed

void #3247

ghost opened this issue Feb 14, 2018 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Feb 14, 2018

No description provided.

@ghost ghost mentioned this issue Feb 14, 2018
@danfinlay
Copy link
Contributor

danfinlay commented Feb 16, 2018

Link to referenced issue for the lazy: #2393
And fix: #3224

@danfinlay
Copy link
Contributor

The nature of the bug:

In the metamask-controller constructor, we initialize a provider, and then use that blocktracker to initialize the filter subprovider that is provided to every page:

https://github.com/lazaridiscom/metamask-extension/blob/58a554b1684fd78775b449b8f2b5d9635d30b69b/app/scripts/metamask-controller.js#L93-L94

The problem seems to be that the network controller allows this provider to be changed without notice. Sometimes it has listeners registered manually, like here:
https://github.com/lazaridiscom/metamask-extension/blob/58a554b1684fd78775b449b8f2b5d9635d30b69b/app/scripts/metamask-controller.js#L151-L153

For some reason, it seems like its old blockTracker reference was stuck on the old network, while a direct reference to the internal variable somehow was getting updated to the new network.

Frankly, this still doesn't make any sense to me at all. Just laying out some initial observations.

One post-mortem lesson I can draw is that we could isolate our network provider logic out of the metamask controller much more. This is going to become necessary soon anyway, when we allow dapps to be signed in on different blockchains, and so the sooner we isolate our instances of blockchain providers (instead of re-initializing them), the sooner we won't be prone to this kind of reference-swapping bug.

@kumavis kumavis closed this as completed Feb 26, 2018
@ghost ghost changed the title Post Mortem Analysis of Issue #2393 void Feb 26, 2018
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

No branches or pull requests

2 participants