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

fix(providers): receipts of unmined blocks should be null #104

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

kallydev
Copy link
Contributor

@kallydev kallydev commented Jan 12, 2024

Motivation

The provider cannot distinguish between non-existent blocks and blocks without transactions when using the eth_getBlockReceipts method.

RPC responses

  • The block exists, but there are no transactions.
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": []
}
  • The block does not exist.
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": null
}

Solution

Use Option to distinguish between [] and null.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I think this is reasonable and the right fix

pending @Evalir

Copy link
Contributor

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

yep this looks good, agreed this is a good fix.

@Evalir Evalir merged commit 1443559 into alloy-rs:main Jan 15, 2024
17 checks passed
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.

3 participants