From 3f89f682a2829988099897b070985fd495b8f820 Mon Sep 17 00:00:00 2001 From: qima Date: Mon, 20 May 2024 21:25:44 +0800 Subject: [PATCH] feat: use different key for payment forward --- .github/workflows/memcheck.yml | 2 +- sn_node/src/node.rs | 4 ++-- sn_transfers/src/cashnotes/spend_reason.rs | 2 +- sn_transfers/src/lib.rs | 11 +++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index cdbdd0b250..4fa626316a 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -284,7 +284,7 @@ jobs: - name: Audit from genesis to collect entire spend DAG and dump to a dot file run: | - ./target/release/safe --log-output-dest=data-dir wallet audit --dot --sk-str 17f659c8d3f19b58f140bfe33c97a65a9c60e4383a2628c406f0414ce47b0572 > spend_dag_and_statistics.txt + ./target/release/safe --log-output-dest=data-dir wallet audit --dot --sk-str 49113d2083f57a976076adbe85decb75115820de1e6e74b47e0429338cef124a > spend_dag_and_statistics.txt echo "==============================================================================" cat spend_dag_and_statistics.txt env: diff --git a/sn_node/src/node.rs b/sn_node/src/node.rs index fc57bf52e6..efa77e4403 100644 --- a/sn_node/src/node.rs +++ b/sn_node/src/node.rs @@ -30,7 +30,7 @@ use sn_protocol::{ messages::{ChunkProof, Cmd, CmdResponse, Query, QueryResponse, Request, Response}, NetworkAddress, PrettyPrintRecordKey, }; -use sn_transfers::{HotWallet, MainPubkey, MainSecretKey, NanoTokens, NETWORK_ROYALTIES_PK}; +use sn_transfers::{HotWallet, MainPubkey, MainSecretKey, NanoTokens, PAYMENT_FORWARD_PK}; use std::{ net::SocketAddr, path::PathBuf, @@ -769,7 +769,7 @@ impl Node { let mut wallet = HotWallet::load_from(&network.root_dir_path)?; let balance = wallet.balance(); - let payee = vec![(balance, *NETWORK_ROYALTIES_PK)]; + let payee = vec![(balance, *PAYMENT_FORWARD_PK)]; spend_requests.extend(wallet.prepare_forward_signed_spend(payee, forward_reason)?); } diff --git a/sn_transfers/src/cashnotes/spend_reason.rs b/sn_transfers/src/cashnotes/spend_reason.rs index 2116f57867..d918a529d6 100644 --- a/sn_transfers/src/cashnotes/spend_reason.rs +++ b/sn_transfers/src/cashnotes/spend_reason.rs @@ -40,7 +40,7 @@ impl SpendReason { } pub fn create_reward_tracking_reason(input_str: &str) -> Result { - let input_pk = crate::NETWORK_ROYALTIES_PK.public_key(); + let input_pk = crate::PAYMENT_FORWARD_PK.public_key(); Ok(Self::BetaRewardTracking(DiscordNameCipher::create( input_str, input_pk, )?)) diff --git a/sn_transfers/src/lib.rs b/sn_transfers/src/lib.rs index 6ad3ab2d37..1603cf1c08 100644 --- a/sn_transfers/src/lib.rs +++ b/sn_transfers/src/lib.rs @@ -45,6 +45,8 @@ use lazy_static::lazy_static; const FOUNDATION_PK_STR: &str = "8f73b97377f30bed96df1c92daf9f21b4a82c862615439fab8095e68860a5d0dff9f97dba5aef503a26c065e5cb3c7ca"; // DevSkim: ignore DS173237 /// Public key where network royalties payments are expected to be made to. const NETWORK_ROYALTIES_STR: &str = "b4243ec9ceaec374ef992684cd911b209758c5de53d1e406b395bc37ebc8ce50e68755ea6d32da480ae927e1af4ddadb"; // DevSkim: ignore DS173237 +/// Public key where payment forward to be targeted. +const PAYMENT_FORWARD_STR: &str = "a585839f0502713a0ed6a327f3bd0c301f9e8fe298c93dd00ed7869d8e6804244f0d3014e90df45cd344a7ccd702865c"; // DevSkim: ignore DS173237 lazy_static! { pub static ref FOUNDATION_PK: MainPubkey = { @@ -64,6 +66,15 @@ lazy_static! { }; } +lazy_static! { + pub static ref PAYMENT_FORWARD_PK: MainPubkey = { + match MainPubkey::from_hex(PAYMENT_FORWARD_STR) { + Ok(pk) => pk, + Err(err) => panic!("Failed to parse hard-coded payment forward PK: {err:?}"), + } + }; +} + // re-export crates used in our public API pub use bls::{self, rand, Ciphertext, Signature};