edr icon indicating copy to clipboard operation
edr copied to clipboard

Panic Error

Open billalxcode opened this issue 6 months ago • 1 comments

Version of Hardhat

2.24.3

What happened?

eth_estimateGas Contract call: TokenERC20#openTrading From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 To: 0xdc64a140aa3e981100a9beca4e685f962f0cf6c9 Value: 0 ETH

Error: reverted with reason string 'UniswapV2: OVERFLOW'

thread '' panicked at crates/edr_solidity/src/error_inferrer.rs:917:10: Expected call instruction location to be defined note: run with RUST_BACKTRACE=1 environment variable to display a backtrace thread '' panicked at core/src/panicking.rs:221:5: panic in a function that cannot unwind stack backtrace: 0: 0x11963c734 - _napi_register_module_v1 1: 0x119658c1c - _napi_register_module_v1 2: 0x119639a84 - _napi_register_module_v1 3: 0x11963c5e8 - _napi_register_module_v1 4: 0x11963d354 - _napi_register_module_v1 5: 0x11963d198 - _napi_register_module_v1 6: 0x11963db08 - _napi_register_module_v1 7: 0x11963d794 - _napi_register_module_v1 8: 0x11963cbf8 - _napi_register_module_v1 9: 0x11963d474 - _napi_register_module_v1 10: 0x11969d9e8 - _napi_register_module_v1 11: 0x11969da60 - _napi_register_module_v1 12: 0x11969db4c - _napi_register_module_v1 13: 0x118fbd0c0 - thread caused non-unwinding panic. aborting. [1] 71276 abort npx hardhat node

Minimal reproduction steps

  1. Deploy token contract with openTrading function
function openTrading(address _router) external onlyOwner {
		require(!tradingOpen, "trading is already open");
		uniswapV2Router = IUniswapV2Router02(_router);
		_approve(address(this), address(uniswapV2Router), _tTotal);
		uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
				address(this),
				uniswapV2Router.WETH()
			);
		uniswapV2Router.addLiquidityETH{value: address(this).balance}(
			address(this),
			balanceOf(address(this)),
			0,
			0,
			owner(),
			block.timestamp
		);
		IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
		swapEnabled = true;
		tradingOpen = true;
		firstBlock = block.number;
	}
  1. Run the open trading function on the ignition hardhat

Search terms

No response

billalxcode avatar Jun 21 '25 23:06 billalxcode

Hi @billalxcode thanks for reporting this!

I tried to repro by writing an isolated test in this project, but I couldn't repro the panic: https://github.com/agostbiro/undefined-call-instruction-location

If your project is public where the panic happens, could you share that please? Or alternatively could you have a look at my repro project and let me know what to change to reproduce the panic?

agostbiro avatar Jun 26 '25 16:06 agostbiro