mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 21:27:12 +00:00
resolve merge conflicts
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
use super::*;
|
||||
use alloy_rlp::RlpEncodable;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz::{Decode, TryFromIter};
|
||||
use ssz::{Decode, Encode, TryFromIter};
|
||||
use ssz_types::{FixedVector, VariableList, typenum::Unsigned};
|
||||
use strum::EnumString;
|
||||
use superstruct::superstruct;
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::BlobsList;
|
||||
use types::execution_requests::{
|
||||
ConsolidationRequests, DepositRequests, RequestType, WithdrawalRequests,
|
||||
};
|
||||
use types::data::BlobsList;
|
||||
use types::execution::{ConsolidationRequests, DepositRequests, RequestType, WithdrawalRequests};
|
||||
use types::kzg_ext::KzgCommitments;
|
||||
use types::{Blob, KzgProof};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
@@ -109,6 +107,12 @@ pub struct JsonExecutionPayload<E: EthSpec> {
|
||||
#[superstruct(only(Deneb, Electra, Fulu, Eip7805, Gloas))]
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub excess_blob_gas: u64,
|
||||
#[superstruct(only(Gloas))]
|
||||
#[serde(with = "ssz_types::serde_utils::hex_var_list")]
|
||||
pub block_access_list: VariableList<u8, E::MaxBytesPerTransaction>,
|
||||
#[superstruct(only(Gloas))]
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub slot_number: u64,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<ExecutionPayloadBellatrix<E>> for JsonExecutionPayloadBellatrix<E> {
|
||||
@@ -280,6 +284,8 @@ impl<E: EthSpec> TryFrom<ExecutionPayloadGloas<E>> for JsonExecutionPayloadGloas
|
||||
withdrawals: withdrawals_to_json(payload.withdrawals)?,
|
||||
blob_gas_used: payload.blob_gas_used,
|
||||
excess_blob_gas: payload.excess_blob_gas,
|
||||
block_access_list: payload.block_access_list,
|
||||
slot_number: payload.slot_number.into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -482,6 +488,8 @@ impl<E: EthSpec> TryFrom<JsonExecutionPayloadGloas<E>> for ExecutionPayloadGloas
|
||||
withdrawals: withdrawals_from_json(payload.withdrawals)?,
|
||||
blob_gas_used: payload.blob_gas_used,
|
||||
excess_blob_gas: payload.excess_blob_gas,
|
||||
block_access_list: payload.block_access_list,
|
||||
slot_number: payload.slot_number.into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -531,6 +539,34 @@ pub enum RequestsError {
|
||||
#[serde(transparent)]
|
||||
pub struct JsonExecutionRequests(pub Vec<String>);
|
||||
|
||||
impl<E: EthSpec> From<ExecutionRequests<E>> for JsonExecutionRequests {
|
||||
fn from(requests: ExecutionRequests<E>) -> Self {
|
||||
let mut result = Vec::new();
|
||||
if !requests.deposits.is_empty() {
|
||||
result.push(format!(
|
||||
"0x{:02x}{}",
|
||||
RequestType::Deposit.to_u8(),
|
||||
hex::encode(requests.deposits.as_ssz_bytes())
|
||||
));
|
||||
}
|
||||
if !requests.withdrawals.is_empty() {
|
||||
result.push(format!(
|
||||
"0x{:02x}{}",
|
||||
RequestType::Withdrawal.to_u8(),
|
||||
hex::encode(requests.withdrawals.as_ssz_bytes())
|
||||
));
|
||||
}
|
||||
if !requests.consolidations.is_empty() {
|
||||
result.push(format!(
|
||||
"0x{:02x}{}",
|
||||
RequestType::Consolidation.to_u8(),
|
||||
hex::encode(requests.consolidations.as_ssz_bytes())
|
||||
));
|
||||
}
|
||||
JsonExecutionRequests(result)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequests<E> {
|
||||
type Error = RequestsError;
|
||||
|
||||
@@ -791,7 +827,7 @@ impl<'a> From<&'a JsonWithdrawal> for EncodableJsonWithdrawal<'a> {
|
||||
}
|
||||
|
||||
#[superstruct(
|
||||
variants(V1, V2, V3),
|
||||
variants(V1, V2, V3, V4),
|
||||
variant_attributes(
|
||||
derive(Debug, Clone, PartialEq, Serialize, Deserialize),
|
||||
serde(rename_all = "camelCase")
|
||||
@@ -807,10 +843,13 @@ pub struct JsonPayloadAttributes {
|
||||
pub prev_randao: Hash256,
|
||||
#[serde(with = "serde_utils::address_hex")]
|
||||
pub suggested_fee_recipient: Address,
|
||||
#[superstruct(only(V2, V3))]
|
||||
#[superstruct(only(V2, V3, V4))]
|
||||
pub withdrawals: Vec<JsonWithdrawal>,
|
||||
#[superstruct(only(V3))]
|
||||
#[superstruct(only(V3, V4))]
|
||||
pub parent_beacon_block_root: Hash256,
|
||||
#[superstruct(only(V4))]
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub slot_number: u64,
|
||||
}
|
||||
|
||||
impl From<PayloadAttributes> for JsonPayloadAttributes {
|
||||
@@ -834,6 +873,14 @@ impl From<PayloadAttributes> for JsonPayloadAttributes {
|
||||
withdrawals: pa.withdrawals.into_iter().map(Into::into).collect(),
|
||||
parent_beacon_block_root: pa.parent_beacon_block_root,
|
||||
}),
|
||||
PayloadAttributes::V4(pa) => Self::V4(JsonPayloadAttributesV4 {
|
||||
timestamp: pa.timestamp,
|
||||
prev_randao: pa.prev_randao,
|
||||
suggested_fee_recipient: pa.suggested_fee_recipient,
|
||||
withdrawals: pa.withdrawals.into_iter().map(Into::into).collect(),
|
||||
parent_beacon_block_root: pa.parent_beacon_block_root,
|
||||
slot_number: pa.slot_number,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -859,6 +906,14 @@ impl From<JsonPayloadAttributes> for PayloadAttributes {
|
||||
withdrawals: jpa.withdrawals.into_iter().map(Into::into).collect(),
|
||||
parent_beacon_block_root: jpa.parent_beacon_block_root,
|
||||
}),
|
||||
JsonPayloadAttributes::V4(jpa) => Self::V4(PayloadAttributesV4 {
|
||||
timestamp: jpa.timestamp,
|
||||
prev_randao: jpa.prev_randao,
|
||||
suggested_fee_recipient: jpa.suggested_fee_recipient,
|
||||
withdrawals: jpa.withdrawals.into_iter().map(Into::into).collect(),
|
||||
parent_beacon_block_root: jpa.parent_beacon_block_root,
|
||||
slot_number: jpa.slot_number,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -910,6 +965,9 @@ pub struct BlobAndProof<E: EthSpec> {
|
||||
pub proofs: KzgProofs<E>,
|
||||
}
|
||||
|
||||
/// A BlobAndProofV3 is just a BlobAndProofV2 that may also be `null` if unknown by the EL.
|
||||
pub type BlobAndProofV3<E> = Option<BlobAndProofV2<E>>;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct JsonForkchoiceStateV1 {
|
||||
|
||||
Reference in New Issue
Block a user