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

refactor!: replace string types with force-validated pydantic types #59

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bitwise-constructs
Copy link
Contributor

What I did

All the types used in EIP712 contracts are now using Pydantic annotated types with built-in validation

fixes: #22
Fixes: APE-1782

How I did it

This PR is being developed in coordination with an overhaul of the eth_pydantic_types library here: ApeWorX/eth-pydantic-types#11

How to verify it

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

…from eth_pydantic_types library

(cherry picked from commit 0df69cd)
@bitwise-constructs
Copy link
Contributor Author

@antazoey 2 tests are broken but will be good to talk about tomorrow and get into how heavy to enforce the pydantic types

fubuloubu
fubuloubu previously approved these changes Oct 15, 2024
Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

Are there tests where typing validation fails?

@antazoey
Copy link
Member

it's comin' along!

Comment on lines +9 to +10
if TYPE_CHECKING:
from eth_pydantic_types.abi import address, bytes32, string, uint256
Copy link
Member

Choose a reason for hiding this comment

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

Not performance critical, so might be worth doing it like this

Suggested change
if TYPE_CHECKING:
from eth_pydantic_types.abi import address, bytes32, string, uint256
from eth_pydantic_types import abi

And then below do like :

...
inner: abi.uint256

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.

Refactor to Pydantic
3 participants