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

Facing SERVER_ERROR which calling contract function #1571

Closed
shivam0x opened this issue May 17, 2021 · 10 comments
Closed

Facing SERVER_ERROR which calling contract function #1571

shivam0x opened this issue May 17, 2021 · 10 comments
Labels
v5 Issues regarding legacy-v5

Comments

@shivam0x
Copy link

Hi @ricmoo I'm facing this issue with a particular contract. The same code for the same other contracts(generated by the same factory) is working fine. Not able to figure out what the issue is. Any help here?

{"reason":"bad result from backend","code":"SERVER_ERROR","method":"estimateGas","params":{"transaction":{"from":"0x0CbC4E5E965feC28D934e2Cafb7Df50369241215","to":"0xEA017BfB09aD1C295C6E18CE22A41A3B7A826Aab","data":"0x6c31364c000000000000000000000000000000000000000000000000000001797b9f949e0000000000000000000000009506d37f70eb4c3d79c398d326c871abbf10521d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064"}},"error":{"reason":"invalid BigNumber value","code":"INVALID_ARGUMENT","argument":"value"}}

@shivam0x shivam0x added the investigate Under investigation and may be a bug. label May 17, 2021
@zemse
Copy link
Collaborator

zemse commented May 17, 2021

Hey I see "error":{"reason":"invalid BigNumber value","code":"INVALID_ARGUMENT","argument":"value" from the server which seems like an ethers js error, can you include some code snippet or what backend you're using?

@shivam0x
Copy link
Author

shivam0x commented May 21, 2021

image

This is the code snippet where I'm facing the issue.

As its a write transaction so I'm using metamask provider in this case else for reading I'm using alchemy.

@zemse
Copy link
Collaborator

zemse commented May 21, 2021

As far I'm understanding this, first eth_estimateGas is called to estimate a gasLimit value. But the response from your backend Metamask for this rpc call is an invalid value (it should be something like number or hex string representation of number). You should be able to prevent this by manually passing in a gasLimit override.

Now metamask should give you a value here. I have never encountered such edge case. I want to see the response of this from metamask. Can you do the following and share the result:

try {
const result = await provider.send('eth_estimateGas', [{
"from":"0x0CbC4E5E965feC28D934e2Cafb7Df50369241215",
"to":"0xEA017BfB09aD1C295C6E18CE22A41A3B7A826Aab",
"data":"0x6c31364c000000000000000000000000000000000000000000000000000001797b9f949e0000000000000000000000009506d37f70eb4c3d79c398d326c871abbf10521d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064"
}])
console.log('success', result)
} catch (e) {
console.log('err', e);
}

Edit I just tried it on mainnet: I get execution reverted: SafeERC20: low-level call failed. Seems like a require statement failing. I am not able to reproduce the error you're getting in the OP. Do you still get the same error?

@shivam0x
Copy link
Author

@zemse thanks for your reply. Yes, it should revert in your case as this is onlyOwner function.

I'll give the above solution is try but I think by this time the client might have used a manual process by now.
Not sure when I'll be able to reproduce this. Also any other thing which I can try in this case as this is the first time I'm facing this issue that too only for 1 product, for all the other products(same code) for the same factory its working fine.

@shivam0x
Copy link
Author

Again faced similar issue with another use:

image

@zemse
Copy link
Collaborator

zemse commented May 30, 2021

The json rpc resonse body contains message: execution reverted. Also given that you're getting this occasionally, are you doing some complex stuff in the call?

  • Working out a decision tree of stuff happening inside might help you guess the code failing.
  • Also tenderly has a option to simulate calls, if you have verified contracts on etherscan it will show you even the line on solidity code that is failing.

Lmk if you solve it or need help with it

@shivam0x
Copy link
Author

The above problem I fixed with some workaround from my frontend but still stuck with this problem. Haven't got any solution for this.

@Nikhil1419
Copy link

Nikhil1419 commented Jul 16, 2021

Hi @ShivamDev31
Any solution on this?

@shivam0x
Copy link
Author

shivam0x commented Aug 7, 2021

Hi, @Nikhil1419 didnt face the same issue again but I'm facing another SERVER_ERROR issue
@zemse @ricmoo a lot of users are facing this issue on ethers v5.4.4. Have already gone through #1766 and migrating to getDefaultProvider("homested") for time being instead of alchemy rpc provider.

Another observation is that chrome users(limited users not all and we are not able to reproduce this) are facing this issue and it's working fine on brave.

Screenshot 2021-08-07 at 3 00 17 PM

@ricmoo
Copy link
Member

ricmoo commented Aug 31, 2024

Closing older issues. But if this is still happening in v6, please re-open or start a new issue.

Thanks! :)

@ricmoo ricmoo closed this as completed Aug 31, 2024
@ricmoo ricmoo added v5 Issues regarding legacy-v5 and removed investigate Under investigation and may be a bug. labels Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v5 Issues regarding legacy-v5
Projects
None yet
Development

No branches or pull requests

4 participants