Closed PatrickAlphaC closed 2 years ago
Hi Patrick I have a similar issue while working on the HTML FundMe app. Is it metamask problem..?
`eth_call
Contract call: FundMe#
Error: Transaction reverted: function selector was not recognized and there's no fallback function`
I get this error with Hardhat, too. (In my own project, not this sample provided by @PatrickAlphaC)
Error: Transaction reverted: function selector was not recognized and there's no fallback function
But it works with Rinkeby...
I get this error with Hardhat, too.
Error: Transaction reverted: function selector was not recognized and there's no fallback function
But it works with Rinkeby...
Yes once I see it works with Rinkeby and was deployed successfully, I ignore the error and continue the course. I believe it might be the problem of metamask or moralis.. or the integration of both.
If you could please help us by distilling the issue down to having fewer dependencies, it will make it a lot easier to help you track down the source of the issue.
Could you provide a codepen or some small snippets that I can test your issue with?
Thank you for your patience.
Can you click the gitpod button of this repo?
https://github.com/PatrickAlphaC/hardhat-fund-me-fcc
Then run:
yarn hardhat node
Grab a private key from the output and import into metamask - and add the hardhat localhost network to metamask.
Then, gitpod button for this repo:
https://github.com/PatrickAlphaC/html-fund-me-fcc
Spin up the UI, enter a number and select "fund".
It appears your transaction is being reverted. Hardhat/ganache will respond with the Transaction Reverted error immediately, whereas testnets will mine the transaction, and revert can be found by looking at the transaction receipt.
Please double check your smart contract, and check the receipt status of the transaction when you try it on testnet - it likely is also reverting without reason.
If you are still having this issue, pull out the relevant code into the smallest example you can still reproduce the issue with, and post that code back here so that we can get to the bottom of this. I will close the issue for now until the issue is made more clear.
Hello Patrick, I am not sure if this helps, but if I run everything on a Ganache Local host instead of a Hardhat local node, everything works fine. So the problem might be also something related to the hardhat node (or maybe the interaction between that and Metamask)
Maybe I'm just big dummy. That happens sometimes too.
Thanks all, sorry for the ruckus... I'll see if I can reproduce again...
I got the same issue with hardhat node, too.
Same issue with hardhat using useDapp
, transaction is successful but hardhat receives invalid calls after that
See the console.log
represent the correct behavior, and immediately it receives invalid calls. Maybe metamask is resending some tx?
Same issue here! It happens when I call a function that requires signing the transaction. When I call the same function in the hardhat test environment I have no problems, but through the frontend using metamask, it throws;
"Error: Transaction reverted: function selector was not recognized and there's no fallback function
at Contract.
Exactly the same issue here as well. For some reason Metamask interaction with hardhat node goes through but hardhat receives invalid calls
Has anyone found any solution for this error?
any updates? I am getting the same errors
Also getting a similar error here w/ hardhat and ethers on a local chain.
The transaction will go through fine, it just throws multiple of these error messages
I am encountering this issue as well, but it seems to me that the transaction is going through because if I console log the transaction hashes, confirmations, and amounts, everything shows up correctly in the console., as well as in my Metamask wallet where all of the transactions and their data are displayed, and the test eth is taken out of the wallet. So I think its just a localhost issue with Hardhat where it posts the response as being reverted before the transaction is confirmed on metamask.
The fix for this issue is pretty simple.
Steps: 1- In your Metamask, for the selected account, Go to Settings. 2- Click on 'Advanced' 3- Click on "Reset Account'
Then try to do the transaction. It will work :)
The fix for this issue is pretty simple.
Steps: 1- In your Metamask, for the selected account, Go to Settings. 2- Click on 'Advanced' 3- Click on "Reset Account'
Then try to do the transaction. It will work :)
Unfortunately for me, it does not fix the issue of the unrecognized selector calls displayed in the console. Is there any progress with this issue? Or anyone has an alternative solution? Could it maybe be due to a newer/incompatible version of moralis, hardhat or so?
I am also facing the same issue, have anyone solved it, Error: Transaction reverted: function selector was not recognized and there's no fallback function
I am also facing the same issue, have anyone solved it, Error: Transaction reverted: function selector was not recognized and there's no fallback function
As it was discussed in other issues, this might be an interaction problem within hardhat, metamask or so. I ignored the hardhat node console error for now and moved on. The frontend interaction seems to work anyway and the transactions seem to happen, since number players and so on are being updated. I also hope someone will come up with an explanation for the phenomenon thou.
It may be obvious, but since I didn't see it mentioned in the thread I thought worth mentioning....that I did some additional testing and noted that if you run a test with a view function instead of a payable function, the error is not generated in the node output, and it operates as expected in this case.
Same issue here. Also, unable to debug. Resolved to the fallback/receive work around.
For me this error was due to a wrong chainId in Metamask. I had some problems with Id: 1337 and used 31337. Metamask was on 1337 still, so after I changed this it worked (also did a reset). Maybe you could check your chainId settings in hardhat and Metamask. Edit: It seems, it just worked once....after I executed the mockOffchain script for performUpkeep, I have now same issue again..
I wouldn't be very sure if this is a metamask issue. When I faced this issue, no solution I found online seemed to work. I tried to use anvil, a local Ethereum development node by foundry, in place of hardhat node. This seems to solved the issue for me. I am able to continue my testing in my local node. I believe the issue is somewhere in the metamask and hardhat local node integration.
Same problem here.
Contract call: FundMe#<unrecognized-selector>
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0xe7f1725e7734ce288f8367e1bb143e90bb3f0512
smartcontractkit/full-blockchain-solidity-course-js#315 (comment) explains the issue and how to fix it.
Currently, i am facing same issue. Did anyone resolve this issue
Found something interesting look at here. My first call to setname was successfully done. later 5 calls were made to the contract which all eventually failed but the first call which was succeed changed the state of the contract.
why there is 5more calls happened from meta mask?????
@SyedImam1998 Metamask makes a lot of "random" RPC calls. Check this issue and this issue for further reading.
@MemoBaca Thanks mate i have added this fallback function now at least this is not throwing error like before:
fallback() external payable {
}
If want to protect your users, use this, not payable for fallback calls :D
/// @dev DON'T give me your money.
function () external {}
Same issue still
Hello, I have a similar problem
Send button not active
Here is the function
Решил проблему добавлением в файл - hardhat.configю.js код module.exports = { solidity: "0.8.18", networks: { hardhat: { initialBaseFeePerGas: 0, }, }, }; , а так-же добавил в конец кода функцию - fallback() external payable {} Очистил Метамаск, перезапустил hardhat и всё заработало!
@vladimir-byshevets by creating a fallback() function you just obfuscated the problem, now all calls (who's methods the contract doesn't implement) go into fallback() where they silently dropped and you never figured out what is the real cause
@vladimir-byshevetsсоздав функцию Fallback(), вы просто запутали проблему, теперь все вызовы (чьи методы не реализуются в контракте) переходят в Fallback(), где они молча удаляются, и вы так и не поняли, в чем настоящая причина
Критикуешь - предлагай!. Если я не правильно сделал, то как правильно?
Also getting a similar error here w/ hardhat and ethers on a local chain.
The transaction will go through fine, it just throws multiple of these error messages
how did you resolved it ?
To resolve this, add a fallback function in your contract:
fallback() external payable {}
@vladimir-byshevetsсоздав функцию Fallback(), вы просто запутали проблему, теперь все вызовы (чьи методы не реализуются в контракте) переходят в Fallback(), где они молча удаляются, и вы так и не поняли, в чем настоящая причина
Критикуешь - предлагай!. Если я не правильно сделал, то как правильно?
you can actually setup tcpdump program and sniff all the traffic that is coming over TCP connection (provided plain HTTP is used and not HTTPS) , when I did that I discovered that Metamask is calling decimals() method on the contract when the popup window with transaction details appears to the end User. This is what is causing this error. Obviously Metamask shouldn't do it, but if you want to get rid of this error and have clean hardhat log for debugging purposes you can just declare decimals() in your contract for the time you are developing (and later remove it). Fallback function will just hide all the calls to the contracts that are unsupported and you will have less development power to see what is going on. The other option is to throw Metamask to the trash. @vladimir-byshevets
I also encountered the same problem with the hardhat and metamask versions. I lowered the metamask version to 10.17.0 and the problem was resolved If there are still problems, you need to modify the chain of hardhat, which defaults to 31337. Try changing it to 1337
Describe the bug
I have created this issue on the hardhat github & the moralis github, and both locations have directed me to metamask instead.
https://github.com/NomicFoundation/hardhat/issues/2708 https://github.com/MoralisWeb3/react-moralis/issues/257
I have a small contract that looks like such:
That is deployed to the hardhat network. When I call
fund
from the frontend using ethers, I get the following error in the terminal my hardhat node is running:However, if I approve the transaction on the front end, it goes through fine. Any code that I have in the
fund
function is successful.What is happening?
I have reset my metamask account several times. Here is how I'm calling this function from the front end:
Steps to reproduce
Clone the repo and install dependencies
Run the hardhat node
Add the hardhat network to your metamask & import one of the private keys from the hardhat nodes output
(Let me know if you need help doing this)
Go to the UI, and try to hit the
Enter Lottery
button, and in your terminal, you'll get this issue:Error messages or log output
Version
10.14.6
Build type
No response
Browser
Brave
Operating system
MacOS
Hardware wallet
No response
Additional context
No response