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

transaction/cost broken for cross-chain transactions #280

Open
lcswillems opened this issue Oct 23, 2021 · 1 comment
Open

transaction/cost broken for cross-chain transactions #280

lcswillems opened this issue Oct 23, 2021 · 1 comment

Comments

@lcswillems
Copy link

Hi,

I think the transaction/cost endpoint is broken for cross-shard transactions.

I attach the reproduction. It has the extension .txt but it should be replaced by .http (I could not attach a .http file directly here). Then this .http file can be ran in VSCode.

bug-cost.txt

I have to account on testnet:

  • account 1 in shard 1: erd1ete948n8jh4aq0c26sla4nfus2dm206tyylcr4y929l73887g0nsnsy93r
  • account 2 in shard 2: erd1admrhe6atmrxdd62dalwwn0j69pemx2c0jcf9cflp20sl89qk6aq56ru6d

Both accounts own some SFT token MEXFARM-c070e3-9426.

In the file I attached, you can find 2 POST requests to transaction/cost endpoint.

In request 1, account 1 (in shard 1) transfers a quantity X of MEXFARM-c070e3-9426 to the compoundRewards method of MEX farm SC. The cost estimation of this call is: 17815967. This call is an intrashard one.

In request 2, account 2 (in shard 2) transfers same quantity X of MEXFARM-c070e3-9426 to the compoundRewards method of MEX farm SC. The cost estimation of this call is: 1052300, i.e. 17 times lower than the call for account 1.

Request 1 and request 2 have the same data field and are barely the same transactions. The only difference is that one is made by an account in shard 1 and the other by an account in shard 2. Hence, having a 17x difference between cost estimation seems there is something in proxy's estimation.

I hope my explanations are clear enough. Let me know if I can help more.

Lucas

@silvestrst-crypto
Copy link

Another thing is that it doesn't just calculate the cost, but also performs check as for the normal transaction. For example, if total accumulated staking rewards are below 1EGLD, reDelegateRewards cost calculation at the /cost endpoint will fail with the message delegate value must be higher than 0. Which doesn't seem right, cost calculation should be about cost calculation.

Although I guess developers tried to reuse existing message validation code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants