diff --git a/newsfragments/2697.breaking.rst b/newsfragments/2697.breaking.rst new file mode 100644 index 0000000000..782e6a1de0 --- /dev/null +++ b/newsfragments/2697.breaking.rst @@ -0,0 +1 @@ +Remove ``SolidityError`` in favor of ``ContractLogicError`` diff --git a/tests/core/utilities/test_method_formatters.py b/tests/core/utilities/test_method_formatters.py index e2dd6423dc..7ea74b7700 100644 --- a/tests/core/utilities/test_method_formatters.py +++ b/tests/core/utilities/test_method_formatters.py @@ -2,7 +2,7 @@ from web3._utils.method_formatters import ( get_error_formatters, - raise_solidity_error_on_revert, + raise_contract_logic_error_on_revert, ) from web3._utils.rpc_abi import ( RPC, @@ -109,11 +109,11 @@ ) def test_get_revert_reason(response, expected) -> None: with pytest.raises(ContractLogicError, match=expected): - raise_solidity_error_on_revert(response) + raise_contract_logic_error_on_revert(response) def test_get_revert_reason_other_error() -> None: - assert raise_solidity_error_on_revert(OTHER_ERROR) is OTHER_ERROR + assert raise_contract_logic_error_on_revert(OTHER_ERROR) is OTHER_ERROR def test_get_error_formatters() -> None: diff --git a/web3/_utils/method_formatters.py b/web3/_utils/method_formatters.py index 251465281c..9ade35e6e7 100644 --- a/web3/_utils/method_formatters.py +++ b/web3/_utils/method_formatters.py @@ -585,7 +585,7 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]: } -def raise_solidity_error_on_revert(response: RPCResponse) -> RPCResponse: +def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse: """ Reverts contain a `data` attribute with the following layout: "Reverted " @@ -649,8 +649,8 @@ def raise_invalid_parity_mode(response: RPCResponse) -> NoReturn: ERROR_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = { - RPC.eth_estimateGas: raise_solidity_error_on_revert, - RPC.eth_call: raise_solidity_error_on_revert, + RPC.eth_estimateGas: raise_contract_logic_error_on_revert, + RPC.eth_call: raise_contract_logic_error_on_revert, RPC.parity_setMode: raise_invalid_parity_mode, } diff --git a/web3/exceptions.py b/web3/exceptions.py index ea1db8074d..8f4daab8ee 100644 --- a/web3/exceptions.py +++ b/web3/exceptions.py @@ -242,20 +242,11 @@ class InvalidEventABI(ValueError): pass -class SolidityError(ValueError): +class ContractLogicError(ValueError): # Inherits from ValueError for backwards compatibility """ Raised on a contract revert error """ - pass - - -class ContractLogicError(SolidityError, ValueError): - # Inherits from ValueError for backwards compatibility - # TODO: Remove SolidityError inheritance in v6 - """ - Raised on a contract revert error - """ class OffchainLookup(ContractLogicError):