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

Eth to method 4 #1741

Merged
merged 6 commits into from
Sep 17, 2020
Merged

Eth to method 4 #1741

merged 6 commits into from
Sep 17, 2020

Conversation

kclowes
Copy link
Collaborator

@kclowes kclowes commented Sep 15, 2020

What was wrong?

The Eth module needs to be moved to use Method. Part 4 includes changes to:

  • RPC.eth_getBlockTransactionCountByHash
  • RPC.eth_getBlockTransactionCountByNumber
  • RPC.eth_getUncleCountByBlockHash
  • RPC.eth_getUncleCountByBlockNumber
  • RPC.eth_getUncleByBlockHashAndIndex
  • RPC.eth_getUncleByBlockNumberAndIndex
  • RPC.eth_getTransactionByHash

Related to Issue #1568

How was it fixed?

Updated eth.py to use Method for the above methods

Todo:

Cute Animal Picture

image

@kclowes kclowes force-pushed the eth-to-method-4 branch 2 times, most recently from 9c1f257 to b6e8228 Compare September 16, 2020 21:10
@kclowes kclowes changed the title [WIP] Eth to method 4 Eth to method 4 Sep 16, 2020
@kclowes kclowes changed the title Eth to method 4 [WIP] Eth to method 4 Sep 17, 2020
@kclowes kclowes changed the title [WIP] Eth to method 4 Eth to method 4 Sep 17, 2020
@kclowes kclowes requested a review from wolovim September 17, 2020 19:57
@@ -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),
Copy link
Member

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])
Copy link
Member

@wolovim wolovim Sep 17, 2020

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.)

Copy link
Collaborator Author

@kclowes kclowes Sep 17, 2020

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

Copy link
Member

@wolovim wolovim left a 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 🚢

@kclowes kclowes merged commit 3e1e6da into ethereum:master Sep 17, 2020
@kclowes kclowes deleted the eth-to-method-4 branch September 17, 2020 21:29
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.

2 participants