slither icon indicating copy to clipboard operation
slither copied to clipboard

running evm printer leads to "ValueError: too many values to unpack (expected 4)"

Open ericnordelo opened this issue 4 years ago • 1 comments

Traceback (most recent call last): File "/home/ericng/.local/lib/python3.8/site-packages/slither/main.py", line 741, in main_impl ) = process_all(filename, args, detector_classes, printer_classes) File "/home/ericng/.local/lib/python3.8/site-packages/slither/main.py", line 83, in process_all ) = process_single(compilation, args, detector_classes, printer_classes) File "/home/ericng/.local/lib/python3.8/site-packages/slither/main.py", line 68, in process_single return _process(slither, detector_classes, printer_classes) File "/home/ericng/.local/lib/python3.8/site-packages/slither/main.py", line 115, in _process printer_results = slither.run_printers() File "/home/ericng/.local/lib/python3.8/site-packages/slither/slither.py", line 195, in run_printers return [p.output(self._crytic_compile.target).data for p in self._printers] File "/home/ericng/.local/lib/python3.8/site-packages/slither/slither.py", line 195, in return [p.output(self._crytic_compile.target).data for p in self._printers] File "/home/ericng/.local/lib/python3.8/site-packages/slither/printers/summary/evm.py", line 79, in output evm_info = _extract_evm_info(self.slither) File "/home/ericng/.local/lib/python3.8/site-packages/slither/printers/summary/evm.py", line 34, in _extract_evm_info evm_info["mapping", contract.name] = generate_source_to_evm_ins_mapping( File "/home/ericng/.local/lib/python3.8/site-packages/slither/analyses/evm/convert.py", line 189, in generate_source_to_evm_ins_mapping offset, _length, file_id, _ = mapping_item ValueError: too many values to unpack (expected 4)

ericnordelo avatar Nov 16 '21 18:11 ericnordelo

I've met the same problem, and the version of solidity is 0.8.4 I tried to add a variable like this offset, _length, file_id, _, x = mapping_item and another bug occurs

File "C:\Users\ruby\AppData\Roaming\Python\Python37\site-packages\slither\analyses\evm\convert.py", line 131, in _get_evm_instructions_node
    node_info["contract"].source_mapping["filename_absolute"],
  File "C:\Users\ruby\AppData\Roaming\Python\Python37\site-packages\slither\analyses\evm\convert.py", line 189, in generate_source_to_evm_ins_mapping
    mapping_item[i] = int(prev_mapping[i])
ValueError: invalid literal for int() with base 10: '-'

then I tried to add codes here (around line 186 of convert.py)

       for i, _ in enumerate(mapping_item):
            if mapping_item[i] == "" and prev_mapping[i] != '-' and prev_mapping[i] != '':
                mapping_item[i] = int(prev_mapping[i])

Now it works, but I don't know why it works or whether it works correctly

Es-00 avatar Jun 28 '22 13:06 Es-00