Merge pull request #1848 from DarrenChangJR/dev

Bug Fix: Contract obj is_fully_implemented
pull/1868/head
Feist Josselin 2 years ago committed by GitHub
commit 4149f60341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      slither/solc_parsing/declarations/contract.py
  2. 14
      tests/unit/core/test_contract_declaration.py
  3. 9
      tests/unit/core/test_data/contract_declaration/concrete.sol
  4. 13
      tests/unit/core/test_data/contract_declaration/concrete_old.sol

@ -170,10 +170,9 @@ class ContractSolc(CallerContextExpression):
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()

@ -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(

@ -0,0 +1,9 @@
pragma solidity ^0.8.0;
contract Concrete {
uint256 public value;
function setValue(uint256 newValue) public {
value = newValue;
}
}

@ -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;
}
}
Loading…
Cancel
Save