Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Enable and fix remaining transaction tests#34

Merged
pipermerriam merged 1 commit intoethereum:masterfrom
DavidKnott:enable-and-fix-transacion-tests
Jul 25, 2017
Merged

Enable and fix remaining transaction tests#34
pipermerriam merged 1 commit intoethereum:masterfrom
DavidKnott:enable-and-fix-transacion-tests

Conversation

@DavidKnott
Copy link
Contributor

This PR is in response to #32
It enables and fixes the remaining json-fixture transaction tests

Cute Animal Picture

http://www.cutestpaw.com/wp-content/uploads/2012/01/baby-tiger.jpg

Copy link
Member

@pipermerriam pipermerriam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you investigate and check to be sure this is all passing because of the right reasons.

try:
normalized_fixture['rlp'] = decode_hex(fixture['rlp'])
except binascii.Error:
normalized_fixture['rlpHex'] = fixture['rlp']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is actually intentional (and likely important) so that there is a clear and unambiguous differentiation between RLP that has been decoded to bytes from it's hex form, and RLP that failed decoding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pipermerriam I changed this back and am now checking for for the KeyError when the tests try to call fixture['rlp'] (when it's now fixture['rlpHex'])

try:
transaction = rlp.decode(fixture['rlp'], sedes=TransactionClass)
except rlp.exceptions.ObjectDeserializationError:
except (rlp.exceptions.ObjectDeserializationError, rlp.exceptions.DecodingError, TypeError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little worried that the tests passing are because this is just catching all of the errors. I'm traveling today and don't have time to check this, but can you verify that the errors being caught here are appropriate error conditions by potentially logging out how many of the tests succeed because of the subsequent return statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pipermerriam I've attached the tests that are passing due to these exceptions, most of them have WrongRLP in the title and I believe the ones that don't should be caught here. I've attached a list of the errors that are passing due to the aforementioned exceptions.
passing_due_to_rlp_exception.txt

@DavidKnott DavidKnott force-pushed the enable-and-fix-transacion-tests branch from b69f26c to a035e67 Compare July 24, 2017 16:13
assert fixture['rlpHex']
return
except TypeError as err:
assert err.args == ("'bytes' object cannot be interpreted as an integer",)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is curious to me? What is causing this error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, can you toss a comment into each of these except blocks with a brief explanation of what they are catching.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, TypeError occurs on 4 tests all called RLPElementIsListWhenItShouldntBe and it occurs when it tries to change a list of bytes into an int

value = [b'dog', b'god', b'cat']
def big_endian_to_int(value):
    return int.from_bytes(value, byteorder='big')
E       TypeError: 'bytes' object cannot be interpreted as an integer

@DavidKnott DavidKnott force-pushed the enable-and-fix-transacion-tests branch from a035e67 to f868a6e Compare July 24, 2017 18:41
@pipermerriam pipermerriam merged commit 79bc002 into ethereum:master Jul 25, 2017
pacrob added a commit to pacrob/py-evm that referenced this pull request Apr 11, 2023
* bump versions in dependencies and ci builds

* move tox to [dev] per issue ethereum#34

* move RTD deps pointer into .readthedocs.yml

* unpin flake8 add flake8-bugbear to lint deps
pacrob added a commit to pacrob/py-evm that referenced this pull request Dec 18, 2023
* bump versions in dependencies and ci builds

* move tox to [dev] per issue ethereum#34

* move RTD deps pointer into .readthedocs.yml

* unpin flake8 add flake8-bugbear to lint deps
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants