[Bug]: Failed to generate IR for function due to assertion failure in named argument reordering
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
I am trying to run slither on [this](https://etherscan.io/address/0x29469395eaf6f95920e59f858042f0e28d98a20b#code) contract and I am running into an issue when it's generating intermediate representation for Helpers.executeTakeBid
### Code example to reproduce the issue:
https://etherscan.io/address/0x29469395eaf6f95920e59f858042f0e28d98a20b#code
### Version:
0.10.0
### Relevant log output:
```shell
'solc --version' running
'solc contracts/blend/Blend.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/daniel/work/testcli/Blend/contracts/blend' running
Compilation warnings/errors on contracts/blend/Blend.sol:
Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
--> contracts/blend/Blend.sol:826:9:
|
826 | address operator,
| ^^^^^^^^^^^^^^^^
Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
--> contracts/blend/Blend.sol:827:9:
|
827 | address from,
| ^^^^^^^^^^^^
Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
--> contracts/blend/Blend.sol:828:9:
|
828 | uint256 tokenId,
| ^^^^^^^^^^^^^^^
Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
--> contracts/blend/Blend.sol:829:9:
|
829 | bytes calldata data
| ^^^^^^^^^^^^^^^^^^^
Warning: Function state mutability can be restricted to pure
--> contracts/blend/lib/Signatures.sol:58:5:
|
58 | function _createTypehashes()
| ^ (Relevant source part starts here and spans across multiple lines).
Warning: Contract code size is 37526 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.
--> contracts/blend/Blend.sol:12:1:
|
12 | contract Blend is IBlend, OfferController, UUPSUpgradeable {
| ^ (Relevant source part starts here and spans across multiple lines).
ERROR:SlitherSolcParsing:
Failed to generate IR for Helpers.executeTakeBid. Please open an issue https://github.com/crytic/slither/issues.
Helpers.executeTakeBid (contracts/blend/Helpers.sol#123-177):
sellOrder = Order({trader:address(this),side:Side.Sell,matchingPolicy:matchingPolicy,collection:address(lien.collection),tokenId:lien.tokenId,amount:1,paymentToken:address(pool),price:execution.makerOrder.order.price,listingTime:execution.makerOrder.order.listingTime + 1,expirationTime:type()(uint256).max,fees:new Fee[](0),salt:lienId,extraParams:})
sell = Input({order:sellOrder,v:0,r:bytes32(0),s:bytes32(0),extraSignature:execution.extraSignature,signatureVersion:SignatureVersion.Single,blockNumber:execution.blockNumber})
balanceBefore = pool.balanceOf(address(this))
lien.collection.approve(delegate,lien.tokenId)
exchange.execute(sell,execution.makerOrder)
amountReceivedFromSale = pool.balanceOf(address(this)) - balanceBefore
amountReceivedFromSale < debt
revert InvalidRepayment()()
pool.transferFrom(address(this),lien.lender,debt)
pool.transferFrom(address(this),lien.borrower,amountReceivedFromSale - debt)
Traceback (most recent call last):
File "/home/daniel/.local/bin/slither", line 8, in
sys.exit(main())
File "/home/daniel/.local/lib/python3.10/site-packages/slither/__main__.py", line 727, in main
main_impl(all_detector_classes=detectors, all_printer_classes=printers)
File "/home/daniel/.local/lib/python3.10/site-packages/slither/__main__.py", line 833, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/home/daniel/.local/lib/python3.10/site-packages/slither/__main__.py", line 107, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/home/daniel/.local/lib/python3.10/site-packages/slither/__main__.py", line 80, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slither.py", line 144, in __init__
self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slither.py", line 164, in _init_parsing_and_analyses
raise e
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slither.py", line 160, in _init_parsing_and_analyses
parser.analyze_contracts()
File "/home/daniel/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 539, in analyze_contracts
self._convert_to_slithir()
File "/home/daniel/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 765, in _convert_to_slithir
raise e
File "/home/daniel/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 750, in _convert_to_slithir
func.generate_slithir_and_analyze()
File "/home/daniel/.local/lib/python3.10/site-packages/slither/core/declarations/function.py", line 1767, in generate_slithir_and_analyze
node.slithir_generation()
File "/home/daniel/.local/lib/python3.10/site-packages/slither/core/cfg/node.py", line 716, in slithir_generation
self._irs = convert_expression(expression, self) # type:ignore
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slithir/convert.py", line 118, in convert_expression
result = apply_ir_heuristics(result, node, is_solidity)
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slithir/convert.py", line 2010, in apply_ir_heuristics
irs = propagate_type_and_convert_call(irs, node)
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slithir/convert.py", line 516, in propagate_type_and_convert_call
call_data = reorder_arguments(call_data, ins.names, decl_param_names)
File "/home/daniel/.local/lib/python3.10/site-packages/slither/slithir/convert.py", line 442, in reorder_arguments
assert len(call_names) == len(decl_names)
AssertionError
```
Contributor guide
Assessment
This issue has not been assessed yet.