Skip to content

Commit

Permalink
fix: client
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Jan 30, 2025
1 parent c77a618 commit 9cc1518
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 0 additions & 2 deletions crates/client/src/client/schema/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ pub struct BlockMutation {
#[cynic(schema_path = "./assets/schema.sdl")]
pub enum HeaderVersion {
V1,
#[cfg(feature = "fault-proving")]
V2,
#[cynic(fallback)]
Unknown,
Expand All @@ -148,7 +147,6 @@ pub struct Header {
pub prev_root: Bytes32,
pub time: Tai64Timestamp,
pub application_hash: Bytes32,
#[cfg(feature = "fault-proving")]
pub tx_id_commitment: Bytes32,
}

Expand Down
21 changes: 20 additions & 1 deletion crates/client/src/client/types/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl TryFrom<schema::block::Header> for Header {

fn try_from(value: schema::block::Header) -> Result<Self, Self::Error> {
match value.version {
HeaderVersion::V1 | HeaderVersion::V2 => Ok(Self {
HeaderVersion::V1 => Ok(Self {
id: value.id.into(),
da_height: value.da_height.into(),
consensus_parameters_version: value.consensus_parameters_version.into(),
Expand All @@ -97,6 +97,25 @@ impl TryFrom<schema::block::Header> for Header {
time: value.time.0,
application_hash: value.application_hash.into(),
#[cfg(feature = "fault-proving")]
tx_id_commitment: Hash::default(),
}),
#[cfg(feature = "fault-proving")]
HeaderVersion::V2 => Ok(Self {
id: value.id.into(),
da_height: value.da_height.into(),
consensus_parameters_version: value.consensus_parameters_version.into(),
state_transition_bytecode_version: value
.state_transition_bytecode_version
.into(),
transactions_count: value.transactions_count.into(),
message_receipt_count: value.message_receipt_count.into(),
transactions_root: value.transactions_root.into(),
message_outbox_root: value.message_outbox_root.into(),
event_inbox_root: value.event_inbox_root.into(),
height: value.height.into(),
prev_root: value.prev_root.into(),
time: value.time.0,
application_hash: value.application_hash.into(),
tx_id_commitment: value.tx_id_commitment.into(),
}),
_ => Err(ConversionError::UnknownVariant("HeaderVersion")),
Expand Down

0 comments on commit 9cc1518

Please sign in to comment.