-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Extend filter tests with dynamic types and longer block ranges #997
Conversation
72b4435
to
e5f6de8
Compare
e5f6de8
to
ead5b07
Compare
Issues found so far:
|
942d61e
to
5cfc783
Compare
cd2013b
to
ddfab83
Compare
Im getting errors deploying a contract with 2d arrays on eth-tester. I will work on adding that test in a different PR. This is ready for review. @carver @pipermerriam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving all the tests and hypothesis!
This is the only part that I was concerned about:
The regex based data filters do not work with dynamic sized types
I want to make sure it's not a silent bug where we are incapable of returning the events, but the user has no indication of that.
assert log_entries[0]['transactionHash'] == txn_hashes[0] | ||
|
||
|
||
@pytest.mark.xfail(reason="The regex based data filters do not work with dynamic sized types") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of failure do we get? Do we just not get the events we were looking for? It seems like we should explicitly raise an exception if we're incapable of generating the filter accurately. Then the test could be a pytest.raises()
on that exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | ||
|
||
SEED = 50505050505 | ||
random.seed(SEED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this left in from some debugging?
expected_match_counter = 0 | ||
|
||
tx_padder = pad_with_transactions(web3) | ||
tx_padder.send(None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're not sending anything, maybe next(tx_padder)
is clearer here.
_to = accounts[random.randint(0, len(accounts) - 1)] | ||
value = 50 + tx_count | ||
w3.eth.sendTransaction({'from': _from, 'to': _to, 'value': value}) | ||
yield tx_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing the benefit of this being a generator. It seems it could be a function you call when you want to pad, like:
def pad_with_transactions(w3):
accounts = w3.eth.accounts
for tx_count in range(random.randint(0, 10)):
_from = accounts[random.randint(0, len(accounts) - 1)]
_to = accounts[random.randint(0, len(accounts) - 1)]
value = 50 + tx_count
w3.eth.sendTransaction({'from': _from, 'to': _to, 'value': value})
Then later, instead of invoking the generator and calling next()
, you call pad_with_transactions(w3)
again.
_to = accounts[random.randint(0, len(accounts) - 1)] | ||
value = 50 | ||
tx_hash = w3.eth.sendTransaction({'from': _from, 'to': _to, 'value': value}) | ||
yield tx_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, doesn't seem to need to be a generator.
assert len(transaction_filter.get_new_entries()) == transaction_counter | ||
|
||
|
||
@pytest.mark.xfail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the reason that this is a suspected eth-tester bug?
15f0a32
to
2f204d6
Compare
2f204d6
to
5caf0d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What was wrong?
Related to Issue #836
How was it fixed?
Adding to the suite of filter tests to show cases that are currently failing. I am separating this work from #953, by marking tests with xfail.
Test cases to cover
Contract with invalid return dataArgument and topic filters with arrays of dynamic typesCute Animal Picture