Skip to content

Commit 63dc968

Browse files
committed
fix comment 11
1 parent fbd66ec commit 63dc968

2 files changed

Lines changed: 36 additions & 6 deletions

File tree

crates/core/src/dutydb/memory.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,6 @@ pub(crate) mod tests {
787787
},
788788
};
789789
VersionedProposal {
790-
version: versioned::DataVersion::Phase0,
791-
blinded: false,
792790
block: ProposalBlock::Phase0(block),
793791
}
794792
}

crates/core/src/signeddata.rs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,31 @@ pub enum ProposalBlock {
12101210
}
12111211

12121212
impl ProposalBlock {
1213+
/// Returns the fork version of this block.
1214+
pub fn version(&self) -> versioned::DataVersion {
1215+
match self {
1216+
Self::Phase0(_) => versioned::DataVersion::Phase0,
1217+
Self::Altair(_) => versioned::DataVersion::Altair,
1218+
Self::Bellatrix(_) | Self::BellatrixBlinded(_) => versioned::DataVersion::Bellatrix,
1219+
Self::Capella(_) | Self::CapellaBlinded(_) => versioned::DataVersion::Capella,
1220+
Self::Deneb { .. } | Self::DenebBlinded(_) => versioned::DataVersion::Deneb,
1221+
Self::Electra { .. } | Self::ElectraBlinded(_) => versioned::DataVersion::Electra,
1222+
Self::Fulu { .. } | Self::FuluBlinded(_) => versioned::DataVersion::Fulu,
1223+
}
1224+
}
1225+
1226+
/// Returns true if this is a blinded block.
1227+
pub fn is_blinded(&self) -> bool {
1228+
matches!(
1229+
self,
1230+
Self::BellatrixBlinded(_)
1231+
| Self::CapellaBlinded(_)
1232+
| Self::DenebBlinded(_)
1233+
| Self::ElectraBlinded(_)
1234+
| Self::FuluBlinded(_)
1235+
)
1236+
}
1237+
12131238
/// Returns the slot of this block.
12141239
pub fn slot(&self) -> phase0::Slot {
12151240
match self {
@@ -1250,15 +1275,22 @@ impl ProposalBlock {
12501275
/// Unsigned versioned proposal across all supported forks.
12511276
#[derive(Debug, Clone, PartialEq, Eq)]
12521277
pub struct VersionedProposal {
1253-
/// Fork version.
1254-
pub version: versioned::DataVersion,
1255-
/// True if this is a blinded proposal.
1256-
pub blinded: bool,
12571278
/// Unsigned block payload.
12581279
pub block: ProposalBlock,
12591280
}
12601281

12611282
impl VersionedProposal {
1283+
/// Returns the fork version, derived from the block variant.
1284+
pub fn version(&self) -> versioned::DataVersion {
1285+
self.block.version()
1286+
}
1287+
1288+
/// Returns true if this is a blinded proposal, derived from the block
1289+
/// variant.
1290+
pub fn is_blinded(&self) -> bool {
1291+
self.block.is_blinded()
1292+
}
1293+
12621294
/// Returns the slot of the proposal block.
12631295
pub fn slot(&self) -> phase0::Slot {
12641296
self.block.slot()

0 commit comments

Comments
 (0)