Skip to content

Commit

Permalink
Merge pull request #1848 from DarrenChangJR/dev
Browse files Browse the repository at this point in the history
Bug Fix: Contract obj is_fully_implemented
  • Loading branch information
montyly authored Apr 25, 2023
2 parents 6600f75 + b60eb9e commit 4149f60
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
3 changes: 1 addition & 2 deletions slither/solc_parsing/declarations/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,9 @@ def _parse_contract_info(self) -> None:
elif attributes["contractKind"] == "library":
self._contract.is_library = True
self._contract.contract_kind = attributes["contractKind"]
self._contract.is_fully_implemented = attributes["fullyImplemented"]

self._contract.is_fully_implemented = attributes["fullyImplemented"]
self._linearized_base_contracts = attributes["linearizedBaseContracts"]
# self._contract.fullyImplemented = attributes["fullyImplemented"]

# Parse base contract information
self._parse_base_contract_info()
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/core/test_contract_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ def test_abstract_contract(solc_binary_path) -> None:
assert not slither.contracts[0].is_fully_implemented


def test_concrete_contract(solc_binary_path) -> None:
solc_path = solc_binary_path("0.8.0")
slither = Slither(Path(CONTRACT_DECL_TEST_ROOT, "concrete.sol").as_posix(), solc=solc_path)
assert slither.contracts[0].is_fully_implemented

solc_path = solc_binary_path("0.5.0")
slither = Slither(
Path(CONTRACT_DECL_TEST_ROOT, "concrete_old.sol").as_posix(),
solc_force_legacy_json=True,
solc=solc_path,
)
assert slither.contracts[0].is_fully_implemented


def test_private_variable(solc_binary_path) -> None:
solc_path = solc_binary_path("0.8.15")
slither = Slither(
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/core/test_data/contract_declaration/concrete.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity ^0.8.0;

contract Concrete {
uint256 public value;

function setValue(uint256 newValue) public {
value = newValue;
}
}
13 changes: 13 additions & 0 deletions tests/unit/core/test_data/contract_declaration/concrete_old.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pragma solidity ^0.5.0;

contract ConcreteOld {
uint256 public myNumber;

constructor(uint256 initialNumber) public {
myNumber = initialNumber;
}

function setNumber(uint256 newNumber) public {
myNumber = newNumber;
}
}

0 comments on commit 4149f60

Please sign in to comment.