Skip to content

forge test --debug fails with Invalid hex calldata when invoked on tests that take fuzz arguments #5563

@emo-eth

Description

@emo-eth

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (6672134 2023-08-08T00:21:59.824374000Z)

What command(s) is the bug in?

forge test --debug

Operating System

None

Describe the bug

This has previously been mentioned in #3438 as a feature request.

I am opening this issue because, if this is not a supported feature, Forge should fail in a way that informs the end user that fuzz test debugging is not supported, perhaps recommending the --sig flag as an alternative (which has a separate open issue, #4722).

Further, the error's implication that calldata was not passed correctly to the debugger, as mentioned in #4722, appears to me to be a bug in the way Forge is relaying fuzz test calldata to the debugger.

Minimal reproduction:

run forge test --debug testFuzz with the following code

pragma solidity ^0.8.17;

import {Test} from "forge-std/Test.sol";

contract FuzzFailTest is Test {
    function testFuzz(uint256 arg) public {}
}

Results in output:

[⠑] Compiling...
[⠔] Compiling 1 files with 0.8.20
[⠑] Solc 0.8.20 finished in 734.48ms
Compiler run successful!
Error: 
Invalid hex calldata

Context:
- Invalid character 'x' at position 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions