mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 21:38:31 +00:00
Update to superstruct v0.4.1 (#2886)
## Proposed Changes Update `superstruct` to bring in @realbigsean's fixes necessary for MEV-compatible private beacon block types (a la #2795). The refactoring is due to another change in superstruct that allows partial getters to be auto-generated.
This commit is contained in:
@@ -237,13 +237,8 @@ impl<'a, T: EthSpec> BeaconBlockRef<'a, T> {
|
||||
|
||||
/// Extracts a reference to an execution payload from a block, returning an error if the block
|
||||
/// is pre-merge.
|
||||
pub fn execution_payload(&self) -> Result<&ExecutionPayload<T>, InconsistentFork> {
|
||||
self.body()
|
||||
.execution_payload()
|
||||
.ok_or_else(|| InconsistentFork {
|
||||
fork_at_slot: ForkName::Merge,
|
||||
object_fork: self.body().fork_name(),
|
||||
})
|
||||
pub fn execution_payload(&self) -> Result<&ExecutionPayload<T>, Error> {
|
||||
self.body().execution_payload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,24 +50,6 @@ pub struct BeaconBlockBody<T: EthSpec> {
|
||||
}
|
||||
|
||||
impl<'a, T: EthSpec> BeaconBlockBodyRef<'a, T> {
|
||||
/// Access the sync aggregate from the block's body, if one exists.
|
||||
pub fn sync_aggregate(self) -> Option<&'a SyncAggregate<T>> {
|
||||
match self {
|
||||
BeaconBlockBodyRef::Base(_) => None,
|
||||
BeaconBlockBodyRef::Altair(inner) => Some(&inner.sync_aggregate),
|
||||
BeaconBlockBodyRef::Merge(inner) => Some(&inner.sync_aggregate),
|
||||
}
|
||||
}
|
||||
|
||||
/// Access the execution payload from the block's body, if one exists.
|
||||
pub fn execution_payload(self) -> Option<&'a ExecutionPayload<T>> {
|
||||
match self {
|
||||
BeaconBlockBodyRef::Base(_) => None,
|
||||
BeaconBlockBodyRef::Altair(_) => None,
|
||||
BeaconBlockBodyRef::Merge(inner) => Some(&inner.execution_payload),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the fork_name of this object
|
||||
pub fn fork_name(self) -> ForkName {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user