Skip to content

Commit

Permalink
add trace_transaction, deprecate traceTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Apr 26, 2021
1 parent 32cc2c6 commit 02f0bed
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/1963.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``parity.trace_transaction``, deprecate ``parity.traceTransaction``
4 changes: 4 additions & 0 deletions tests/integration/parity/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion web3/_utils/module_testing/parity_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion web3/parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
)
Expand Down Expand Up @@ -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')

0 comments on commit 02f0bed

Please sign in to comment.