Version of Hardhat
3.2.0
What happened?
When calling swapETHForExactTokens on a UniswapV2Router contract with a deadline in the past, Hardhat v3 returns:
"message": "Internal error"
instead of the expected revert reason:
Error: VM Exception while processing transaction: reverted with reason string 'UniswapV2Router: EXPIRED'
This behavior differs from Hardhat v2, where the revert reason was correctly surfaced, like this Error: VM Exception while processing transaction: reverted with reason string 'UniswapV2Router: EXPIRED'.
Minimal reproduction steps
Steps:
- Use Hardhat v3.2.0
- Call
swapETHForExactTokens on UniswapV2Router contract
- Provide a
deadline parameter that is already expired, e.g. 1700000000
Expected behavior:
Hardhat should decode and return the revert reason:
UniswapV2Router: EXPIRED
Actual behavior
Hardhat returns a generic error:
{
"message": "Internal error",
"txHash": "0xb9b4d2e93ffb6739fe1886e1c277d1bd6c15d59b88f66f9d6aaae134a806e851",
"data": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000018556e69737761705632526f757465723a20455850495245440000000000000000"
}
Additional context
The data field contains the encoded revert reason:
0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000018556e69737761705632526f757465723a20455850495245440000000000000000
Decoding this yields:
This suggests that Hardhat v3 is not decoding the revert reason in this scenario, even though the information is available in the response data. This was working the expected way in hardhat v2.
Search terms
No response
Version of Hardhat
3.2.0
What happened?
When calling
swapETHForExactTokenson a UniswapV2Router contract with a deadline in the past, Hardhat v3 returns:instead of the expected revert reason:
This behavior differs from Hardhat v2, where the revert reason was correctly surfaced, like this
Error: VM Exception while processing transaction: reverted with reason string 'UniswapV2Router: EXPIRED'.Minimal reproduction steps
Steps:
swapETHForExactTokensonUniswapV2Routercontractdeadlineparameter that is already expired, e.g.1700000000Expected behavior:
Hardhat should decode and return the revert reason:
UniswapV2Router: EXPIREDActual behavior
Hardhat returns a generic error:
Additional context
The data field contains the encoded revert reason:
Decoding this yields:
This suggests that Hardhat v3 is not decoding the revert reason in this scenario, even though the information is available in the response data. This was working the expected way in hardhat v2.
Search terms
No response