Skip to content
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

[Bug-Candidate]: get_dependencies bug #1502

Open
l0ca1 opened this issue Dec 14, 2022 · 1 comment
Open

[Bug-Candidate]: get_dependencies bug #1502

l0ca1 opened this issue Dec 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@l0ca1
Copy link

l0ca1 commented Dec 14, 2022

Describe the issue:

test.sol:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
contract Contract {
    uint256 var_amount;

    function direct_returns(uint256 amount) internal returns (uint256) {
        uint256 _amount = var_amount + amount;
        return _amount;
    }

    function indirect_returns(uint256 amount)
        internal
        returns (uint256 _amount)
    {
        _amount = var_amount + amount;
    }

    function test() external {
        uint256 a = direct_returns(10);
        uint256 b = indirect_returns(10);
    }
}

test.py:

direct_returns_function:Function
indirect_returns_function:Function
test_function:Function
a_variable:Variable
b_variable:Variable

#contract is test.sol:Contract
for function in contract.functions:
    if function.name=="direct_returns":
        direct_returns_function = function
    elif function.name=="indirect_returns":
        indirect_returns_function = function
    elif function.name=="test":
        test_function = function

for vari in test_function.variables_as_dict.values():
    if vari.name=="a":
        a_variable = vari
    elif vari.name=="b":
        b_variable = vari
    

print([vari.name for vari in get_dependencies(a_variable,contract)])
print([vari.name for vari in get_dependencies(b_variable,contract)])

get result:

['TMP_2', 'TMP_0', 'amount', '_amount', 'var_amount']
['TMP_3']

I was expecting the same result (same result length), but here it is different

Code example to reproduce the issue:

``

Version:

0.9.1

Relevant log output:

No response

@l0ca1 l0ca1 added the bug-candidate Bugs reports that are not yet confirmed label Dec 14, 2022
@0xalpharush
Copy link
Contributor

This may be related to #1450

@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants