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

Error when performing a transfer through a proxy contract. #2028

Open
alfarkas opened this issue Nov 2, 2023 · 4 comments
Open

Error when performing a transfer through a proxy contract. #2028

alfarkas opened this issue Nov 2, 2023 · 4 comments

Comments

@alfarkas
Copy link

alfarkas commented Nov 2, 2023

Error on "transfer" call from a contract to a proxy contract

Description

When you have two contracts deployed with proxies, and when one of them tries to call the other one to attempt a transfer, it fails, apparently it runs out of gas. Polygon edge sets a gas of 2300 when doing this, which is correct for a transfer, but for some reason it's not working as expected. Increasing the gas assigned there seems to work but is not a good solution.
When making a "call" instead of a "transfer" it works fine.

Your environment

  • Mac OS 14.0, also ubuntu 20.04
  • Polygon edge v1.3.1, v0.6.3, v0.6.1 (tried it on those versions)
  • Branch Develop
  • Locally and on AWS cloud.
  • Locally runs on docker, runs natively on AWS.

Steps to reproduce

  • Deploy two contracts behind proxies, one contract calls the other one performing a transfer.
    i.e.:
    Contract 1:
function withdrawFromTest2usingTransfer(
        Test2 test2Address,
        uint256 amount
    ) public {
        test2Address.withdrawFromTest2usingTransfer(
            payable(address(this)),
            amount
        );
        emit EthReceived(amount);
    }

Contract 2:

function withdrawFromTest2usingTransfer(
        address payable recipientAddress,
        uint256 amount
    ) public {
        recipientAddress.transfer(amount);
    }

Expected behavior

  • To be able to perform a transfer from a contrat to another contract behind a proxy.

Logs

Provide us with debug logs from all of your validators by setting logging to debug output with: server --log-level debug

Proposed solution

If you have an idea on how to fix this issue, please write it down here, so we can begin discussing it

@goran-ethernal
Copy link
Collaborator

Are you passing the address of the proxy of the second contract, or the address of the contract implementation itself?

@alfarkas
Copy link
Author

alfarkas commented Nov 3, 2023

Hi @goran-ethernal , thank you for answering.
The contract 1 is behind a proxy, I call the contract1Proxy function that calls the contract 2 which is not behind a proxy, then contract2 makes a transfer to the address of contract1Proxy.
You can see an example on this repo https://github.com/NicolasMenendez/poc-polygon-edge.
We tested the same code on other networks and it works just fine.

@alfarkas
Copy link
Author

alfarkas commented Nov 6, 2023

@goran-ethernal Were you able to reproduce the error? need more info?
Let me know if i need to provide more details.

@goran-ethernal
Copy link
Collaborator

We will try to reproduce the error, and let you know what we found out.

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