Skip to content

Secure3Audit/U235Pro_AAVE_Similarity_Analysis

Repository files navigation

U235Pro_AAVE_Similarity_Analysis

Purpose

The primary objective of this analysis is to assess the code similarity between the a sub-folder of the source repo and the target repo.

Our engineering team has embarked on a detailed direct comparison of the code repositories. This examination aims to accurately quantify and understand the extent of similarity.

Our analysis result can be found in the conclusion.

Code Repos

Source

Target

A copy of the codes has also been cloned into source_code/ and target_code/ for reference. The .git has been removed for both.

Conclusion

Based on our comparison, we conclude that the source is a subset of the target with approximately 7156 loc reduction.

Target has gone through multiple rounds of security audits. Prior security assessments on target repos can be a good reference. Readers of this analysis, based on your security requirements, should determine on their own whether or not to directly trust the prior or existing security assessments or audits on target repos.

Methodology for Similarity Comparison

We utilized two tools for the similarity analysis:

  1. git diff --numstat: https://git-scm.com/docs/git-diff
  2. cloc: https://github.com/AlDanial/cloc

Comparison Detail

git diff output

git diff source_code/contracts-internal/contracts-internal/ target_code/aave-v3-core/ --numstat | grep .sol > results/git_diff.txt

output: results/git_diff.txt

cloc output

cloc --not-match-f="(example|test|tests|mock|Mock)" --exclude-dir=mock,mocks,test,debug,template,open-zeppelin,lib,dependencies,interfaces --include-ext=sol --diff target_code/aave-v3-core source_code/contracts-internal/contracts-internal > results/cloc_diff_concise.txt

output: results/cloc_diff_concise.txt

github.com/AlDanial/cloc v 1.98  T=0.17 s (355.5 files/s, 65858.5 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Solidity
 same                            0              0              0              0
 modified                        0              0              0              0
 added                           1              1              2              6
 removed                        58           1284           2482           7156
-------------------------------------------------------------------------------
SUM:
 same                            0              0              0              0
 modified                        0              0              0              0
 added                           1              1              2              6
 removed                        58           1284           2482           7156
-------------------------------------------------------------------------------

We see about 7156 lines of code removed.

Get a more detailed result:

cloc --by-file --not-match-f="(example|test|tests|mock|Mock)" --exclude-dir=mock,mocks,test,debug,template,open-zeppelin,lib,dependencies,interfaces --include-ext=sol --diff target_code/aave-v3-core source_code/contracts-internal/contracts-internal > results/cloc_diff.txt

output: results/cloc_diff.txt