Skip to content

Commit

Permalink
Remove TssId.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvc94ch committed Jul 2, 2024
1 parent ec45342 commit 2d78da6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
22 changes: 1 addition & 21 deletions primitives/src/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use futures::channel::oneshot;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};

use crate::{TaskId, TaskPhase};
use crate::TaskExecution;
use scale_codec::{Decode, Encode};
use scale_info::prelude::string::String;
use scale_info::TypeInfo;
Expand All @@ -20,26 +20,6 @@ pub type ShardId = u64;
pub type ProofOfKnowledge = [u8; 65];
pub type Commitment = Vec<TssPublicKey>;

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TssId {
task_id: TaskId,
task_phase: TaskPhase,
}

impl TssId {
pub fn new(task_id: TaskId, task_phase: TaskPhase) -> Self {
Self { task_id, task_phase }
}
}

#[cfg(feature = "std")]
impl std::fmt::Display for TssId {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}-{}", self.task_id, self.task_phase)
}
}

#[derive(Debug, Clone, Eq, PartialEq, Encode, Decode, TypeInfo)]
pub enum MemberStatus {
Added,
Expand Down
6 changes: 3 additions & 3 deletions primitives/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ impl Default for TaskPhase {
}
}

#[cfg_attr(feature = "std", derive(Serialize))]
#[derive(Debug, Clone, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Clone, Copy, Debug, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TaskExecution {
pub task_id: TaskId,
pub phase: TaskPhase,
Expand All @@ -189,7 +189,7 @@ impl TaskExecution {
#[cfg(feature = "std")]
impl std::fmt::Display for TaskExecution {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.task_id)
write!(f, "{}-{}", self.task_id, self.phase)
}
}

Expand Down

0 comments on commit 2d78da6

Please sign in to comment.