Question: How to debug a contract on era-compiler-llvm #18
-
EnvironmentTestnet Provide a brief description of the functionality you're trying to implement.I am trying to deploy the Uniswap V2 code on the zkSync ERC local net. What is the specific issue or error you're encountering?An error was encountered when running the test case 'moves the price to 1:90'. However, another one 'moves the price to 1:110' was successful. The specific error information is as follows: 1) ExampleSwapToPrice Can you share the error messages or logs you're receiving, if any?Error: transaction failed [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (transactionHash="0xc129dd7c33e43aa89b0e10f08f23ee70cbe010a240b51bd620347b310fbe60a6", transaction={"nonce":106,"gasPrice":{"type":"BigNumber","hex":"0x11e1a300"},"gasLimit":{"type":"BigNumber","hex":"0xd693a400"},"to":"0x748fA9975Afd2076BAc17B4223be5F3271cc9AC5","value":{"type":"BigNumber","hex":"0x00"},"data":"0xbef90fd300000000000000000000000049dc9fa6e1090a76beb6199460d3179cb6150eb00000000000000000000000005b66afaff2b28a3341a01b429a4648040e16120c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000005affffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000e90e12261ccb0f3f7976ae611a29e84a6a85f424ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","chainId":270,"v":575,"r":"0x2918373e82e6af775276938fe80054cbe071801b2b898aebf70b2952143e5134","s":"0x4cb63884e8b7cd5270824608184d3691c0627a44cd627e71de7dcea7f134f6b7","from":"0xE90E12261CCb0F3F7976Ae611A29e84a6A85f424","hash":"0xc129dd7c33e43aa89b0e10f08f23ee70cbe010a240b51bd620347b310fbe60a6","type":null,"confirmations":0}, receipt={"to":"0x748fA9975Afd2076BAc17B4223be5F3271cc9AC5","from":"0xE90E12261CCb0F3F7976Ae611A29e84a6A85f424","contractAddress":null,"transactionIndex":2,"root":"0x9ae51096a60f1704ed381854a01304833bae70d0069aa4312ead2c2d7ee84b28","gasUsed":{"type":"BigNumber","hex":"0x0940e9"},"logsBloom":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Have you made any recent changes to the contract before encountering this issue?No Are there any external libraries or contracts that your contract interacts with?https://github.com/Uniswap/v2-periphery/blob/master/contracts/examples/ExampleSwapToPrice.sol Can you provide the relevant portions of your contract code where the issue is occurring?
Have you tried to isolate the problem, and if so, what were the results?Yes, I have tried and finally determined that the issue is with this line of code: What steps have you already taken to try to resolve the issue?Define an
to
then the transaction will execute successfully. Repo Link (Optional)No response Additional DetailsAt the moment, this is as far as I could locate the problem. Do you have any insights or suggestions to share? Moreover, I still want to know how to debug this type of code. Currently, due to the uncertainty of how to properly debug this kind of problem, I can't pinpoint the issue effectively and accurately. Are there any reference documents available? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Another user had run into an issue with a Uniswap V2 fork and this is what fixed it for them, let us know if that helps:
|
Beta Was this translation helpful? Give feedback.
Hi @ThreeAndTwo 👋
One way to further debug issues like this is to use the new In-Memory Node and point your contract against a local node that prints out additional information.
Example (if you'd like to see the full stack of call traces for each transaction in a human readable format):
If you want to dig deeper, you can also test bootloader and system contracts (documentation available here)