debugging

This commit is contained in:
Eitan Seri-Levi
2025-02-15 12:14:58 +02:00
parent 7eb040c70e
commit cdbdb5226d
23 changed files with 252 additions and 157 deletions

View File

@@ -731,10 +731,7 @@ impl HttpJsonRpc {
pub async fn get_inclusion_list<E: EthSpec>(
&self,
parent_hash: Hash256,
) -> Result<
VariableList<Transaction<E::MaxBytesPerTransaction>, E::MaxTransactionsPerInclusionList>,
Error,
> {
) -> Result<Option<Vec<String>>, Error> {
let params = json!([parent_hash]);
self.rpc_request(
@@ -852,11 +849,18 @@ impl HttpJsonRpc {
Ok(response.into())
}
// TODO(fulu): switch to v5 endpoint when the EL is ready for Fulu
pub async fn new_payload_v4_fulu<E: EthSpec>(
pub async fn new_payload_v5_fulu<E: EthSpec>(
&self,
new_payload_request_fulu: NewPayloadRequestFulu<'_, E>,
) -> Result<PayloadStatusV1, Error> {
// TODO(focil) clean this up?
let mut il_transactions = vec![];
for transaction in new_payload_request_fulu.il_transactions {
if let Ok(hex_tx) = String::from_utf8(transaction.into()).map(|v| format!("0x{}", v)) {
il_transactions.push(hex_tx);
}
}
let params = json!([
JsonExecutionPayload::V5(new_payload_request_fulu.execution_payload.clone().into()),
new_payload_request_fulu.versioned_hashes,
@@ -864,11 +868,12 @@ impl HttpJsonRpc {
new_payload_request_fulu
.execution_requests
.get_execution_requests_list(),
il_transactions
]);
let response: JsonPayloadStatusV1 = self
.rpc_request(
ENGINE_NEW_PAYLOAD_V4,
ENGINE_NEW_PAYLOAD_V5,
params,
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
)
@@ -1301,11 +1306,10 @@ impl HttpJsonRpc {
}
}
NewPayloadRequest::Fulu(new_payload_request_fulu) => {
// TODO(fulu): switch to v5 endpoint when the EL is ready for Fulu
if engine_capabilities.new_payload_v4 {
self.new_payload_v4_fulu(new_payload_request_fulu).await
if engine_capabilities.new_payload_v5 {
self.new_payload_v5_fulu(new_payload_request_fulu).await
} else {
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
Err(Error::RequiredMethodUnsupported("engine_newPayloadV5"))
}
}
}

View File

@@ -47,7 +47,7 @@ pub struct NewPayloadRequest<'block, E: EthSpec> {
pub parent_beacon_block_root: Hash256,
#[superstruct(only(Electra, Fulu))]
pub execution_requests: &'block ExecutionRequests<E>,
#[superstruct(only(Electra, Fulu))]
#[superstruct(only(Fulu))]
pub il_transactions: InclusionListTransactions<E>,
}
@@ -204,7 +204,6 @@ impl<'a, E: EthSpec> NewPayloadRequest<'a, E> {
.collect(),
parent_beacon_block_root: block_ref.parent_root,
execution_requests: &block_ref.body.execution_requests,
il_transactions,
})),
BeaconBlockRef::Fulu(block_ref) => Ok(Self::Fulu(NewPayloadRequestFulu {
execution_payload: &block_ref.body.execution_payload.execution_payload,
@@ -259,7 +258,6 @@ impl<'a, E: EthSpec> TryFrom<BeaconBlockRef<'a, E>> for NewPayloadRequest<'a, E>
.collect(),
parent_beacon_block_root: block_ref.parent_root,
execution_requests: &block_ref.body.execution_requests,
il_transactions: vec![].into(),
})),
BeaconBlockRef::Fulu(block_ref) => Ok(Self::Fulu(NewPayloadRequestFulu {
execution_payload: &block_ref.body.execution_payload.execution_payload,

View File

@@ -166,6 +166,20 @@ pub enum Error {
BeaconStateError(BeaconStateError),
PayloadTypeMismatch,
VerifyingVersionedHashes(versioned_hashes::Error),
HexError(hex::FromHexError),
SszTypeError(ssz_types::Error),
}
impl From<ssz_types::Error> for Error {
fn from(e: ssz_types::Error) -> Self {
Error::SszTypeError(e)
}
}
impl From<hex::FromHexError> for Error {
fn from(e: hex::FromHexError) -> Self {
Error::HexError(e)
}
}
impl From<BeaconStateError> for Error {
@@ -1958,12 +1972,24 @@ impl<E: EthSpec> ExecutionLayer<E> {
parent_hash: Hash256,
) -> Result<InclusionListTransactions<E>, Error> {
debug!(self.log(), "Requesting inclusion list from EL"; "parent_hash" => %parent_hash);
let transactions = self
let raw_transactions = self
.engine()
.api
.get_inclusion_list::<E>(parent_hash)
.await?;
Ok(transactions)
// TODO(focil) clean this up?
let mut transactions = vec![];
let Some(raw_transactions) = raw_transactions else {
debug!(self.log(), "The EL sent an empty inclusion list"; "parent_hash" => %parent_hash);
return Ok(transactions.into());
};
for raw_tx in raw_transactions {
let decoded_hex_tx =
VariableList::new(hex::decode(raw_tx.strip_prefix("0x").unwrap_or(&raw_tx))?)?;
transactions.push(decoded_hex_tx);
}
Ok(transactions.into())
}
}