You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Events don't work with constants declared in the global scope. Also, the bug was not present on version 0.10.0
Code example to reproduce the issue:
uintconstant A =3;
contractC {
event ev(uint[A]);
}
Version:
0.10.1
Relevant log output:
'solc --version' running
'solc Treasury.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes,compact-format --allow-paths .,/home/tigran' running
Compilation warnings/errors on Treasury.sol:
Warning: SPDX license identifier not provided insource file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED"for non-open-source code. Please see https://spdx.org for more information.
--> Treasury.sol
Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.7;"
--> Treasury.sol
Traceback (most recent call last):
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 852, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 107, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 80, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/slither.py", line 150, in __init__
self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/slither.py", line 160, in _init_parsing_and_analyses
raise e
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/slither.py", line 156, in _init_parsing_and_analyses
parser.parse_contracts()
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 542, in parse_contracts
self._analyze_second_part(contracts_to_be_analyzed, libraries)
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 629, in _analyze_second_part
self._analyze_struct_events(contract)
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 704, in _analyze_struct_events
contract.analyze_events()
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/declarations/contract.py", line 755, in analyze_events
event_parser.analyze() # type: ignore
^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/declarations/event.py", line 54, in analyze
elem_parser.analyze(self._slither_parser)
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/variables/variable_declaration.py", line 212, in analyze
self._variable.type = parse_type(self._elem_to_parse, caller_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/solidity_types/type_parsing.py", line 430, in parse_type
length = parse_expression(t["length"], caller_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 510, in parse_expression
var, was_created = find_variable(value, caller_context, referenced_declaration)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/expressions/find_variable.py", line 397, in find_variable
direct_contracts, direct_functions, current_scope = _find_variable_init(caller_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/expressions/find_variable.py", line 333, in _find_variable_init
raise SlitherError(
slither.exceptions.SlitherError: <class 'slither.solc_parsing.slither_compilation_unit_solc.SlitherCompilationUnitSolc'> (<slither.solc_parsing.slither_compilation_unit_solc.SlitherCompilationUnitSolc object at 0x7b96b39ce090> is not valid for find_variable
ERROR:root:Error:
ERROR:root:<class 'slither.solc_parsing.slither_compilation_unit_solc.SlitherCompilationUnitSolc'> (<slither.solc_parsing.slither_compilation_unit_solc.SlitherCompilationUnitSolc object at 0x7b96b39ce090> is not valid for find_variable
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues
The text was updated successfully, but these errors were encountered:
0xalpharush
changed the title
[Bug-Candidate]: Slither cannot parse event arguments from global scope
[Bug]: Slither cannot parse event arguments from global scope
Mar 15, 2024
Describe the issue:
Events don't work with constants declared in the global scope. Also, the bug was not present on version 0.10.0
Code example to reproduce the issue:
Version:
0.10.1
Relevant log output:
The text was updated successfully, but these errors were encountered: