explicitly import all macros

This commit is contained in:
Jędrzej Stuczyński
2024-05-26 13:30:30 +01:00
parent 77b4fd2aa5
commit a2b1917d06
49 changed files with 63 additions and 29 deletions
+4 -1
View File
@@ -61,7 +61,10 @@ rocket_cors = { workspace = true }
rocket_okapi = { workspace = true, features = ["swagger"] }
okapi = { workspace = true, features = ["impl_json_schema"] }
#axum.workspace = true
#tower-http = { workspace = true, features = ["cors"] }
#utoipa = { workspace = true, features = ["axum_extras", "time"] }
#utoipa-swagger-ui = { workspace = true, features = ["axum"] }
## ephemera-specific
#actix-web = "4"
+1
View File
@@ -3,6 +3,7 @@
use self::data::CirculatingSupplyCacheData;
use cosmwasm_std::Addr;
use log::error;
use nym_api_requests::models::CirculatingSupplyResponse;
use nym_validator_client::nyxd::error::NyxdError;
use nym_validator_client::nyxd::Coin;
+1
View File
@@ -4,6 +4,7 @@
use super::CirculatingSupplyCache;
use crate::circulating_supply_api::cache::CirculatingSupplyCacheError;
use crate::support::nyxd::Client;
use log::{error, trace};
use nym_contracts_common::truncate_decimal;
use nym_task::TaskClient;
use nym_validator_client::nyxd::Coin;
+1 -1
View File
@@ -7,7 +7,7 @@ use nym_api_requests::models::CirculatingSupplyResponse;
use nym_validator_client::nyxd::Coin;
use rocket::http::Status;
use rocket::serde::json::Json;
use rocket::State;
use rocket::{get, State};
use rocket_okapi::openapi;
// TODO: this is not the best place to put it, it should be more centralised,
+7 -8
View File
@@ -1,15 +1,8 @@
// Copyright 2023-2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
use std::ops::Deref;
use k256::ecdsa::signature::Verifier;
use rand::rngs::OsRng;
use rand::RngCore;
use rocket::serde::json::Json;
use rocket::State as RocketState;
use time::OffsetDateTime;
use log::{debug, error, trace};
use nym_api_requests::coconut::models::{
CredentialsRequestBody, EpochCredentialsResponse, FreePassNonceResponse, FreePassRequest,
IssuedCredentialResponse, IssuedCredentialsResponse,
@@ -26,6 +19,12 @@ use nym_credentials::coconut::bandwidth::{
bandwidth_credential_params, CredentialType, IssuanceBandwidthCredential,
};
use nym_validator_client::nyxd::Coin;
use rand::rngs::OsRng;
use rand::RngCore;
use rocket::serde::json::Json;
use rocket::{get, post, State as RocketState};
use std::ops::Deref;
use time::OffsetDateTime;
use crate::coconut::api_routes::helpers::build_credentials_response;
use crate::coconut::error::{CoconutError, Result};
+1
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::coconut::error::Result;
use async_trait::async_trait;
use cw3::{ProposalResponse, VoteResponse};
use cw4::MemberResponse;
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse;
+1
View File
@@ -4,6 +4,7 @@
use crate::coconut::error::Result;
use crate::nyxd;
use crate::support::nyxd::ClientInner;
use async_trait::async_trait;
use nym_coconut::VerificationKey;
use nym_coconut_dkg_common::types::{Epoch, EpochId};
use nym_credentials::coconut::utils::obtain_aggregate_verification_key;
@@ -5,6 +5,7 @@ use crate::coconut::client::Client;
use crate::coconut::keys::KeyPairWithEpoch;
use crate::support::{config, nyxd};
use anyhow::{anyhow, bail, Context};
use log::warn;
use nym_coconut_dkg_common::types::{EpochId, EpochState};
use nym_dkg::bte::keys::KeyPair as DkgKeyPair;
use rand::{CryptoRng, RngCore};
@@ -8,6 +8,7 @@ use crate::coconut::keys::KeyPair as CoconutKeyPair;
use crate::nyxd;
use crate::support::config;
use anyhow::{bail, Result};
use log::{debug, error, info, trace, warn};
use nym_coconut_dkg_common::types::{Epoch, EpochId, EpochState};
use nym_crypto::asymmetric::identity;
use nym_dkg::bte::keys::KeyPair as DkgKeyPair;
+1 -1
View File
@@ -6,7 +6,7 @@ use crate::coconut::dkg::controller::keys::archive_coconut_keypair;
use crate::coconut::dkg::controller::DkgController;
use crate::coconut::error::CoconutError;
use crate::coconut::keys::KeyPairWithEpoch;
use log::debug;
use log::{debug, error, info, warn};
use nym_coconut_dkg_common::dealing::{chunk_dealing, DealingChunkInfo, MAX_DEALING_CHUNK_SIZE};
use nym_coconut_dkg_common::types::{DealingIndex, EpochId};
use nym_dkg::{Dealing, Scalar};
+1 -1
View File
@@ -9,7 +9,7 @@ use crate::coconut::error::CoconutError;
use crate::coconut::keys::KeyPairWithEpoch;
use crate::coconut::state::bandwidth_credential_params;
use cosmwasm_std::Addr;
use log::debug;
use log::{debug, error, info, warn};
use nym_coconut::KeyPair as CoconutKeyPair;
use nym_coconut::{check_vk_pairing, Base58, SecretKey, VerificationKey};
use nym_coconut_dkg_common::event_attributes::DKG_PROPOSAL_ID;
@@ -4,6 +4,7 @@
use crate::coconut::dkg::controller::DkgController;
use crate::coconut::error::CoconutError;
use cw3::Status;
use log::{debug, error, info, warn};
use nym_coconut_dkg_common::types::EpochId;
use rand::{CryptoRng, RngCore};
use thiserror::Error;
@@ -6,6 +6,7 @@ use crate::coconut::error::CoconutError;
use crate::coconut::state::bandwidth_credential_params;
use cosmwasm_std::Addr;
use cw3::Vote;
use log::{debug, error, info, warn};
use nym_coconut::{check_vk_pairing, Base58, VerificationKey};
use nym_coconut_dkg_common::types::EpochId;
use nym_coconut_dkg_common::verification_key::ContractVKShare;
+1 -1
View File
@@ -3,7 +3,7 @@
use crate::coconut::dkg::controller::DkgController;
use crate::coconut::error::CoconutError;
use log::debug;
use log::{debug, info};
use nym_coconut_dkg_common::types::EpochId;
use rand::{CryptoRng, RngCore};
use thiserror::Error;
+1 -1
View File
@@ -12,7 +12,7 @@ use crate::coconut::dkg::state::registration::{
use crate::coconut::error::CoconutError;
use crate::coconut::keys::{KeyPair as CoconutKeyPair, KeyPairWithEpoch};
use cosmwasm_std::Addr;
use log::debug;
use log::{debug, warn};
use nym_coconut_dkg_common::dealer::DealerDetails;
use nym_coconut_dkg_common::types::EpochId;
use nym_crypto::asymmetric::identity;
+1
View File
@@ -10,6 +10,7 @@ use nym_config::defaults::NYM_API_VERSION;
use nym_crypto::asymmetric::identity;
use nym_validator_client::nym_api::routes::{BANDWIDTH, COCONUT_ROUTES};
use rocket::fairing::AdHoc;
use rocket::routes;
pub(crate) mod api_routes;
pub(crate) mod client;
+1
View File
@@ -8,6 +8,7 @@ use crate::coconut::error::{CoconutError, Result};
use crate::coconut::keys::KeyPair;
use crate::coconut::storage::CoconutStorageExt;
use crate::support::storage::NymApiStorage;
use log::{debug, warn};
use nym_api_requests::coconut::helpers::issued_credential_plaintext;
use nym_api_requests::coconut::BlindSignRequestBody;
use nym_coconut::{BlindedSignature, VerificationKey};
+1
View File
@@ -3,6 +3,7 @@
use crate::coconut::storage::models::{EpochCredentials, IssuedCredential};
use crate::support::storage::manager::StorageManager;
use async_trait::async_trait;
use nym_coconut_dkg_common::types::EpochId;
use thiserror::Error;
+1
View File
@@ -5,6 +5,7 @@ use crate::coconut::storage::manager::CoconutStorageManagerExt;
use crate::coconut::storage::models::{join_attributes, EpochCredentials, IssuedCredential};
use crate::node_status_api::models::NymApiStorageError;
use crate::support::storage::NymApiStorage;
use async_trait::async_trait;
use nym_api_requests::coconut::models::Pagination;
use nym_coconut::{Base58, BlindedSignature};
use nym_coconut_dkg_common::types::EpochId;
@@ -3,6 +3,7 @@
use crate::epoch_operations::error::RewardingError;
use crate::RewardedSetUpdater;
use log::{error, warn};
use nym_mixnet_contract_common::EpochState;
use std::cmp::max;
+1
View File
@@ -18,6 +18,7 @@ use crate::support::nyxd::Client;
use crate::support::storage::NymApiStorage;
use error::RewardingError;
pub(crate) use helpers::MixnodeWithPerformance;
use log::{error, info, trace, warn};
use nym_mixnet_contract_common::{CurrentIntervalResponse, Interval};
use nym_task::{TaskClient, TaskManager};
use std::collections::HashSet;
@@ -5,6 +5,7 @@ use crate::epoch_operations::error::RewardingError;
use crate::epoch_operations::helpers::stake_to_f64;
use crate::RewardedSetUpdater;
use cosmwasm_std::Decimal;
use log::{debug, error, warn};
use nym_mixnet_contract_common::families::FamilyHead;
use nym_mixnet_contract_common::reward_params::Performance;
use nym_mixnet_contract_common::{
@@ -4,6 +4,7 @@
use crate::epoch_operations::error::RewardingError;
use crate::epoch_operations::helpers::MixnodeWithPerformance;
use crate::RewardedSetUpdater;
use log::{error, warn};
use nym_mixnet_contract_common::{EpochState, Interval, MixId};
impl RewardedSetUpdater {
@@ -3,6 +3,7 @@
use crate::epoch_operations::error::RewardingError;
use crate::epoch_operations::RewardedSetUpdater;
use log::{error, info};
impl RewardedSetUpdater {
// returns boolean indicating whether we should bother continuing
+2 -4
View File
@@ -1,9 +1,6 @@
// Copyright 2020-2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
#[macro_use]
extern crate rocket;
use crate::coconut::dkg::controller::keys::{
can_validate_coconut_keys, load_bte_keypair, load_coconut_keypair_if_exists,
};
@@ -20,6 +17,7 @@ use ::nym_config::defaults::setup_env;
use circulating_supply_api::cache::CirculatingSupplyCache;
use clap::Parser;
use coconut::dkg::controller::DkgController;
use log::{info, trace};
use node_status_api::NodeStatusCache;
use nym_bin_common::logging::setup_logging;
use nym_config::defaults::NymNetworkDetails;
@@ -86,7 +84,7 @@ async fn start_nym_api_tasks(config: Config) -> anyhow::Result<ShutdownHandles>
let identity_public_key = *identity_keypair.public_key();
// let's build our rocket!
let rocket = http::setup_rocket(
let rocket = http::setup_rest_api(
&config,
network_details,
nyxd_client.clone(),
+1 -1
View File
@@ -5,7 +5,7 @@ use crate::network::models::{ContractInformation, NetworkDetails};
use crate::nym_contract_cache::cache::NymContractCache;
use nym_contracts_common::ContractBuildInformation;
use rocket::serde::json::Json;
use rocket::State;
use rocket::{get, State};
use rocket_okapi::openapi;
use std::collections::HashMap;
use std::ops::Deref;
+1
View File
@@ -15,6 +15,7 @@ use crate::nym_contract_cache::cache::NymContractCache;
use crate::storage::NymApiStorage;
use crate::support::{config, nyxd};
use futures::channel::mpsc;
use log::info;
use nym_bandwidth_controller::BandwidthController;
use nym_credential_storage::persistent_storage::PersistentStorage;
use nym_crypto::asymmetric::{encryption, identity};
+1 -1
View File
@@ -9,7 +9,7 @@ use crate::network_monitor::test_packet::NodeTestMessage;
use crate::network_monitor::test_route::TestRoute;
use crate::storage::NymApiStorage;
use crate::support::config;
use log::{debug, error, info};
use log::{debug, error, info, trace};
use nym_sphinx::params::PacketType;
use nym_sphinx::receiver::MessageReceiver;
use nym_task::TaskClient;
@@ -4,7 +4,7 @@
use crate::network_monitor::monitor::sender::GatewayPackets;
use crate::network_monitor::test_route::TestRoute;
use crate::nym_contract_cache::cache::NymContractCache;
use log::info;
use log::{error, info, trace};
use nym_crypto::asymmetric::{encryption, identity};
use nym_mixnet_contract_common::{GatewayBond, Layer, MixNodeBond};
use nym_node_tester_utils::node::TestableNode;
@@ -7,7 +7,7 @@ use crate::network_monitor::ROUTE_TESTING_TEST_NONCE;
use futures::channel::mpsc;
use futures::lock::{Mutex, MutexGuard};
use futures::{SinkExt, StreamExt};
use log::warn;
use log::{debug, error, trace, warn};
use nym_crypto::asymmetric::encryption;
use nym_node_tester_utils::error::NetworkTestingError;
use nym_node_tester_utils::processor::TestPacketProcessor;
@@ -5,6 +5,7 @@ use crate::network_monitor::gateways_reader::{GatewayMessages, GatewaysReader};
use crate::network_monitor::monitor::processor::ReceivedProcessorSender;
use futures::channel::mpsc;
use futures::StreamExt;
use log::trace;
use nym_crypto::asymmetric::identity;
use nym_gateway_client::{AcknowledgementReceiver, MixnetMessageReceiver};
use nym_task::TaskClient;
+2
View File
@@ -6,7 +6,9 @@ use crate::support::caching::cache::{SharedCache, UninitialisedCache};
use crate::support::caching::refresher::{CacheItemProvider, CacheRefresher};
use crate::support::config;
use crate::support::config::DEFAULT_NODE_DESCRIBE_BATCH_SIZE;
use async_trait::async_trait;
use futures::{stream, StreamExt};
use log::debug;
use nym_api_requests::models::{
IpPacketRouterDetails, NetworkRequesterDetails, NymNodeDescription,
};
@@ -1,6 +1,7 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
use log::error;
use nym_api_requests::models::InclusionProbability;
use nym_contracts_common::truncate_decimal;
use nym_mixnet_contract_common::{MixId, MixNodeDetails, RewardingParams};
+1
View File
@@ -4,6 +4,7 @@
use self::data::NodeStatusCacheData;
use self::inclusion_probabilities::InclusionProbabilities;
use crate::support::caching::Cache;
use log::error;
use nym_api_requests::models::{GatewayBondAnnotated, MixNodeBondAnnotated, MixnodeStatus};
use nym_contracts_common::{IdentityKey, IdentityKeyRef};
use nym_mixnet_contract_common::MixId;
+1
View File
@@ -15,6 +15,7 @@ use crate::{
storage::NymApiStorage,
support::caching::CacheNotification,
};
use log::error;
use nym_task::TaskClient;
use std::time::Duration;
use tokio::sync::watch;
@@ -1,6 +1,7 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
use log::warn;
use rocket::http::Status;
use rocket::request::{FromRequest, Outcome};
use rocket::Request;
+1
View File
@@ -3,6 +3,7 @@
use crate::node_status_api::utils::NodeUptimes;
use crate::storage::models::NodeStatus;
use log::error;
use nym_api_requests::models::{
GatewayStatusReportResponse, GatewayUptimeHistoryResponse, HistoricalUptimeResponse,
MixnodeStatusReportResponse, MixnodeUptimeHistoryResponse, NodePerformance, RequestError,
+3 -2
View File
@@ -11,7 +11,7 @@ use nym_api_requests::models::{
};
use nym_mixnet_contract_common::MixId;
use rocket::serde::json::Json;
use rocket::State;
use rocket::{get, post, State};
use rocket_okapi::openapi;
use super::helpers::_get_gateways_detailed;
@@ -233,6 +233,7 @@ pub mod unstable {
use crate::node_status_api::models::ErrorResponse;
use crate::support::http::helpers::PaginationRequest;
use crate::support::storage::NymApiStorage;
use log::{error, trace};
use nym_api_requests::models::{
GatewayTestResultResponse, MixnodeTestResultResponse, PartialTestResult, TestNode,
TestRoute,
@@ -241,7 +242,7 @@ pub mod unstable {
use nym_mixnet_contract_common::MixId;
use rocket::http::Status;
use rocket::serde::json::Json;
use rocket::State;
use rocket::{get, State};
use rocket_okapi::openapi;
use std::cmp::min;
use std::collections::HashMap;
@@ -6,7 +6,7 @@ use crate::node_status_api::models::{
};
use crate::node_status_api::ONE_DAY;
use crate::storage::NymApiStorage;
use log::error;
use log::{error, info, trace, warn};
use nym_task::{TaskClient, TaskManager};
use std::time::Duration;
use time::{OffsetDateTime, PrimitiveDateTime, Time};
+1
View File
@@ -4,6 +4,7 @@
use crate::nym_contract_cache::cache::data::CachedContractsInfo;
use crate::support::caching::Cache;
use data::ValidatorCacheData;
use log::{debug, error};
use nym_api_requests::models::MixnodeStatus;
use nym_mixnet_contract_common::{
families::FamilyHead, GatewayBond, IdentityKey, Interval, MixId, MixNodeBond, MixNodeDetails,
+1
View File
@@ -7,6 +7,7 @@ use crate::nyxd::Client;
use crate::support::caching::CacheNotification;
use anyhow::Result;
use futures::future::join_all;
use log::{error, info, trace, warn};
use nym_mixnet_contract_common::{MixId, MixNodeDetails, RewardedSetNodeStatus};
use nym_task::TaskClient;
use nym_validator_client::nyxd::contract_traits::{
+1 -1
View File
@@ -15,7 +15,7 @@ use nym_mixnet_contract_common::{
use nym_name_service_common::response::NamesListResponse;
use nym_service_provider_directory_common::response::ServicesListResponse;
use rocket::{serde::json::Json, State};
use rocket::{get, serde::json::Json, State};
use rocket_okapi::openapi;
use std::collections::HashSet;
+1 -1
View File
@@ -6,7 +6,7 @@ use crate::nym_contract_cache::cache::NymContractCache;
use crate::support::caching::cache::SharedCache;
use nym_api_requests::models::DescribedGateway;
use rocket::serde::json::Json;
use rocket::State;
use rocket::{get, State};
use rocket_okapi::openapi;
use std::ops::Deref;
+1 -1
View File
@@ -8,7 +8,7 @@ use nym_bin_common::build_information::BinaryBuildInformationOwned;
use nym_coconut::Base58;
use rocket::http::Status;
use rocket::serde::json::Json;
use rocket::State;
use rocket::{get, State};
use rocket_okapi::openapi;
#[openapi(tag = "Api Status")]
+2
View File
@@ -2,6 +2,8 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::support::caching::cache::SharedCache;
use async_trait::async_trait;
use log::error;
use nym_task::TaskClient;
use std::time::Duration;
use tokio::time::interval;
+1
View File
@@ -7,6 +7,7 @@ use crate::support::config::persistence::{
use crate::support::config::r#override::OverrideConfig;
use crate::support::config::template::CONFIG_TEMPLATE;
use anyhow::bail;
use log::debug;
use nym_config::defaults::mainnet::read_parsed_var_if_not_default;
use nym_config::defaults::var_names::{CONFIGURED, NYXD};
use nym_config::serde_helpers::de_maybe_stringified;
+1
View File
@@ -1,6 +1,7 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
use rocket::FromForm;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
+1 -1
View File
@@ -27,7 +27,7 @@ use rocket_okapi::swagger_ui::make_swagger_ui;
pub(crate) mod helpers;
pub(crate) mod openapi;
pub(crate) async fn setup_rocket(
pub(crate) async fn setup_rest_api(
config: &Config,
network_details: NetworkDetails,
nyxd_client: nyxd::Client,
+1
View File
@@ -13,6 +13,7 @@ use crate::storage::models::{NodeStatus, TestingRoute};
use crate::support::storage::models::{
GatewayDetails, MixnodeDetails, TestedGatewayStatus, TestedMixnodeStatus,
};
use log::{error, info, warn};
use nym_mixnet_contract_common::MixId;
use rocket::fairing::AdHoc;
use sqlx::ConnectOptions;