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: check for empty tx root in BlockTransactions::Uncle match #8600

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Jun 4, 2024

This fixes two things in alloy conversions:

  • Preventing errors when empty blocks are returned by getBlockByNumber RPC calls.
  • Extracting the chain id from the signature in nonstandard rpc responses that do not directly populate the chain id.

@Rjected Rjected added C-bug An unexpected or incorrect behavior A-utils Related to commonly used utilities labels Jun 4, 2024
@Rjected Rjected requested a review from gakonst as a code owner June 4, 2024 18:56
@@ -36,7 +36,13 @@ impl TryFrom<alloy_rpc_types::Block> for Block {
.collect(),
alloy_rpc_types::BlockTransactions::Hashes(_) |
alloy_rpc_types::BlockTransactions::Uncle => {
return Err(ConversionError::MissingFullTransactions)
// alloy deserializes empty blocks into `BlockTransactions::Uncle`, if the tx
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this note is correct, [] would be Hashes because it's the first variant

Copy link
Member Author

Choose a reason for hiding this comment

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

right, thought it was uncle because of default, but it's not

@Rjected Rjected force-pushed the dan/fix-alloy-deser-empty branch from 3f8a678 to 64b86ce Compare June 4, 2024 19:36
@Rjected Rjected force-pushed the dan/fix-alloy-deser-empty branch from 64b86ce to a78b7e8 Compare June 4, 2024 19:38
@mattsse
Copy link
Collaborator

mattsse commented Jun 5, 2024

clippy issues :)

@Rjected Rjected added this pull request to the merge queue Jun 5, 2024
Merged via the queue into main with commit c5e3807 Jun 5, 2024
29 checks passed
@Rjected Rjected deleted the dan/fix-alloy-deser-empty branch June 5, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-utils Related to commonly used utilities C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants