Skip to content

Commit

Permalink
Merge branch 'dev' into feature/cyfrinup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexroan authored Jun 4, 2024
2 parents 5dd1617 + d02513e commit 5dfcbd0
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 8 deletions.
1 change: 1 addition & 0 deletions aderyn_core/src/ast/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub enum FunctionKind {
Function,
Receive,
Fallback,
FreeFunction,
}

impl Display for FunctionKind {
Expand Down
3 changes: 3 additions & 0 deletions aderyn_core/src/ast/source_units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{collections::HashMap, io};
#[derive(Clone, Debug, Deserialize, Eq, Serialize, PartialEq, Hash)]
#[serde(untagged)]
pub enum SourceUnitNode {
FunctionDefinition(FunctionDefinition),
PragmaDirective(PragmaDirective),
ImportDirective(ImportDirective),
ContractDefinition(ContractDefinition),
Expand All @@ -33,6 +34,7 @@ impl SourceUnitNode {
SourceUnitNode::UserDefinedValueTypeDefinition(user_defined_value_type_definition) => {
Some(user_defined_value_type_definition.id)
}
SourceUnitNode::FunctionDefinition(function_defn) => Some(function_defn.id),
}
}
}
Expand All @@ -56,6 +58,7 @@ impl Node for SourceUnitNode {
SourceUnitNode::UserDefinedValueTypeDefinition(user_defined_value_type_definition) => {
user_defined_value_type_definition.accept(visitor)
}
SourceUnitNode::FunctionDefinition(function_defn) => function_defn.accept(visitor),
}
}
fn accept_id(&self, visitor: &mut impl ASTConstVisitor) -> Result<()> {
Expand Down
8 changes: 6 additions & 2 deletions reports/adhoc-sol-files-highs-only-report.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"files_summary": {
"total_source_units": 18,
"total_sloc": 206
"total_source_units": 19,
"total_sloc": 214
},
"files_details": {
"files_details": [
{
"file_path": "Counter.sol",
"n_sloc": 20
},
{
"file_path": "Helper.sol",
"n_sloc": 8
},
{
"file_path": "InconsistentUints.sol",
"n_sloc": 17
Expand Down
43 changes: 37 additions & 6 deletions reports/adhoc-sol-files-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a stati
- [L-10: Internal functions called only once can be inlined](#l-10-internal-functions-called-only-once-can-be-inlined)
- [L-11: Contract still has TODOs](#l-11-contract-still-has-todos)
- [L-12: Inconsistency in declaring uint256/uint (or) int256/int variables within a contract. Use explicit size declarations (uint256 or int256).](#l-12-inconsistency-in-declaring-uint256uint-or-int256int-variables-within-a-contract-use-explicit-size-declarations-uint256-or-int256)
- [L-13: Unused Custom Error](#l-13-unused-custom-error)


# Summary
Expand All @@ -30,15 +31,16 @@ This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a stati

| Key | Value |
| --- | --- |
| .sol Files | 18 |
| Total nSLOC | 206 |
| .sol Files | 19 |
| Total nSLOC | 214 |


## Files Details

| Filepath | nSLOC |
| --- | --- |
| Counter.sol | 20 |
| Helper.sol | 8 |
| InconsistentUints.sol | 17 |
| InternalFunctions.sol | 22 |
| OnceModifierExample.sol | 8 |
Expand All @@ -56,15 +58,15 @@ This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a stati
| multiple-versions/0.7/B.sol | 5 |
| multiple-versions/0.8/A.sol | 5 |
| multiple-versions/0.8/B.sol | 5 |
| **Total** | **206** |
| **Total** | **214** |


## Issue Summary

| Category | No. of Issues |
| --- | --- |
| High | 1 |
| Low | 12 |
| Low | 13 |


# High Issues
Expand Down Expand Up @@ -126,7 +128,7 @@ The `ecrecover` function is susceptible to signature malleability. This means th

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;`

<details><summary>14 Found Instances</summary>
<details><summary>15 Found Instances</summary>


- Found in Counter.sol [Line: 2](../tests/adhoc-sol-files/Counter.sol#L2)
Expand All @@ -135,6 +137,12 @@ Consider using a specific version of Solidity in your contracts instead of a wid
pragma solidity ^0.8.13;
```

- Found in Helper.sol [Line: 2](../tests/adhoc-sol-files/Helper.sol#L2)

```solidity
pragma solidity >=0.8.0;
```

- Found in InconsistentUints.sol [Line: 1](../tests/adhoc-sol-files/InconsistentUints.sol#L1)

```solidity
Expand Down Expand Up @@ -308,7 +316,7 @@ Index event fields make the field more quickly accessible to off-chain tools tha

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>8 Found Instances</summary>
<details><summary>9 Found Instances</summary>


- Found in Counter.sol [Line: 2](../tests/adhoc-sol-files/Counter.sol#L2)
Expand All @@ -317,6 +325,12 @@ Solc compiler version 0.8.20 switches the default target EVM version to Shanghai
pragma solidity ^0.8.13;
```

- Found in Helper.sol [Line: 2](../tests/adhoc-sol-files/Helper.sol#L2)

```solidity
pragma solidity >=0.8.0;
```

- Found in InconsistentUints.sol [Line: 1](../tests/adhoc-sol-files/InconsistentUints.sol#L1)

```solidity
Expand Down Expand Up @@ -496,3 +510,20 @@ Consider keeping the naming convention consistent in a given contract. Explicit



## L-13: Unused Custom Error

it is recommended that the definition be removed when custom error is unused

<details><summary>1 Found Instances</summary>


- Found in Helper.sol [Line: 8](../tests/adhoc-sol-files/Helper.sol#L8)

```solidity
error NotNice();
```

</details>



15 changes: 15 additions & 0 deletions tests/adhoc-sol-files/Helper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

function make() pure {
}

// Not used (should be captured)
error NotNice();

// Used in below function (should not be captured)
error OutsideError();

function iLiveOutsideContracts() {
revert OutsideError();
}

0 comments on commit 5dfcbd0

Please sign in to comment.