From 0827f8f5de03ceef2ee028332dcc7c0d92e37631 Mon Sep 17 00:00:00 2001 From: Tiffany McKenzie <25855566+tmckenzie51@users.noreply.github.com> Date: Mon, 26 Apr 2021 11:36:21 -0500 Subject: [PATCH 1/4] snakecase traceBlock --- web3/_utils/module_testing/parity_module.py | 8 +++++++- web3/parity.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/web3/_utils/module_testing/parity_module.py b/web3/_utils/module_testing/parity_module.py index 249b910e54..c012d18a2a 100644 --- a/web3/_utils/module_testing/parity_module.py +++ b/web3/_utils/module_testing/parity_module.py @@ -71,7 +71,13 @@ def test_trace_replay_block_without_transactions( assert len(trace) == 0 def test_trace_block(self, web3: "Web3", block_with_txn: BlockData) -> None: - trace = web3.parity.traceBlock(block_with_txn['number']) + trace = web3.parity.trace_block(block_with_txn['number']) + assert trace[0]['blockNumber'] == block_with_txn['number'] + + def test_traceBlock_deprecated(self, web3: "Web3", block_with_txn: BlockData) -> None: + with pytest.warns(DeprecationWarning, + match='traceBlock is deprecated in favor of trace_block'): + trace = web3.parity.traceBlock(block_with_txn['number']) assert trace[0]['blockNumber'] == block_with_txn['number'] def test_trace_transaction(self, web3: "Web3", parity_fixture_data: Dict[str, str]) -> None: diff --git a/web3/parity.py b/web3/parity.py index e75416bc88..bf3e61049f 100644 --- a/web3/parity.py +++ b/web3/parity.py @@ -164,7 +164,7 @@ def trace_replay_transaction_munger( mungers=[trace_replay_transaction_munger] ) - traceBlock: Method[Callable[[BlockIdentifier], List[ParityBlockTrace]]] = Method( + trace_block: Method[Callable[[BlockIdentifier], List[ParityBlockTrace]]] = Method( RPC.trace_block, 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') + traceBlock = DeprecatedMethod(trace_block, 'traceBlock', 'trace_block') From d281370b13680c7df5aeeaf5e915ced4fbbd035a Mon Sep 17 00:00:00 2001 From: Tiffany McKenzie <25855566+tmckenzie51@users.noreply.github.com> Date: Mon, 26 Apr 2021 11:51:22 -0500 Subject: [PATCH 2/4] add release note --- newsfragments/1961.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/1961.feature.rst diff --git a/newsfragments/1961.feature.rst b/newsfragments/1961.feature.rst new file mode 100644 index 0000000000..15ab5ab02f --- /dev/null +++ b/newsfragments/1961.feature.rst @@ -0,0 +1 @@ +Add trace_block, deprecate traceBlock From feb190e2b863dc8bbfdef8e80b1c502355474833 Mon Sep 17 00:00:00 2001 From: Tiffany McKenzie <25855566+tmckenzie51@users.noreply.github.com> Date: Mon, 26 Apr 2021 16:25:15 -0500 Subject: [PATCH 3/4] xfail deprecated test --- tests/integration/parity/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/parity/common.py b/tests/integration/parity/common.py index dfa5b08112..912e7ca7ef 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_traceBlock_deprecated(self, web3): + super().test_traceBlock_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) From c64725ef006fa3c23a1653418b2e10b4ad899251 Mon Sep 17 00:00:00 2001 From: Tiffany McKenzie <25855566+tmckenzie51@users.noreply.github.com> Date: Mon, 26 Apr 2021 17:09:57 -0500 Subject: [PATCH 4/4] lint --- tests/integration/parity/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/parity/common.py b/tests/integration/parity/common.py index c47a1e5872..ab2467cc9b 100644 --- a/tests/integration/parity/common.py +++ b/tests/integration/parity/common.py @@ -171,7 +171,7 @@ def test_trace_transaction(self, web3): @pytest.mark.xfail(reason="TODO: tracing not working on v2.5.13") def test_traceBlock_deprecated(self, web3): super().test_traceBlock_deprecated(web3) - + @pytest.mark.xfail(reason="TODO: tracing not working on v2.5.13") def test_traceFilter_deprecated(self, web3): super().test_traceFilter_deprecated(web3)