slither
slither copied to clipboard
[Bug]: Failed to generate IR for function due to assertion failure in named argument reordering
Describe the issue:
I am trying to run slither on this 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:
'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 <module>
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
~@kevinclancy This is related to the argument reordering~
EDIT: It might actually be related to https://github.com/crytic/slither/issues/1622
Hi @0xalpharush. I have caught the same error today. Any advice? Is this something on my side? I have used version 0.8.20 of solc by the way.
ERROR:SlitherSolcParsing:
Failed to generate IR for Account.recovery. Please open an issue https://github.com/crytic/slither/issues.
Account.recovery (src/Account.sol#63-67):
hash = MessageHashUtils.toEthSignedMessageHash(message)
recoveredAddress = ECDSA.recover(hash,signature)
recoveredAddress == nameServiceOwner
Traceback (most recent call last):
File "/usr/local/bin/slither", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer==0.10.0', 'console_scripts', 'slither')())
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/__main__.py", line 727, in main
main_impl(all_detector_classes=detectors, all_printer_classes=printers)
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/__main__.py", line 833, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/__main__.py", line 107, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/__main__.py", line 80, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/slither.py", line 144, in __init__
self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/slither.py", line 164, in _init_parsing_and_analyses
raise e
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/slither.py", line 160, in _init_parsing_and_analyses
parser.analyze_contracts()
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 539, in analyze_contracts
self._convert_to_slithir()
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 765, in _convert_to_slithir
raise e
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 750, in _convert_to_slithir
func.generate_slithir_and_analyze()
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/core/declarations/function.py", line 1767, in generate_slithir_and_analyze
node.slithir_generation()
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/core/cfg/node.py", line 718, in slithir_generation
self._find_read_write_call()
File "/Users/xxx/Library/Python/3.9/lib/python/site-packages/slither/core/cfg/node.py", line 926, in _find_read_write_call
assert isinstance(ir.function, Function)
AssertionError
I also got caught by the same issue:
$ slither .
'forge clean' running (wd: /Users/bart/dev/x/y)
'forge config --json' running
'forge build --build-info --skip */test/** */script/** --force' running (wd: /Users/bart/dev/x/y)
ERROR:SlitherSolcParsing:
Failed to generate IR for LSSVMPair.multicall. Please open an issue https://github.com/crytic/slither/issues.
LSSVMPair.multicall (lib/lssvm2/src/LSSVMPair.sol#683-700):
i < calls.length
sig = bytes4(calls[i])
sig == transferOwnership.selector
revert LSSVMPair__FunctionNotAllowed()()
(success,result) = address(this).delegatecall(calls[i])
! success && revertOnFail
revert(uint256,uint256)(0x20 + result,mload(uint256)(result))
++ i
onlyOwner()
Any suggestions for a workaround (if there's one!) highly appreciated!