ethereum / eth-abi

Ethereum ABI utilities for python
MIT License
247 stars 269 forks source link

reduce truncation in errors #166

Closed charles-cooper closed 2 years ago

charles-cooper commented 2 years ago

allow more int values to be fully printed in errors. the current code truncates a lot of integer values which fit in 256 bits, which reduces helpfulness of the error message when debugging.

What was wrong?

Issue #

How was it fixed?

Summary of approach.

To-Do

Cute Animal Picture

![put a cute animal picture link inside the parentheses]()

charles-cooper commented 2 years ago

@kclowes @fselmo is it possible to get a review on this? I can fix the merge conflicts if the approach looks ok

kclowes commented 2 years ago

Thanks for the ping, @charles-cooper. This change looks fine to me. If you don't mind fixing the merge conflicts I can probably get this in next week. Thanks!

edit: if you don't hear from me next week, feel free to tag me again :)

charles-cooper commented 2 years ago

@kclowes resolved!

charles-cooper commented 2 years ago

i see that this breaks some specific tests:

Screenshot from 2022-07-07 16-19-00

@kclowes actually i think it would be good to remove the abbr() function altogether? it's not friendly for debugging, and as downstream tools (like pytest) have settings to truncate output anyways -- i can't really think of a situation where you want to truncate the info in the exception which isn't already handled by downstream tooling

kclowes commented 2 years ago

Yeah, that's a fair point. I just changed the expectation of the tests for now. I think it does make sense to remove abbr in the next major release. What version of eth-abi are you using?

charles-cooper commented 2 years ago

Yeah, that's a fair point. I just changed the expectation of the tests for now. I think it does make sense to remove abbr in the next major release. What version of eth-abi are you using?

2.1.1 and 3.0.0

kclowes commented 2 years ago

2.1.1 and 3.0.0

Cool. I'll try and get those released next week. Thanks again!

charles-cooper commented 2 years ago

Thanks @kclowes !!

kclowes commented 2 years ago

@charles-cooper both 2.2.0 and 3.0.1 are out with this fix!