From f20dc2b8ad7c6767f4a2d982fc0abcf8394c7fd7 Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 11 Sep 2024 16:34:02 +0200 Subject: [PATCH] Fix merge --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- core/payment-driver/base/src/driver.rs | 12 ++++++++++-- core/payment/src/lib.rs | 3 ++- core/payment/src/processor.rs | 2 +- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a53a45586..ecdfde858 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8807,7 +8807,7 @@ dependencies = [ [[package]] name = "ya-client" version = "0.9.0" -source = "git+https://github.com/golemfactory/ya-client.git?rev=b5369b76044f0a1584532f603c542587e15be852#b5369b76044f0a1584532f603c542587e15be852" +source = "git+https://github.com/golemfactory/ya-client.git?rev=8dc4ccec33ad4d51fe975b038677bcbbd920653a#8dc4ccec33ad4d51fe975b038677bcbbd920653a" dependencies = [ "actix-codec", "awc", @@ -8831,7 +8831,7 @@ dependencies = [ [[package]] name = "ya-client-model" version = "0.7.0" -source = "git+https://github.com/golemfactory/ya-client.git?rev=b5369b76044f0a1584532f603c542587e15be852#b5369b76044f0a1584532f603c542587e15be852" +source = "git+https://github.com/golemfactory/ya-client.git?rev=8dc4ccec33ad4d51fe975b038677bcbbd920653a#8dc4ccec33ad4d51fe975b038677bcbbd920653a" dependencies = [ "bigdecimal 0.2.2", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 37a8cd239..91a44192a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -296,9 +296,9 @@ ya-service-api-interfaces = { path = "core/serv-api/interfaces" } ya-service-api-web = { path = "core/serv-api/web" } ## CLIENT -ya-client = { git = "https://github.com/golemfactory/ya-client.git", rev = "c8675c4eb0d42119b1cfa2f5772ba91f877d81f9" } +ya-client = { git = "https://github.com/golemfactory/ya-client.git", rev = "8dc4ccec33ad4d51fe975b038677bcbbd920653a" } #ya-client = { path = "../ya-client" } -ya-client-model = { git = "https://github.com/golemfactory/ya-client.git", rev = "c8675c4eb0d42119b1cfa2f5772ba91f877d81f9" } +ya-client-model = { git = "https://github.com/golemfactory/ya-client.git", rev = "8dc4ccec33ad4d51fe975b038677bcbbd920653a" } golem-certificate = { git = "https://github.com/golemfactory/golem-certificate.git", rev = "952fdbd47adc57e46b7370935111e046271ef415" } ## RELAY and networking stack diff --git a/core/payment-driver/base/src/driver.rs b/core/payment-driver/base/src/driver.rs index 85e94580d..9b70f71a8 100644 --- a/core/payment-driver/base/src/driver.rs +++ b/core/payment-driver/base/src/driver.rs @@ -141,8 +141,16 @@ pub trait PaymentDriver { let s: [u8; 32] = msg.signature[33..65].try_into().unwrap(); let signature = Signature { v, r, s }; - let payload = if msg.canonicalized { - utils::payment_hash_canonicalized(&msg.payment) + let payload = if let Some(payload) = msg.canonical { + match msg.payment.verify_canonical(payload.as_slice()) { + Ok(_) => prepare_signature_hash(&payload), + Err(e) => { + log::info!( + "Signature verification: canonical representation doesn't match struct: {e}" + ); + return Ok(false); + } + } } else { // Backward compatibility version for older Nodes that don't send canonical // signed bytes and used Payment debug formatting as representation. diff --git a/core/payment/src/lib.rs b/core/payment/src/lib.rs index fb1a6beee..1e5298f7a 100644 --- a/core/payment/src/lib.rs +++ b/core/payment/src/lib.rs @@ -61,7 +61,8 @@ impl PaymentService { let config = Arc::new(Config::from_env()?); let processor = Arc::new(PaymentProcessor::new(db.clone())); - self::service::bind_service(&db, processor.clone(), BindOptions::default(), config); + self::service::bind_service(&db, processor.clone(), config); + processor.process_post_migration_jobs().await?; tokio::task::spawn(async move { diff --git a/core/payment/src/processor.rs b/core/payment/src/processor.rs index db0f39dd9..ce26ce613 100644 --- a/core/payment/src/processor.rs +++ b/core/payment/src/processor.rs @@ -26,7 +26,7 @@ use std::ops::Sub; use std::str::FromStr; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; -use std::time::Duration; +use std::time::{Duration, Instant}; use thiserror::Error; use tokio::sync::{Mutex, RwLock};