Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9883e0d872 | |||
| bd158e6160 | |||
| 038506707e | |||
| 835b9921d5 | |||
| 71ba11cf91 |
Generated
+1
-1
@@ -5093,7 +5093,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-credential-proxy"
|
||||
version = "0.1.4"
|
||||
version = "0.1.6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
@@ -268,6 +268,9 @@ pub struct WebhookTicketbookWalletSharesRequest {
|
||||
pub struct TicketbookObtainQueryParams {
|
||||
pub output: Option<Output>,
|
||||
|
||||
#[serde(default)]
|
||||
pub skip_webhook: bool,
|
||||
|
||||
pub include_master_verification_key: bool,
|
||||
|
||||
pub include_coin_index_signatures: bool,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "nym-credential-proxy"
|
||||
version = "0.1.4"
|
||||
version = "0.1.6"
|
||||
authors.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
|
||||
@@ -357,6 +357,7 @@ pub(crate) async fn try_obtain_blinded_ticketbook_async(
|
||||
params: TicketbookObtainQueryParams,
|
||||
pending: BlindedShares,
|
||||
) {
|
||||
let skip_webhook = params.skip_webhook;
|
||||
if let Err(err) = try_obtain_blinded_ticketbook_async_inner(
|
||||
&state,
|
||||
request,
|
||||
@@ -367,6 +368,11 @@ pub(crate) async fn try_obtain_blinded_ticketbook_async(
|
||||
)
|
||||
.await
|
||||
{
|
||||
if skip_webhook {
|
||||
info!(uuid = %request,"the webhook is not going to be called for this request");
|
||||
return;
|
||||
}
|
||||
|
||||
// post to the webhook to notify of errors on this side
|
||||
if let Err(webhook_err) = try_trigger_webhook_request_for_error(
|
||||
&state,
|
||||
|
||||
@@ -146,14 +146,16 @@ impl DepositMaker {
|
||||
// in this case terminate the proxy with 0 exit code so it wouldn't get automatically restarted
|
||||
// because it requires some serious MANUAL intervention
|
||||
error!("CRITICAL FAILURE: failed to parse out deposit information from the contract transaction. either the chain got upgraded and the schema changed or the ecash contract got changed! terminating the process. it has to be inspected manually. error was: {err}");
|
||||
process::exit(0)
|
||||
self.cancellation_token.cancel();
|
||||
return Err(VpnApiError::DepositFailure);
|
||||
}
|
||||
};
|
||||
|
||||
if contract_data.len() != replies.len() {
|
||||
// another critical failure, that one should be quite impossible and thus has to be manually inspected
|
||||
error!("CRITICAL FAILURE: failed to parse out all deposit information from the contract transaction. got {} responses while we sent {} deposits! either the chain got upgraded and the schema changed or the ecash contract got changed! terminating the process. it has to be inspected manually", contract_data.len(), replies.len());
|
||||
process::exit(0)
|
||||
self.cancellation_token.cancel();
|
||||
return Err(VpnApiError::DepositFailure);
|
||||
}
|
||||
|
||||
for (reply_channel, response) in replies.into_iter().zip(contract_data) {
|
||||
@@ -163,7 +165,8 @@ impl DepositMaker {
|
||||
Err(err) => {
|
||||
// another impossibility
|
||||
error!("CRITICAL FAILURE: failed to parse out deposit id out of the response at index {response_index}: {err}. either the chain got upgraded and the schema changed or the ecash contract got changed! terminating the process. it has to be inspected manually");
|
||||
process::exit(0)
|
||||
self.cancellation_token.cancel();
|
||||
return Err(VpnApiError::DepositFailure);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -711,23 +711,6 @@ pub(crate) struct ChainWritePermit<'a> {
|
||||
}
|
||||
|
||||
impl<'a> ChainWritePermit<'a> {
|
||||
// pub(crate) async fn make_transaction<F, Fut, T, E>(self, tx: F) -> Result<T, VpnApiError>
|
||||
// where
|
||||
// F: Fn(&'a RwLockWriteGuard<'a, DirectSigningHttpRpcNyxdClient>) -> Fut,
|
||||
// Fut: Future<Output = Result<T, E>> + Send + 'static,
|
||||
// VpnApiError: From<E>,
|
||||
// {
|
||||
// let address = self.inner.address();
|
||||
// let starting_sequence = self
|
||||
// .inner
|
||||
// .get_sequence(&self.inner.address())
|
||||
// .await?
|
||||
// .sequence;
|
||||
// // let res = tx(&*self.inner).await?;
|
||||
//
|
||||
// todo!()
|
||||
// }
|
||||
|
||||
pub(crate) async fn make_deposits(
|
||||
self,
|
||||
short_sha: &'static str,
|
||||
|
||||
@@ -14,11 +14,11 @@ use crate::http::HttpServer;
|
||||
use crate::storage::VpnApiStorage;
|
||||
use crate::tasks::StoragePruner;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::bin_info;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::{bin_info, bin_info_owned};
|
||||
use nym_network_defaults::setup_env;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tracing::{info, trace};
|
||||
use tracing::{error, info, trace};
|
||||
|
||||
pub mod cli;
|
||||
pub mod config;
|
||||
@@ -59,6 +59,12 @@ fn build_sha_short() -> &'static str {
|
||||
if bin_info.commit_sha.len() < 7 {
|
||||
panic!("unavailable build commit sha")
|
||||
}
|
||||
|
||||
if bin_info.commit_sha == "VERGEN_IDEMPOTENT_OUTPUT" {
|
||||
error!("the binary hasn't been built correctly. it doesn't have a commit sha information");
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
&bin_info.commit_sha[..7]
|
||||
}
|
||||
|
||||
@@ -113,10 +119,10 @@ async fn run_api(cli: Cli) -> Result<(), VpnApiError> {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
std::env::set_var(
|
||||
"RUST_LOG",
|
||||
"trace,handlebars=warn,tendermint_rpc=warn,h2=warn,hyper=warn,rustls=warn,reqwest=warn,tungstenite=warn,async_tungstenite=warn,tokio_util=warn,tokio_tungstenite=warn,tokio-util=warn,nym_validator_client=info",
|
||||
);
|
||||
// std::env::set_var(
|
||||
// "RUST_LOG",
|
||||
// "trace,handlebars=warn,tendermint_rpc=warn,h2=warn,hyper=warn,rustls=warn,reqwest=warn,tungstenite=warn,async_tungstenite=warn,tokio_util=warn,tokio_tungstenite=warn,tokio-util=warn,axum=warn,sqlx-core=warn,nym_validator_client=info",
|
||||
// );
|
||||
|
||||
let cli = Cli::parse();
|
||||
cli.webhook.ensure_valid_client_url()?;
|
||||
@@ -125,6 +131,9 @@ async fn main() -> anyhow::Result<()> {
|
||||
setup_env(cli.config_env_file.as_ref());
|
||||
setup_tracing_logger();
|
||||
|
||||
let bin_info = bin_info_owned!();
|
||||
info!("using the following version: {bin_info}");
|
||||
|
||||
run_api(cli).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user