Skip to content
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

feat: return checksummed addresses from contract calls #294

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented Dec 8, 2021

What I did

fixes: #262

How I did it

call to_checksum_address() on the data being return so long that it is of an address type.

How to verify it

Two things:

  1. Verify that addresses returned from contracts are now checksummed
  2. Verify that normal calls unrelated to addresses still work.

Test that tests this new feature: https://github.com/unparalleled-js/ape-demo-project/blob/main/tests/test_fund.py#L17-L21,
The other tests pass as well in that demo project.
Thus, this addresses the issue.

NOTE: eth-abi python package naturally returns HexAddress as "normalized". It is not much effort to change that, but to fix their test suite against that is actually kind of challenging believe it or not and I am not sure they would want that.. Though I have started the process to see what it's like: ethereum/eth-abi#152

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

@antazoey antazoey changed the title feat: ret checksummed addresses feat: return checksummed addresses from contract calls Dec 8, 2021
if not vm_return_values:
return vm_return_values

if not isinstance(vm_return_values, (tuple, list)):
Copy link
Member Author

Choose a reason for hiding this comment

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

From what I could tell, the return values here were always a tuple anyway, but I added this part just to not make any assumptions about it

@antazoey antazoey merged commit 3ab1ac0 into ApeWorX:main Dec 10, 2021
@antazoey antazoey deleted the fix/return-checksummed-addresses branch December 10, 2021 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Addresses returned from contracts are not checksum addresses
2 participants