Skip to content

Commit

Permalink
Remove duplicated definitions for SecretIdent and SecretShare
Browse files Browse the repository at this point in the history
  • Loading branch information
DogLooksGood committed Nov 23, 2023
1 parent 5c8ec51 commit 305ee4c
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 113 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ Race Protocol: A multi-chain infrastructure for asymmetric competitive games

# Master(Unreleased)

# 0.2.5

## Fixes
- Remove duplicated definitions for `SecretIdent` and `SecretShare`, which causes the compliation error.

# 0.2.4

## Features
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ members = [
]

[workspace.dependencies]
race-api = { path = "api", version = ">=0.2.4" }
race-proc-macro = { path = "proc-macro", version = ">=0.2.4" }
race-core = { path = "core", version = ">=0.2.4" }
race-client = { path = "client", version = ">=0.2.4" }
race-encryptor = { path = "encryptor", version = ">=0.2.4" }
race-test = { path = "test", version = ">=0.2.4" }
race-api = { path = "api", version = ">=0.2.5" }
race-proc-macro = { path = "proc-macro", version = ">=0.2.5" }
race-core = { path = "core", version = ">=0.2.5" }
race-client = { path = "client", version = ">=0.2.5" }
race-encryptor = { path = "encryptor", version = ">=0.2.5" }
race-test = { path = "test", version = ">=0.2.5" }
race-env = { path = "env", version = "*" }
race-transport = { path = "transport", version = "*" }
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
Expand Down Expand Up @@ -78,7 +78,7 @@ regex = "1"

[workspace.package]
authors = ["RACE Foundation <race.game.team@gmail.com>"]
version = "0.2.4"
version = "0.2.5"
edition = "2021"
rust-version = "1.65.0"
license = "MPL-2.0"
Expand Down
92 changes: 0 additions & 92 deletions core/src/types/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,95 +27,3 @@ impl std::fmt::Display for Signature {
)
}
}

#[derive(Hash, Debug, BorshDeserialize, BorshSerialize, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub struct SecretIdent {
pub from_addr: String,
pub to_addr: Option<String>,
pub random_id: usize,
pub index: usize,
}

impl SecretIdent {
#[allow(unused)]
pub fn new_for_assigned<S: Into<String>>(
random_id: usize,
index: usize,
from_addr: S,
to_addr: S,
) -> Self {
SecretIdent {
from_addr: from_addr.into(),
to_addr: Some(to_addr.into()),
random_id,
index,
}
}

#[allow(unused)]
pub fn new_for_revealed<S: Into<String>>(
random_id: RandomId,
index: usize,
from_addr: S,
) -> Self {
SecretIdent {
from_addr: from_addr.into(),
to_addr: None,
random_id,
index,
}
}
}

#[derive(Hash, Debug, BorshDeserialize, BorshSerialize, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub enum SecretShare {
Random {
from_addr: String,
to_addr: Option<String>,
random_id: RandomId,
index: usize,
secret: Vec<u8>,
},
Answer {
from_addr: String,
decision_id: DecisionId,
secret: Vec<u8>,
},
}

impl std::fmt::Display for SecretShare {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
SecretShare::Random {
from_addr,
to_addr,
random_id,
index,
..
} => {
write!(
f,
"#{}[{}]=>[{}]@{}",
random_id,
from_addr,
match to_addr {
Some(ref addr) => addr.as_str(),
None => "ALL",
},
index
)
}
SecretShare::Answer {
from_addr,
decision_id,
..
} => {
write!(f, "#{}[{}]", decision_id, from_addr)
}
}
}
}
4 changes: 2 additions & 2 deletions js/borsh/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/borsh/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/borsh",
"version": "0.2.4",
"version": "0.2.5",
"description": "A borsh implementation with decorator support",
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/sdk-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/sdk-core",
"version": "0.2.4",
"version": "0.2.5",
"description": "The type definitions for Race SDK",
"scripts": {
"test": "jest",
Expand Down
2 changes: 1 addition & 1 deletion js/sdk-facade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/sdk-facade",
"version": "0.2.4",
"version": "0.2.5",
"description": "The Facade integration for Race SDK",
"main": "lib/cjs/index.ts",
"module": "lib/esm/index.js",
Expand Down
4 changes: 2 additions & 2 deletions js/sdk-solana/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/sdk-solana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/sdk-solana",
"version": "0.2.4",
"version": "0.2.5",
"description": "The Solana support for Race SDK",
"scripts": {
"test": "jest",
Expand Down

0 comments on commit 305ee4c

Please sign in to comment.