Skip to content

Commit

Permalink
Merge pull request #1051 from jknap/jknap/add-parity-trace-filter
Browse files Browse the repository at this point in the history
Add support for parity trace_filter calls
  • Loading branch information
carver authored Sep 10, 2018
2 parents e066452 + 315adc9 commit b3c0c16
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ services:
sandbox:
build:
context: .
environment:
PARITY_VERSION: v1.11.7
volumes:
- .:/code
command: tail -f /dev/null
3 changes: 3 additions & 0 deletions tests/integration/parity/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,6 @@ def test_trace_call(self, web3, math_contract, math_contract_address):

def test_eth_call_with_0_result(self, web3, math_contract, math_contract_address):
super().test_eth_call_with_0_result(web3, math_contract, math_contract_address)

def test_trace_filter(self, web3, txn_filter_params, parity_fixture_data):
super().test_trace_filter(web3, txn_filter_params, parity_fixture_data)
9 changes: 9 additions & 0 deletions tests/integration/parity/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,12 @@ def block_with_txn_with_log(web3, parity_fixture_data):
@pytest.fixture(scope="module")
def txn_hash_with_log(parity_fixture_data):
return parity_fixture_data['txn_hash_with_log']


@pytest.fixture(scope="module")
def txn_filter_params(coinbase):
return {
"fromBlock": "earliest",
"toBlock": "latest",
"fromAddress": [coinbase],
}
6 changes: 6 additions & 0 deletions web3/parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def traceBlock(self, block_identifier):
[block_identifier]
)

def traceFilter(self, params):
return self.web3.manager.request_blocking(
"trace_filter",
[params]
)

def traceTransaction(self, transaction_hash):
return self.web3.manager.request_blocking(
"trace_transaction",
Expand Down
5 changes: 5 additions & 0 deletions web3/utils/module_testing/parity_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ def test_trace_raw_transaction(self,
assert trace['stateDiff'] is None
assert trace['vmTrace'] is None
assert trace['trace'][0]['action']['from'] == funded_account_for_raw_txn.lower()

def test_trace_filter(self, web3, txn_filter_params, parity_fixture_data):
trace = web3.parity.traceFilter(txn_filter_params)
assert isinstance(trace, list)
assert trace[0]['action']['from'] == add_0x_prefix(parity_fixture_data['coinbase'])

0 comments on commit b3c0c16

Please sign in to comment.