Skip to content

Conversation

@farukk77
Copy link

Summary

I have addressed the critical "Silent Failure" and ambiguity issues highlighted in the discussion of #1824 (specifically the distinction between Scenario A, B, and C).

The previous manual parsing logic was fragile because it treated "valid empty strings" and "corrupted/truncated bytes" exactly the same (returning "").

Changes

  1. Dependency: Added eth-abi>=4.0.0 to requirements.txt.
  2. Logic: Refactored decode_eth_response in src/inputs/plugins/ethereum_governance.py to use eth_abi.decode instead of manual slicing.

How it handles the Scenarios (Fixing the Ambiguity)

Unlike the manual slicing approach, this implementation strictly validates the input:

  • Scenario A (Valid Empty): Explicitly checks for "0x" and returns an empty string as a valid result.
  • Scenario B (Network Error): Checks if the response is None (RPC failure) and logs a specific error, distinguishing it from an empty rule.
  • Scenario C (Corrupted Data): Unlike manual slicing which silently fails on truncated data, eth_abi.decode raises a DecodingError. I catch and log this error specifically to aid debugging.

This ensures the system is robust against data format changes and provides clear logs for debugging silent failures.

@farukk77 farukk77 requested review from a team as code owners January 31, 2026 10:53
@github-actions github-actions bot added dependencies Pull requests that update a dependency file robotics Robotics code changes python Python code labels Jan 31, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
3 3 0 0
View the top 3 failed test(s) by shortest run time
tests/inputs/base/test_governance_ethereum.py::tests.inputs.base.test_governance_ethereum
Stack Traces | 0s run time
.venv/lib/python3.10.../site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
.venv/lib/python3.10.../site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
.../hostedtoolcache/Python/3.10.19.../x64/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
.venv/lib/python3.10.../_pytest/assertion/rewrite.py:184: in exec_module
    exec(co, module.__dict__)
.../inputs/base/test_governance_ethereum.py:7: in <module>
    from inputs.plugins.ethereum_governance import GovernanceEthereum
E     File ".../inputs/plugins/ethereum_governance.py", line 12
E       def decode_eth_response(self, hex_response: Optional[str]) -> str:
E   IndentationError: unexpected indent
tests/inputs/base/test_inputs_plugins.py::tests.inputs.base.test_inputs_plugins
Stack Traces | 0s run time
.venv/lib/python3.10.../site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
.venv/lib/python3.10.../site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
.../hostedtoolcache/Python/3.10.19....../x64/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
.venv/lib/python3.10.../_pytest/assertion/rewrite.py:184: in exec_module
    exec(co, module.__dict__)
.../inputs/base/test_inputs_plugins.py:35: in <module>
    @pytest.mark.parametrize("input_class", get_all_inputs_classes())
.../inputs/base/test_inputs_plugins.py:20: in get_all_inputs_classes
    module = importlib.import_module(f"inputs.plugins.{plugin}")
.../hostedtoolcache/Python/3.10.19....../x64/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:879: in exec_module
    ???
<frozen importlib._bootstrap_external>:1017: in get_code
    ???
<frozen importlib._bootstrap_external>:947: in source_to_code
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
E     File ".../inputs/plugins/ethereum_governance.py", line 12
E       def decode_eth_response(self, hex_response: Optional[str]) -> str:
E   IndentationError: unexpected indent
tests/inputs/plugins/test_ethereum_governance.py::tests.inputs.plugins.test_ethereum_governance
Stack Traces | 0s run time
.venv/lib/python3.10.../site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
.venv/lib/python3.10.../site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
.../hostedtoolcache/Python/3.10.19.../x64/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
.venv/lib/python3.10.../_pytest/assertion/rewrite.py:184: in exec_module
    exec(co, module.__dict__)
.../inputs/plugins/test_ethereum_governance.py:8: in <module>
    from inputs.plugins.ethereum_governance import GovernanceEthereum, Message
E     File ".../inputs/plugins/ethereum_governance.py", line 12
E       def decode_eth_response(self, hex_response: Optional[str]) -> str:
E   IndentationError: unexpected indent

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Python code robotics Robotics code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants