Skip to content

Commit

Permalink
snakecase traceReplayTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
tmckenzie51 committed Apr 23, 2021
1 parent bd6d24c commit c688e2a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/1949.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add trace_replay_transaction deprecate traceReplayTransaction
15 changes: 14 additions & 1 deletion web3/_utils/module_testing/parity_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,24 @@


class ParityTraceModuleTest:
def test_traceReplayTransaction_deprecated(
self, web3: "Web3", parity_fixture_data: Dict[str, str],
) -> None:
with pytest.warns(DeprecationWarning,
match='traceReplayTransaction is deprecated in favor of '
'trace_replay_transaction'):
trace = web3.parity.traceReplayTransaction(
HexStr(parity_fixture_data['mined_txn_hash']))
assert trace['stateDiff'] is None
assert trace['vmTrace'] is None
assert trace['trace'][0]['action']['from'] == add_0x_prefix(
HexStr(parity_fixture_data['coinbase']),
)

def test_trace_replay_transaction(
self, web3: "Web3", parity_fixture_data: Dict[str, str],
) -> None:
trace = web3.parity.traceReplayTransaction(HexStr(parity_fixture_data['mined_txn_hash']))
trace = web3.parity.trace_replay_transaction(HexStr(parity_fixture_data['mined_txn_hash']))

assert trace['stateDiff'] is None
assert trace['vmTrace'] is None
Expand Down
7 changes: 6 additions & 1 deletion web3/parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
RPC,
)
from web3.method import (
DeprecatedMethod,
Method,
default_root_munger,
)
Expand Down Expand Up @@ -153,7 +154,7 @@ def trace_replay_transaction_munger(
) -> Tuple[Union[BlockIdentifier, _Hash32], ParityTraceMode]:
return (block_identifier, mode)

traceReplayTransaction: Method[Callable[..., ParityBlockTrace]] = Method(
trace_replay_transaction: Method[Callable[..., ParityBlockTrace]] = Method(
RPC.trace_replayTransaction,
mungers=[trace_replay_transaction_munger],
)
Expand Down Expand Up @@ -218,3 +219,7 @@ def trace_transactions_munger(
RPC.parity_mode,
mungers=None
)

# Deprecated Methods
traceReplayTransaction = DeprecatedMethod(trace_replay_transaction, 'traceReplayTransaction',
'trace_replay_transaction')

0 comments on commit c688e2a

Please sign in to comment.