-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add Web3 1.0 support #2350
Comments
or just polyfill subscriptions |
Is it normal if I cannot find MetaMask provider with Web3 1.0 ? |
Not capitalized. Just web3.currentProvider |
Ok, I tried, it works, thanks. It tooks 500ms to find. Which is wrong because I can find web3.currentProvider, while Web3.givenProvider is null. |
Since the |
Hmmm, indeed it makes sense. Maybe my English is guilty here, but if I misunderstood, maybe other will. Thanks anyway, it makes my life much more simple. |
Any idea when "web3.eth.subscribe" will be available with MetaMask ? |
This issue now has a funding of 0.3 ETH (241.43 USD) attached to it.
|
If no one is currently working on this issue, I'd like to tackle it. What's the best way to start this? Is there a gitter or something similar to discuss details? |
@edkek you can use the github issue page :) or https://gitter.im/MetaMask/Lobby |
here is my roadmap for this feature:
i'd like to separate the notions of websocket transport and subscription support. I think it should be easy enough to provide subscription support on top of http rpc (which will Infura's life easier) with the help of eth-block-tracker. |
Will Infura be content with the many polling calls introduced by eth-block-tracker? |
@awgneo we already use the block-tracker, it effectively reduces the number of requests made by a dapp via per-block client side caching |
The funding of 0.3 ETH (221.33 USD) attached has been claimed by @muhammaddava1321. @muhammaddava1321, please leave a comment to let the funder (@owocki) and the other parties involved your implementation plan. If you don't leave a comment, the funder may expire your claim at their discretion.
|
@muhammaddava1321 please introduce yourself |
@muhammaddava1321 if i dont hear from you soon, im going to reject your claim and let someone else take this. nothing personal, just want to make sure someone who's making coordinating with everyone a priority has the claim. let us know! |
i am rejecting this claim due to radio silence from the claimee |
@owocki i'd like to claim this! i'll start poking around and get a preliminary changeset out |
@choochootrain can you please submit a claim on https://gitcoin.co/funding/details?url=https://github.com/MetaMask/metamask-extension/issues/2350 ? thats the source of truth for who has it claimed :) |
The funding of 0.3 ETH (221.28 USD) attached has been claimed by @choochootrain. @choochootrain, please leave a comment to let the funder (@owocki) and the other parties involved your implementation plan. If you don't leave a comment, the funder may expire your claim at their discretion.
|
here's my mental model of this so far: i have to read up on the new web3 surface area and work backwards to see what changes need to be made to the metamask provider (this is i'll dig into this further on monday - happy new year! |
@choochootrain ill let the metamask folks comment on the scope... (but they might be busy catching up from the holidays) looking forward to seeing this done :) |
@lazaridiscom @danfinlay it just means that we won't be injecting it by default, but using a web provider to allow the apps themselves choose their own library, given that more than one exists. It's still our library of choice and we use it ourselves, just giving users more options. |
@danfinlay @lazaridiscom Would raising the bounty for this issue help move it forward quicker? If yes, we at Brickblock would be happy to throw some ETH into the hat. |
If the core team completes this feature, we’ll reject all bounties for it, since we’re already salaried, but a bounty could encourage an external community member to try to implement this sooner. |
@alexvandesande , thank yo for the info. You should possibly clarify this in your documentation, because the announcement reads like "Deprecated". Possibly the @chapati23 raising the bounty should help, but i've the feeling that @danfinlay , @kumavis - I really think its time to create a task description, with the minimum estimated steps needed to fulfill this. Would possibly be enough to
Could(!) look like this (to invite people to take a look at this issue, to possibly do one subtask) TaskMetaMask should be compatible with web3 1.0. This quick overview provides the estimated necessary steps: Solution Path A (by kumvaris)source: #2350 (comment) Issue: Add websocket subprovider - MetaMask/web3-provider-engine/issues/189
Comments by benjamincburns: #2350 (comment) Solution Path B (by benjamincburns)info from end of: #2350 (comment) Base work:
Solution Path CThis would be my process/path:
Solution Path D (by yourself)
|
two notes:
|
@owocki I think we are beyond this kind of consideration. This is a core feature for many Dapps that rely on web3 1.0.0 and the bounty is so small (0.3Eth) that nobody will take the time needed to solve this issue. |
this issue was funded back when ETH was 2x the price it is now. nonetheless, your point about the amount of funding is still valid. i am happy to increase the funding for the issue if @danfinlay and @kumavis want to give it another go (perhaps on another ticket) |
@GrandSchtroumpf , the solution-paths are already given, mostly in comments within this issue. I've update my comment above and collected quickly the relevant info of kumvaris path (and added a personal one) : #2350 (comment) |
For the case anyone wants to make a tiny step: #3618 |
I totally agree that the bounty is very small. We're talking about a major door into the Ethereum world, here, not a super fancy awesome useless feature. Furthermore, maybe no one cares because it's clear that the injection of Metamask is deprecated, because changing its default version would break most dApps and because we can always use currentProvider and replace the whole injected Web3.JS
|
@lazaridiscom web3 uses this version of websocket when websocket is not available on the window or if we are on a server: |
The wheels have been spinning on this one for months... It seems like the common pattern is:
We have a general idea of the steps that need to be taken to get this task knocked out. Can we get a rough consensus on the steps required, and then split those sub-tasks out into their own tasks so this can be tackled in a more gradual and granular fashion? |
@GrandSchtroumpf - In this issue here, I just apply the standard-procedure in an abstract manner. With the quite low amount of domain-knowledge I have, I would answer you: yes. But @kumavis and others should know better. |
Sorry for the low bounty, and the low response rate. The core team has been very busy with other issues at the moment, and we've always planned to do this eventually, and we might just do it ourselves soon. The community doesn't need to feel responsible for completing this. That said, since this issue clearly needs a re-focusing, I will now write a brief summary of what this issue involves. The Current State of MetaMask's ProviderMetaMask's most popular open source component to date has by far been web3-provider-engine. This express inspired middleware architecture allowed @kumavis to compose MetaMask's custom provider logic into a stack of "subproviders" that handle different requests, or portions of requests, and then either pass the mutated request down the stack, or reply directly. This engine was designed for the original Ethereum JSON RPC spec. Since then, there has also emerged a websocket API that includes subscriptions called the RPC Pub Sub API. This new API allowed push subscriptions, and Web3 1.0 to exist. Currently, MetaMask still uses polling & HTTP to get all of its data, and so the most obvious way to add Web3 1.0 support is to allow us to move onto a websocket based infrastructure. A Problem With ThatOver time, it has become increasingly clear that some of the ethereum-opinionated aspects of For example, our cache-subprovider needs block awareness to know when to clear its cache, and so block tracking was built into provider-engine, and bit by bit, these pieces of opinionated architecture has made provider-engine a bit harder to work with. Furthermore, since provider-engine was never designed for handling subscriptions, since it's a middleware for responding to requests, it has no natural way of representing a websocket connection. The Websocket SolutionSince much of the difficulty of adding a new connection type is that provider-engine encompasses all the middleware, and makes them hard to interact with, we're moving MetaMask over to json-rpc-engine. You'll see us use it a few places in MetaMask instead of provider-engine. This is basically the same general product as provider-engine, except with all the ethereum-opinionated aspects torn out, so they can more easily be accessed by external consumers, and so some types of features (like subscriptions) can more easily be added. By removing the specialized logic from the engine itself, that kind of wiring can be left to the subproviders themselves. For example, the new arrangement might look a little more manual, but it allows much more diversity in subproviders (pseudocode below): var engine = new JsonRpcEngine()
var blockTracker = new BlockTrackerSubprovider()
var cache = new CacheSubprovider({ blockTracker })
engine.add(blockTracker)
engine.add(cache)
engine.start() Moving to In particular, the final subprovider that will need to be written for this issue is the websocket subprovider. Once we have this all ready, we'll probably need to compose the zero provider which is currently only imported, because only by composing the subproviders will we have access to the block-tracker's events. Or we come up with a way of accessing specific subproviders from the parent controller. Anyways, this proposal is hardly trivial, as An MVP SolutionWhile everything above has been accurate and true, there is a way we can provide web3 1.0 support a bit faster, but without the full performance benefits of websockets. This is to polyfill the subscription API, the way Ben Burns did here already. If that subprovider got a little polish and QA, it's possible it would be ready to go very soon, and so someone looking for the shortest path to letting their dapp use Web3 1.0 might just take that on, and I think it would still win the bounty for this issue, since this issue is really about web3 1.0 support, not websockets themselves. The subscription data event would still need to be exposed in some way, and maybe a new module could be used to wrap |
@danfinlay thanks for the thoughtful re-focusing comment. if its okay to you ill move your latest comment over to a new github issue and issue a new bounty for the MVP scope. |
Updated Summary: #2350 (comment) |
@danfinlay here is a new issue: #3639 i move we
does that sound good to the group? |
To help clarify what would be involved in adding websocket support, I've enhanced the issue description here: |
just bountied #3642 with 1 ETH |
@danfinlay , yeah, before it reaches 100 comments! |
I'm sad that the core team doesn't see this as a major issue :( |
Well, @kyriediculous, don't be sad. This has quite a priority and there is ongoing work, see e.g. #3642 |
@danfinlay , as this issue has follow-up's set, you could lock it. |
@ all It looks that there is a first working draft of web3 1.0 support for testing available, see: |
Appears to include:
The text was updated successfully, but these errors were encountered: