Skip to content

Commit

Permalink
Removed reth-payload-primitives, added withdrawals_hash handling
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaiko committed Jan 3, 2025
1 parent 987e66e commit efda978
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/taiko/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ reth-consensus.workspace = true
reth-trie-db.workspace = true
reth-primitives = { workspace = true, features = ["taiko"] }
reth-rpc.workspace = true
reth-payload-primitives.workspace = true

# taiko
reth-taiko-consensus.workspace = true
Expand Down
25 changes: 20 additions & 5 deletions crates/taiko/node/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ where
attributes: &TaikoPayloadAttributes,
) -> Result<(), EngineObjectValidationError> {
debug!(target: "taiko::engine", version=?version, attributes=?attributes);
let res = reth_payload_primitives::validate_version_specific_fields(
self.chain_spec(),
version,
attributes.into(),
);
let res = validate_version_specific_fields(self.chain_spec(), version, attributes.into());
debug!(target: "taiko::engine", version=?version, ?res);
res
}
Expand All @@ -137,6 +133,7 @@ fn validate_withdrawals_presence<T: EthereumHardforks>(
message_validation_kind: MessageValidationKind,
timestamp: u64,
has_withdrawals: bool,
withdrawals_hash: Option<B256>,
) -> Result<(), EngineObjectValidationError> {
let is_shanghai_active = chain_spec.is_shanghai_active_at_timestamp(timestamp);

Expand All @@ -148,6 +145,10 @@ fn validate_withdrawals_presence<T: EthereumHardforks>(
}
}
EngineApiMessageVersion::V2 | EngineApiMessageVersion::V3 | EngineApiMessageVersion::V4 => {
if is_shanghai_active && !hash_withdrawals && withdrawals_hash.is_none() {
return Err(message_validation_kind
.to_error(VersionSpecificValidationError::NoWithdrawalsPostShanghai))
}
if !is_shanghai_active && has_withdrawals {
return Err(message_validation_kind
.to_error(VersionSpecificValidationError::HasWithdrawalsPreShanghai))
Expand All @@ -167,12 +168,26 @@ where
Type: PayloadAttributes,
T: EthereumHardforks,
{
let withdrawals_hash = match payload_or_attrs {
PayloadOrAttributes::ExecutionPayload {
payload: TaikoExecutionPayload { withdrawals_hash, .. },
..
} => {
if withdrawals_hash.is_zero() {
None
} else {
Some(*withdrawals_hash)
}
}
_ => None,
};
validate_withdrawals_presence(
chain_spec,
version,
payload_or_attrs.message_validation_kind(),
payload_or_attrs.timestamp(),
payload_or_attrs.withdrawals().is_some(),
withdrawals_hash,
)?;
validate_parent_beacon_block_root_presence(
chain_spec,
Expand Down

0 comments on commit efda978

Please sign in to comment.