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

[Request] Feature - Option to generate a file where all abstractions are either aided or replaced with their source #61

Open
0xcuriousapple opened this issue Sep 20, 2023 · 0 comments

Comments

@0xcuriousapple
Copy link

0xcuriousapple commented Sep 20, 2023

Main Thread: https://x.com/0xcuriousapple/status/1703200615441031444

Hey Ackee Team,
Great Extention!
If possible, consider adding an option allowing users to generate a file with all abstractions resolved.
Currently reviewing large codebases is a huge pain due to all abstractions and multilevel inheritances for auditors and devs.
For development, it makes sense to use abstractions and inheritance, but while reviewing it is ideal that you see everything happening in one place.
Hopping between different files with peeks is not ideal since it requires you to keep everything in memory and keep remembering previous peeks in the current peek

For example, consider there is a function A with

A { 
_a1()
_b1()
}

_a1{
__a2() 
}

_b1{

}
__a2 {

}

When I am reviewing A, I start with _a1, go deep to a2, keep in mind everything that's done and then come back to A and then review b1 while remembering what has happened before.

For multilevel inheritance, this becomes worse, and reviewers then start assuming the state changes.

One live example from wild

  function burnFrom(address _account, uint256 _amount) external virtual override {
        require(_canBurn(), "Not authorized to burn.");
        require(balanceOf(_account) >= _amount, "not enough balance");
        uint256 decreasedAllowance = allowance(_account, msg.sender) - _amount;
        _approve(_account, msg.sender, 0);
        _approve(_account, msg.sender, decreasedAllowance);
        _burn(_account, _amount);
    }

For A, the final output could look something like

A { 
_a1()
{
__a2() 
{
// what a2 does
}
}
_b1()
{
what b1 does
}
}

For the above live example, the output could look like

  function burnFrom(address _account, uint256 _amount) external virtual override {
        require(_canBurn(), "Not authorized to burn.");
        {
            _canBurn() {
        
            }
        }
        
        require(balanceOf(_account) >= _amount, "not enough balance");
        {
            balanceOf(address) { // direct copy of original function sig is fine IMO
        
            }
        }
        
        uint256 decreasedAllowance = allowance(_account, msg.sender) - _amount;|
        {
            allowance(address, address) {
        
            }
        }
        
        _approve(_account, msg.sender, 0);
       {
           _approve(address, address, uint256) {
        
           }
        }
       ......
    }

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant