-
Notifications
You must be signed in to change notification settings - Fork 5
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
CERT-7012 Add New Listing Check #9
Conversation
965c26e
to
822dbb1
Compare
822dbb1
to
217a490
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
@@ -19,7 +19,7 @@ def __init__(self, customer: str, chain: Chain, proposal_address: str, source_co | |||
self.check_folder.mkdir(parents=True, exist_ok=True) | |||
|
|||
|
|||
def _write_to_file(self, path: str | Path, data: dict | str) -> None: | |||
def _write_to_file(self, path: str | Path, data: dict | str | list) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I think Any should be more suitable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to be specific for now if there are more types in the future i will change that.
ProposalTools/Utils/source_code.py
Outdated
""" | ||
Retrieves the functions from the Solidity contract. | ||
|
||
Returns: | ||
(list | None): List of functions or None if not found. | ||
(dict | None): List of functions or None if not found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this always returning a dict?
If so please change the txt as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
for statement in function_node.get('body', {}).get('statements', []): | ||
if statement.get('type') == 'VariableDeclarationStatement': | ||
for var in statement.get('variables', []): | ||
if var.get('typeName', {}).get('baseTypeName', {}).get('namePath') == 'IAaveV3ConfigEngine.Listing': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is specific "IAaveV3ConfigEngine"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the structure of the TAC when trying to fetch the listing variables.
for statement in function_node.get('body', {}).get('statements', []): | ||
if statement.get('type') == 'ExpressionStatement': | ||
expression = statement.get('expression', {}) | ||
if expression.get('type') == 'FunctionCall': | ||
function_name = expression.get('expression', {}).get('name', "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern or a similar one seems to be repetitive in 3 (or more) functions, can we maybe combine this to 1 flow?
I haven't had the chance to dig deep into details, but it seems like collecting the data can be done in 1 loop? or am I'm wrong here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can write every thing in one huge function, but it will frustrating to keep up with what happens there and the lack of documentations.
https://certora.atlassian.net/browse/CERT-7012