godwoken icon indicating copy to clipboard operation
godwoken copied to clipboard

Indeterminate behaviour that might have been caused by recent changes to Godwoken

Open distributedstatemachine opened this issue 1 year ago • 14 comments

We have an application that was working fine until this commit was introduced . It would seem that ethers.rs might not be able to handle this response. We believe this might be causing ethers to return this error (See this issue).

main.bundle.js:147 Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":45,\"error\":{\"code\":-32099,\"message\":\"revert: Error: VM Exception while processing transaction: reverted with reason string 'SafeMath: subtraction overflow'\"}}","error":{"code":-32099},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"gasPrice\":\"0x0\",\"to\":\"0x1c0bce4643e9a9e3d282c5c80bfb746e6eef1863\",\"data\":\"0xec489c210000000000000000000000005492119c74b6c9f72ebf735856c213dd03ac565f\"},\"latest\"],\"id\":45,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://godwoken-testnet-v1.ckbapp.dev"}, data="0x",

distributedstatemachine avatar Oct 10 '22 10:10 distributedstatemachine

Hi, this commit has not been deployed on testnet and mainnet https://github.com/godwokenrises/godwoken/commit/09f6d583bba9e2a646bf4418816594fccaa50aee , how can you make sure is this commit introduced the error?

Can you provide the error response and reproducible example to us?

jjyr avatar Oct 10 '22 13:10 jjyr

Thanks for coming back so quickly. Here is a sample repro of a falling call. Please note that this was working on Friday and nothing has changed on our end.

curl 'https://godwoken-testnet-v1.ckbapp.dev/' \
  -H 'authority: godwoken-testnet-v1.ckbapp.dev' \
  -H 'accept: application/json' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'origin: chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn' \
  -H 'pragma: no-cache' \
  -H 'sec-ch-ua: "Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Linux"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: none' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36' \
  --data-raw '{"id":1741899502,"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0xabfb1a497faa51b667aa2baca2c768255cb1725c","to":"0xa30910bddce9e141ce3af22069cac56a1a940b19","data":"0x945bcec9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000220000000000000000000000000abfb1a497faa51b667aa2baca2c768255cb1725c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000abfb1a497faa51b667aa2baca2c768255cb1725c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000280ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000207435412d4baf1cddce79bc4191ebaf7805daf81b0002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000630acc0a29e325ce022563df69ba7e25eeb1e18400000000000000000000000010a86c9c8cbe7cf2849bfcb0eabe39b3bfec91d4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000f4240fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1a3f2"}]}' \
  --compressed

distributedstatemachine avatar Oct 10 '22 14:10 distributedstatemachine

hi, it is strange cuz we don't have any new updates since last Friday either.

However, we updated the godwoken-web3 to v1.8.1 version just now, can you try again and check if it is resolved by new version?

RetricSu avatar Oct 11 '22 01:10 RetricSu

Thanks @RetricSu . This issue does not seem to be present in 1.8.1. As we are going into production soon, we think it is important to understand the root cause of issues , so that we can put proper processes in place to mitigate them.

We would therefore like to understand what changes were made that caused this error, as the the team managing the chain says nothing was changed on their end.

In addition this , we would also appreciate some visibility in the release cycle e.g. when is 1.8.2 going into production?

distributedstatemachine avatar Oct 11 '22 08:10 distributedstatemachine

Thanks @RetricSu . This issue does not seem to be present in 1.8.1. As we are going into production soon, we think it is important to understand the root cause of issues , so that we can put proper processes in place to mitigate them.

We would therefore like to understand what changes were made that caused this error, as the the team managing the chain says nothing was changed on their end.

In addition this , we would also appreciate some visibility in the release cycle e.g. when is 1.8.2 going into production?

Here are my speculations.

Godwoken have been returning undecodable error responses all the time. And this issue would be exposed when the client uses ethers.js >5.6.1. BTW, godwoken-tests#181 is a similar issue as well.

When you upgrade ethers.js to >5.6.1, the error occurs, just like this issue description.


