-
Notifications
You must be signed in to change notification settings - Fork 12
Description
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 :)