-
Notifications
You must be signed in to change notification settings - Fork 685
Enables eth.vm Type Hinting #1451
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
Conversation
ee38175
to
ff977b3
Compare
I have used
For now the type hint of the function That said, @cburgdorf could you please review the changes I have made? |
ff977b3
to
9a45ec0
Compare
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.
Great work man! This is tightening the type guarantees for a huge chunk of the code base. There are a number of places where I think we can do better. Left some comments and will give it another round of review then.
@@ -107,6 +107,7 @@ commands= | |||
mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional --check-untyped-defs --disallow-incomplete-defs -p eth | |||
mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs --disallow-any-generics -p eth.utils | |||
mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs --disallow-any-generics -p eth.tools | |||
mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs --disallow-any-generics -p eth.vm |
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.
Rad! This is lifting up the type guarantees for a huge part of the code base ❤️
Typical CI throttling bug. Everything is green. @Bhargavasomu I added some corrections on top that you may want to check out. There are some cases with some left over Merging 🎉 Great work! |
So the 2 takeaways I guess are
Will keep in mind the above things while type hinting the rest of the modules. Learned a lot of new things from here. Thankyou for helping me out here @cburgdorf. |
@@ -592,7 +610,8 @@ def get_transaction_result( | |||
This is referred to as a `call()` in web3. | |||
""" | |||
with self.get_vm(at_header).state_in_temp_block() as state: | |||
computation = state.costless_execute_transaction(transaction) | |||
# Ignore is to not bleed the SpoofTransaction deeper into the code base | |||
computation = state.costless_execute_transaction(transaction) # type: ignore |
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.
Probably a better solution here is an abstract interface for the transaction that SpoofTransaction
and the main RLP Transaction both implement.
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.
That ignore is gone in the final version that was merged.
What was wrong?
Needed type hinting for
eth.vm
as part of #1398How was it fixed?
Adding Type Hints to
eth.vm
Cute Animal Picture