Skip to content

Commit

Permalink
cli/reportgen + test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Aug 2, 2024
1 parent 133dbab commit cf5a8ed
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 119 deletions.
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/high/incorrect_modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ mod incorrect_modifier_detector_tests {
#[test]
#[serial]
fn test_incorrect_modifier() {
let context = crate::detect::test_utils::load_solidity_source_unit_with_callgraphs(
let context = crate::detect::test_utils::load_solidity_source_unit(
"../tests/contract-playground/src/IncorrectModifier.sol",
);

Expand Down
5 changes: 1 addition & 4 deletions reports/adhoc-sol-files-highs-only-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@
"weak-randomness",
"pre-declared-local-variable-usage",
"delete-nested-mapping",
<<<<<<< HEAD
"incorrect-modifier"
=======
"incorrect-modifier",
"contract-locks-ether"
>>>>>>> dev
]
}
27 changes: 8 additions & 19 deletions reports/report.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"files_summary": {
<<<<<<< HEAD
"total_source_units": 74,
"total_sloc": 2072
=======
"total_source_units": 75,
"total_sloc": 2128
>>>>>>> dev
"total_source_units": 76,
"total_sloc": 2204
},
"files_details": {
"files_details": [
Expand Down Expand Up @@ -317,11 +312,7 @@
]
},
"issue_count": {
<<<<<<< HEAD
"high": 33,
=======
"high": 34,
>>>>>>> dev
"high": 35,
"low": 25
},
"high_issues": {
Expand Down Expand Up @@ -1860,7 +1851,6 @@
]
},
{
<<<<<<< HEAD
"title": "Incorrect Modifier",
"description": "A modifier must contain a placeholder statement `_` and a `revert` or a `require` condition.",
"detector_name": "incorrect-modifier",
Expand Down Expand Up @@ -1888,7 +1878,10 @@
"line_no": 6,
"src": "103:8",
"src_char": "103:8"
=======
}
]
},
{
"title": "Contract locks Ether without a withdraw function.",
"description": "It appears that the contract includes a payable function to accept Ether but lacks a corresponding function to withdraw it, which leads to the Ether being locked in the contract. To resolve this issue, please implement a public or external function that allows for the withdrawal of Ether from the contract.",
"detector_name": "contract-locks-ether",
Expand Down Expand Up @@ -1922,7 +1915,6 @@
"line_no": 58,
"src": "4547:15",
"src_char": "3059:15"
>>>>>>> dev
}
]
}
Expand Down Expand Up @@ -4086,10 +4078,7 @@
"weak-randomness",
"pre-declared-local-variable-usage",
"delete-nested-mapping",
<<<<<<< HEAD
"incorrect-modifier"
=======
"incorrect-modifier",
"contract-locks-ether"
>>>>>>> dev
]
}
62 changes: 18 additions & 44 deletions reports/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,14 @@ This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a stati
- [H-25: RTLO character detected in file. \u{202e}](#h-25-rtlo-character-detected-in-file-u202e)
- [H-26: Return value of the function call is not checked.](#h-26-return-value-of-the-function-call-is-not-checked)
- [H-27: Dangerous unary operator found in assignment.](#h-27-dangerous-unary-operator-found-in-assignment)
<<<<<<< HEAD
- [H-28: Dangerous strict equality checks on contract balances.](#h-28-dangerous-strict-equality-checks-on-contract-balances)
- [H-29: Compiler Bug: Signed array in storage detected for compiler version `<0.5.10`](#h-29-compiler-bug-signed-array-in-storage-detected-for-compiler-version-0510)
- [H-30: Weak Randomness](#h-30-weak-randomness)
- [H-31: Usage of variable before declaration.](#h-31-usage-of-variable-before-declaration)
- [H-32: Deletion from a nested mappping.](#h-32-deletion-from-a-nested-mappping)
- [H-33: Incorrect Modifier](#h-33-incorrect-modifier)
=======
- [H-28: Tautology or Contradiction in comparison.](#h-28-tautology-or-contradiction-in-comparison)
- [H-29: Dangerous strict equality checks on contract balances.](#h-29-dangerous-strict-equality-checks-on-contract-balances)
- [H-30: Compiler Bug: Signed array in storage detected for compiler version `<0.5.10`](#h-30-compiler-bug-signed-array-in-storage-detected-for-compiler-version-0510)
- [H-31: Weak Randomness](#h-31-weak-randomness)
- [H-32: Usage of variable before declaration.](#h-32-usage-of-variable-before-declaration)
- [H-33: Deletion from a nested mappping.](#h-33-deletion-from-a-nested-mappping)
- [H-34: Contract locks Ether without a withdraw function.](#h-34-contract-locks-ether-without-a-withdraw-function)
>>>>>>> dev
- [H-34: Incorrect Modifier](#h-34-incorrect-modifier)
- [H-35: Contract locks Ether without a withdraw function.](#h-35-contract-locks-ether-without-a-withdraw-function)
- [Low Issues](#low-issues)
- [L-1: Centralization Risk for trusted owners](#l-1-centralization-risk-for-trusted-owners)
- [L-2: Solmate's SafeTransferLib does not check for token contract's existence](#l-2-solmates-safetransferlib-does-not-check-for-token-contracts-existence)
Expand Down Expand Up @@ -85,13 +77,8 @@ This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a stati

| Key | Value |
| --- | --- |
<<<<<<< HEAD
| .sol Files | 74 |
| Total nSLOC | 2072 |
=======
| .sol Files | 75 |
| Total nSLOC | 2128 |
>>>>>>> dev
| .sol Files | 76 |
| Total nSLOC | 2204 |


## Files Details
Expand Down Expand Up @@ -174,22 +161,14 @@ This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a stati
| src/reused_contract_name/ContractB.sol | 7 |
| src/uniswap/UniswapV2Swapper.sol | 50 |
| src/uniswap/UniswapV3Swapper.sol | 150 |
<<<<<<< HEAD
| **Total** | **2072** |
=======
| **Total** | **2128** |
>>>>>>> dev
| **Total** | **2204** |


## Issue Summary

| Category | No. of Issues |
| --- | --- |
<<<<<<< HEAD
| High | 33 |
=======
| High | 34 |
>>>>>>> dev
| High | 35 |
| Low | 25 |


Expand Down Expand Up @@ -1862,8 +1841,7 @@ A deletion in a structure containing a mapping will not delete the mapping. The



<<<<<<< HEAD
## H-33: Incorrect Modifier
## H-34: Incorrect Modifier

A modifier must contain a placeholder statement `_` and a `revert` or a `require` condition.

Expand Down Expand Up @@ -1892,8 +1870,13 @@ A modifier must contain a placeholder statement `_` and a `revert` or a `require

```solidity
modifier onlyOnce() {
=======
## H-34: Contract locks Ether without a withdraw function.
```

</details>



## H-35: Contract locks Ether without a withdraw function.

It appears that the contract includes a payable function to accept Ether but lacks a corresponding function to withdraw it, which leads to the Ether being locked in the contract. To resolve this issue, please implement a public or external function that allows for the withdrawal of Ether from the contract.

Expand Down Expand Up @@ -1928,7 +1911,6 @@ It appears that the contract includes a payable function to accept Ether but lac

```solidity
contract DepositContract is IDepositContract, ERC165 {
>>>>>>> dev
```

</details>
Expand Down Expand Up @@ -2108,11 +2090,7 @@ Openzeppelin has deprecated several functions and replaced with newer versions.

ERC20 functions may not behave as expected. For example: return values are not always meaningful. It is recommended to use OpenZeppelin's SafeERC20 library.

<<<<<<< HEAD
<details><summary>13 Found Instances</summary>
=======
<details><summary>12 Found Instances</summary>
>>>>>>> dev
<details><summary>14 Found Instances</summary>


- Found in src/ArbitraryTransferFrom.sol [Line: 16](../tests/contract-playground/src/ArbitraryTransferFrom.sol#L16)
Expand Down Expand Up @@ -2207,11 +2185,7 @@ ERC20 functions may not behave as expected. For example: return values are not a

Consider using a specific version of Solidity in your contracts instead of a wide version. For example, instead of `pragma solidity ^0.8.0;`, use `pragma solidity 0.8.0;`

<<<<<<< HEAD
<details><summary>20 Found Instances</summary>
=======
<details><summary>21 Found Instances</summary>
>>>>>>> dev
<details><summary>22 Found Instances</summary>


- Found in src/CompilerBugStorageSignedIntegerArray.sol [Line: 2](../tests/contract-playground/src/CompilerBugStorageSignedIntegerArray.sol#L2)
Expand Down Expand Up @@ -3121,7 +3095,7 @@ Using `ERC721::_mint()` can mint ERC721 tokens to addresses which don't support

Solc compiler version 0.8.20 switches the default target EVM version to Shanghai, which means that the generated bytecode will include PUSH0 opcodes. Be sure to select the appropriate EVM version in case you intend to deploy on a chain other than mainnet like L2 chains that may not support PUSH0, otherwise deployment of your contracts will fail.

<details><summary>29 Found Instances</summary>
<details><summary>30 Found Instances</summary>


- Found in src/AdminContract.sol [Line: 2](../tests/contract-playground/src/AdminContract.sol#L2)
Expand Down Expand Up @@ -3401,7 +3375,7 @@ Solc compiler version 0.8.20 switches the default target EVM version to Shanghai

Consider removing empty blocks.

<details><summary>27 Found Instances</summary>
<details><summary>28 Found Instances</summary>


- Found in src/AdminContract.sol [Line: 14](../tests/contract-playground/src/AdminContract.sol#L14)
Expand Down
81 changes: 48 additions & 33 deletions reports/report.sarif
Original file line number Diff line number Diff line change
Expand Up @@ -2694,70 +2694,92 @@
{
"physicalLocation": {
"artifactLocation": {
<<<<<<< HEAD
"uri": "src/IncorrectModifier.sol"
},
"region": {
"byteLength": 9,
"byteOffset": 856
=======
"uri": "src/ContractLocksEther.sol"
},
"region": {
"byteLength": 10,
"byteOffset": 73
>>>>>>> dev
}
}
},
{
"physicalLocation": {
"artifactLocation": {
<<<<<<< HEAD
"uri": "src/IncorrectModifier.sol"
},
"region": {
"byteLength": 13,
"byteOffset": 1156
=======
"uri": "src/ContractLocksEther.sol"
},
"region": {
"byteLength": 11,
"byteOffset": 822
>>>>>>> dev
}
}
},
{
"physicalLocation": {
"artifactLocation": {
<<<<<<< HEAD
"uri": "src/IncorrectModifier.sol"
},
"region": {
"byteLength": 14,
"byteOffset": 1387
=======
"uri": "src/EmptyBlocks.sol"
},
"region": {
"byteLength": 39,
"byteOffset": 344
>>>>>>> dev
}
}
},
{
"physicalLocation": {
"artifactLocation": {
<<<<<<< HEAD
"uri": "src/OnceModifierExample.sol"
},
"region": {
"byteLength": 8,
"byteOffset": 103
=======
}
}
}
],
"message": {
"text": "A modifier must contain a placeholder statement `_` and a `revert` or a `require` condition."
},
"ruleId": "incorrect-modifier"
},
{
"level": "warning",
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/ContractLocksEther.sol"
},
"region": {
"byteLength": 10,
"byteOffset": 73
}
}
},
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/ContractLocksEther.sol"
},
"region": {
"byteLength": 11,
"byteOffset": 822
}
}
},
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/EmptyBlocks.sol"
},
"region": {
"byteLength": 39,
"byteOffset": 344
}
}
},
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/EmptyBlocks.sol"
},
"region": {
Expand All @@ -2774,21 +2796,14 @@
"region": {
"byteLength": 15,
"byteOffset": 4547
>>>>>>> dev
}
}
}
],
"message": {
<<<<<<< HEAD
"text": "A modifier must contain a placeholder statement `_` and a `revert` or a `require` condition."
},
"ruleId": "incorrect-modifier"
=======
"text": "It appears that the contract includes a payable function to accept Ether but lacks a corresponding function to withdraw it, which leads to the Ether being locked in the contract. To resolve this issue, please implement a public or external function that allows for the withdrawal of Ether from the contract."
},
"ruleId": "contract-locks-ether"
>>>>>>> dev
},
{
"level": "note",
Expand Down
Loading

0 comments on commit cf5a8ed

Please sign in to comment.