-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Remove share of functions and modifiers instances #213
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…acts, each contract has an own copy of all the functions/modifiers Changed: - function/modifier inherits from ChildInheritance, which contains original_contract, pointing to the base contract - function.contract will point to the contract where the instance is stored - function.is_shadowed indicates if a function is shadowed - function.canonical_name returns original_contract+ '.'+ name - contract._functions/_modifiers are indexes by their canonical_name - contract.functions_as_dict is rename available_functions_as_dict and return non-shadowed functions (same for modifiers_as_dict) - For better clarity, all the detectors use now canoncal_name, for variable/function/structure/... rather than contract.name + name - abstract_detector.add_event_to_json/ abstract_detector.add_events_to_json (the json type is still 'function' to simplify the 3-party parsing)
- slithir convert: fix incorrect internal call conversion (use canonical name) - slithir internalcall: use tuple(func_nale, contract_name) to init unknown internal call - Update upgradability-check with new API
contracts.*not_inherited -> contracts.*_declared Add *_inherited *_declared for events/enums/state_variables/structures Use *_declared in core and detectors (remove *.contract == contract type of check)
Conflicts: slither/core/declarations/structure.py slither/core/variables/state_variable.py slither/detectors/abstract_detector.py slither/detectors/attributes/const_functions.py slither/detectors/erc/incorrect_erc20_interface.py slither/detectors/erc/unindexed_event_parameters.py slither/detectors/naming_convention/naming_convention.py slither/detectors/operations/unused_return_values.py slither/detectors/statements/calls_in_loop.py slither/detectors/statements/incorrect_strict_equality.py slither/detectors/statements/tx_origin.py slither/detectors/variables/possible_const_state_variables.py slither/detectors/variables/unused_state_variables.py slither/slithir/convert.py
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to change the way functions and modifiers are internally stored.
Currently, the instances of functions and modifiers are shared across all the contracts, this creates several issues, such as incorrect internal functions calls resolutions.
This a considerable change, and will require thorough tests (including for both detectors and printers)
The PR fixes #155
Current changelog:
ChildInheritance
, which containscontract_declarer
, pointing to the base contractfunction.contract
will point to the contract where the instance is storedfunction.is_shadowed
indicates if a function is shadowedfunction.canonical_name
returnsoriginal_contract+ '.'+ name
contract._functions/_modifiers
are indexed by theircanonical_name
contract.functions_as_dict
is renamedavailable_functions_as_dict
and return non-shadowed functions (same for modifiers_as_dict)canoncal_name
, for variable/function/structure/... rather thancontract.name + '.' + name
function
to simplify the 3-party parsing)contract.*not_inherited
renamedcontract.*_declared
. Addevents/enums/state_variables/structures
_declared