-
Notifications
You must be signed in to change notification settings - Fork 974
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into fix/ir-assignment-2266
- Loading branch information
Showing
29 changed files
with
214 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Foundry | ||
|
||
To init this test case, run `forge install --no-commit --no-git foundry-rs/forge-std` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[profile.default] | ||
src = "src" | ||
out = "out" | ||
libs = ["lib"] | ||
|
||
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options |
16 changes: 16 additions & 0 deletions
16
tests/e2e/compilation/test_data/test_change/src/Counter.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
contract Counter { | ||
uint256 public number; | ||
|
||
function setNumber(uint256 newNumber) public { | ||
number = newNumber; | ||
} | ||
|
||
//START | ||
function increment() public { | ||
number++; | ||
} | ||
//END | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pathlib import Path | ||
import shutil | ||
import re | ||
|
||
import pytest | ||
|
||
from slither import Slither | ||
from slither.exceptions import SlitherException | ||
|
||
|
||
TEST_DATA_DIR = Path(__file__).resolve().parent / "test_data" | ||
|
||
foundry_available = shutil.which("forge") is not None | ||
project_ready = Path(TEST_DATA_DIR, "test_change/lib/forge-std").exists() | ||
|
||
|
||
@pytest.mark.skipif( | ||
not foundry_available or not project_ready, reason="requires Foundry and project setup" | ||
) | ||
def test_diagnostic(): | ||
|
||
test_file_directory = TEST_DATA_DIR / "test_change" | ||
|
||
sl = Slither(test_file_directory.as_posix()) | ||
assert len(sl.compilation_units) == 1 | ||
|
||
counter_file = test_file_directory / "src" / "Counter.sol" | ||
shutil.copy(counter_file, counter_file.with_suffix(".bak")) | ||
|
||
with counter_file.open("r") as file: | ||
content = file.read() | ||
|
||
with counter_file.open("w") as file: | ||
file.write(re.sub(r"//START.*?//END\n?", "", content, flags=re.DOTALL)) | ||
|
||
with pytest.raises(SlitherException): | ||
Slither(test_file_directory.as_posix(), ignore_compile=True) | ||
|
||
# Restore the original counter so the test is idempotent | ||
Path(counter_file.with_suffix(".bak")).rename(counter_file) |
4 changes: 2 additions & 2 deletions
4
...2e/detectors/snapshots/detectors__detector_ConstantPragma_0_4_25_pragma_0_4_25_sol__0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
2 different versions of Solidity are used: | ||
- Version constraint ^0.4.25 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.4.25/pragma.0.4.25.sol#1 | ||
-^0.4.25 (tests/e2e/detectors/test_data/pragma/0.4.25/pragma.0.4.25.sol#1) | ||
- Version constraint ^0.4.24 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.4.25/pragma.0.4.24.sol#1 | ||
-^0.4.24 (tests/e2e/detectors/test_data/pragma/0.4.25/pragma.0.4.24.sol#1) | ||
|
4 changes: 2 additions & 2 deletions
4
...2e/detectors/snapshots/detectors__detector_ConstantPragma_0_5_16_pragma_0_5_16_sol__0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
2 different versions of Solidity are used: | ||
- Version constraint ^0.5.16 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.5.16/pragma.0.5.16.sol#1 | ||
-^0.5.16 (tests/e2e/detectors/test_data/pragma/0.5.16/pragma.0.5.16.sol#1) | ||
- Version constraint ^0.5.15 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.5.16/pragma.0.5.15.sol#1 | ||
-^0.5.15 (tests/e2e/detectors/test_data/pragma/0.5.16/pragma.0.5.15.sol#1) | ||
|
4 changes: 2 additions & 2 deletions
4
...2e/detectors/snapshots/detectors__detector_ConstantPragma_0_6_11_pragma_0_6_11_sol__0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
2 different versions of Solidity are used: | ||
- Version constraint ^0.6.11 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.6.11/pragma.0.6.11.sol#1 | ||
-^0.6.11 (tests/e2e/detectors/test_data/pragma/0.6.11/pragma.0.6.11.sol#1) | ||
- Version constraint ^0.6.10 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.6.11/pragma.0.6.10.sol#1 | ||
-^0.6.10 (tests/e2e/detectors/test_data/pragma/0.6.11/pragma.0.6.10.sol#1) | ||
|
4 changes: 2 additions & 2 deletions
4
.../e2e/detectors/snapshots/detectors__detector_ConstantPragma_0_7_6_pragma_0_7_6_sol__0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
2 different versions of Solidity are used: | ||
- Version constraint ^0.7.6 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.7.6/pragma.0.7.6.sol#1 | ||
-^0.7.6 (tests/e2e/detectors/test_data/pragma/0.7.6/pragma.0.7.6.sol#1) | ||
- Version constraint ^0.7.5 is used by: | ||
- tests/e2e/detectors/test_data/pragma/0.7.6/pragma.0.7.5.sol#1 | ||
-^0.7.5 (tests/e2e/detectors/test_data/pragma/0.7.6/pragma.0.7.5.sol#1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.