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

scilla_call precompile errors with Built-in failed #2002

Open
DrZoltanFazekas opened this issue Dec 11, 2024 · 0 comments
Open

scilla_call precompile errors with Built-in failed #2002

DrZoltanFazekas opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@DrZoltanFazekas
Copy link
Contributor

DrZoltanFazekas commented Dec 11, 2024

Here's an example of a transaction that involves an ERC20 -> ZRC2 interop call. The transaction succeeded but the ZRC2 transfer did not happen: https://explorer.zq2-protomainnet.zilliqa.com/tx/0xa86cfe1c38d6744eda04a62eac3119b54f562c575f7f1feac395a69e57da927e

The involved ZUSDT (ERC20) contract imported from ZQ1 calls the precompile with 21000 gas: https://github.com/Plunderswap/zrc2proxy/blob/3cefaae8c4e4c47647263a959cebd29183a8f336/contracts/EIP20ZRC2Proxy.sol

We've implemented a workaround to revert transactions in case the precompile is called with 21000 gas but the caller (ERC20) contract was not whitelisted. In the above case, however, ZUSDT was whitelisted in the proto-mainnet config file, so the interop call should have worked with 21000 gas: 0x2274005778063684fbB1BfA96a2b725dC37D75f9

The precompile failed, the relevant section of the trace says:

            {
                "type": "call",
                "action": {
                    "from": "0x2274005778063684fbb1bfa96a2b725dc37d75f9",
                    "callType": "call",
                    "gas": "0x5208",
                    "input": "0x000000000000000000000000818ca2e217e060ad17b7bd0124a483a1f66930a900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000001a1005d41b9b27187ed6faadc05084e5ad6d59800000000000000000000000000000000000000000000000000000000000502a800000000000000000000000000000000000000000000000000000000000000085472616e73666572000000000000000000000000000000000000000000000000",
                    "to": "0x000000000000000000000000000000005a494c53",
                    "value": "0x0"
                },
                "error": "Built-in failed",
                "result": null,
                "subtraces": 0,
                "traceAddress": [
                    0,
                    1,
                    0,
                    0
                ]
            },
@DrZoltanFazekas DrZoltanFazekas added the bug Something isn't working label Dec 11, 2024
@bzawisto bzawisto self-assigned this Dec 13, 2024
@bzawisto bzawisto linked a pull request Dec 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants