reversed the dependency between 'nym-contracts-common' and 'dkg' (#3089)

This commit is contained in:
Jędrzej Stuczyński
2023-02-22 15:19:52 +00:00
committed by GitHub
parent 2553d633ae
commit e09b2ab7d6
6 changed files with 27 additions and 21 deletions
Generated
+1 -1
View File
@@ -1601,6 +1601,7 @@ dependencies = [
"ff 0.11.1",
"group 0.11.0",
"lazy_static",
"nym-contracts-common",
"nym-pemstore",
"rand 0.8.5",
"rand_chacha 0.3.1",
@@ -3519,7 +3520,6 @@ version = "0.1.0"
dependencies = [
"bs58",
"cosmwasm-std",
"dkg",
"schemars",
"serde",
"serde_json",
@@ -9,7 +9,6 @@ edition = "2021"
[dependencies]
bs58 = "0.4.0"
cosmwasm-std = "1.0.0"
dkg = { path = "../../../common/dkg", optional = true }
schemars = "0.8"
serde = { version = "1.0", features = ["derive"] }
thiserror = "1"
@@ -69,19 +69,3 @@ impl<'de> Deserialize<'de> for ContractSafeBytes {
Ok(ContractSafeBytes(bytes))
}
}
#[cfg(feature = "dkg")]
impl<'a> From<&'a Dealing> for ContractSafeBytes {
fn from(dealing: &'a Dealing) -> Self {
ContractSafeBytes(dealing.to_bytes())
}
}
#[cfg(feature = "dkg")]
impl<'a> TryFrom<&'a ContractSafeBytes> for Dealing {
type Error = DkgError;
fn try_from(value: &'a ContractSafeBytes) -> Result<Self, Self::Error> {
Dealing::try_from_bytes(&value.0)
}
}
+6 -1
View File
@@ -12,9 +12,10 @@ bitvec = "1.0.0"
# unfortunately until https://github.com/zkcrypto/bls12_381/issues/10 is resolved, we have to rely on the fork
# as we need to be able to serialize Gt so that we could create the lookup table for baby-step-giant-step algorithm
bls12_381 = { git = "https://github.com/jstuczyn/bls12_381", branch ="gt-serialisation", default-features = false, features = ["alloc", "pairings", "experimental", "zeroize"] }
nym-contracts-common = { path = "../cosmwasm-smart-contracts/contracts-common", optional = true }
bs58 = "0.4"
lazy_static = "1.4.0"
rand = { version = "0.8.5", default-features = false}
rand_chacha = "0.3"
@@ -41,3 +42,7 @@ criterion = "0.3"
[[bench]]
name = "benchmarks"
harness = false
[features]
default = []
cw-types = ["nym-contracts-common"]
+18
View File
@@ -307,6 +307,24 @@ impl Dealing {
}
}
#[cfg(feature = "cw-types")]
impl<'a> From<&'a Dealing> for nym_contracts_common::dealings::ContractSafeBytes {
fn from(dealing: &'a Dealing) -> Self {
nym_contracts_common::dealings::ContractSafeBytes(dealing.to_bytes())
}
}
#[cfg(feature = "cw-types")]
impl<'a> TryFrom<&'a nym_contracts_common::dealings::ContractSafeBytes> for Dealing {
type Error = DkgError;
fn try_from(
value: &'a nym_contracts_common::dealings::ContractSafeBytes,
) -> Result<Self, Self::Error> {
Dealing::try_from_bytes(&value.0)
}
}
// this assumes all dealings have been verified
pub fn try_recover_verification_keys(
dealings: &[Dealing],
+2 -2
View File
@@ -75,12 +75,12 @@ credentials = { path = "../common/credentials" }
nym-crypto = { path = "../common/crypto" }
cw3 = { version = "0.13.4" }
cw4 = { version = "0.13.4" }
dkg = { path = "../common/dkg" }
dkg = { path = "../common/dkg", features = ["cw-types"] }
gateway-client = { path = "../common/client-libs/gateway-client" }
nym-inclusion-probability = { path = "../common/inclusion-probability" }
nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet-contract" }
nym-vesting-contract-common = { path = "../common/cosmwasm-smart-contracts/vesting-contract" }
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common", features = ["dkg"] }
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" }
multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" }
nymcoconut = { path = "../common/nymcoconut" }
nym-sphinx = { path = "../common/nymsphinx" }