diff --git a/common/nym_offline_compact_ecash/benches/benchmarks_ecash_e2e.rs b/common/nym_offline_compact_ecash/benches/benchmarks_ecash_e2e.rs index 8beefea27e..37745a1750 100644 --- a/common/nym_offline_compact_ecash/benches/benchmarks_ecash_e2e.rs +++ b/common/nym_offline_compact_ecash/benches/benchmarks_ecash_e2e.rs @@ -4,7 +4,6 @@ use criterion::{criterion_group, criterion_main, Criterion}; use itertools::izip; use nym_compact_ecash::identify::{identify, IdentifyResult}; -use nym_compact_ecash::scheme::expiration_date_signatures::date_scalar; use nym_compact_ecash::scheme::keygen::SecretKeyAuth; use nym_compact_ecash::setup::Parameters; use nym_compact_ecash::tests::helpers::{ @@ -15,6 +14,7 @@ use nym_compact_ecash::{ ttp_keygen, withdrawal_request, PartialWallet, PayInfo, PublicKeyUser, SecretKeyUser, VerificationKeyAuth, }; +use nym_network_defaults::TicketTypeRepr; use rand::seq::SliceRandom; struct BenchCase { @@ -30,13 +30,14 @@ fn bench_compact_ecash(c: &mut Criterion) { // group.sample_size(300); // group.measurement_time(Duration::from_secs(1500)); - let expiration_date = 1703721600; // Dec 28 2023 - let spend_date = 1701907200; // Dec 07 2023 + let spend_date = 1701907200; // Dec 07 2023 00:00:00 + let expiration_date = 1702166400; // Dec 10 2023 00:00:00 + let encoded_ticket_type = TicketTypeRepr::default() as u8; let case = BenchCase { num_authorities: 100, threshold_p: 0.7, - ll: 1000, + ll: 50, spend_vv: 1, case_nr_pub_keys: 99, }; @@ -83,7 +84,12 @@ fn bench_compact_ecash(c: &mut Criterion) { .unwrap(); // ISSUANCE PHASE - let (req, req_info) = withdrawal_request(user_keypair.secret_key(), expiration_date).unwrap(); + let (req, req_info) = withdrawal_request( + user_keypair.secret_key(), + expiration_date, + encoded_ticket_type, + ) + .unwrap(); // CLIENT BENCHMARK: prepare a single withdrawal request group.bench_function( @@ -91,7 +97,16 @@ fn bench_compact_ecash(c: &mut Criterion) { "[Client] withdrawal_request_{}_authorities_{}_L_{}_threshold", case.num_authorities, case.ll, case.threshold_p, ), - |b| b.iter(|| withdrawal_request(user_keypair.secret_key(), expiration_date).unwrap()), + |b| { + b.iter(|| { + withdrawal_request( + user_keypair.secret_key(), + expiration_date, + encoded_ticket_type, + ) + .unwrap() + }) + }, ); // ISSUING AUTHRORITY BENCHMARK: Benchmark the issue function @@ -110,6 +125,7 @@ fn bench_compact_ecash(c: &mut Criterion) { user_keypair.public_key(), &req, expiration_date, + encoded_ticket_type, ) }) }, @@ -122,6 +138,7 @@ fn bench_compact_ecash(c: &mut Criterion) { user_keypair.public_key(), &req, expiration_date, + encoded_ticket_type, ); wallet_blinded_signatures.push(blind_signature.unwrap()); } @@ -223,7 +240,7 @@ fn bench_compact_ecash(c: &mut Criterion) { |b| { b.iter(|| { payment - .spend_verify(&verification_key, &pay_info, date_scalar(spend_date)) + .spend_verify(&verification_key, &pay_info, spend_date) .unwrap() }) }, diff --git a/gateway/gateway-requests/src/models.rs b/gateway/gateway-requests/src/models.rs index d4e651c3c2..32b2a9f812 100644 --- a/gateway/gateway-requests/src/models.rs +++ b/gateway/gateway-requests/src/models.rs @@ -64,6 +64,7 @@ mod tests { }; use nym_credentials::ecash::utils::EcashTime; use nym_credentials::IssuanceTicketBook; + use nym_credentials_interface::TicketType; use nym_crypto::asymmetric::ed25519; use rand::rngs::OsRng; @@ -75,7 +76,7 @@ mod tests { let mut rng = OsRng; let signing_key = ed25519::PrivateKey::new(&mut rng); - let issuance = IssuanceTicketBook::new(42, [], signing_key); + let issuance = IssuanceTicketBook::new(42, [], signing_key, TicketType::V1MixnetEntry); let expiration_date = issuance.expiration_date(); let sig_req = issuance.prepare_for_signing(); let exp_date_sigs = generate_expiration_date_signatures( @@ -91,6 +92,7 @@ mod tests { sig_req.ecash_pub_key.clone(), &sig_req.withdrawal_request, expiration_date.ecash_unix_timestamp(), + issuance.ticketbook_type().encode(), ) .unwrap(); diff --git a/nym-api/src/ecash/storage/manager.rs b/nym-api/src/ecash/storage/manager.rs index 8da7591c22..a77b4dbb20 100644 --- a/nym-api/src/ecash/storage/manager.rs +++ b/nym-api/src/ecash/storage/manager.rs @@ -27,6 +27,7 @@ pub trait EcashStorageManagerExt { /// # Arguments /// /// * `epoch_id`: Id of the (coconut) epoch in question. + #[allow(dead_code)] async fn create_epoch_credentials_entry(&self, epoch_id: EpochId) -> Result<(), sqlx::Error>; /// Update the EpochCredentials by incrementing the total number of issued credentials, @@ -62,6 +63,7 @@ pub trait EcashStorageManagerExt { ) -> Result, sqlx::Error>; /// Store the provided issued credential information and return its (database) id. + #[allow(clippy::too_many_arguments)] async fn store_issued_ticketbook( &self, epoch_id: u32, diff --git a/nym-api/src/ecash/storage/mod.rs b/nym-api/src/ecash/storage/mod.rs index 752081e4af..cd7fc26f40 100644 --- a/nym-api/src/ecash/storage/mod.rs +++ b/nym-api/src/ecash/storage/mod.rs @@ -89,6 +89,7 @@ pub trait EcashStorageExt { deposit_id: DepositId, ) -> Result, NymApiStorageError>; + #[allow(clippy::too_many_arguments)] async fn store_issued_credential( &self, epoch_id: u32, @@ -324,6 +325,7 @@ impl EcashStorageExt for NymApiStorage { .await?) } + #[allow(clippy::too_many_arguments)] async fn store_issued_credential( &self, epoch_id: u32, diff --git a/tools/internal/testnet-manager/Cargo.toml b/tools/internal/testnet-manager/Cargo.toml index d8c52671df..929ac555a6 100644 --- a/tools/internal/testnet-manager/Cargo.toml +++ b/tools/internal/testnet-manager/Cargo.toml @@ -35,7 +35,7 @@ nym-crypto = { path = "../../../common/crypto", features = ["asymmetric", "rand" nym-config = { path = "../../../common/config" } nym-validator-client = { path = "../../../common/client-libs/validator-client" } nym-compact-ecash = { path = "../../../common/nym_offline_compact_ecash" } -dkg-bypass-contract = { path = "dkg-bypass-contract" } +dkg-bypass-contract = { path = "dkg-bypass-contract", default-features = false } # contracts: nym-mixnet-contract-common = { path = "../../../common/cosmwasm-smart-contracts/mixnet-contract" } diff --git a/tools/internal/testnet-manager/dkg-bypass-contract/Cargo.toml b/tools/internal/testnet-manager/dkg-bypass-contract/Cargo.toml index fdd8eac22b..06ec3f196e 100644 --- a/tools/internal/testnet-manager/dkg-bypass-contract/Cargo.toml +++ b/tools/internal/testnet-manager/dkg-bypass-contract/Cargo.toml @@ -18,4 +18,8 @@ cosmwasm-schema = { workspace = true } cw-storage-plus = { workspace = true } nym-coconut-dkg-common = { path = "../../../../common/cosmwasm-smart-contracts/coconut-dkg" } -nym-contracts-common = { path = "../../../../common/cosmwasm-smart-contracts/contracts-common" } \ No newline at end of file +nym-contracts-common = { path = "../../../../common/cosmwasm-smart-contracts/contracts-common" } + +[features] +default = ["library"] +library = [] \ No newline at end of file diff --git a/tools/internal/testnet-manager/dkg-bypass-contract/src/contract.rs b/tools/internal/testnet-manager/dkg-bypass-contract/src/contract.rs index 7a454c60bb..c04fae8ef2 100644 --- a/tools/internal/testnet-manager/dkg-bypass-contract/src/contract.rs +++ b/tools/internal/testnet-manager/dkg-bypass-contract/src/contract.rs @@ -4,8 +4,7 @@ use crate::msg::MigrateMsg; use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - entry_point, Addr, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response, StdError, - StdResult, Storage, + Addr, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response, StdError, StdResult, Storage, }; use cw_storage_plus::{Index, IndexList, IndexedMap, Item, Map, MultiIndex}; use nym_coconut_dkg_common::dealer::DealerRegistrationDetails; @@ -58,7 +57,7 @@ pub(crate) fn next_node_index(store: &mut dyn Storage) -> StdResult { #[cw_serde] pub enum EmptyMessage {} -#[cfg_attr(not(feature = "library"), entry_point)] +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] pub fn instantiate( _: DepsMut<'_>, _: Env, @@ -69,7 +68,7 @@ pub fn instantiate( } /// Handle an incoming message -#[cfg_attr(not(feature = "library"), entry_point)] +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] pub fn execute( _: DepsMut<'_>, _: Env, @@ -79,13 +78,13 @@ pub fn execute( Ok(Response::new()) } -#[cfg_attr(not(feature = "library"), entry_point)] +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] pub fn query(_: Deps<'_>, _: Env, _: EmptyMessage) -> Result { Ok(Default::default()) } // LIMITATION: we're not storing dealings themselves -#[cfg_attr(not(feature = "library"), entry_point)] +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] pub fn migrate(deps: DepsMut<'_>, env: Env, msg: MigrateMsg) -> Result { // on migration immediately attempt to rewrite the storage let threshold = (2 * msg.dealers.len() as u64 + 3 - 1) / 3; diff --git a/tools/internal/testnet-manager/src/manager/dkg_skip.rs b/tools/internal/testnet-manager/src/manager/dkg_skip.rs index 4cacc8acd4..d09e219228 100644 --- a/tools/internal/testnet-manager/src/manager/dkg_skip.rs +++ b/tools/internal/testnet-manager/src/manager/dkg_skip.rs @@ -259,7 +259,7 @@ impl NetworkManager { fs::write( &mnemonic_path, - &Zeroizing::new(signer.data.cosmos_account.mnemonic.to_string()), + Zeroizing::new(signer.data.cosmos_account.mnemonic.to_string()), )?; fs::write(&endpoint_path, url.as_str())?;