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

chore(sdk): SealedHeader generic over header #11429

Merged
merged 8 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions crates/primitives-traits/src/header/sealed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@ use serde::{Deserialize, Serialize};
/// to modify header.
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref, Serialize, Deserialize)]
#[add_arbitrary_tests(rlp)]
pub struct SealedHeader {
pub struct SealedHeader<H = Header> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that's reasonable, although for header op and eth use the same type

Copy link
Member Author

Choose a reason for hiding this comment

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

we shouldn't only limit this to op

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense

/// Locked Header hash.
hash: BlockHash,
/// Locked Header fields.
#[as_ref]
#[deref]
header: Header,
header: H,
}

impl SealedHeader {
impl<H> SealedHeader<H> {
/// Creates the sealed header with the corresponding block hash.
#[inline]
pub const fn new(header: Header, hash: BlockHash) -> Self {
pub const fn new(header: H, hash: BlockHash) -> Self {
Self { header, hash }
}
}

impl SealedHeader {
/// Returns the sealed Header fields.
#[inline]
pub const fn header(&self) -> &Header {
Expand Down
Loading