From 2e5a71fb8a3c05e46fc40937315ed17ab516b35f Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Wed, 6 Apr 2022 15:30:36 +0200 Subject: [PATCH] Removed caching of the POST response from submitting a confirmation (#846) (#847) * Removed caching of the POST response from submitting a confirmation * Version bump to v3.20.1 * Added comment clarifying change in methods --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/routes/transactions/handlers/proposal.rs | 7 ++--- src/routes/transactions/routes.rs | 29 ++++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 93a5da9ec..c3c998c7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1813,7 +1813,7 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "safe-client-gateway" -version = "3.20.0" +version = "3.20.1" dependencies = [ "bb8-redis", "bigdecimal", diff --git a/Cargo.toml b/Cargo.toml index c6b2816b1..2bc23fa8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "safe-client-gateway" -version = "3.20.0" +version = "3.20.1" authors = ["jpalvarezl ", "rmeissner ", "fmrsabino "] edition = "2018" diff --git a/src/routes/transactions/handlers/proposal.rs b/src/routes/transactions/handlers/proposal.rs index cf47dc0b8..0708b2d9f 100644 --- a/src/routes/transactions/handlers/proposal.rs +++ b/src/routes/transactions/handlers/proposal.rs @@ -1,19 +1,18 @@ use crate::cache::cache_operations::{Invalidate, InvalidationPattern, InvalidationScope}; use crate::providers::info::{DefaultInfoProvider, InfoProvider}; -use crate::routes::transactions::handlers::details::get_multisig_transaction_details; -use crate::routes::transactions::models::details::TransactionDetails; use crate::routes::transactions::models::requests::MultisigTransactionRequest; use crate::utils::context::RequestContext; use crate::utils::errors::ApiResult; use crate::utils::http_client::Request; use serde_json::json; +// The transaction details are returned at the route level. The same as for transaction submission pub async fn submit_confirmation( context: &RequestContext, chain_id: &str, safe_tx_hash: &str, signature: &str, -) -> ApiResult { +) -> ApiResult<()> { let info_provider = DefaultInfoProvider::new(chain_id, context); let url = core_uri!( info_provider, @@ -36,7 +35,7 @@ pub async fn submit_confirmation( .execute() .await; - get_multisig_transaction_details(&info_provider, chain_id, safe_tx_hash).await + Ok(()) } pub async fn propose_transaction( diff --git a/src/routes/transactions/routes.rs b/src/routes/transactions/routes.rs index 7d4c8123e..198ace455 100644 --- a/src/routes/transactions/routes.rs +++ b/src/routes/transactions/routes.rs @@ -66,21 +66,22 @@ pub async fn post_confirmation<'e>( safe_tx_hash: String, tx_confirmation_request: Result, Error<'e>>, ) -> ApiResult> { - CacheResponse::new(&context) - .resp_generator(|| { - proposal::submit_confirmation( - &context, - &chain_id, - &safe_tx_hash, - &tx_confirmation_request - .as_ref() - .unwrap() - .0 - .signed_safe_tx_hash, - ) - }) + let request: ConfirmationRequest = tx_confirmation_request?.0; + + proposal::submit_confirmation( + &context, + &chain_id, + &safe_tx_hash, + &request.signed_safe_tx_hash, + ) + .await?; + + let tx_details = CacheResponse::new(&context) + .resp_generator(|| details::get_transactions_details(&context, &chain_id, &safe_tx_hash)) .execute() - .await + .await; + + return tx_details; } /// `/v1/chains//safes//transactions/history?&&`