diff --git a/newsfragments/1963.feature.rst b/newsfragments/1963.feature.rst new file mode 100644 index 0000000000..a13663866a --- /dev/null +++ b/newsfragments/1963.feature.rst @@ -0,0 +1 @@ +Add ``parity.trace_transaction``, deprecate ``parity.traceTransaction`` diff --git a/tests/integration/parity/common.py b/tests/integration/parity/common.py index dfa5b08112..ddf868c028 100644 --- a/tests/integration/parity/common.py +++ b/tests/integration/parity/common.py @@ -168,6 +168,10 @@ def test_trace_block(self, web3): def test_trace_transaction(self, web3): super().test_trace_transaction(web3) + @pytest.mark.xfail(reason="TODO: tracing not working on v2.5.13") + def test_traceTransaction_deprecated(self, web3): + super().test_traceTransaction_deprecated(web3) + @pytest.mark.xfail(reason="TODO: tracing not working on v2.5.13") def test_trace_filter(self, web3): super().test_trace_filter(web3) diff --git a/web3/_utils/module_testing/parity_module.py b/web3/_utils/module_testing/parity_module.py index 249b910e54..df12848fdc 100644 --- a/web3/_utils/module_testing/parity_module.py +++ b/web3/_utils/module_testing/parity_module.py @@ -75,7 +75,13 @@ def test_trace_block(self, web3: "Web3", block_with_txn: BlockData) -> None: assert trace[0]['blockNumber'] == block_with_txn['number'] def test_trace_transaction(self, web3: "Web3", parity_fixture_data: Dict[str, str]) -> None: - trace = web3.parity.traceTransaction(HexStr(parity_fixture_data['mined_txn_hash'])) + trace = web3.parity.trace_transaction(HexStr(parity_fixture_data['mined_txn_hash'])) + assert trace[0]['action']['from'] == add_0x_prefix(HexStr(parity_fixture_data['coinbase'])) + + def test_traceTransaction_deprecated(self, web3: "Web3", parity_fixture_data: Dict[str, str]) -> None: + with pytest.warns(DeprecationWarning, + match="traceTransaction is deprecated in favor of trace_transaction"): + trace = web3.parity.traceTransaction(HexStr(parity_fixture_data['mined_txn_hash'])) assert trace[0]['action']['from'] == add_0x_prefix(HexStr(parity_fixture_data['coinbase'])) def test_trace_call( diff --git a/web3/parity.py b/web3/parity.py index e75416bc88..5f10c3ba57 100644 --- a/web3/parity.py +++ b/web3/parity.py @@ -174,7 +174,7 @@ def trace_replay_transaction_munger( mungers=[default_root_munger], ) - traceTransaction: Method[Callable[[_Hash32], List[ParityFilterTrace]]] = Method( + trace_transaction: Method[Callable[[_Hash32], List[ParityFilterTrace]]] = Method( RPC.trace_transaction, mungers=[default_root_munger], ) @@ -224,3 +224,4 @@ def trace_transactions_munger( traceReplayTransaction = DeprecatedMethod(trace_replay_transaction, 'traceReplayTransaction', 'trace_replay_transaction') netPeers = DeprecatedMethod(net_peers, 'netPeers', 'net_peers') + traceTransaction = DeprecatedMethod(trace_transaction, 'traceTransaction', 'trace_transaction')