matter-labs / foundry-zksync

Fork of Foundry tailored for zkSync environment
Apache License 2.0
290 stars 125 forks source link

Slow deployment on Sophon testnet #588

Open lutr0 opened 5 days ago

lutr0 commented 5 days ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

forge 0.0.2 (e2e2d57 2024-09-23T00:23:48.096721400Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

When trying to deploy the standard Counter contract on Sophon Testnet, intermittently the deployment takes a long time (can be 1h+). Sometimes the transaction is dropped from the mempool.

As we never encountered this issue on zkSync Sepolia, I wonder if this is due to the chain having a custom base token. This issue has been encountered by other devs as well. We use no VPN/SSH, we are simply accessing the rpc

To reproduce: Create the default Counter repo and run (you will need some testnet tokens): source .env && ZK_DEBUG_HISTORICAL_BLOCK_HASHES=0 forge script ./script/Counter.s.sol --rpc-url https://rpc.testnet.sophon.xyz/ --private-key $PRIVATE_KEY --zksync --broadcast

Below the log with RUST_LOG=trace: slow_deployment.txt Alternatively as gist: https://gist.github.com/lutr0/c25cc2655a6eb72b3b6f11a4501e32e2

nbaztec commented 4 days ago

Preliminary investigation suggests the node is silently dropping the tx. From the following log 0x751a138032a08914c876973c97a61302fefb784f219129f8e27469115c2d57e2 was the hash returned after the tx was submitted, but the subsequent calls for retrieving the receipt always return null - hence the slowdown. The tx isn't visible on the block explorer either.

2024-09-18T11:35:34.325865Z TRACE alloy_rpc_client::call: serialized request request={"method":"eth_sendRawTransaction","params":["0x71f904362c8085e6c6a23fc08305910e94000000000000000000000000000000000001000080b8843cda33513100000000000000000000000000000....0000000000000000bd16851548ac6f2945a2d7d191ca4e3639c8b220705dcd98c48fb36b7e29a248b8410859232f2dfdb6b12bdf1b13a5da8f8db7bc2017d891c8ba9d8ed59fe970905d58e247d6eb6571e944c9b7d218d5c52390edd2314739b32e206e610aefa589051bc0"],"id":3,"jsonrpc":"2.0"}

2024-09-18T11:35:34.692784Z TRACE ReqwestTransport{url=https://rpc.testnet.sophon.xyz/}: alloy_transport_http::reqwest_transport: response body body={"jsonrpc":"2.0","result":"0x751a138032a08914c876973c97a61302fefb784f219129f8e27469115c2d57e2","id":3}

2024-09-18T11:35:35.338202Z TRACE alloy_rpc_client::call: serialized request request={"method":"eth_getTransactionReceipt","params":["0x751a138032a08914c876973c97a61302fefb784f219129f8e27469115c2d57e2"],"id":7,"jsonrpc":"2.0"}
2024-09-18T11:35:35.828215Z TRACE ReqwestTransport{url=https://rpc.testnet.sophon.xyz/}: alloy_transport_http::reqwest_transport: response body body={"jsonrpc":"2.0","result":null,"id":7}
...
<repeats>
...
2024-09-18T11:36:45.717753Z TRACE ReqwestTransport{url=https://rpc.testnet.sophon.xyz/}: alloy_transport_http::reqwest_transport: response body body={"jsonrpc":"2.0","result":null,"id":28}