mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 02:12:33 +00:00
The great renaming receipt -> request
This commit is contained in:
@@ -20,7 +20,7 @@ use reqwest::StatusCode;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::IntoStaticStr;
|
||||
use superstruct::superstruct;
|
||||
use types::execution_payload::{DepositReceipts, WithdrawalRequests};
|
||||
use types::execution_payload::{DepositRequests, WithdrawalRequests};
|
||||
pub use types::{
|
||||
Address, BeaconBlockRef, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader,
|
||||
ExecutionPayloadRef, FixedVector, ForkName, Hash256, Transactions, Uint256, VariableList,
|
||||
@@ -67,7 +67,7 @@ pub enum Error {
|
||||
TransitionConfigurationMismatch,
|
||||
SszError(ssz_types::Error),
|
||||
DeserializeWithdrawals(ssz_types::Error),
|
||||
DeserializeDepositReceipts(ssz_types::Error),
|
||||
DeserializeDepositRequests(ssz_types::Error),
|
||||
DeserializeWithdrawalRequests(ssz_types::Error),
|
||||
BuilderApi(builder_client::Error),
|
||||
IncorrectStateVariant,
|
||||
@@ -204,7 +204,7 @@ pub struct ExecutionBlockWithTransactions<E: EthSpec> {
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub excess_blob_gas: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
pub deposit_receipts: Vec<JsonDepositRequest>,
|
||||
pub deposit_requests: Vec<JsonDepositRequest>,
|
||||
#[superstruct(only(Electra))]
|
||||
pub withdrawal_requests: Vec<JsonWithdrawalRequest>,
|
||||
}
|
||||
@@ -314,8 +314,8 @@ impl<E: EthSpec> TryFrom<ExecutionPayload<E>> for ExecutionBlockWithTransactions
|
||||
.collect(),
|
||||
blob_gas_used: block.blob_gas_used,
|
||||
excess_blob_gas: block.excess_blob_gas,
|
||||
deposit_receipts: block
|
||||
.deposit_receipts
|
||||
deposit_requests: block
|
||||
.deposit_requests
|
||||
.into_iter()
|
||||
.map(|deposit| deposit.into())
|
||||
.collect(),
|
||||
@@ -546,7 +546,7 @@ impl<E: EthSpec> GetPayloadResponse<E> {
|
||||
pub struct ExecutionPayloadBodyV1<E: EthSpec> {
|
||||
pub transactions: Transactions<E>,
|
||||
pub withdrawals: Option<Withdrawals<E>>,
|
||||
pub deposit_receipts: Option<DepositReceipts<E>>,
|
||||
pub deposit_requests: Option<DepositRequests<E>>,
|
||||
pub withdrawal_requests: Option<WithdrawalRequests<E>>,
|
||||
}
|
||||
|
||||
@@ -635,13 +635,13 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
|
||||
}
|
||||
}
|
||||
ExecutionPayloadHeader::Electra(header) => {
|
||||
let (Some(withdrawals), Some(deposit_receipts), Some(withdrawal_requests)) = (
|
||||
let (Some(withdrawals), Some(deposit_requests), Some(withdrawal_requests)) = (
|
||||
self.withdrawals,
|
||||
self.deposit_receipts,
|
||||
self.deposit_requests,
|
||||
self.withdrawal_requests,
|
||||
) else {
|
||||
return Err(format!(
|
||||
"block {} is post-electra but payload body doesn't have withdrawals/deposit_receipts/withdrawal_requests \
|
||||
"block {} is post-electra but payload body doesn't have withdrawals/deposit_requests/withdrawal_requests \
|
||||
Check that ELs are returning receipts and withdrawal_requests in getPayloadBody requests",
|
||||
header.block_hash
|
||||
));
|
||||
@@ -664,7 +664,7 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
|
||||
withdrawals,
|
||||
blob_gas_used: header.blob_gas_used,
|
||||
excess_blob_gas: header.excess_blob_gas,
|
||||
deposit_receipts,
|
||||
deposit_requests,
|
||||
withdrawal_requests,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use superstruct::superstruct;
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::BlobsList;
|
||||
use types::{
|
||||
DepositReceipt, ExecutionLayerWithdrawalRequest, FixedVector, PublicKeyBytes, Signature,
|
||||
DepositRequest, ExecutionLayerWithdrawalRequest, FixedVector, PublicKeyBytes, Signature,
|
||||
Unsigned,
|
||||
};
|
||||
|
||||
@@ -106,7 +106,7 @@ pub struct JsonExecutionPayload<E: EthSpec> {
|
||||
pub excess_blob_gas: u64,
|
||||
#[superstruct(only(V4))]
|
||||
// TODO(electra): Field name should be changed post devnet-0. See https://github.com/ethereum/execution-apis/pull/544
|
||||
pub deposit_requests: VariableList<JsonDepositRequest, E::MaxDepositReceiptsPerPayload>,
|
||||
pub deposit_requests: VariableList<JsonDepositRequest, E::MaxDepositRequestsPerPayload>,
|
||||
#[superstruct(only(V4))]
|
||||
pub withdrawal_requests:
|
||||
VariableList<JsonWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>,
|
||||
@@ -213,7 +213,7 @@ impl<E: EthSpec> From<ExecutionPayloadElectra<E>> for JsonExecutionPayloadV4<E>
|
||||
blob_gas_used: payload.blob_gas_used,
|
||||
excess_blob_gas: payload.excess_blob_gas,
|
||||
deposit_requests: payload
|
||||
.deposit_receipts
|
||||
.deposit_requests
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<_>>()
|
||||
@@ -340,7 +340,7 @@ impl<E: EthSpec> From<JsonExecutionPayloadV4<E>> for ExecutionPayloadElectra<E>
|
||||
.into(),
|
||||
blob_gas_used: payload.blob_gas_used,
|
||||
excess_blob_gas: payload.excess_blob_gas,
|
||||
deposit_receipts: payload
|
||||
deposit_requests: payload
|
||||
.deposit_requests
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
@@ -725,7 +725,7 @@ pub struct JsonExecutionPayloadBodyV1<E: EthSpec> {
|
||||
#[serde(with = "ssz_types::serde_utils::list_of_hex_var_list")]
|
||||
pub transactions: Transactions<E>,
|
||||
pub withdrawals: Option<VariableList<JsonWithdrawal, E::MaxWithdrawalsPerPayload>>,
|
||||
pub deposit_receipts: Option<VariableList<JsonDepositRequest, E::MaxDepositReceiptsPerPayload>>,
|
||||
pub deposit_requests: Option<VariableList<JsonDepositRequest, E::MaxDepositRequestsPerPayload>>,
|
||||
pub withdrawal_requests:
|
||||
Option<VariableList<JsonWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>>,
|
||||
}
|
||||
@@ -742,8 +742,8 @@ impl<E: EthSpec> From<JsonExecutionPayloadBodyV1<E>> for ExecutionPayloadBodyV1<
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
}),
|
||||
deposit_receipts: value.deposit_receipts.map(|json_receipts| {
|
||||
DepositReceipts::<E>::from(
|
||||
deposit_requests: value.deposit_requests.map(|json_receipts| {
|
||||
DepositRequests::<E>::from(
|
||||
json_receipts
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
@@ -849,8 +849,8 @@ pub struct JsonDepositRequest {
|
||||
pub index: u64,
|
||||
}
|
||||
|
||||
impl From<DepositReceipt> for JsonDepositRequest {
|
||||
fn from(deposit: DepositReceipt) -> Self {
|
||||
impl From<DepositRequest> for JsonDepositRequest {
|
||||
fn from(deposit: DepositRequest) -> Self {
|
||||
Self {
|
||||
pubkey: deposit.pubkey,
|
||||
withdrawal_credentials: deposit.withdrawal_credentials,
|
||||
@@ -861,7 +861,7 @@ impl From<DepositReceipt> for JsonDepositRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<JsonDepositRequest> for DepositReceipt {
|
||||
impl From<JsonDepositRequest> for DepositRequest {
|
||||
fn from(json_deposit: JsonDepositRequest) -> Self {
|
||||
Self {
|
||||
pubkey: json_deposit.pubkey,
|
||||
|
||||
@@ -1994,14 +1994,14 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
.collect(),
|
||||
)
|
||||
.map_err(ApiError::DeserializeWithdrawals)?;
|
||||
let deposit_receipts = VariableList::new(
|
||||
let deposit_requests = VariableList::new(
|
||||
electra_block
|
||||
.deposit_receipts
|
||||
.deposit_requests
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect(),
|
||||
)
|
||||
.map_err(ApiError::DeserializeDepositReceipts)?;
|
||||
.map_err(ApiError::DeserializeDepositRequests)?;
|
||||
let withdrawal_requests = VariableList::new(
|
||||
electra_block
|
||||
.withdrawal_requests
|
||||
@@ -2028,7 +2028,7 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
withdrawals,
|
||||
blob_gas_used: electra_block.blob_gas_used,
|
||||
excess_blob_gas: electra_block.excess_blob_gas,
|
||||
deposit_receipts,
|
||||
deposit_requests,
|
||||
withdrawal_requests,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
withdrawals: pa.withdrawals.clone().into(),
|
||||
blob_gas_used: 0,
|
||||
excess_blob_gas: 0,
|
||||
deposit_receipts: vec![].into(),
|
||||
deposit_requests: vec![].into(),
|
||||
withdrawal_requests: vec![].into(),
|
||||
}),
|
||||
_ => unreachable!(),
|
||||
|
||||
@@ -589,8 +589,8 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
.withdrawals()
|
||||
.ok()
|
||||
.map(|withdrawals| VariableList::from(withdrawals.clone())),
|
||||
deposit_receipts: block.deposit_receipts().ok().map(
|
||||
|deposit_receipts| VariableList::from(deposit_receipts.clone()),
|
||||
deposit_requests: block.deposit_requests().ok().map(
|
||||
|deposit_requests| VariableList::from(deposit_requests.clone()),
|
||||
),
|
||||
withdrawal_requests: block.withdrawal_requests().ok().map(
|
||||
|withdrawal_requests| {
|
||||
|
||||
Reference in New Issue
Block a user