-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Eth to method 4 #1741
Eth to method 4 #1741
Conversation
9c1f257
to
b6e8228
Compare
9772b8a
to
179199a
Compare
179199a
to
921dec2
Compare
web3/_utils/method_formatters.py
Outdated
@@ -360,7 +362,7 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]: | |||
RPC.eth_getUncleCountByBlockNumber: apply_formatter_at_index(block_number_formatter, 0), | |||
RPC.eth_getUncleByBlockNumberAndIndex: compose( | |||
apply_formatter_at_index(block_number_formatter, 0), | |||
apply_formatter_at_index(integer_to_hex, 1), | |||
apply_formatter_at_index(block_number_formatter, 1), |
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 has a smell. The formatter is being applied to the index, right?
params: Tuple[BlockIdentifier, Union[HexStr, int]] | ||
) -> NoReturn: | ||
block_identifier = params[0] | ||
uncle_index = to_integer_if_hex(params[1]) |
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.
(Carrying on from the last comment) I do think this explicit pattern is easier to reason about than the block_number_formatter
. What do you think about renaming block_number_formatter
to to_hex_if_integer
, since this formatter has bled outside of just block number formatting? (Okay if not in this PR.)
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.
Yep, agreed. I had a duplicate method in the original PR, so I'll add that here, and then add an issue to remove the duplicated method in a separate PR.
EDIT: See #1745
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.
Comment above is nonblocking 🚢
What was wrong?
The Eth module needs to be moved to use Method. Part 4 includes changes to:
Related to Issue #1568
How was it fixed?
Updated eth.py to use Method for the above methods
Todo:
Cute Animal Picture