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

Calldata display issue during function call in debugger #5651

Open
bean5oup opened this issue Jan 16, 2025 · 0 comments
Open

Calldata display issue during function call in debugger #5651

bean5oup opened this issue Jan 16, 2025 · 0 comments

Comments

@bean5oup
Copy link

Describe the bug
While debugging a smart contract in Remix IDE, I noticed that the displayed calldata in the Debugger section seems to be incorrect. The calldata representation does not match the expected format, leading to confusion when analyzing function calls.

To Reproduce
Steps to reproduce the behavior:

  1. Open Remix IDE in the browser.
  2. Deploy the following example smart contract C:
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

contract C {
    function test() public {
        Test testInstance = new Test();
        testInstance.alloc(9);
    }
}

contract Test {
    function alloc(int len) external pure returns (string memory r) {
        bytes memory data = new bytes(uint(len));
        for (uint i = 0; i < uint(len); i++) {
            data[i] = "A";
        }
        return string(data);
    }
}
  1. Call test
  2. Open the Debugger after the transaction is executed.
  3. Check the displayed calldata calling the testInstance.alloc(9) function in the Test contract before and after staticcall instruction in the Debugger tab.

Expected behavior
staticcall(gas, address, in, insize, out, outsize)
It seems that in and insize are swapped during parsing. The display might show them incorrectly, but it looks like the actual behavior works as expected.

Screenshots
function signature 0x2318a79b

Image

before staticcall

Image

after staticcall
I think the correct call data display is 0x2318a79b0000000000000000000000000000000000000000000000000000000000000009.
But it seems that the following image is showing the data from the 0x24 pointer with a size of 0x80.

Image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: chrome
  • Version: 131
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

1 participant