mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
* First pass
* Add restrictions to RuntimeVariableList api
* Use empty_uninitialized and fix warnings
* Fix some todos
* Merge branch 'unstable' into max-blobs-preset
* Fix take impl on RuntimeFixedList
* cleanup
* Fix test compilations
* Fix some more tests
* Fix test from unstable
* Merge branch 'unstable' into max-blobs-preset
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
* Remove footgun function
* Minor simplifications
* Move from preset to config
* Fix typo
* Revert "Remove footgun function"
This reverts commit de01f923c7.
* Try fixing tests
* Thread through ChainSpec
* Fix release tests
* Move RuntimeFixedVector into module and rename
* Add test
* Remove empty RuntimeVarList awefullness
* Fix tests
* Simplify BlobSidecarListFromRoot
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
* Bump quota to account for new target (6)
* Remove clone
* Fix issue from review
* Try to remove ugliness
* Merge branch 'unstable' into max-blobs-preset
* Fix max value
* Fix doctest
* Fix formatting
* Fix max check
* Delete hardcoded max_blobs_per_block in RPC limits
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
66 lines
2.2 KiB
Rust
66 lines
2.2 KiB
Rust
use crate::{DBColumn, Error, StoreItem};
|
|
use ssz::{Decode, Encode};
|
|
use types::{
|
|
EthSpec, ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella,
|
|
ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu,
|
|
};
|
|
|
|
macro_rules! impl_store_item {
|
|
($ty_name:ident) => {
|
|
impl<E: EthSpec> StoreItem for $ty_name<E> {
|
|
fn db_column() -> DBColumn {
|
|
DBColumn::ExecPayload
|
|
}
|
|
|
|
fn as_store_bytes(&self) -> Vec<u8> {
|
|
self.as_ssz_bytes()
|
|
}
|
|
|
|
fn from_store_bytes(bytes: &[u8]) -> Result<Self, Error> {
|
|
Ok(Self::from_ssz_bytes(bytes)?)
|
|
}
|
|
}
|
|
};
|
|
}
|
|
impl_store_item!(ExecutionPayloadBellatrix);
|
|
impl_store_item!(ExecutionPayloadCapella);
|
|
impl_store_item!(ExecutionPayloadDeneb);
|
|
impl_store_item!(ExecutionPayloadElectra);
|
|
impl_store_item!(ExecutionPayloadFulu);
|
|
|
|
/// This fork-agnostic implementation should be only used for writing.
|
|
///
|
|
/// It is very inefficient at reading, and decoding the desired fork-specific variant is recommended
|
|
/// instead.
|
|
impl<E: EthSpec> StoreItem for ExecutionPayload<E> {
|
|
fn db_column() -> DBColumn {
|
|
DBColumn::ExecPayload
|
|
}
|
|
|
|
fn as_store_bytes(&self) -> Vec<u8> {
|
|
self.as_ssz_bytes()
|
|
}
|
|
|
|
fn from_store_bytes(bytes: &[u8]) -> Result<Self, Error> {
|
|
ExecutionPayloadFulu::from_ssz_bytes(bytes)
|
|
.map(Self::Fulu)
|
|
.or_else(|_| {
|
|
ExecutionPayloadElectra::from_ssz_bytes(bytes)
|
|
.map(Self::Electra)
|
|
.or_else(|_| {
|
|
ExecutionPayloadDeneb::from_ssz_bytes(bytes)
|
|
.map(Self::Deneb)
|
|
.or_else(|_| {
|
|
ExecutionPayloadCapella::from_ssz_bytes(bytes)
|
|
.map(Self::Capella)
|
|
.or_else(|_| {
|
|
ExecutionPayloadBellatrix::from_ssz_bytes(bytes)
|
|
.map(Self::Bellatrix)
|
|
})
|
|
})
|
|
})
|
|
})
|
|
.map_err(Into::into)
|
|
}
|
|
}
|