Delete legacy payload reconstruction (#6213)

* Delete legacy payload reconstruction

* Delete unneeded failing test

* Merge remote-tracking branch 'origin/unstable' into remove-more-ethers

* Merge remote-tracking branch 'origin/unstable' into remove-more-ethers

* Cleanups
This commit is contained in:
Michael Sproul
2024-09-06 18:10:55 +10:00
committed by GitHub
parent c0b4f01cf3
commit d6861380a2
10 changed files with 110 additions and 755 deletions

View File

@@ -734,54 +734,6 @@ impl HttpJsonRpc {
.await
}
pub async fn get_block_by_hash_with_txns<E: EthSpec>(
&self,
block_hash: ExecutionBlockHash,
fork: ForkName,
) -> Result<Option<ExecutionBlockWithTransactions<E>>, Error> {
let params = json!([block_hash, true]);
Ok(Some(match fork {
ForkName::Bellatrix => ExecutionBlockWithTransactions::Bellatrix(
self.rpc_request(
ETH_GET_BLOCK_BY_HASH,
params,
ETH_GET_BLOCK_BY_HASH_TIMEOUT * self.execution_timeout_multiplier,
)
.await?,
),
ForkName::Capella => ExecutionBlockWithTransactions::Capella(
self.rpc_request(
ETH_GET_BLOCK_BY_HASH,
params,
ETH_GET_BLOCK_BY_HASH_TIMEOUT * self.execution_timeout_multiplier,
)
.await?,
),
ForkName::Deneb => ExecutionBlockWithTransactions::Deneb(
self.rpc_request(
ETH_GET_BLOCK_BY_HASH,
params,
ETH_GET_BLOCK_BY_HASH_TIMEOUT * self.execution_timeout_multiplier,
)
.await?,
),
ForkName::Electra => ExecutionBlockWithTransactions::Electra(
self.rpc_request(
ETH_GET_BLOCK_BY_HASH,
params,
ETH_GET_BLOCK_BY_HASH_TIMEOUT * self.execution_timeout_multiplier,
)
.await?,
),
ForkName::Base | ForkName::Altair => {
return Err(Error::UnsupportedForkVariant(format!(
"called get_block_by_hash_with_txns with fork {:?}",
fork
)))
}
}))
}
pub async fn new_payload_v1<E: EthSpec>(
&self,
execution_payload: ExecutionPayload<E>,

View File

@@ -778,6 +778,57 @@ pub struct JsonExecutionPayloadBody<E: EthSpec> {
Option<VariableList<ConsolidationRequest, E::MaxConsolidationRequestsPerPayload>>,
}
impl<E: EthSpec> From<ExecutionPayloadBodyV1<E>> for JsonExecutionPayloadBodyV1<E> {
fn from(value: ExecutionPayloadBodyV1<E>) -> Self {
Self {
transactions: value.transactions,
withdrawals: value.withdrawals.map(|json_withdrawals| {
VariableList::from(
json_withdrawals
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
}),
}
}
}
impl<E: EthSpec> From<ExecutionPayloadBodyV2<E>> for JsonExecutionPayloadBodyV2<E> {
fn from(value: ExecutionPayloadBodyV2<E>) -> Self {
Self {
transactions: value.transactions,
withdrawals: value.withdrawals.map(|json_withdrawals| {
VariableList::from(
json_withdrawals
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
}),
deposit_requests: value.deposit_requests.map(|receipts| {
VariableList::from(receipts.into_iter().map(Into::into).collect::<Vec<_>>())
}),
withdrawal_requests: value.withdrawal_requests.map(|withdrawal_requests| {
VariableList::from(
withdrawal_requests
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
}),
consolidation_requests: value.consolidation_requests.map(|consolidation_requests| {
VariableList::from(
consolidation_requests
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
}),
}
}
}
impl<E: EthSpec> From<JsonExecutionPayloadBody<E>> for ExecutionPayloadBody<E> {
fn from(value: JsonExecutionPayloadBody<E>) -> Self {
match value {