Closed bwheeler96 closed 6 years ago
My mistake. In 3.13.3 changing networks still causes events to stop reporting for me as well. However, it does appear to sometimes work, whereas before it never used to work. I tried some tests based on the comments made by @ChainSafe and it doesn't seem to matter how long I wait before switching between networks. It could be that if you switch quickly, it's more likely to fail.
Just adding my 2 gwei to the conversation. I was not receiving contract events when using metamask, but events worked fine if i was connecting to local geth instance.
A) make sure your contract address is lower cased. (i'm assuming metamask is doing some filtering that uses your address and mine had upper case letters) B) close all chrome tabs, close chrome. Reopen chrome and log back in to metamask.
After I made those changes I am able to see events coming through. Still a bit flaky, but better than nothing.
Just spent half the day debugging why my DAPP frontend is not receiving events then found this issue. I can confirm this issue is still present in: 3.13.4
As already stated above, the following works as a solution - but hopefully we will get a fix:
I can confirm that this issue is present in 3.13.7, switching networks and restarting seems to help.
Noticeable, perhaps related:
Console.logging the contract event objects shows that arguments (including callbacks) passed through do not seem to be processed, but after doing the above they are.
before restart:
console.log(instance.setName({},{fromBlock: 0, toBlock: 'pending'},function(err,result){console.log(result)}));
c {requestManager: s, options: {…}, implementation: {…}, filterId: null, callbacks: Array(0), …} callbacks: [] filterId:"null" formatter: ƒ () getLogsCallbacks: [] implementation: {newFilter: ƒ, uninstallFilter: ƒ, getLogs: ƒ, poll: ƒ} options: {topics: Array(1). . .
after restart:
console.log(instance.setName({},{fromBlock: 0, toBlock: 'pending'},function(err,result){console.log(result)}));
c {requestManager: s, options: {…}, implementation: {…}, filterId: null, callbacks: Array(0), …} callbacks: [f] filterId:"0x3" formatter: ƒ () getLogsCallbacks: [] implementation: {newFilter: ƒ, uninstallFilter: ƒ, getLogs: ƒ, poll: ƒ} options: {topics: Array(1). . .
Is there a bug bounty or something on this? I'm willing to put in a few finney if it gets this fixed sooner.
This issue now has a funding of 0.25 ETH (217.57 USD) attached to it.
I just added some funding! hopefully someone can tackle this.
Work has been started on the 0.25 ETH (214.39 USD) funding by:
Please work together and coordinate delivery of the issue scope. Gitcoin doesn't know enough about everyones skillsets / free time to say who should work on what, but we trust that the community is smart and well-intentioned enough to work together. As a general rule; if you start work first, youll be at the top of the above list ^^, and should have 'dibs' as long as you follow through.
On the above list? Please leave a comment to let the funder (@pelsasser) and the other parties involved what you're working, with respect to this issue and your plans to resolve it. If you don't leave a comment, the funder may expire your submission at their discretion.
@lazaridiscom - yea, sorry my requirement doesn't really help alot since we would have to wait for this fix to make it into a new release. So I can remove that requirement so you can get paid in a timely fashion.
I can show you how to produce the error with our environment pretty easily - it is part of this issue here
Feel free to contact me phil@marketprotocol.io and I can help you get our development environment up to see the issue if you decide to go that route.
@lazaridiscom Glad to see you're trying to help here! Note that there are likely several bugs around events. The issue you just linked to looks different from what people are talking about here. The two main bugs I observed in this thread are:
For a repro of the latter issue:
To see the demo actually working properly, restart the browser (or disable/enable MetaMask) once you're on Ropsten and then don't switch networks after that. My repro works fine against ganache
also, so you may want to deploy the same contract locally instead.
Contract source:
pragma solidity ^0.4.19;
contract Counter {
uint256 public count = 0;
event Increment(address who); // declaring event
function increment() public {
Increment(msg.sender); // logging event
count += 1;
}
}
@lazaridiscom I tested your change (https://github.com/MetaMask/metamask-extension/pull/3224/files) and it appears to fix the problem on my end
Work for 0.25 ETH (214.25 USD) has been submitted .
If you are the claimee, please leave a comment to let the funder (@pelsasser) (and the other parties involved) that you've submitted you work. If you don't leave a comment, the funder may expire your submission at their discretion.
@lazaridiscom Seems like your changes fixes this issue.
@lazaridiscom - thanks for the patience, releasing funding now.
The funding of 0.25 ETH (210.74 USD) attached to this issue has been approved & issued .
I can't get logs from my contract. The following code works fine with the default web3 implementation that comes with truffle:
But when I run the same code in a browser using the MetaMask version of web3, nothing happens. The promise never returns, and nothing is ever even sent to the network.
For example in the truffle web3 instance, the following requests are logged by testrpc:
But when using the MetaMask implementation, nothing is even submitted to the testrpc instance.
I read the compatibility guide and am following it pretty closely. I can send transactions and call contracts just fine. I simple can not filter events.
The web3 version MetaMask is injecting is
0.20.2
and the version that truffle builds with is0.16.0
. Hopefully web3 doesn't have any breaking changes in minor versions