Skip to content

Commit 965639c

Browse files
committed
Add trace_call, deprecate traceCall
1 parent 32cc2c6 commit 965639c

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

newsfragments/1957.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``parity.trace_call``, deprecate ``parity.traceCall``

web3/_utils/module_testing/parity_module.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ def test_trace_transaction(self, web3: "Web3", parity_fixture_data: Dict[str, st
7878
trace = web3.parity.traceTransaction(HexStr(parity_fixture_data['mined_txn_hash']))
7979
assert trace[0]['action']['from'] == add_0x_prefix(HexStr(parity_fixture_data['coinbase']))
8080

81+
def test_traceCall_deprecated(
82+
self, web3: "Web3", math_contract: "Contract", math_contract_address: ChecksumAddress
83+
) -> None:
84+
coinbase = web3.eth.coinbase
85+
txn_params = math_contract._prepare_transaction(
86+
fn_name='add',
87+
fn_args=(7, 11),
88+
transaction={'from': coinbase, 'to': math_contract_address},
89+
)
90+
with pytest.warns(DeprecationWarning,
91+
match="traceCall is deprecated in favor of trace_call"):
92+
trace = web3.parity.traceCall(txn_params)
93+
assert trace['stateDiff'] is None
94+
assert trace['vmTrace'] is None
95+
result = hex_to_integer(trace['output'])
96+
assert result == 18
97+
8198
def test_trace_call(
8299
self, web3: "Web3", math_contract: "Contract", math_contract_address: ChecksumAddress
83100
) -> None:
@@ -87,13 +104,13 @@ def test_trace_call(
87104
fn_args=(7, 11),
88105
transaction={'from': coinbase, 'to': math_contract_address},
89106
)
90-
trace = web3.parity.traceCall(txn_params)
107+
trace = web3.parity.trace_call(txn_params)
91108
assert trace['stateDiff'] is None
92109
assert trace['vmTrace'] is None
93110
result = hex_to_integer(trace['output'])
94111
assert result == 18
95112

96-
def test_eth_call_with_0_result(
113+
def test_trace_call_with_0_result(
97114
self, web3: "Web3", math_contract: "Contract", math_contract_address: ChecksumAddress
98115
) -> None:
99116
coinbase = web3.eth.coinbase
@@ -102,7 +119,7 @@ def test_eth_call_with_0_result(
102119
fn_args=(0, 0),
103120
transaction={'from': coinbase, 'to': math_contract_address},
104121
)
105-
trace = web3.parity.traceCall(txn_params)
122+
trace = web3.parity.trace_call(txn_params)
106123
assert trace['stateDiff'] is None
107124
assert trace['vmTrace'] is None
108125
result = hex_to_integer(trace['output'])

web3/parity.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def trace_call_munger(
195195

196196
return (transaction, mode, block_identifier)
197197

198-
traceCall: Method[Callable[..., ParityBlockTrace]] = Method(
198+
trace_call: Method[Callable[..., ParityBlockTrace]] = Method(
199199
RPC.trace_call,
200200
mungers=[trace_call_munger],
201201
)
@@ -224,3 +224,4 @@ def trace_transactions_munger(
224224
traceReplayTransaction = DeprecatedMethod(trace_replay_transaction, 'traceReplayTransaction',
225225
'trace_replay_transaction')
226226
netPeers = DeprecatedMethod(net_peers, 'netPeers', 'net_peers')
227+
traceCall = DeprecatedMethod(trace_call, 'traceCall', 'trace_call')

0 commit comments

Comments
 (0)