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

dedup: TransactionList and BlockResponse #444

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Apr 2, 2024

Motivation

Ref #440 and #441

Solution

Removed TransactionList from alloy_network

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

/// A block response
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
pub struct BlockResponse<N: Network> {
#[serde(flatten)]
header: N::HeaderResponse,
transactions: TransactionList<N::TransactionResponse>,
Copy link
Member

Choose a reason for hiding this comment

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

we should probably do the following while we're here:

Copy link
Member Author

Choose a reason for hiding this comment

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

TransactionList is already generic over T, I was removing it in favour of BlockTransactions (which does have a generic) from rpc-types.

Also if we're removing BlockResponse we can also remove TransactionList as it is the only place it is used

Copy link
Member

Choose a reason for hiding this comment

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

BlockTransactions is not currently generic, and should be for reuse in other networks

Copy link
Member Author

@yash-atreya yash-atreya Apr 3, 2024

Choose a reason for hiding this comment

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

I'll leave TransactionsList as is but would like to change the Hydrated enum value to Full to be consistent with BlockTransactions

Copy link
Member

Choose a reason for hiding this comment

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

i feel like we're having a miscommunication here so i'm gonna step back

  • the 2 types in alloy-network lib.rs should be deleted as they're duplicative
  • the types in alloy-rpc-types should have generics added with defaults

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds great! That's ideal.

@yash-atreya yash-atreya requested a review from prestwich April 3, 2024 18:20
@yash-atreya yash-atreya changed the title dedup: TransactionList dedup: TransactionList and BlockResponse Apr 3, 2024
@prestwich prestwich merged commit a965adf into alloy-rs:main Apr 5, 2024
18 checks passed
ben186 pushed a commit to ben186/alloy that referenced this pull request Jul 27, 2024
* dedup: TransactionList

* dedup: BlockResponse in `network`

* fix: ci

* add: generic to BlockTransactions
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