shardeum / bug-reporting

59 stars 33 forks source link

Failed TXs on complex or cross-contract logics #417

Open GushALKDev opened 1 year ago

GushALKDev commented 1 year ago
What is the issue?

:red_circle: "Simple" logics works fine, the issues seems to appear when the logic crosses contracts or it is a more complex logic. :red_circle:

What impact does the issue have?

:red_circle: It causes failed TXs :red_circle:

How to reproduce the issue?

:red_circle:

LINK TO VIDEOS: https://we.tl/t-iesQC0aHoq

You can test it out by your own at https://stg.dexynth.com/#/trading

The network is failing again as you can see in the first attached video.

There is no LIMIT/SL/TP/LIQ due to your RPC limitations (WSS and events) but you can try out the Market order type.

"Simple" logics works fine, the issues seems to appear when the logic crosses contracts or it is a more complex logic.

Example with a clean account (Video 3)

As you can see here, our protocol works fast and fine in other networks. I hope these videos help you to better debug your network. (Video4)

:red_circle:

skundu42 commented 1 year ago

Try 1 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xb3168f1123673873bc4e62ed83d4f550c036585ea9e6f59d7faf678fcd2a1b76 Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/ (https://explorer-dapps.shardeum.org/tx/0xb3168f1123673873bc4e62ed83d4f550c036585ea9e6f59d7faf678fcd2a1b76)0xc83c79110d477259e0c7d09eb0d2d81d91f48e7f312deb8fa1128e6838a0e650

Try 2 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0x049db7ecce2ef885465c190b7783c8aa6a1c0d66f9f1dae75bfc171d4c034014 Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0x069e0c5585babe167dd13bd6ca77996bce848ec987da1a8f749ab3197156dd52

Try 3 Start Trade -> FAILED -> https://explorer-dapps.shardeum.org/tx/0x47419542ef865084f6d5ac92fba2f92e6708110b325083a8e2207ea54fd0028c Oracle callback -> NOT REQUESTED DUE A FAILED START TRADE

Try 4 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xddb747f1c69d0092ecdf687e8e0934adb3ce6acd4dbe0f19303f185e610e26a7 Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xa0c65efa81d22206291262649591b5ba0fa105289b98ab463c7b12599ddefba7

Try 5 Start Trade -> FAILED -> https://explorer-dapps.shardeum.org/tx/0x06f8d430a816cf0fcbd184ef36fc199e52685d68f4e11d81ca104951cc829520 Oracle callback -> NOT REQUESTED DUE A FAILED START TRADE

Try 6 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xa4df85c3dceb680067930154de9397a99cc855e2c03f1266f1fbe340e8cbfb82 Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0x94c0ab53c9c3447888fe3c679c0929de72d20801056239387ac0d4c398903739

Try 7 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/https://explorer-dapps.shardeum.org/tx/0xcd2c59dbbad5dec4cae71eee74b9c435596695a3601d65fc221ac75219eb914d Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xc7a19ded1952455ba7a04027ceab34fc2c6bc00a16079d6cb66668e150db0908

Try 8 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0x504c336ec52d28268e793fbcbca5f0d037bf325177a385dcd007fa0246e9285c Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0x0f33ed34db74ceacfb08cae968a50db13162682882fead89742df07e96e3f250

Try 9 Start Trade -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xc48b82f40f5ad098a670ff7dee5bf214ac442b490d8a5aee70f84e683ffe680d Oracle callback -> SUCCESS -> https://explorer-dapps.shardeum.org/tx/0xea3c630cfdf31c7d2738bea63f3329cb4becf230cf5c9019857b918e2b9a8e27

Try 10 Start Trade -> FAILED -> https://explorer-dapps.shardeum.org/tx/0x64ba52a30d0e3596e0a27a8abaf9bab65a2edc2ba61bcfa9411acbd1898752b5 Oracle callback -> NOT REQUESTED DUE A FAILED START TRADE

Try 11 Start Trade -> FAILED -> https://explorer-dapps.shardeum.org/tx/0x0fce464e771f11b75ead770abc354cefcd59a6f96752d0dec8723de0ff8f03ca Oracle callback -> NOT REQUESTED DUE A FAILED START TRADE

Try 12 Start Trade -> FAILED -> https://explorer-dapps.shardeum.org/tx/0x4002738617ead241b0972276fc3e79d9527e9418a144a652397ff973de4c125d Oracle callback -> NOT REQUESTED DUE A FAILED START TRADE

GushALKDev commented 1 year ago

At this moments all tries are always Failed!

achal-singh commented 1 year ago

Hey @GushALKDev, Have you deployed the same set of contracts on an EVM compatible network which is supported by Etherscan? I know you've tried this on BNB Testnet (BNBScan), but if you've tried this on any of Ethereum's Testnets (viz. Goerli or Sepolia) as well, please mention some details here like the contract addresses on these networks, any other piece of information (like the correct way to test the function calls etc in addition to what's given in the videos), that'd be of some help in diagnosing the issue.

GushALKDev commented 1 year ago

Hi @achal-singh!

We have a deployed version in ZKSync Era Testnet, it is not an Ethereum Testnet but it is a Layer 2 of an Ethereum network, could it be valid for you?

In addition, all these contracts are verified so you can interact and check them directly from its block explorer.

You can try it from our frontend.

Best Regards!

achal-singh commented 1 year ago

Got it. Could you provide the link to this contract address on the ZKSync Era Testnet Explorer?

GushALKDev commented 1 year ago

Yes, but I just notice that I deployed a new version 2 days ago and it is unverified, let me verify the contracts and I will let you know the addresses.

I´ll come back to you in a while.

GushALKDev commented 1 year ago

The verification system in ZKSync doesn't work as fine as expected, if you have to recompile after a deployment you won´t be able to verify the contract deployed before, even if nothing changes.

I am going to redeploy and verify the whole protocol and I´ll let you know when finish.

GushALKDev commented 1 year ago

Hi again @achal-singh!

The whole protocol is redeployed and verified, you can try it out at https://stg.dexynth.com/#/trading

All protocol addresses are stored here https://goerli.explorer.zksync.io/address/0xDFE1AA80F1c268C066daA4288E81e8B74c56Ccc7#contract

The contract from the trade starts is https://goerli.explorer.zksync.io/address/0x6eCBA505873E2e9E86e09DAbf69989f55183e5DD

Best regards!

achal-singh commented 1 year ago

Hey @GushALKDev, Looks like there are a whole bunch of contracts involved in this DEX. Is there a doc I can refer to deploy and test this in the correct way on my local machine?

From what I've seen so far that there are a set of contracts/interfaces being imported and deployed from GFarmTradingStorageV5.sol and a lot of function calls are defined in another contract named: "GNSTradingV6_2.sol". But it's tough to make a logical flow of how things actually flow here, i.e. for example, to figure out how a particular trade goes through.

Other than this, Remix is also giving out this error: CompilerError: Stack too deep when compiling inline assembly: Variable value0 is 1 slot(s) too deep inside the stack. when I try compiling the GFarmTradingStorageV5.sol contract. So a definitive guide to setup and deploy everything would be helpful in diagnosing the reason behind failing trade transactions on Shardeum.

Is there a doc I can follow to understand things to test and deploy?

Do correct me if I'm missing something here and if you have a better way I can test this out.

Regards!