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(rpc-types): set Uncle as default for BlockTransactions #98

Merged
merged 3 commits into from
Jan 5, 2024

Conversation

Evalir
Copy link
Contributor

@Evalir Evalir commented Jan 5, 2024

Motivation

When fetching uncle blocks, these blocks never contain a transactions field. This means that normal serialization into a Block can fail as BlockTransactions doesn't have a default and therefore will just not be added to the Block struct at all, causing a serde failure.

Solution

In the case the field is missing, simply include the field as default with an BlockTransactions::Uncle instance.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@Evalir Evalir changed the title fix(rpc-types): set Uncle as default for BlockTransactions [wip] fix(rpc-types): set Uncle as default for BlockTransactions Jan 5, 2024
@Evalir Evalir marked this pull request as draft January 5, 2024 15:10
@Evalir Evalir marked this pull request as ready for review January 5, 2024 15:22
@Evalir Evalir changed the title [wip] fix(rpc-types): set Uncle as default for BlockTransactions fix(rpc-types): set Uncle as default for BlockTransactions Jan 5, 2024
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.

smol style nit

crates/rpc-types/src/eth/block.rs Outdated Show resolved Hide resolved
@Evalir Evalir merged commit ec44bb0 into main Jan 5, 2024
17 checks passed
@Evalir Evalir deleted the evalir/set-uncles-default branch January 6, 2024 18:25
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