diff --git a/slither/visitors/slithir/expression_to_slithir.py b/slither/visitors/slithir/expression_to_slithir.py index 67f591c9f..f4346f81d 100644 --- a/slither/visitors/slithir/expression_to_slithir.py +++ b/slither/visitors/slithir/expression_to_slithir.py @@ -406,8 +406,10 @@ def _post_call_expression(self, expression: CallExpression) -> None: self._result.append(var) set_val(expression, val) - elif (called.name == "sload(uint256)" or called.name == "sstore(uint256,uint256)") and ( - len(args) > 0 and isinstance(args[0], StateVariable) + elif ( + called.name in ["sload(uint256)", "sstore(uint256,uint256)"] + and len(args) > 0 + and isinstance(args[0], StateVariable) ): # parse_yul._parse_yul_magic_suffixes does a best effort tentative to retrieve # the right state variable on .slot access diff --git a/tests/unit/slithir/test_yul_parser_assembly_slot.py b/tests/unit/slithir/test_yul_parser_assembly_slot.py index 56f6a5c6d..593b65a5d 100644 --- a/tests/unit/slithir/test_yul_parser_assembly_slot.py +++ b/tests/unit/slithir/test_yul_parser_assembly_slot.py @@ -40,10 +40,7 @@ def test_yul_parser_assembly_slot(solc_binary_path) -> None: assert isinstance(value.value, LocalVariable) -def test_yul_parser_assembly_slot(solc_binary_path) -> None: - # mstore(0x0, bucketId) - # mstore(0x20, _counters.slot) - data = {"0x0": "bucketId", "0x20": "_counters"} +def test_yul_parser_sstore_sload(solc_binary_path) -> None: solc_path = solc_binary_path("0.8.18") slither = Slither(Path(TEST_DATA_DIR, "assembly_sstore_sload.sol").as_posix(), solc=solc_path)