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

Slow validation function blocking asyncio #2928

Open
menaitm opened this issue Apr 24, 2023 · 1 comment
Open

Slow validation function blocking asyncio #2928

menaitm opened this issue Apr 24, 2023 · 1 comment

Comments

@menaitm
Copy link

menaitm commented Apr 24, 2023

  • Version: 6.2.0
  • Python: 3.10

What was wrong?

After profiling my asyncio application, 2.5% of the event loop blocking is coming from the validate_address function in web3py:
https://github.com/ethereum/web3.py/blob/v6.2.0/web3/_utils/validation.py#L160

Inside this function, is_checksum_address() is the slowest call.

How can it be fixed?

Can the library provide flags to enable/disable expensive validation methods like this?

@DavidRomanovizc
Copy link
Contributor

Hello, @menaitm, I think there are several possible options: you can try to write a faster algorithm that, for example, will use bit operations instead of calculating a hash function, or you can add a parameter to the validate_address function that will disable the is_checksum_address. If it necessary, I can take over the solution of this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants