-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
primitives: use alloy Header
struct
#10691
Conversation
I think that we should revise the types in alloy to transform all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the casts are indeed excessive and we should change them in alloy, because only u64 are useful here
wdyt @klkvr
self.headers.get(&self.max_block()?).map(|h| { | ||
let sealed = h.clone().seal_slow(); | ||
SealedHeader::new(sealed.inner().clone(), sealed.seal()) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this have to be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in alloy seal_slow
returns a generic Sealed<T>
type which is different from the SealedHeader
that we have in reth. So that to be compatible with reth at the moment we have to reconstruct a reth SealedHeader
from the alloy Sealed<Header>
type.
But I'm thinking about a follow up PR to replace our reth SealedHeader
by the alloy Sealed<Header>
primitive wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now has an additional clone, this is not great and looks just weird.
we don't need the seal function here if we only need the hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can also be solved with a SealedHeader:: seal(Header)
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to reduce overhead, what would you say to replace also in this PR SealedHeader
by alloy Sealed
type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.headers.get(&self.max_block()?).map(|h| { | |
let sealed = h.clone().seal_slow(); | |
SealedHeader::new(sealed.inner().clone(), sealed.seal()) | |
}) | |
self.headers.get(&self.max_block()?).map(|h| { | |
let sealed = h.clone().seal_slow(); | |
let (header, seal) = sealed.into_parts(); | |
SealedHeader::new(header, seal); | |
}) |
I think we can just do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fixed this but I think that in a follow up we can simply rm SealedHeader
from reth and use Sealed
instead, it will simplify everything no?
@mattsse Yeah related alloy-rs/alloy#1241 cc @greged93 |
agreed, we should definitely unify all of this, there's no point in u128 as revm uses u64 anyway, wondering if there's a spec for gas value type? |
@klkvr If you validate alloy-rs/alloy#1241 (please can you comment there to be sure this is accepted), me or @greged93 can start working on this :) |
@klkvr @mattsse In my opinion:
|
need help fixing merge conflicts @tcoratger ? all for removing redundancy, think it will be brilliant |
@emhane No worries, I think I can handle it. Can you provide just an overview review to confirm that everything (the approach, the conversion handling...) is good so that directly after solving conflicts we can merge and avoid further conflicts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
let sealed = header.seal_slow(); | ||
let (header, seal) = sealed.into_parts(); | ||
sealed_header = SealedHeader::new(header, seal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls open issue if one doesn't exist to remove SealedHeader
in favour of alloy Sealed
as you suggested, to avoid these conversions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done #11123
Should close #10687
Blocked by:
Arbitrary
forHeader
alloy-rs/alloy#1235is_zero_difficulty
forHeader
alloy-rs/alloy#1236exceeds_allowed_future_timestamp
forHeader
alloy-rs/alloy#1237