Skip to content

Add test to verify client consistency with None topic args #985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/integration/parity/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def test_eth_getTransactionReceipt_unmined(self, web3, unlocked_account):
assert receipt is not None
assert receipt['blockHash'] is None

def test_eth_getLogs_with_logs_none_topic_args(self, web3):
pytest.xfail("Parity matches None to asbent values")
super().test_eth_getLogs_with_logs_none_topic_args(web3)

@flaky(max_runs=MAX_FLAKY_RUNS)
def test_eth_call_old_contract_state(self, web3, math_contract, unlocked_account):
start_block = web3.eth.getBlock('latest')
Expand Down
48 changes: 48 additions & 0 deletions web3/utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,57 @@ def assert_contains_log(result):
"fromBlock": 0,
"address": emitter_contract_address,
}

def test_eth_getLogs_with_logs_topic_args(
self,
web3,
block_with_txn_with_log,
emitter_contract_address,
txn_hash_with_log):
def assert_contains_log(result):
assert len(result) == 1
log_entry = result[0]
assert log_entry['blockNumber'] == block_with_txn_with_log['number']
assert log_entry['blockHash'] == block_with_txn_with_log['hash']
assert log_entry['logIndex'] == 0
assert is_same_address(log_entry['address'], emitter_contract_address)
assert log_entry['transactionIndex'] == 0
assert log_entry['transactionHash'] == HexBytes(txn_hash_with_log)

# Test with None event sig

filter_params = {
"fromBlock": 0,
"topics": [
None,
'0x000000000000000000000000000000000000000000000000000000000000d431'],
}

result = web3.eth.getLogs(filter_params)
assert_contains_log(result)

# Test with None indexed arg
filter_params = {
"fromBlock": 0,
"topics": [
'0x057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca',
None],
}
result = web3.eth.getLogs(filter_params)
assert_contains_log(result)

def test_eth_getLogs_with_logs_none_topic_args(
self,
web3):
# Test with None overflowing
filter_params = {
"fromBlock": 0,
"topics": [None, None, None],
}

result = web3.eth.getLogs(filter_params)
assert len(result) == 0

def test_eth_call_old_contract_state(self, web3, math_contract, unlocked_account):
start_block = web3.eth.getBlock('latest')
block_num = start_block.number
Expand Down