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:
Michael Sproul
2022-01-06 03:14:58 +00:00
parent 0b54ff17f2
commit fac117667b
12 changed files with 19 additions and 41 deletions

View File

@@ -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()
}
}

View File

@@ -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 {