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

Support eth_call by block hash #345

Merged
merged 1 commit into from May 14, 2020

Conversation

leoyvens
Copy link
Contributor

This resolves #285 by having the block parameter to call be a BlockId instead of a BlockNumber (breaking change), and serializing the BlockId in the manner expected by EIP 1898.

@leoyvens leoyvens force-pushed the eth-call-by-hash branch 2 times, most recently from 809118a to da94b6c Compare May 14, 2020 17:13
@@ -158,7 +158,11 @@ impl Serialize for BlockId {
S: Serializer,
{
match *self {
BlockId::Hash(ref x) => serializer.serialize_str(&format!("0x{}", x)),
BlockId::Hash(ref x) => {
Copy link
Owner

Choose a reason for hiding this comment

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

Initially I thought this is going to break some of the existing APIs using BlockId, but it's not the case. In fact it seems that the fact that Serialize is implemented for BlockId is not used anywhere in the rust-web3 codebase internally, so it's okay to change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly.

@tomusdrw
Copy link
Owner

Thanks a lot!

@tomusdrw tomusdrw merged commit dc5cdc0 into tomusdrw:master May 14, 2020
@leoyvens
Copy link
Contributor Author

Thanks for the quick review!

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.

Support EIP-1898 - geth state-related RPC methods now support specifying block hashes as well as block numbers
2 participants