Add nym prefix to coconut contracts and crates (#3160)

* Add nym prefix to coconut-dkg

* Add nym prefix to coconut-bandwidth

* Add nym prefix to bandwidth-claim-contract

* Add nym prefix to coconut-bandwidth-contract-common

* Add nym prefix to coconut-dkg-common

* Add nym prefix to group-contract-common

* Add nym prefix to multisig-contract-common

* Add nym prefix to coconut-interface

* Add nym prefix to credential-storage

* rustfmt

* Mark coconut-test crate as private

* Fix build errors

* rustfmt
This commit is contained in:
Jon Häggblad
2023-03-08 13:17:09 +01:00
committed by GitHub
parent 0741d05ab3
commit d315a2a91b
108 changed files with 538 additions and 527 deletions
Generated
+101 -101
View File
@@ -246,14 +246,6 @@ dependencies = [
"tower-service",
]
[[package]]
name = "bandwidth-claim-contract"
version = "0.1.0"
dependencies = [
"schemars",
"serde",
]
[[package]]
name = "base16ct"
version = "0.1.1"
@@ -701,39 +693,6 @@ dependencies = [
"bitflags",
]
[[package]]
name = "coconut-bandwidth-contract-common"
version = "0.1.0"
dependencies = [
"cosmwasm-std",
"multisig-contract-common",
"schemars",
"serde",
]
[[package]]
name = "coconut-dkg-common"
version = "0.1.0"
dependencies = [
"cosmwasm-std",
"cw-utils",
"multisig-contract-common",
"nym-contracts-common",
"schemars",
"serde",
]
[[package]]
name = "coconut-interface"
version = "0.1.0"
dependencies = [
"bs58",
"getset",
"nymcoconut",
"serde",
"thiserror",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@@ -974,11 +933,11 @@ version = "0.1.0"
dependencies = [
"bip39",
"clap 4.1.4",
"coconut-interface",
"credential-storage",
"log",
"nym-bin-common",
"nym-coconut-interface",
"nym-config",
"nym-credential-storage",
"nym-credentials",
"nym-crypto",
"nym-network-defaults",
@@ -991,17 +950,6 @@ dependencies = [
"validator-client",
]
[[package]]
name = "credential-storage"
version = "0.1.0"
dependencies = [
"async-trait",
"log",
"sqlx 0.5.13",
"thiserror",
"tokio",
]
[[package]]
name = "criterion"
version = "0.4.0"
@@ -1934,13 +1882,13 @@ name = "gateway-client"
version = "0.1.0"
dependencies = [
"async-trait",
"coconut-interface",
"credential-storage",
"futures",
"gateway-requests",
"getrandom 0.2.8",
"log",
"mobile-storage",
"nym-coconut-interface",
"nym-credential-storage",
"nym-credentials",
"nym-crypto",
"nym-network-defaults",
@@ -1967,9 +1915,9 @@ name = "gateway-requests"
version = "0.1.0"
dependencies = [
"bs58",
"coconut-interface",
"futures",
"log",
"nym-coconut-interface",
"nym-credentials",
"nym-crypto",
"nym-pemstore",
@@ -2122,15 +2070,6 @@ dependencies = [
"subtle 2.4.1",
]
[[package]]
name = "group-contract-common"
version = "0.1.0"
dependencies = [
"cw4",
"schemars",
"serde",
]
[[package]]
name = "h2"
version = "0.3.15"
@@ -3027,20 +2966,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "multisig-contract-common"
version = "0.1.0"
dependencies = [
"cosmwasm-std",
"cw-utils",
"cw3",
"cw3-fixed-multisig",
"cw4",
"schemars",
"serde",
"thiserror",
]
[[package]]
name = "native-tls"
version = "0.2.11"
@@ -3145,12 +3070,8 @@ dependencies = [
"bs58",
"cfg-if",
"clap 4.1.4",
"coconut-bandwidth-contract-common",
"coconut-dkg-common",
"coconut-interface",
"console-subscriber",
"cosmwasm-std",
"credential-storage",
"cw-utils",
"cw3",
"cw4",
@@ -3161,16 +3082,20 @@ dependencies = [
"humantime-serde",
"lazy_static",
"log",
"multisig-contract-common",
"nym-api-requests",
"nym-bin-common",
"nym-coconut-bandwidth-contract-common",
"nym-coconut-dkg-common",
"nym-coconut-interface",
"nym-config",
"nym-contracts-common",
"nym-credential-storage",
"nym-credentials",
"nym-crypto",
"nym-dkg",
"nym-inclusion-probability",
"nym-mixnet-contract-common",
"nym-multisig-contract-common",
"nym-pemstore",
"nym-sphinx",
"nym-task",
@@ -3205,16 +3130,24 @@ name = "nym-api-requests"
version = "0.1.0"
dependencies = [
"bs58",
"coconut-interface",
"cosmrs",
"cosmwasm-std",
"getset",
"nym-coconut-interface",
"nym-mixnet-contract-common",
"schemars",
"serde",
"ts-rs",
]
[[package]]
name = "nym-bandwidth-claim-contract"
version = "0.1.0"
dependencies = [
"schemars",
"serde",
]
[[package]]
name = "nym-bin-common"
version = "0.2.0"
@@ -3277,8 +3210,6 @@ dependencies = [
"bs58",
"cfg-if",
"clap 4.1.4",
"coconut-bandwidth-contract-common",
"coconut-dkg-common",
"comfy-table",
"cosmrs",
"cosmwasm-std",
@@ -3287,8 +3218,10 @@ dependencies = [
"humantime-serde",
"k256",
"log",
"multisig-contract-common",
"nym-coconut-bandwidth-contract-common",
"nym-coconut-dkg-common",
"nym-mixnet-contract-common",
"nym-multisig-contract-common",
"nym-network-defaults",
"nym-vesting-contract-common",
"rand 0.6.5",
@@ -3308,8 +3241,6 @@ version = "1.1.12"
dependencies = [
"clap 4.1.4",
"client-core",
"coconut-interface",
"credential-storage",
"dirs",
"futures",
"gateway-client",
@@ -3317,7 +3248,9 @@ dependencies = [
"lazy_static",
"log",
"nym-bin-common",
"nym-coconut-interface",
"nym-config",
"nym-credential-storage",
"nym-credentials",
"nym-crypto",
"nym-network-defaults",
@@ -3338,6 +3271,39 @@ dependencies = [
"websocket-requests",
]
[[package]]
name = "nym-coconut-bandwidth-contract-common"
version = "0.1.0"
dependencies = [
"cosmwasm-std",
"nym-multisig-contract-common",
"schemars",
"serde",
]
[[package]]
name = "nym-coconut-dkg-common"
version = "0.1.0"
dependencies = [
"cosmwasm-std",
"cw-utils",
"nym-contracts-common",
"nym-multisig-contract-common",
"schemars",
"serde",
]
[[package]]
name = "nym-coconut-interface"
version = "0.1.0"
dependencies = [
"bs58",
"getset",
"nymcoconut",
"serde",
"thiserror",
]
[[package]]
name = "nym-config"
version = "0.1.0"
@@ -3363,14 +3329,25 @@ dependencies = [
"thiserror",
]
[[package]]
name = "nym-credential-storage"
version = "0.1.0"
dependencies = [
"async-trait",
"log",
"sqlx 0.5.13",
"thiserror",
"tokio",
]
[[package]]
name = "nym-credentials"
version = "0.1.0"
dependencies = [
"bls12_381 0.5.0",
"coconut-interface",
"cosmrs",
"nym-api-requests",
"nym-coconut-interface",
"nym-crypto",
"rand 0.7.3",
"thiserror",
@@ -3443,7 +3420,6 @@ dependencies = [
"bip39",
"bs58",
"clap 4.1.4",
"coconut-interface",
"colored",
"dashmap 4.0.2",
"dirs",
@@ -3457,6 +3433,7 @@ dependencies = [
"mixnode-common",
"nym-api-requests",
"nym-bin-common",
"nym-coconut-interface",
"nym-config",
"nym-credentials",
"nym-crypto",
@@ -3482,6 +3459,15 @@ dependencies = [
"validator-client",
]
[[package]]
name = "nym-group-contract-common"
version = "0.1.0"
dependencies = [
"cw4",
"schemars",
"serde",
]
[[package]]
name = "nym-inclusion-probability"
version = "0.1.0"
@@ -3551,6 +3537,20 @@ dependencies = [
"validator-client",
]
[[package]]
name = "nym-multisig-contract-common"
version = "0.1.0"
dependencies = [
"cosmwasm-std",
"cw-utils",
"cw3",
"cw3-fixed-multisig",
"cw4",
"schemars",
"serde",
"thiserror",
]
[[package]]
name = "nym-network-defaults"
version = "0.1.0"
@@ -3708,8 +3708,6 @@ version = "1.1.12"
dependencies = [
"clap 4.1.4",
"client-core",
"coconut-interface",
"credential-storage",
"dirs",
"futures",
"gateway-client",
@@ -3718,7 +3716,9 @@ dependencies = [
"log",
"mobile-storage",
"nym-bin-common",
"nym-coconut-interface",
"nym-config",
"nym-credential-storage",
"nym-credentials",
"nym-crypto",
"nym-network-defaults",
@@ -3941,12 +3941,12 @@ dependencies = [
name = "nym-types"
version = "1.0.0"
dependencies = [
"coconut-interface",
"cosmrs",
"cosmwasm-std",
"eyre",
"itertools",
"log",
"nym-coconut-interface",
"nym-config",
"nym-mixnet-contract-common",
"nym-vesting-contract",
@@ -6745,9 +6745,6 @@ dependencies = [
"async-trait",
"base64 0.13.1",
"bip39",
"coconut-bandwidth-contract-common",
"coconut-dkg-common",
"coconut-interface",
"colored",
"cosmrs",
"cosmwasm-std",
@@ -6755,15 +6752,18 @@ dependencies = [
"cw4",
"flate2",
"futures",
"group-contract-common",
"itertools",
"log",
"multisig-contract-common",
"nym-api-requests",
"nym-coconut-bandwidth-contract-common",
"nym-coconut-dkg-common",
"nym-coconut-interface",
"nym-config",
"nym-contracts-common",
"nym-execute",
"nym-group-contract-common",
"nym-mixnet-contract-common",
"nym-multisig-contract-common",
"nym-network-defaults",
"nym-vesting-contract",
"nym-vesting-contract-common",
+2 -2
View File
@@ -15,10 +15,10 @@ thiserror = "1.0"
url = "2.2"
tokio = { version = "1.24.1", features = ["rt-multi-thread", "net", "signal", "macros"] } # async runtime
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-config = { path = "../../common/config" }
nym-credentials = { path = "../../common/credentials" }
credential-storage = { path = "../../common/credential-storage" }
nym-credential-storage = { path = "../../common/credential-storage" }
nym-crypto = { path = "../../common/crypto", features = ["rand", "asymmetric", "symmetric", "aes", "hashing"] }
nym-bin-common = { path = "../../common/bin-common"}
nym-network-defaults = { path = "../../common/network-defaults" }
+3 -3
View File
@@ -7,9 +7,9 @@ use nym_bin_common::completions::ArgShell;
use rand::rngs::OsRng;
use std::str::FromStr;
use coconut_interface::{Base58, Parameters};
use credential_storage::storage::Storage;
use credential_storage::PersistentStorage;
use nym_coconut_interface::{Base58, Parameters};
use nym_credential_storage::storage::Storage;
use nym_credential_storage::PersistentStorage;
use nym_credentials::coconut::bandwidth::{BandwidthVoucher, TOTAL_ATTRIBUTES};
use nym_credentials::coconut::utils::obtain_aggregate_signature;
use nym_crypto::asymmetric::{encryption, identity};
+1 -1
View File
@@ -4,7 +4,7 @@
use std::time::SystemTimeError;
use thiserror::Error;
use credential_storage::error::StorageError;
use nym_credential_storage::error::StorageError;
use nym_credentials::error::Error as CredentialError;
use nym_crypto::asymmetric::encryption::KeyRecoveryError;
use nym_crypto::asymmetric::identity::Ed25519RecoveryError;
+1 -1
View File
@@ -77,7 +77,7 @@ async fn main() -> Result<()> {
.client_home_directory
.join(DATA_DIR)
.join(CRED_DB_FILE_NAME);
let shared_storage = credential_storage::initialise_storage(db_path).await;
let shared_storage = nym_credential_storage::initialise_storage(db_path).await;
let recovery_storage = recovery_storage::RecoveryStorage::new(r.recovery_dir)?;
let network_details = NymNetworkDetails::new_from_env();
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_interface::Parameters;
use nym_coconut_interface::Parameters;
use nym_credentials::coconut::bandwidth::BandwidthVoucher;
use nym_crypto::asymmetric::{encryption, identity};
+2 -2
View File
@@ -36,9 +36,9 @@ tokio-tungstenite = "0.14" # websocket
## internal
nym-bin-common = { path = "../../common/bin-common" }
client-core = { path = "../client-core", features = ["fs-surb-storage"] }
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-config = { path = "../../common/config" }
credential-storage = { path = "../../common/credential-storage" }
nym-credential-storage = { path = "../../common/credential-storage" }
nym-credentials = { path = "../../common/credentials" }
nym-crypto = { path = "../../common/crypto" }
gateway-client = { path = "../../common/client-libs/gateway-client" }
+1 -1
View File
@@ -74,7 +74,7 @@ impl SocketClient {
let client = validator_client::Client::new_query(client_config)
.expect("Could not construct query client");
BandwidthController::new(
credential_storage::initialise_storage(config.get_base().get_database_path()).await,
nym_credential_storage::initialise_storage(config.get_base().get_database_path()).await,
client,
)
}
+3 -3
View File
@@ -29,9 +29,9 @@ url = "2.2"
# internal
nym-bin-common = { path = "../../common/bin-common" }
client-core = { path = "../client-core", features = ["fs-surb-storage"] }
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-config = { path = "../../common/config" }
credential-storage = { path = "../../common/credential-storage", optional = true }
nym-credential-storage = { path = "../../common/credential-storage", optional = true }
mobile-storage = { path = "../../common/mobile-storage", optional = true }
nym-credentials = { path = "../../common/credentials" }
nym-crypto = { path = "../../common/crypto" }
@@ -49,6 +49,6 @@ nym-topology = { path = "../../common/topology" }
validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] }
[features]
default = ["credential-storage"]
default = ["nym-credential-storage"]
eth = []
mobile = ["mobile-storage", "gateway-client/mobile"]
+1 -1
View File
@@ -92,7 +92,7 @@ impl NymClient {
#[cfg(not(feature = "mobile"))]
let storage =
credential_storage::initialise_storage(config.get_base().get_database_path()).await;
nym_credential_storage::initialise_storage(config.get_base().get_database_path()).await;
#[cfg(feature = "mobile")]
let storage = mobile_storage::PersistentStorage {};
+1 -1
View File
@@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4"
# internal
client-core = { path = "../client-core", default-features = false, features = ["wasm"] }
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-credentials = { path = "../../common/credentials" }
nym-crypto = { path = "../../common/crypto" }
nym-sphinx = { path = "../../common/nymsphinx" }
+1 -1
View File
@@ -1,5 +1,5 @@
[package]
name = "bandwidth-claim-contract"
name = "nym-bandwidth-claim-contract"
version = "0.1.0"
edition = "2021"
+2 -2
View File
@@ -18,7 +18,7 @@ async-trait = { workspace = true }
tokio = { version = "1.24.1", features = ["macros"] }
# internal
coconut-interface = { path = "../../coconut-interface" }
nym-coconut-interface = { path = "../../coconut-interface" }
nym-credentials = { path = "../../credentials" }
nym-crypto = { path = "../../crypto" }
gateway-requests = { path = "../../../gateway/gateway-requests" }
@@ -47,7 +47,7 @@ features = ["net", "sync", "time"]
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-tungstenite]
version = "0.14"
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.credential-storage]
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.nym-credential-storage]
path = "../../credential-storage"
# wasm-only dependencies
@@ -7,7 +7,7 @@ use crate::error::GatewayClientError;
use crate::wasm_mockups::Storage;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "mobile"))]
use credential_storage::storage::Storage;
use nym_credential_storage::storage::Storage;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "mobile")]
@@ -22,7 +22,7 @@ use crate::wasm_mockups::StorageError;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "mobile"))]
use credential_storage::error::StorageError;
use nym_credential_storage::error::StorageError;
#[cfg(target_arch = "wasm32")]
use crate::wasm_mockups::{Client, CosmWasmClient};
@@ -30,7 +30,7 @@ use std::str::FromStr;
#[cfg(not(target_arch = "wasm32"))]
use validator_client::{nyxd::CosmWasmClient, Client};
use {
coconut_interface::Base58,
nym_coconut_interface::Base58,
nym_credentials::coconut::{
bandwidth::prepare_for_spending, utils::obtain_aggregate_verification_key,
},
@@ -42,7 +42,7 @@ use crate::wasm_mockups::PersistentStorage;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "mobile"))]
use credential_storage::PersistentStorage;
use nym_credential_storage::PersistentStorage;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "mobile")]
@@ -69,17 +69,17 @@ where
pub async fn prepare_coconut_credential(
&self,
) -> Result<(coconut_interface::Credential, i64), GatewayClientError> {
) -> Result<(nym_coconut_interface::Credential, i64), GatewayClientError> {
let bandwidth_credential = self.storage.get_next_coconut_credential().await?;
let voucher_value = u64::from_str(&bandwidth_credential.voucher_value)
.map_err(|_| StorageError::InconsistentData)?;
let voucher_info = bandwidth_credential.voucher_info.clone();
let serial_number =
coconut_interface::Attribute::try_from_bs58(bandwidth_credential.serial_number)?;
nym_coconut_interface::Attribute::try_from_bs58(bandwidth_credential.serial_number)?;
let binding_number =
coconut_interface::Attribute::try_from_bs58(bandwidth_credential.binding_number)?;
nym_coconut_interface::Attribute::try_from_bs58(bandwidth_credential.binding_number)?;
let signature =
coconut_interface::Signature::try_from_bs58(bandwidth_credential.signature)?;
nym_coconut_interface::Signature::try_from_bs58(bandwidth_credential.signature)?;
let epoch_id = u64::from_str(&bandwidth_credential.epoch_id)
.map_err(|_| StorageError::InconsistentData)?;
@@ -9,13 +9,13 @@ pub use crate::packet_router::{
};
use crate::socket_state::{PartiallyDelegated, SocketState};
use crate::{cleanup_socket_message, try_decrypt_binary_message};
use coconut_interface::Credential;
use futures::{SinkExt, StreamExt};
use gateway_requests::authentication::encrypted_address::EncryptedAddressBytes;
use gateway_requests::iv::IV;
use gateway_requests::registration::handshake::{client_handshake, SharedKeys};
use gateway_requests::{BinaryRequest, ClientControlRequest, ServerResponse, PROTOCOL_VERSION};
use log::*;
use nym_coconut_interface::Credential;
use nym_crypto::asymmetric::identity;
use nym_network_defaults::{REMAINING_BANDWIDTH_THRESHOLD, TOKENS_TO_BURN};
use nym_sphinx::forwarding::packet::MixPacket;
@@ -33,7 +33,7 @@ use validator_client::nyxd::CosmWasmClient;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "mobile"))]
use credential_storage::PersistentStorage;
use nym_credential_storage::PersistentStorage;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "mobile")]
@@ -3,13 +3,13 @@
#[cfg(target_arch = "wasm32")]
use crate::wasm_mockups::StorageError;
#[cfg(not(feature = "mobile"))]
#[cfg(not(target_arch = "wasm32"))]
use credential_storage::error::StorageError;
use gateway_requests::registration::handshake::error::HandshakeError;
#[cfg(feature = "mobile")]
#[cfg(not(target_arch = "wasm32"))]
use mobile_storage::StorageError;
#[cfg(not(feature = "mobile"))]
#[cfg(not(target_arch = "wasm32"))]
use nym_credential_storage::error::StorageError;
use std::io;
use thiserror::Error;
use tungstenite::Error as WsError;
@@ -31,7 +31,7 @@ pub enum GatewayClientError {
CredentialStorageError(#[from] StorageError),
#[error("Coconut error - {0}")]
CoconutError(#[from] coconut_interface::CoconutError),
CoconutError(#[from] nym_coconut_interface::CoconutError),
// TODO: see if `JsValue` is a reasonable type for this
#[cfg(target_arch = "wasm32")]
@@ -11,13 +11,13 @@ rust-version = "1.56"
base64 = "0.13"
colored = "2.0"
coconut-dkg-common = { path = "../../cosmwasm-smart-contracts/coconut-dkg" }
nym-coconut-dkg-common = { path = "../../cosmwasm-smart-contracts/coconut-dkg" }
nym-contracts-common = { path = "../../cosmwasm-smart-contracts/contracts-common" }
nym-mixnet-contract-common = { path= "../../cosmwasm-smart-contracts/mixnet-contract" }
nym-vesting-contract-common = { path= "../../cosmwasm-smart-contracts/vesting-contract" }
coconut-bandwidth-contract-common = { path= "../../cosmwasm-smart-contracts/coconut-bandwidth-contract" }
multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig-contract" }
group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" }
nym-coconut-bandwidth-contract-common = { path= "../../cosmwasm-smart-contracts/coconut-bandwidth-contract" }
nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig-contract" }
nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" }
nym-vesting-contract = { path = "../../../contracts/vesting" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
@@ -28,7 +28,7 @@ url = { version = "2.2", features = ["serde"] }
tokio = { version = "1.24.1", features = ["sync", "time"] }
futures = "0.3"
coconut-interface = { path = "../../coconut-interface" }
nym-coconut-interface = { path = "../../coconut-interface" }
nym-network-defaults = { path = "../../network-defaults" }
nym-api-requests = { path = "../../../nym-api/nym-api-requests" }
nym-execute = { path = "../../execute" }
@@ -2,8 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
use crate::{nym_api, ValidatorClientError};
use coconut_dkg_common::types::NodeIndex;
use coconut_interface::VerificationKey;
use nym_api_requests::coconut::{
BlindSignRequestBody, BlindedSignatureResponse, VerifyCredentialBody, VerifyCredentialResponse,
};
@@ -11,6 +9,8 @@ use nym_api_requests::models::{
GatewayCoreStatusResponse, MixnodeCoreStatusResponse, MixnodeStatusResponse,
RewardEstimationResponse, StakeSaturationResponse,
};
use nym_coconut_dkg_common::types::NodeIndex;
use nym_coconut_interface::VerificationKey;
pub use nym_mixnet_contract_common::{mixnode::MixNodeDetails, GatewayBond, IdentityKeyRef, MixId};
#[cfg(feature = "nyxd-client")]
@@ -18,17 +18,17 @@ use crate::nyxd::traits::{DkgQueryClient, MixnetQueryClient, MultisigQueryClient
#[cfg(feature = "nyxd-client")]
use crate::nyxd::{self, CosmWasmClient, NyxdClient, QueryNyxdClient, SigningNyxdClient};
#[cfg(feature = "nyxd-client")]
use coconut_dkg_common::{
use cw3::ProposalResponse;
#[cfg(feature = "nyxd-client")]
use nym_api_requests::models::MixNodeBondAnnotated;
#[cfg(feature = "nyxd-client")]
use nym_coconut_dkg_common::{
dealer::ContractDealing,
types::{DealerDetails, EpochId},
verification_key::ContractVKShare,
};
#[cfg(feature = "nyxd-client")]
use coconut_interface::Base58;
#[cfg(feature = "nyxd-client")]
use cw3::ProposalResponse;
#[cfg(feature = "nyxd-client")]
use nym_api_requests::models::MixNodeBondAnnotated;
use nym_coconut_interface::Base58;
#[cfg(feature = "nyxd-client")]
use nym_mixnet_contract_common::{
families::{Family, FamilyHead},
@@ -6,8 +6,8 @@ use cosmrs::tendermint::abci;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
pub use coconut_bandwidth_contract_common::event_attributes::*;
pub use coconut_dkg_common::event_attributes::*;
pub use nym_coconut_bandwidth_contract_common::event_attributes::*;
pub use nym_coconut_dkg_common::event_attributes::*;
// it seems that currently validators just emit stringified events (which are also returned as part of deliverTx response)
// as theirs logs
@@ -140,7 +140,7 @@ pub enum NyxdError {
CosmwasmStdError(#[from] cosmwasm_std::StdError),
#[error("Coconut interface error: {0}")]
CoconutInterfaceError(#[from] coconut_interface::error::CoconutInterfaceError),
CoconutInterfaceError(#[from] nym_coconut_interface::error::CoconutInterfaceError),
#[error("Account had an unexpected bech32 prefix. Expected: {expected}, got: {got}")]
UnexpectedBech32Prefix { got: String, expected: String },
@@ -4,8 +4,8 @@
use crate::nyxd::error::NyxdError;
use crate::nyxd::{CosmWasmClient, NyxdClient};
use coconut_bandwidth_contract_common::msg::QueryMsg;
use coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse;
use nym_coconut_bandwidth_contract_common::msg::QueryMsg;
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse;
use async_trait::async_trait;
@@ -5,8 +5,8 @@ pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient;
use crate::nyxd::cosmwasm_client::types::ExecuteResult;
use crate::nyxd::error::NyxdError;
use crate::nyxd::{Coin, Fee, NyxdClient};
use coconut_bandwidth_contract_common::spend_credential::SpendCredentialData;
use coconut_bandwidth_contract_common::{deposit::DepositData, msg::ExecuteMsg};
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredentialData;
use nym_coconut_bandwidth_contract_common::{deposit::DepositData, msg::ExecuteMsg};
use async_trait::async_trait;
@@ -4,13 +4,13 @@
use crate::nyxd::error::NyxdError;
use crate::nyxd::{CosmWasmClient, NyxdClient};
use async_trait::async_trait;
use coconut_dkg_common::dealer::{
use cosmrs::AccountId;
use nym_coconut_dkg_common::dealer::{
DealerDetailsResponse, PagedDealerResponse, PagedDealingsResponse,
};
use coconut_dkg_common::msg::QueryMsg as DkgQueryMsg;
use coconut_dkg_common::types::{Epoch, EpochId, InitialReplacementData};
use coconut_dkg_common::verification_key::PagedVKSharesResponse;
use cosmrs::AccountId;
use nym_coconut_dkg_common::msg::QueryMsg as DkgQueryMsg;
use nym_coconut_dkg_common::types::{Epoch, EpochId, InitialReplacementData};
use nym_coconut_dkg_common::verification_key::PagedVKSharesResponse;
#[async_trait]
pub trait DkgQueryClient {
@@ -5,9 +5,9 @@ use crate::nyxd::cosmwasm_client::types::ExecuteResult;
use crate::nyxd::error::NyxdError;
use crate::nyxd::{Fee, NyxdClient, SigningCosmWasmClient};
use async_trait::async_trait;
use coconut_dkg_common::msg::ExecuteMsg as DkgExecuteMsg;
use coconut_dkg_common::types::EncodedBTEPublicKeyWithProof;
use coconut_dkg_common::verification_key::VerificationKeyShare;
use nym_coconut_dkg_common::msg::ExecuteMsg as DkgExecuteMsg;
use nym_coconut_dkg_common::types::EncodedBTEPublicKeyWithProof;
use nym_coconut_dkg_common::verification_key::VerificationKeyShare;
use nym_contracts_common::dealings::ContractSafeBytes;
#[async_trait]
@@ -4,7 +4,7 @@
use crate::nyxd::error::NyxdError;
use crate::nyxd::{CosmWasmClient, NyxdClient};
use group_contract_common::msg::QueryMsg;
use nym_group_contract_common::msg::QueryMsg;
use async_trait::async_trait;
use cw4::MemberResponse;
@@ -5,7 +5,7 @@ use crate::nyxd::error::NyxdError;
use crate::nyxd::{CosmWasmClient, NyxdClient};
use cw3::{ProposalListResponse, ProposalResponse};
use multisig_contract_common::msg::QueryMsg;
use nym_multisig_contract_common::msg::QueryMsg;
use async_trait::async_trait;
@@ -6,9 +6,9 @@ use crate::nyxd::cosmwasm_client::types::ExecuteResult;
use crate::nyxd::error::NyxdError;
use crate::nyxd::{Fee, NyxdClient};
use coconut_bandwidth_contract_common::msg::ExecuteMsg as CoconutBandwidthExecuteMsg;
use cw3::Vote;
use multisig_contract_common::msg::ExecuteMsg;
use nym_coconut_bandwidth_contract_common::msg::ExecuteMsg as CoconutBandwidthExecuteMsg;
use nym_multisig_contract_common::msg::ExecuteMsg;
use async_trait::async_trait;
use cosmwasm_std::{to_binary, Coin, CosmosMsg, WasmMsg};
+1 -1
View File
@@ -1,5 +1,5 @@
[package]
name = "coconut-interface"
name = "nym-coconut-interface"
version = "0.1.0"
edition = "2021"
description = "Crutch library until there is proper SerDe support for coconut structs"
+3 -3
View File
@@ -32,6 +32,6 @@ validator-client = { path = "../client-libs/validator-client", features = ["nyxd
nym-network-defaults = { path = "../network-defaults" }
nym-mixnet-contract-common = { path = "../cosmwasm-smart-contracts/mixnet-contract" }
nym-vesting-contract-common = { path = "../cosmwasm-smart-contracts/vesting-contract" }
coconut-bandwidth-contract-common = { path = "../cosmwasm-smart-contracts/coconut-bandwidth-contract" }
coconut-dkg-common = { path = "../cosmwasm-smart-contracts/coconut-dkg" }
multisig-contract-common = { path = "../cosmwasm-smart-contracts/multisig-contract" }
nym-coconut-bandwidth-contract-common = { path = "../cosmwasm-smart-contracts/coconut-bandwidth-contract" }
nym-coconut-dkg-common = { path = "../cosmwasm-smart-contracts/coconut-dkg" }
nym-multisig-contract-common = { path = "../cosmwasm-smart-contracts/multisig-contract" }
@@ -6,7 +6,7 @@ use std::str::FromStr;
use clap::Parser;
use log::{debug, info};
use coconut_bandwidth_contract_common::msg::InstantiateMsg;
use nym_coconut_bandwidth_contract_common::msg::InstantiateMsg;
use validator_client::nyxd::AccountId;
#[derive(Debug, Parser)]
@@ -5,8 +5,8 @@ use clap::Parser;
use log::{debug, info};
use std::str::FromStr;
use coconut_dkg_common::msg::InstantiateMsg;
use coconut_dkg_common::types::TimeConfiguration;
use nym_coconut_dkg_common::msg::InstantiateMsg;
use nym_coconut_dkg_common::types::TimeConfiguration;
use validator_client::nyxd::AccountId;
#[derive(Debug, Parser)]
@@ -7,7 +7,7 @@ use clap::Parser;
use cosmwasm_std::Decimal;
use cw_utils::{Duration, Threshold};
use log::{debug, info};
use multisig_contract_common::msg::InstantiateMsg;
use nym_multisig_contract_common::msg::InstantiateMsg;
use validator_client::nyxd::AccountId;
#[derive(Debug, Parser)]
@@ -1,5 +1,5 @@
[package]
name = "coconut-bandwidth-contract-common"
name = "nym-coconut-bandwidth-contract-common"
version = "0.1.0"
edition = "2021"
@@ -9,4 +9,4 @@ edition = "2021"
cosmwasm-std = "1.0.0"
schemars = "0.8"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
multisig-contract-common = { path = "../multisig-contract" }
nym-multisig-contract-common = { path = "../multisig-contract" }
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
use cosmwasm_std::{from_binary, to_binary, Addr, Coin, CosmosMsg, StdResult, WasmMsg};
use multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg;
use nym_multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@@ -1,5 +1,5 @@
[package]
name = "coconut-dkg-common"
name = "nym-coconut-dkg-common"
version = "0.1.0"
edition = "2021"
@@ -12,4 +12,4 @@ schemars = "0.8"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
contracts-common = { path = "../contracts-common", package = "nym-contracts-common" }
multisig-contract-common = { path = "../multisig-contract" }
nym-multisig-contract-common = { path = "../multisig-contract" }
@@ -5,7 +5,7 @@ use crate::msg::ExecuteMsg;
use crate::types::{EpochId, NodeIndex};
use cosmwasm_std::{from_binary, to_binary, Addr, CosmosMsg, StdResult, Timestamp, WasmMsg};
use cw_utils::Expiration;
use multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg;
use nym_multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg;
use serde::{Deserialize, Serialize};
pub type VerificationKeyShare = String;
@@ -1,5 +1,5 @@
[package]
name = "group-contract-common"
name = "nym-group-contract-common"
version = "0.1.0"
edition = "2021"
@@ -1,5 +1,5 @@
[package]
name = "multisig-contract-common"
name = "nym-multisig-contract-common"
version = "0.1.0"
edition = "2021"
+1 -1
View File
@@ -1,5 +1,5 @@
[package]
name = "credential-storage"
name = "nym-credential-storage"
version = "0.1.0"
edition = "2021"
+1 -1
View File
@@ -11,7 +11,7 @@ cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegr
thiserror = "1.0"
# I guess temporarily until we get serde support in coconut up and running
coconut-interface = { path = "../coconut-interface" }
nym-coconut-interface = { path = "../coconut-interface" }
nym-crypto = { path = "../crypto", features = ["rand", "asymmetric", "symmetric", "hashing"] }
nym-api-requests = { path = "../../nym-api/nym-api-requests" }
validator-client = { path = "../client-libs/validator-client" }
+2 -2
View File
@@ -6,7 +6,7 @@
// right now this has no double-spending protection, spender binding, etc
// it's the simplest possible case
use coconut_interface::{
use nym_coconut_interface::{
hash_to_scalar, prepare_blind_sign, Attribute, BlindSignRequest, Credential, Parameters,
PrivateAttribute, PublicAttribute, Signature, VerificationKey,
};
@@ -282,7 +282,7 @@ pub fn prepare_for_spending(
#[cfg(test)]
mod test {
use super::*;
use coconut_interface::Base58;
use nym_coconut_interface::Base58;
use rand::rngs::OsRng;
fn voucher_fixture() -> BandwidthVoucher {
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_interface::{
use nym_api_requests::coconut::BlindSignRequestBody;
use nym_coconut_interface::{
aggregate_signature_shares, aggregate_verification_keys, prove_bandwidth_credential, Attribute,
BlindedSignature, Credential, Parameters, Signature, SignatureShare, VerificationKey,
};
use nym_api_requests::coconut::BlindSignRequestBody;
use nym_crypto::asymmetric::encryption::PublicKey;
use nym_crypto::shared_key::recompute_shared_key;
use nym_crypto::symmetric::stream_cipher;
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_interface::CoconutError;
use nym_coconut_interface::CoconutError;
use nym_crypto::asymmetric::encryption::KeyRecoveryError;
use validator_client::ValidatorClientError;
+1 -1
View File
@@ -28,7 +28,7 @@ validator-client = { path = "../../common/client-libs/validator-client", feature
nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" }
nym-vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" }
nym-config = { path = "../../common/config" }
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
# Used for Type conversion, can be extracted but its a lot of work
nym-vesting-contract = { path = "../../contracts/vesting" }
+4 -4
View File
@@ -1,5 +1,5 @@
[package]
name = "coconut-bandwidth"
name = "nym-coconut-bandwidth"
version = "0.1.0"
edition = "2021"
@@ -9,9 +9,9 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]
[dependencies]
bandwidth-claim-contract = { path = "../../common/bandwidth-claim-contract" }
coconut-bandwidth-contract-common = { path = "../../common/cosmwasm-smart-contracts/coconut-bandwidth-contract" }
multisig-contract-common = { path = "../../common/cosmwasm-smart-contracts/multisig-contract" }
nym-bandwidth-claim-contract = { path = "../../common/bandwidth-claim-contract" }
nym-coconut-bandwidth-contract-common = { path = "../../common/cosmwasm-smart-contracts/coconut-bandwidth-contract" }
nym-multisig-contract-common = { path = "../../common/cosmwasm-smart-contracts/multisig-contract" }
cosmwasm-std = "1.0.0"
cosmwasm-storage = "1.0.0"
+3 -1
View File
@@ -5,7 +5,9 @@ use cosmwasm_std::{
entry_point, to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult,
};
use coconut_bandwidth_contract_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use nym_coconut_bandwidth_contract_common::msg::{
ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg,
};
use crate::error::ContractError;
use crate::queries::{query_all_spent_credentials_paged, query_spent_credential};
+3 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_bandwidth_contract_common::spend_credential::{
PagedSpendCredentialResponse, SpendCredential, SpendCredentialResponse,
};
use cosmwasm_std::{Deps, Order, StdResult};
use cw_storage_plus::Bound;
use nym_coconut_bandwidth_contract_common::spend_credential::{
PagedSpendCredentialResponse, SpendCredential, SpendCredentialResponse,
};
use crate::storage::{self, SPEND_CREDENTIAL_PAGE_DEFAULT_LIMIT, SPEND_CREDENTIAL_PAGE_MAX_LIMIT};
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_bandwidth_contract_common::spend_credential::SpendCredential;
use cw_storage_plus::{Index, IndexList, IndexedMap, UniqueIndex};
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredential;
// storage prefixes
const SPEND_CREDENTIAL_PK_NAMESPACE: &str = "sc";
@@ -44,10 +44,10 @@ mod tests {
use crate::storage::SpendCredential;
use crate::support::tests::fixtures;
use crate::support::tests::fixtures::TEST_MIX_DENOM;
use coconut_bandwidth_contract_common::spend_credential::SpendCredentialStatus;
use cosmwasm_std::testing::MockStorage;
use cosmwasm_std::Addr;
use cosmwasm_std::Coin;
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredentialStatus;
#[test]
fn spend_credential_single_read_retrieval() {
@@ -1,8 +1,10 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_bandwidth_contract_common::spend_credential::{SpendCredential, SpendCredentialData};
use cosmwasm_std::{Addr, Coin};
use nym_coconut_bandwidth_contract_common::spend_credential::{
SpendCredential, SpendCredentialData,
};
pub const TEST_MIX_DENOM: &str = "unym";
@@ -5,9 +5,9 @@ pub const MULTISIG_CONTRACT: &str = "multisig contract address";
pub const POOL_CONTRACT: &str = "mix pool contract address";
use crate::contract::instantiate;
use coconut_bandwidth_contract_common::msg::InstantiateMsg;
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier};
use cosmwasm_std::{Empty, MemoryStorage, OwnedDeps};
use nym_coconut_bandwidth_contract_common::msg::InstantiateMsg;
use super::fixtures::TEST_MIX_DENOM;
@@ -1,17 +1,17 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_bandwidth_contract_common::spend_credential::{
use cosmwasm_std::{BankMsg, Coin, DepsMut, Env, Event, MessageInfo, Response};
use nym_coconut_bandwidth_contract_common::spend_credential::{
to_cosmos_msg, SpendCredential, SpendCredentialData,
};
use cosmwasm_std::{BankMsg, Coin, DepsMut, Env, Event, MessageInfo, Response};
use crate::error::ContractError;
use crate::state::{ADMIN, CONFIG};
use crate::storage;
use coconut_bandwidth_contract_common::deposit::DepositData;
use coconut_bandwidth_contract_common::events::{
use nym_coconut_bandwidth_contract_common::deposit::DepositData;
use nym_coconut_bandwidth_contract_common::events::{
DEPOSITED_FUNDS_EVENT_TYPE, DEPOSIT_ENCRYPTION_KEY, DEPOSIT_IDENTITY_KEY, DEPOSIT_INFO,
DEPOSIT_VALUE,
};
@@ -113,11 +113,11 @@ mod tests {
use super::*;
use crate::support::tests::fixtures::spend_credential_data_fixture;
use crate::support::tests::helpers::{self, MULTISIG_CONTRACT, POOL_CONTRACT};
use coconut_bandwidth_contract_common::msg::ExecuteMsg;
use cosmwasm_std::testing::{mock_env, mock_info};
use cosmwasm_std::{from_binary, Coin, CosmosMsg, WasmMsg};
use cw_controllers::AdminError;
use multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg;
use nym_coconut_bandwidth_contract_common::msg::ExecuteMsg;
use nym_multisig_contract_common::msg::ExecuteMsg as MultisigExecuteMsg;
#[test]
fn invalid_deposit() {
+3 -3
View File
@@ -1,5 +1,5 @@
[package]
name = "coconut-dkg"
name = "nym-coconut-dkg"
version = "0.1.0"
edition = "2021"
@@ -9,7 +9,7 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]
[dependencies]
coconut-dkg-common = { path = "../../common/cosmwasm-smart-contracts/coconut-dkg" }
nym-coconut-dkg-common = { path = "../../common/cosmwasm-smart-contracts/coconut-dkg" }
cosmwasm-std = "1.0.0"
cosmwasm-storage = "1.0.0"
@@ -24,6 +24,6 @@ thiserror = "1.0.23"
[dev-dependencies]
cw-multi-test = { version = "0.13.4" }
cw4-group = { path = "../multisig/cw4-group" }
group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract" }
nym-group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract" }
lazy_static = "1.4"
rusty-fork = "0.3"
+5 -5
View File
@@ -17,12 +17,12 @@ use crate::state::{State, MULTISIG, STATE};
use crate::verification_key_shares::queries::query_vk_shares_paged;
use crate::verification_key_shares::transactions::try_commit_verification_key_share;
use crate::verification_key_shares::transactions::try_verify_verification_key_share;
use coconut_dkg_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use coconut_dkg_common::types::{Epoch, EpochState};
use cosmwasm_std::{
entry_point, to_binary, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response,
};
use cw4::Cw4Contract;
use nym_coconut_dkg_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use nym_coconut_dkg_common::types::{Epoch, EpochState};
/// Instantiate the contract.
///
@@ -136,13 +136,13 @@ mod tests {
use super::*;
use crate::support::tests::fixtures::TEST_MIX_DENOM;
use crate::support::tests::helpers::{ADMIN_ADDRESS, MULTISIG_CONTRACT};
use coconut_dkg_common::msg::ExecuteMsg::RegisterDealer;
use coconut_dkg_common::types::NodeIndex;
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
use cosmwasm_std::{coins, Addr};
use cw4::Member;
use cw_multi_test::{App, AppBuilder, AppResponse, ContractWrapper, Executor};
use group_contract_common::msg::InstantiateMsg as GroupInstantiateMsg;
use nym_coconut_dkg_common::msg::ExecuteMsg::RegisterDealer;
use nym_coconut_dkg_common::types::NodeIndex;
use nym_group_contract_common::msg::InstantiateMsg as GroupInstantiateMsg;
fn instantiate_with_group(app: &mut App, members: &[Addr]) -> Addr {
let group_code_id = app.store_code(Box::new(ContractWrapper::new(
+1 -1
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
use crate::dealers::storage::{self, IndexedDealersMap};
use coconut_dkg_common::dealer::{DealerDetailsResponse, DealerType, PagedDealerResponse};
use cosmwasm_std::{Deps, Order, StdResult};
use cw_storage_plus::Bound;
use nym_coconut_dkg_common::dealer::{DealerDetailsResponse, DealerType, PagedDealerResponse};
fn query_dealers(
deps: Deps<'_>,
+1 -1
View File
@@ -1,9 +1,9 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_dkg_common::types::{DealerDetails, NodeIndex};
use cosmwasm_std::{Addr, StdResult, Storage};
use cw_storage_plus::{Index, IndexList, IndexedMap, Item, UniqueIndex};
use nym_coconut_dkg_common::types::{DealerDetails, NodeIndex};
const CURRENT_DEALERS_PK: &str = "crd";
const PAST_DEALERS_PK: &str = "ptd";
@@ -6,8 +6,8 @@ use crate::epoch_state::storage::INITIAL_REPLACEMENT_DATA;
use crate::epoch_state::utils::check_epoch_state;
use crate::error::ContractError;
use crate::state::STATE;
use coconut_dkg_common::types::{DealerDetails, EncodedBTEPublicKeyWithProof, EpochState};
use cosmwasm_std::{Addr, DepsMut, MessageInfo, Response};
use nym_coconut_dkg_common::types::{DealerDetails, EncodedBTEPublicKeyWithProof, EpochState};
// currently we only require that
// a) it's part of the signer group
@@ -81,9 +81,9 @@ pub(crate) mod tests {
use crate::support::tests::fixtures::dealer_details_fixture;
use crate::support::tests::helpers;
use crate::support::tests::helpers::{add_fixture_dealer, GROUP_MEMBERS};
use coconut_dkg_common::types::{InitialReplacementData, TimeConfiguration};
use cosmwasm_std::testing::{mock_env, mock_info};
use cw4::Member;
use nym_coconut_dkg_common::types::{InitialReplacementData, TimeConfiguration};
use rusty_fork::rusty_fork_test;
rusty_fork_test! {
@@ -3,10 +3,10 @@
use crate::dealings::storage;
use crate::dealings::storage::DEALINGS_BYTES;
use coconut_dkg_common::dealer::{ContractDealing, PagedDealingsResponse};
use coconut_dkg_common::types::TOTAL_DEALINGS;
use cosmwasm_std::{Deps, Order, StdResult};
use cw_storage_plus::Bound;
use nym_coconut_dkg_common::dealer::{ContractDealing, PagedDealingsResponse};
use nym_coconut_dkg_common::types::TOTAL_DEALINGS;
pub fn query_dealings_paged(
deps: Deps<'_>,
@@ -1,9 +1,9 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_dkg_common::types::{ContractSafeBytes, TOTAL_DEALINGS};
use cosmwasm_std::Addr;
use cw_storage_plus::Map;
use nym_coconut_dkg_common::types::{ContractSafeBytes, TOTAL_DEALINGS};
pub(crate) const DEALINGS_PAGE_MAX_LIMIT: u32 = 2;
pub(crate) const DEALINGS_PAGE_DEFAULT_LIMIT: u32 = 1;
@@ -6,8 +6,8 @@ use crate::dealings::storage::DEALINGS_BYTES;
use crate::epoch_state::storage::INITIAL_REPLACEMENT_DATA;
use crate::epoch_state::utils::check_epoch_state;
use crate::error::ContractError;
use coconut_dkg_common::types::{ContractSafeBytes, EpochState};
use cosmwasm_std::{DepsMut, MessageInfo, Response};
use nym_coconut_dkg_common::types::{ContractSafeBytes, EpochState};
pub fn try_commit_dealings(
deps: DepsMut<'_>,
@@ -54,10 +54,10 @@ pub(crate) mod tests {
use crate::support::tests::fixtures::{dealer_details_fixture, dealing_bytes_fixture};
use crate::support::tests::helpers;
use crate::support::tests::helpers::add_fixture_dealer;
use coconut_dkg_common::dealer::DealerDetails;
use coconut_dkg_common::types::{InitialReplacementData, TimeConfiguration};
use cosmwasm_std::testing::{mock_env, mock_info};
use cosmwasm_std::Addr;
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::{InitialReplacementData, TimeConfiguration};
#[test]
fn invalid_commit_dealing() {
@@ -3,8 +3,8 @@
use crate::epoch_state::storage::{CURRENT_EPOCH, INITIAL_REPLACEMENT_DATA, THRESHOLD};
use crate::error::ContractError;
use coconut_dkg_common::types::{Epoch, InitialReplacementData};
use cosmwasm_std::Storage;
use nym_coconut_dkg_common::types::{Epoch, InitialReplacementData};
pub(crate) fn query_current_epoch(storage: &dyn Storage) -> Result<Epoch, ContractError> {
CURRENT_EPOCH
@@ -28,8 +28,8 @@ pub(crate) fn query_initial_dealers(
pub(crate) mod test {
use super::*;
use crate::support::tests::helpers::init_contract;
use coconut_dkg_common::types::{EpochState, TimeConfiguration};
use cosmwasm_std::testing::mock_env;
use nym_coconut_dkg_common::types::{EpochState, TimeConfiguration};
#[test]
fn query_state() {
@@ -1,8 +1,8 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_dkg_common::types::{Epoch, InitialReplacementData};
use cw_storage_plus::Item;
use nym_coconut_dkg_common::types::{Epoch, InitialReplacementData};
pub(crate) const CURRENT_EPOCH: Item<'_, Epoch> = Item::new("current_epoch");
pub const THRESHOLD: Item<u64> = Item::new("threshold");
@@ -7,8 +7,8 @@ use crate::epoch_state::storage::{CURRENT_EPOCH, INITIAL_REPLACEMENT_DATA, THRES
use crate::epoch_state::utils::check_epoch_state;
use crate::error::ContractError;
use crate::state::STATE;
use coconut_dkg_common::types::{Epoch, EpochState, InitialReplacementData};
use cosmwasm_std::{Addr, Deps, DepsMut, Env, Order, Response, Storage};
use nym_coconut_dkg_common::types::{Epoch, EpochState, InitialReplacementData};
fn reset_epoch_state(storage: &mut dyn Storage) -> Result<(), ContractError> {
THRESHOLD.remove(storage);
@@ -182,12 +182,12 @@ pub(crate) mod tests {
use crate::error::ContractError::EarlyEpochStateAdvancement;
use crate::support::tests::fixtures::dealer_details_fixture;
use crate::support::tests::helpers::{init_contract, GROUP_MEMBERS};
use coconut_dkg_common::types::{
ContractSafeBytes, DealerDetails, EpochState, TimeConfiguration,
};
use cosmwasm_std::testing::mock_env;
use cosmwasm_std::Addr;
use cw4::Member;
use nym_coconut_dkg_common::types::{
ContractSafeBytes, DealerDetails, EpochState, TimeConfiguration,
};
use rusty_fork::rusty_fork_test;
// Because of the global variable handling group, we need individual process for each test
@@ -3,8 +3,8 @@
use crate::epoch_state::storage::CURRENT_EPOCH;
use crate::error::ContractError;
use coconut_dkg_common::types::EpochState;
use cosmwasm_std::Storage;
use nym_coconut_dkg_common::types::EpochState;
pub(crate) fn check_epoch_state(
storage: &dyn Storage,
@@ -25,8 +25,8 @@ pub(crate) fn check_epoch_state(
pub(crate) mod test {
use super::*;
use crate::support::tests::helpers::init_contract;
use coconut_dkg_common::types::{Epoch, TimeConfiguration};
use cosmwasm_std::testing::mock_env;
use nym_coconut_dkg_common::types::{Epoch, TimeConfiguration};
#[test]
pub fn check_state() {
@@ -1,10 +1,10 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_dkg_common::dealer::DealerDetails;
use coconut_dkg_common::types::ContractSafeBytes;
use coconut_dkg_common::verification_key::ContractVKShare;
use cosmwasm_std::Addr;
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::ContractSafeBytes;
use nym_coconut_dkg_common::verification_key::ContractVKShare;
pub const TEST_MIX_DENOM: &str = "unym";
@@ -3,8 +3,6 @@
use crate::contract::instantiate;
use crate::dealers::storage::current_dealers;
use coconut_dkg_common::msg::InstantiateMsg;
use coconut_dkg_common::types::DealerDetails;
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier};
use cosmwasm_std::{
from_binary, to_binary, Addr, ContractResult, DepsMut, Empty, MemoryStorage, OwnedDeps,
@@ -12,6 +10,8 @@ use cosmwasm_std::{
};
use cw4::{Cw4QueryMsg, Member, MemberListResponse, MemberResponse};
use lazy_static::lazy_static;
use nym_coconut_dkg_common::msg::InstantiateMsg;
use nym_coconut_dkg_common::types::DealerDetails;
use std::sync::Mutex;
use super::fixtures::TEST_MIX_DENOM;
@@ -3,10 +3,10 @@
use crate::verification_key_shares::storage;
use crate::verification_key_shares::storage::vk_shares;
use coconut_dkg_common::types::EpochId;
use coconut_dkg_common::verification_key::PagedVKSharesResponse;
use cosmwasm_std::{Deps, Order, StdResult};
use cw_storage_plus::Bound;
use nym_coconut_dkg_common::types::EpochId;
use nym_coconut_dkg_common::verification_key::PagedVKSharesResponse;
pub fn query_vk_shares_paged(
deps: Deps<'_>,
@@ -4,10 +4,10 @@
// SPDX-License-Identifier: Apache-2.0
use crate::constants::{VK_SHARES_EPOCH_ID_IDX_NAMESPACE, VK_SHARES_PK_NAMESPACE};
use coconut_dkg_common::types::EpochId;
use coconut_dkg_common::verification_key::ContractVKShare;
use cosmwasm_std::Addr;
use cw_storage_plus::{Index, IndexList, IndexedMap, MultiIndex};
use nym_coconut_dkg_common::types::EpochId;
use nym_coconut_dkg_common::verification_key::ContractVKShare;
pub(crate) const VERIFICATION_KEY_SHARES_PAGE_MAX_LIMIT: u32 = 75;
pub(crate) const VERIFICATION_KEY_SHARES_PAGE_DEFAULT_LIMIT: u32 = 50;
@@ -8,9 +8,11 @@ use crate::epoch_state::utils::check_epoch_state;
use crate::error::ContractError;
use crate::state::{MULTISIG, STATE};
use crate::verification_key_shares::storage::vk_shares;
use coconut_dkg_common::types::EpochState;
use coconut_dkg_common::verification_key::{to_cosmos_msg, ContractVKShare, VerificationKeyShare};
use cosmwasm_std::{Addr, DepsMut, Env, MessageInfo, Response};
use nym_coconut_dkg_common::types::EpochState;
use nym_coconut_dkg_common::verification_key::{
to_cosmos_msg, ContractVKShare, VerificationKeyShare,
};
pub fn try_commit_verification_key_share(
deps: DepsMut<'_>,
@@ -92,10 +94,10 @@ mod tests {
use crate::epoch_state::transactions::advance_epoch_state;
use crate::support::tests::helpers;
use crate::support::tests::helpers::{add_fixture_dealer, MULTISIG_CONTRACT};
use coconut_dkg_common::dealer::DealerDetails;
use coconut_dkg_common::types::{EpochState, TimeConfiguration};
use cosmwasm_std::testing::{mock_env, mock_info};
use cw_controllers::AdminError;
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::{EpochState, TimeConfiguration};
#[test]
fn current_epoch_id() {
+8 -7
View File
@@ -2,15 +2,16 @@
name = "coconut-test"
version = "0.1.0"
edition = "2021"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bandwidth-claim-contract = { path = "../../common/bandwidth-claim-contract" }
coconut-bandwidth-contract-common = { path = "../../common/cosmwasm-smart-contracts/coconut-bandwidth-contract" }
coconut-dkg-common = { path = "../../common/cosmwasm-smart-contracts/coconut-dkg" }
multisig-contract-common = { path = "../../common/cosmwasm-smart-contracts/multisig-contract" }
group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract" }
nym-bandwidth-claim-contract = { path = "../../common/bandwidth-claim-contract" }
nym-coconut-bandwidth-contract-common = { path = "../../common/cosmwasm-smart-contracts/coconut-bandwidth-contract" }
nym-coconut-dkg-common = { path = "../../common/cosmwasm-smart-contracts/coconut-dkg" }
nym-multisig-contract-common = { path = "../../common/cosmwasm-smart-contracts/multisig-contract" }
nym-group-contract-common = { path = "../../common/cosmwasm-smart-contracts/group-contract" }
cosmwasm-std = "1.0.0"
cosmwasm-storage = "1.0.0"
@@ -24,8 +25,8 @@ schemars = "0.8"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
thiserror = "1.0.23"
coconut-bandwidth = { path = "../coconut-bandwidth" }
coconut-dkg = { path = "../coconut-dkg" }
nym-coconut-bandwidth = { path = "../coconut-bandwidth" }
nym-coconut-dkg = { path = "../coconut-dkg" }
cw-multi-test = { version = "0.13.4" }
cw3-flex-multisig = { path = "../multisig/cw3-flex-multisig" }
cw4-group = { path = "../multisig/cw4-group" }
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
use crate::helpers::*;
use coconut_bandwidth::error::ContractError;
use coconut_bandwidth_contract_common::{
deposit::DepositData,
msg::{ExecuteMsg, InstantiateMsg},
};
use cosmwasm_std::{coins, Addr};
use cw_controllers::AdminError;
use cw_multi_test::Executor;
use nym_coconut_bandwidth::error::ContractError;
use nym_coconut_bandwidth_contract_common::{
deposit::DepositData,
msg::{ExecuteMsg, InstantiateMsg},
};
const TEST_MIX_DENOM: &str = "unym";
+7 -7
View File
@@ -4,7 +4,7 @@
use cosmwasm_std::{entry_point, Addr, Coin, DepsMut, Empty, Env, Response};
use cw3_flex_multisig::state::CONFIG;
use cw_multi_test::{App, AppBuilder, Contract, ContractWrapper};
use multisig_contract_common::error::ContractError;
use nym_multisig_contract_common::error::ContractError;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@@ -43,18 +43,18 @@ pub fn mock_app(init_funds: &[Coin]) -> App {
}
pub fn contract_dkg() -> Box<dyn Contract<Empty>> {
let contract = ContractWrapper::new(
coconut_dkg::contract::execute,
coconut_dkg::contract::instantiate,
coconut_dkg::contract::query,
nym_coconut_dkg::contract::execute,
nym_coconut_dkg::contract::instantiate,
nym_coconut_dkg::contract::query,
);
Box::new(contract)
}
pub fn contract_bandwidth() -> Box<dyn Contract<Empty>> {
let contract = ContractWrapper::new(
coconut_bandwidth::contract::execute,
coconut_bandwidth::contract::instantiate,
coconut_bandwidth::contract::query,
nym_coconut_bandwidth::contract::execute,
nym_coconut_bandwidth::contract::instantiate,
nym_coconut_bandwidth::contract::query,
);
Box::new(contract)
}
@@ -1,16 +1,16 @@
use crate::helpers::*;
use coconut_bandwidth::error::ContractError;
use coconut_bandwidth_contract_common::{
use cosmwasm_std::{coins, Addr, Coin, Decimal};
use cw_multi_test::Executor;
use cw_utils::{Duration, Threshold};
use nym_coconut_bandwidth::error::ContractError;
use nym_coconut_bandwidth_contract_common::{
msg::{
ExecuteMsg as CoconutBandwidthExecuteMsg, InstantiateMsg as CoconutBandwidthInstantiateMsg,
},
spend_credential::SpendCredentialData,
};
use cosmwasm_std::{coins, Addr, Coin, Decimal};
use cw_multi_test::Executor;
use cw_utils::{Duration, Threshold};
use group_contract_common::msg::InstantiateMsg as GroupInstantiateMsg;
use multisig_contract_common::msg::InstantiateMsg as MultisigInstantiateMsg;
use nym_group_contract_common::msg::InstantiateMsg as GroupInstantiateMsg;
use nym_multisig_contract_common::msg::InstantiateMsg as MultisigInstantiateMsg;
pub const TEST_COIN_DENOM: &str = "unym";
pub const TEST_COCONUT_BANDWIDTH_CONTRACT_ADDRESS: &str =
@@ -7,19 +7,19 @@ use crate::helpers::{
use crate::spend_credential_creates_proposal::{
TEST_COCONUT_BANDWIDTH_CONTRACT_ADDRESS, TEST_COCONUT_DKG_CONTRACT_ADDRESS, TEST_COIN_DENOM,
};
use coconut_dkg_common::msg::ExecuteMsg::{
AdvanceEpochState, CommitVerificationKeyShare, RegisterDealer,
};
use coconut_dkg_common::msg::InstantiateMsg as DkgInstantiateMsg;
use coconut_dkg_common::msg::QueryMsg::GetVerificationKeys;
use coconut_dkg_common::verification_key::PagedVKSharesResponse;
use cosmwasm_std::{coins, Addr, Decimal};
use cw4::Member;
use cw_multi_test::Executor;
use cw_utils::{Duration, Threshold};
use group_contract_common::msg::InstantiateMsg as GroupInstantiateMsg;
use multisig_contract_common::msg::ExecuteMsg::{Execute, Vote};
use multisig_contract_common::msg::InstantiateMsg as MultisigInstantiateMsg;
use nym_coconut_dkg_common::msg::ExecuteMsg::{
AdvanceEpochState, CommitVerificationKeyShare, RegisterDealer,
};
use nym_coconut_dkg_common::msg::InstantiateMsg as DkgInstantiateMsg;
use nym_coconut_dkg_common::msg::QueryMsg::GetVerificationKeys;
use nym_coconut_dkg_common::verification_key::PagedVKSharesResponse;
use nym_group_contract_common::msg::InstantiateMsg as GroupInstantiateMsg;
use nym_multisig_contract_common::msg::ExecuteMsg::{Execute, Vote};
use nym_multisig_contract_common::msg::InstantiateMsg as MultisigInstantiateMsg;
#[test]
fn dkg_proposal() {
@@ -27,8 +27,8 @@ cosmwasm-std = { version = "1.0.0" }
schemars = "0.8.1"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" }
multisig-contract-common = { path= "../../../common/cosmwasm-smart-contracts/multisig-contract" }
nym-group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" }
nym-multisig-contract-common = { path= "../../../common/cosmwasm-smart-contracts/multisig-contract" }
[dev-dependencies]
cosmwasm-schema = { version = "1.0.0" }
@@ -18,8 +18,8 @@ use cw_storage_plus::Bound;
use cw_utils::{maybe_addr, Expiration, ThresholdResponse};
use crate::state::{Config, CONFIG};
use multisig_contract_common::error::ContractError;
use multisig_contract_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use nym_multisig_contract_common::error::ContractError;
use nym_multisig_contract_common::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
// version info for migration info
const CONTRACT_NAME: &str = "crates.io:cw3-flex-multisig";
@@ -502,7 +502,7 @@ mod tests {
// uploads code and returns address of group contract
fn instantiate_group(app: &mut App, members: Vec<Member>) -> Addr {
let group_id = app.store_code(contract_group());
let msg = group_contract_common::msg::InstantiateMsg {
let msg = nym_group_contract_common::msg::InstantiateMsg {
admin: Some(OWNER.into()),
members,
};
@@ -1410,7 +1410,7 @@ mod tests {
// adds NEWBIE with 2 power -> with snapshot, invalid vote
// removes VOTER3 -> with snapshot, can vote on proposal
let newbie: &str = "newbie";
let update_msg = group_contract_common::msg::ExecuteMsg::UpdateMembers {
let update_msg = nym_group_contract_common::msg::ExecuteMsg::UpdateMembers {
remove: vec![VOTER3.into()],
add: vec![member(VOTER2, 21), member(newbie, 2)],
};
@@ -1623,7 +1623,7 @@ mod tests {
// admin changes the group (3 -> 0, 2 -> 9, 0 -> 29) - total = 56, require 29 to pass
let newbie: &str = "newbie";
let update_msg = group_contract_common::msg::ExecuteMsg::UpdateMembers {
let update_msg = nym_group_contract_common::msg::ExecuteMsg::UpdateMembers {
remove: vec![VOTER3.into()],
add: vec![member(VOTER2, 9), member(newbie, 29)],
};
@@ -1702,7 +1702,7 @@ mod tests {
// admin changes the group (3 -> 0, 2 -> 9, 0 -> 28) - total = 55, require 28 to pass
let newbie: &str = "newbie";
let update_msg = group_contract_common::msg::ExecuteMsg::UpdateMembers {
let update_msg = nym_group_contract_common::msg::ExecuteMsg::UpdateMembers {
remove: vec![VOTER3.into()],
add: vec![member(VOTER2, 9), member(newbie, 29)],
};
+1 -1
View File
@@ -24,7 +24,7 @@ crate-type = ["cdylib", "rlib"]
library = []
[dependencies]
group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" }
nym-group-contract-common = { path = "../../../common/cosmwasm-smart-contracts/group-contract" }
cw-utils = { version = "0.13.4" }
cw2 = { version = "0.13.4" }
+1 -1
View File
@@ -14,7 +14,7 @@ use cw_utils::maybe_addr;
use crate::error::ContractError;
use crate::state::{ADMIN, HOOKS, MEMBERS, TOTAL};
use group_contract_common::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use nym_group_contract_common::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
// version info for migration info
const CONTRACT_NAME: &str = "crates.io:cw4-group";
+1 -1
View File
@@ -5,7 +5,7 @@ use std::ops::Deref;
use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg};
use cw4::{Cw4Contract, Member};
use group_contract_common::msg::ExecuteMsg;
use nym_group_contract_common::msg::ExecuteMsg;
/// Cw4GroupContract is a wrapper around Cw4Contract that provides a lot of helpers
/// for working with cw4-group contracts.
+1 -1
View File
@@ -52,7 +52,7 @@ tokio-util = { version = "0.7.4", features = ["codec"] }
url = { version = "2.2", features = ["serde"] }
# internal
coconut-interface = { path = "../common/coconut-interface" }
nym-coconut-interface = { path = "../common/coconut-interface" }
nym-credentials = { path = "../common/credentials" }
nym-config = { path = "../common/config" }
nym-crypto = { path = "../common/crypto" }
+1 -1
View File
@@ -22,7 +22,7 @@ thiserror = "1.0"
nym-crypto = { path = "../../common/crypto" }
nym-pemstore = { path = "../../common/pemstore" }
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-credentials = { path = "../../common/credentials" }
[dependencies.tungstenite]
+1 -1
View File
@@ -5,7 +5,7 @@ use crate::authentication::encrypted_address::EncryptedAddressBytes;
use crate::iv::IV;
use crate::registration::handshake::SharedKeys;
use crate::{GatewayMacSize, PROTOCOL_VERSION};
use coconut_interface::Credential;
use nym_coconut_interface::Credential;
use nym_crypto::generic_array::typenum::Unsigned;
use nym_crypto::hmac::recompute_keyed_hmac_and_verify_tag;
use nym_crypto::symmetric::stream_cipher;
@@ -1,7 +1,7 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_interface::Credential;
use nym_coconut_interface::Credential;
pub struct Bandwidth {
value: u64,
@@ -62,7 +62,7 @@ pub(crate) enum RequestHandlingError {
ProposalIdError { reason: String },
#[error("Coconut interface error - {0}")]
CoconutInterfaceError(#[from] coconut_interface::error::CoconutInterfaceError),
CoconutInterfaceError(#[from] nym_coconut_interface::error::CoconutInterfaceError),
#[error("Credential error - {0}")]
CredentialError(#[from] nym_credentials::error::Error),
@@ -1,8 +1,8 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_interface::Credential;
use log::*;
use nym_coconut_interface::Credential;
use std::time::{Duration, SystemTime};
use validator_client::nyxd::traits::DkgQueryClient;
use validator_client::{
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
use crate::node::client_handling::websocket::connection_handler::authenticated::RequestHandlingError;
use bandwidth_claim_contract::msg::ExecuteMsg;
use bandwidth_claim_contract::payment::LinkPaymentData;
use nym_bandwidth_claim_contract::msg::ExecuteMsg;
use nym_bandwidth_claim_contract::payment::LinkPaymentData;
use nym_credentials::token::bandwidth::TokenCredential;
use nym_crypto::asymmetric::identity::{PublicKey, Signature, SIGNATURE_LENGTH};
use nym_network_defaults::{ETH_EVENT_NAME, ETH_MIN_BLOCK_DEPTH};
+5 -5
View File
@@ -64,12 +64,12 @@ rocket_okapi = { version = "0.8.0-rc.2", features = ["swagger"] }
schemars = { version = "0.8", features = ["preserve_order"] }
## internal
coconut-bandwidth-contract-common = { path = "../common/cosmwasm-smart-contracts/coconut-bandwidth-contract" }
coconut-dkg-common = { path = "../common/cosmwasm-smart-contracts/coconut-dkg" }
coconut-interface = { path = "../common/coconut-interface" }
nym-coconut-bandwidth-contract-common = { path = "../common/cosmwasm-smart-contracts/coconut-bandwidth-contract" }
nym-coconut-dkg-common = { path = "../common/cosmwasm-smart-contracts/coconut-dkg" }
nym-coconut-interface = { path = "../common/coconut-interface" }
nym-config = { path = "../common/config" }
cosmwasm-std = "1.0.0"
credential-storage = { path = "../common/credential-storage" }
nym-credential-storage = { path = "../common/credential-storage" }
nym-credentials = { path = "../common/credentials" }
nym-crypto = { path = "../common/crypto" }
cw3 = { version = "0.13.4" }
@@ -80,7 +80,7 @@ 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" }
multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" }
nym-multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" }
nymcoconut = { path = "../common/nymcoconut" }
nym-sphinx = { path = "../common/nymsphinx" }
nym-pemstore = { path = "../common/pemstore" }
+1 -1
View File
@@ -14,7 +14,7 @@ schemars = { version = "0.8", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
ts-rs = { version = "6.1.2", optional = true }
coconut-interface = { path = "../../common/coconut-interface" }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-mixnet-contract-common = { path= "../../common/cosmwasm-smart-contracts/mixnet-contract" }
[features]
+1 -1
View File
@@ -5,7 +5,7 @@ use cosmrs::AccountId;
use getset::{CopyGetters, Getters};
use serde::{Deserialize, Serialize};
use coconut_interface::{
use nym_coconut_interface::{
error::CoconutInterfaceError, Attribute, Base58, BlindSignRequest, Credential, VerificationKey,
};
+6 -6
View File
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
use crate::coconut::error::Result;
use coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse;
use coconut_dkg_common::dealer::{ContractDealing, DealerDetails, DealerDetailsResponse};
use coconut_dkg_common::types::{
EncodedBTEPublicKeyWithProof, Epoch, EpochId, InitialReplacementData,
};
use coconut_dkg_common::verification_key::{ContractVKShare, VerificationKeyShare};
use cw3::ProposalResponse;
use cw4::MemberResponse;
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse;
use nym_coconut_dkg_common::dealer::{ContractDealing, DealerDetails, DealerDetailsResponse};
use nym_coconut_dkg_common::types::{
EncodedBTEPublicKeyWithProof, Epoch, EpochId, InitialReplacementData,
};
use nym_coconut_dkg_common::verification_key::{ContractVKShare, VerificationKeyShare};
use nym_contracts_common::dealings::ContractSafeBytes;
use nym_dkg::Threshold;
use validator_client::nyxd::cosmwasm_client::types::ExecuteResult;
+2 -2
View File
@@ -3,8 +3,8 @@
use crate::coconut::error::Result;
use crate::nyxd;
use coconut_dkg_common::types::EpochId;
use coconut_interface::VerificationKey;
use nym_coconut_dkg_common::types::EpochId;
use nym_coconut_interface::VerificationKey;
use nym_credentials::coconut::utils::obtain_aggregate_verification_key;
use validator_client::CoconutApiClient;
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use coconut_bandwidth_contract_common::events::{
use nym_api_requests::coconut::BlindSignRequestBody;
use nym_coconut_bandwidth_contract_common::events::{
DEPOSITED_FUNDS_EVENT_TYPE, DEPOSIT_ENCRYPTION_KEY, DEPOSIT_IDENTITY_KEY, DEPOSIT_INFO,
DEPOSIT_VALUE,
};
use nym_api_requests::coconut::BlindSignRequestBody;
use nym_credentials::coconut::bandwidth::BandwidthVoucher;
use nym_crypto::asymmetric::encryption;
use nym_crypto::asymmetric::identity::{self, Signature};
+5 -5
View File
@@ -3,13 +3,13 @@
use crate::coconut::client::Client;
use crate::coconut::error::CoconutError;
use coconut_dkg_common::dealer::{ContractDealing, DealerDetails, DealerDetailsResponse};
use coconut_dkg_common::types::{
EncodedBTEPublicKeyWithProof, Epoch, EpochId, InitialReplacementData, NodeIndex,
};
use coconut_dkg_common::verification_key::{ContractVKShare, VerificationKeyShare};
use cw3::ProposalResponse;
use cw4::MemberResponse;
use nym_coconut_dkg_common::dealer::{ContractDealing, DealerDetails, DealerDetailsResponse};
use nym_coconut_dkg_common::types::{
EncodedBTEPublicKeyWithProof, Epoch, EpochId, InitialReplacementData, NodeIndex,
};
use nym_coconut_dkg_common::verification_key::{ContractVKShare, VerificationKeyShare};
use nym_contracts_common::dealings::ContractSafeBytes;
use nym_dkg::Threshold;
use validator_client::nyxd::cosmwasm_client::logs::{find_attribute, NODE_INDEX};
+1 -1
View File
@@ -14,7 +14,7 @@ use crate::coconut::keypair::KeyPair as CoconutKeyPair;
use crate::nyxd;
use crate::support::config::Config;
use anyhow::Result;
use coconut_dkg_common::types::EpochState;
use nym_coconut_dkg_common::types::EpochState;
use nym_dkg::bte::keys::KeyPair as DkgKeyPair;
use nym_task::{TaskClient, TaskManager};
use rand::rngs::OsRng;
+3 -3
View File
@@ -4,7 +4,7 @@
use crate::coconut::dkg::client::DkgClient;
use crate::coconut::dkg::state::{ConsistentState, State};
use crate::coconut::error::CoconutError;
use coconut_dkg_common::types::TOTAL_DEALINGS;
use nym_coconut_dkg_common::types::TOTAL_DEALINGS;
use nym_contracts_common::dealings::ContractSafeBytes;
use nym_dkg::bte::setup;
use nym_dkg::Dealing;
@@ -86,9 +86,9 @@ pub(crate) mod tests {
use crate::coconut::dkg::state::PersistentState;
use crate::coconut::tests::DummyClient;
use crate::coconut::KeyPair;
use coconut_dkg_common::dealer::DealerDetails;
use coconut_dkg_common::types::InitialReplacementData;
use cosmwasm_std::Addr;
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::InitialReplacementData;
use nym_dkg::bte::keys::KeyPair as DkgKeyPair;
use nym_dkg::bte::{Params, PublicKeyWithProof};
use nymcoconut::{ttp_keygen, Parameters};
+1 -1
View File
@@ -4,7 +4,7 @@
use crate::coconut::dkg::client::DkgClient;
use crate::coconut::dkg::state::State;
use crate::coconut::error::CoconutError;
use coconut_dkg_common::dealer::DealerType;
use nym_coconut_dkg_common::dealer::DealerType;
pub(crate) async fn public_key_submission(
dkg_client: &DkgClient,
+3 -3
View File
@@ -4,9 +4,9 @@
use crate::coconut::dkg::complaints::ComplaintReason;
use crate::coconut::error::CoconutError;
use crate::coconut::keypair::KeyPair as CoconutKeyPair;
use coconut_dkg_common::dealer::DealerDetails;
use coconut_dkg_common::types::EpochState;
use cosmwasm_std::Addr;
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::EpochState;
use nym_dkg::bte::{keys::KeyPair as DkgKeyPair, PublicKey, PublicKeyWithProof};
use nym_dkg::{NodeIndex, RecoveredVerificationKeys, Threshold};
use nymcoconut::SecretKey;
@@ -337,7 +337,7 @@ impl State {
pub async fn set_coconut_keypair(
&mut self,
coconut_keypair: Option<coconut_interface::KeyPair>,
coconut_keypair: Option<nym_coconut_interface::KeyPair>,
) {
self.coconut_keypair.set(coconut_keypair).await
}
+7 -7
View File
@@ -6,12 +6,12 @@ use crate::coconut::dkg::complaints::ComplaintReason;
use crate::coconut::dkg::state::{ConsistentState, State};
use crate::coconut::error::CoconutError;
use crate::coconut::helpers::accepted_vote_err;
use coconut_dkg_common::event_attributes::DKG_PROPOSAL_ID;
use coconut_dkg_common::types::{NodeIndex, TOTAL_DEALINGS};
use coconut_dkg_common::verification_key::owner_from_cosmos_msgs;
use coconut_interface::KeyPair as CoconutKeyPair;
use cosmwasm_std::Addr;
use cw3::{ProposalResponse, Status};
use nym_coconut_dkg_common::event_attributes::DKG_PROPOSAL_ID;
use nym_coconut_dkg_common::types::{NodeIndex, TOTAL_DEALINGS};
use nym_coconut_dkg_common::verification_key::owner_from_cosmos_msgs;
use nym_coconut_interface::KeyPair as CoconutKeyPair;
use nym_credentials::coconut::bandwidth::{PRIVATE_ATTRIBUTES, PUBLIC_ATTRIBUTES};
use nym_dkg::bte::{decrypt_share, setup};
use nym_dkg::error::DkgError;
@@ -277,9 +277,9 @@ pub(crate) mod tests {
use crate::coconut::dkg::state::PersistentState;
use crate::coconut::tests::DummyClient;
use crate::coconut::KeyPair;
use coconut_dkg_common::dealer::DealerDetails;
use coconut_dkg_common::types::InitialReplacementData;
use coconut_dkg_common::verification_key::ContractVKShare;
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::InitialReplacementData;
use nym_coconut_dkg_common::verification_key::ContractVKShare;
use nym_contracts_common::dealings::ContractSafeBytes;
use nym_dkg::bte::keys::KeyPair as DkgKeyPair;
use nymcoconut::aggregate_verification_keys;
+1 -1
View File
@@ -71,7 +71,7 @@ pub enum CoconutError {
DifferentPublicAttributes(String, String),
#[error("Error in coconut interface - {0}")]
CoconutInterfaceError(#[from] coconut_interface::error::CoconutInterfaceError),
CoconutInterfaceError(#[from] nym_coconut_interface::error::CoconutInterfaceError),
#[error("Storage error - {0}")]
StorageError(#[from] NymApiStorageError),
+2 -1
View File
@@ -8,7 +8,8 @@ use validator_client::nyxd::error::NyxdError::AbciError;
// thus the transaction might fail
pub(crate) fn accepted_vote_err(ret: Result<(), CoconutError>) -> Result<(), CoconutError> {
if let Err(CoconutError::NyxdError(AbciError { ref log, .. })) = ret {
let accepted_err = multisig_contract_common::error::ContractError::NotOpen {}.to_string();
let accepted_err =
nym_multisig_contract_common::error::ContractError::NotOpen {}.to_string();
// If redundant voting is not the case, error out on all other error variants
if !log.value().contains(&accepted_err) {
ret?;
+2 -2
View File
@@ -6,7 +6,7 @@ use tokio::sync::{RwLock, RwLockReadGuard};
#[derive(Clone, Debug)]
pub struct KeyPair {
inner: Arc<RwLock<Option<coconut_interface::KeyPair>>>,
inner: Arc<RwLock<Option<nym_coconut_interface::KeyPair>>>,
}
impl KeyPair {
@@ -20,7 +20,7 @@ impl KeyPair {
self.inner.read().await
}
pub async fn set(&self, keypair: Option<coconut_interface::KeyPair>) {
pub async fn set(&self, keypair: Option<nym_coconut_interface::KeyPair>) {
let mut w_lock = self.inner.write().await;
*w_lock = keypair;
}

Some files were not shown because too many files have changed in this diff Show More