Error calling internal / private functions from Metamask #3819
Unanswered
tant42
asked this question in
Troubleshooting
Replies: 1 comment
-
Hi @tant42. I don't know why you were getting errors in different scenarios, but if I understood correctly you:
I see how that looks like a bug but, honestly, it seems very unlikely. If I had to guess, I'd say there was some problem when you tested the dapp (a wrong network, a cache issue on metamask, whatever) and when you inlined the function it coincided with that unrelated problem going away. That being said, if you can show that this happens consistently (that is, create a minimal reproducible example), then please open an issue about it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not sure if this is a bug, so wanted to get some understanding first. I'm trying to test my code running an hardhat node and metamask / web3-onboard / ethers on the browser.
I have a contract function that calls another contract function conditionally (pseudocode)
_updateScore is a private function that does stuff.
When I call from a deploy / test script, all is well. When I call from my browser, I was getting a lot of "function selector not recognized errors".
Added a fallback and things worked again, but the fallback calls were bothering me. It looked like they were being called by the contract owner (so I assume that was how hardhat was making calls from the contract itself). Since I'm new to digging this deep on these things, I'm assuming these are hardhat's way of doing test calls to estimate gas fees?
After some trial an error, I ended up inlining the code from the private common function into the postScore function and all the errors went away.
I'd like to know:
On the "server" / node side:
Hardhat 2.12.4
Hardhat Ethers 2.2.1
Ethers 5.7.2
On the client side:
Ethers 5.7.2
Beta Was this translation helpful? Give feedback.
All reactions