-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: Duplicate Withdrawal and move try from impls to rpc-compat #4186
Conversation
Codecov Report
... and 25 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Since SealedBlock is also using Withdrawal under the hood, I think we would also have to move it, for now I have not moved it. |
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.
great start,
this requires some cleaning up
impl From<&Withdrawal> for StandaloneWithdraw { | ||
fn from(withdrawal: &Withdrawal) -> Self { | ||
StandaloneWithdraw { | ||
index: withdrawal.index, | ||
validator_index: withdrawal.validator_index, | ||
address: withdrawal.address, | ||
amount: withdrawal.amount, | ||
} | ||
} | ||
} | ||
|
||
impl From<StandaloneWithdraw> for Withdrawal { | ||
fn from(standalone: StandaloneWithdraw) -> Self { | ||
Withdrawal { | ||
index: standalone.index, | ||
validator_index: standalone.validator_index, | ||
address: standalone.address, | ||
amount: standalone.amount, | ||
} | ||
} | ||
} |
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.
if we include the conversion here then we cannot get rid of it which defeats the point of moving the 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.
My bad . Will fix
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.
If I implement the conversion in block.rs in primitives, then it leads to cyclic dependency error as I would have to import StandaloneWithdraw from rpc-types.
The. only way I can think is to duplicate block.rs as well in rpc-types?
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.
cc @mattsse
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.
right, we should convert this tryfrom into a function instead, like the other things we moved to compat
@@ -98,13 +98,19 @@ impl PayloadBuilderAttributes { | |||
/// Derives the unique [PayloadId] for the given parent and attributes | |||
pub fn new(parent: H256, attributes: PayloadAttributes) -> Self { | |||
let id = payload_id(&parent, &attributes); | |||
let withdraw = attributes.withdrawals.as_ref().map(|withdrawals| { |
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.
let withdraw = attributes.withdrawals.as_ref().map(|withdrawals| { | |
let withdrawals = attributes.withdrawals.as_ref().map(|withdrawals| { |
impl From<&Withdrawal> for StandaloneWithdraw { | ||
fn from(withdrawal: &Withdrawal) -> Self { | ||
StandaloneWithdraw { | ||
index: withdrawal.index, | ||
validator_index: withdrawal.validator_index, | ||
address: withdrawal.address, | ||
amount: withdrawal.amount, | ||
} | ||
} | ||
} | ||
|
||
impl From<StandaloneWithdraw> for Withdrawal { | ||
fn from(standalone: StandaloneWithdraw) -> Self { | ||
Withdrawal { | ||
index: standalone.index, | ||
validator_index: standalone.validator_index, | ||
address: standalone.address, | ||
amount: standalone.amount, | ||
} | ||
} | ||
} |
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.
right, we should convert this tryfrom into a function instead, like the other things we moved to compat
4 tests are failing in https://github.com/paradigmxyz/reth/blob/main/crates/consensus/beacon/src/engine/mod.rs Investigating why it happened
`
|
any updates here @supernovahs? this will become a blocker for us shortly, |
Yeah actually I could not find why are the 4 tests failing . Any pointers would help |
@mattsse Can u take a look ? I'm not able to figure out why they are failing?Thx |
@mattsse Can u review ? thx |
Ready i think |
cool, checking shortly |
Yeah , got errors due to a recent update . Will update it tomorrow |
Fixed |
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.
great, a few nits.
wdyt @Rjected
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 looks very close! Just one question and a few nits, otherwise lgtm
@@ -0,0 +1,6 @@ | |||
//! Standalone functions for engine specific |
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.
nit:
//! Standalone functions for engine specific | |
//! Standalone functions for engine specific rpc type 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.
ok
pub mod payload; | ||
mod transition; | ||
|
||
pub use self::{cancun::*, forkchoice::*, payload::*, transition::*}; | ||
pub use payload::{ | ||
ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadFieldV2, ExecutionPayloadV1, | ||
ExecutionPayloadV2, ExecutionPayloadV3, PayloadError, Withdrawal, | ||
}; |
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 wasn't the previous pub use self::payload::*
sufficient here?
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.
right
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
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
#3964