-
-
Notifications
You must be signed in to change notification settings - Fork 5
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!: adds signed and unsigned ints to list of types #11
base: main
Are you sure you want to change the base?
feat!: adds signed and unsigned ints to list of types #11
Conversation
|
3fea75b
to
18e505f
Compare
disentangled previous byte and string types from hash logic, but changed naming convention in the process. added abi child type for abi specific data, like the name of the type.
…s into unified pydantic model classes
submitting as ready for review while updating docs and tests |
…h defaulting size of hexbytes object when building out the bound sizes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is looking reallly good!
setup.py
Outdated
"eth-hash[pycryptodome]>=0.5.2,<1", | ||
"eth-utils>=2.2.0,<3", | ||
"eth-typing>=3.5.0,<4", | ||
"eth-utils>=2.2.0,<5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can probably move up some of the lower pins here - try to get these to just 1 major version
|
||
```python | ||
from pydantic import BaseModel | ||
|
||
from eth_pydantic_types import HashBytes32, HashStr20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you include an example of a non-predefine type that is bound?
Like how do I use BoundHexBytes sizes other than 32 and 20?
@@ -28,6 +36,7 @@ | |||
|
|||
|
|||
class BaseHex: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I am working on core right, and I recently realized I really need a HexInt
class.
Basically it allows any hex-str or or bytes but always validates into an integer.
I am going to make one in core ape for now but eventually we can use this work to double-import.
…into feat/int-types # Conflicts: # setup.py
…t/int-types # Conflicts: # eth_pydantic_types/__init__.py # eth_pydantic_types/address.py # eth_pydantic_types/hash.py # eth_pydantic_types/hex.py # setup.py
eth_pydantic_types/hex.py
Outdated
|
||
@classmethod | ||
def validate_size(cls, value: str) -> str: | ||
if cls.calculate_schema: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: instead of using calculate_schema
, what about overriding validate_size()
in Address?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed by overriding not the full validate_size()
call but extracted the contents of this conditional to its own call and overrode that
@@ -1,77 +1,43 @@ | |||
import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id like to see a test_abi
just to kinda show-case how to use those features, it doesnt have to be comprehensive
What I did
Created pydantic types for sized signed and unsigned int types
fixes: #
How I did it
How to verify it
Checklist