This issue, returning undecodable error responses, was fixed by https://github.com/godwokenrises/godwoken-web3/pull/512, which was deployed on testnet yesterday. Therefore, any version of ethers works right now, as @RetricSu said

keroro520 avatar Oct 11 '22 09:10 keroro520

Thanks @RetricSu . This issue does not seem to be present in 1.8.1. As we are going into production soon, we think it is important to understand the root cause of issues , so that we can put proper processes in place to mitigate them.

We would therefore like to understand what changes were made that caused this error, as the the team managing the chain says nothing was changed on their end.

This morning after receiving this issue we have update the testnet from v1.7.0 to v1.8.1, the entire code change can be found by https://github.com/godwokenrises/godwoken-web3/compare/v1.7.0...v1.8.1 , which including some error handling refactoring PR, eth_estimateGas/eth_call process refacotring PR etc.

We didn't have any updates on testnet last Friday since it was a holiday and the team was not working during that period.

I think one way to help catch the root cause (if you didn't upgrade ether library as @keroro520 mentioned above )might be that setup a minimal reproducible repo with your smart contracts. we can use this repo on local environment using devnet godwoken-kicker, from there the web3 version can be switched from different version easily.

RetricSu avatar Oct 11 '22 09:10 RetricSu

Thanks both!

distributedstatemachine avatar Oct 11 '22 09:10 distributedstatemachine

Additional notes for future reference; this issue only happened with on our testnet , our mainnet app worked fine. We use etheres v 5.6.4 in both instances

distributedstatemachine avatar Oct 11 '22 09:10 distributedstatemachine

This is happening again

distributedstatemachine avatar Oct 17 '22 12:10 distributedstatemachine

We think it might be caused by some kind of contract revert.

Is that possible to provide a minimal reproducible repo with your smart contracts? Or just provide contract code and related methods that could help with analysis.

Flouse avatar Oct 17 '22 17:10 Flouse

We dont think its a contract issue , as the issue happens randomly , and then fixes itself.

Here is an example of a call that throws this error sometimes:

 {"method":"eth_call","params":[{"to":"0x02457f1941e351f84bf719aa7999dd750de33e62","data":"0x07dcfd2a000000000000000000000000475423226ec8853ef17c6de238bfde3e30ed2f3100000000000000000000000039784ddab654e8469498cb24ead628e6df644ec9"},"latest"],"id":48,"jsonrpc":"2.0"}

and here is the error that is thrown in the console

https://ibb.co/7JkK6Ch

distributedstatemachine avatar Oct 17 '22 18:10 distributedstatemachine

Can you provide the source code of the contract ?

jjyr avatar Oct 18 '22 01:10 jjyr

In addition this , we would also appreciate some visibility in the release cycle e.g. when is 1.8.2 going into production?

  1. https://github.com/godwokenrises/godwoken-info/pulls?q=is%3Apr+ From here you could lean about the release cycle of Godwoken. Please consider to watch godwoken-info repo or join this discord channel.

  2. The current web3 version of Godwoken mainnet_v1 is v1.7.4. We plan to update mainnet Web3 to v1.8+ next week.

curl https://v1.mainnet.godwoken.io/rpc -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method":"poly_version", "params": [], "id": 1}'

{"jsonrpc":"2.0","id":1,"result":{"versions":{"web3Version":"1.7.4","web3IndexerVersion":"1.7.4","godwokenVersion":"1.6.1 e256d50"}

Flouse avatar Oct 20 '22 06:10 Flouse

Hi, @samtvlabs Godwoken mainnet has been update to Web3 1.8.5

curl https://v1.mainnet.godwoken.io/rpc -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method":"poly_version", "params": [], "id": 1}'

# Result
{"jsonrpc":"2.0","id":1,"result":{"versions":{"web3Version":"1.8.5","web3IndexerVersion":"1.8.5","godwokenVersion":"1.6.1 e256d50"}

Flouse avatar Oct 25 '22 08:10 Flouse