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

CERT-7012 Add New Listing Check #9

Merged
merged 6 commits into from
Sep 4, 2024
Merged

Conversation

nivcertora
Copy link
Contributor

@nivcertora nivcertora requested a review from a team August 28, 2024 10:30
@nivcertora nivcertora self-assigned this Aug 28, 2024
@github-actions github-actions bot force-pushed the niv/CERT-7012-NewListing branch from 965c26e to 822dbb1 Compare August 28, 2024 10:40
@github-actions github-actions bot force-pushed the niv/CERT-7012-NewListing branch from 822dbb1 to 217a490 Compare August 28, 2024 10:40
Copy link
Contributor

@liav-certora liav-certora left a 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:
Copy link
Contributor

@yoav-el-certora yoav-el-certora Sep 3, 2024

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

Copy link
Contributor Author

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.

"""
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.
Copy link
Contributor

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.

Copy link
Contributor Author

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':
Copy link
Contributor

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"?

Copy link
Contributor Author

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.

Comment on lines +188 to +192
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', "")
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@nivcertora nivcertora merged commit 3d6598b into main Sep 4, 2024
1 check passed
@nivcertora nivcertora deleted the niv/CERT-7012-NewListing branch September 4, 2024 10:20
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

Successfully merging this pull request may close these issues.

3 participants