From b713ada7e957ce5d1b8e78aaf9c34a505fdb6e28 Mon Sep 17 00:00:00 2001 From: chrismaree Date: Wed, 30 Oct 2024 15:17:25 +0100 Subject: [PATCH] WIP Signed-off-by: chrismaree --- .../svm-spoke/src/instructions/handle_receive_message.rs | 6 +++++- programs/svm-spoke/src/lib.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/svm-spoke/src/instructions/handle_receive_message.rs b/programs/svm-spoke/src/instructions/handle_receive_message.rs index 158aba27d..4b4763070 100644 --- a/programs/svm-spoke/src/instructions/handle_receive_message.rs +++ b/programs/svm-spoke/src/instructions/handle_receive_message.rs @@ -8,6 +8,9 @@ use crate::{ State, }; +//TODO: we have inconsistent imports in this file, in some places referencing from source crates (SvmSpoke::id) +// rather than importing at the top. fix overall and check other files. + #[derive(Accounts)] #[instruction(params: HandleReceiveMessageParams)] pub struct HandleReceiveMessage<'info> { @@ -41,13 +44,14 @@ pub struct HandleReceiveMessageParams { pub authority_bump: u8, } +// TODO: consider refactoring this to be consistent with using free functions. impl<'info> HandleReceiveMessage<'info> { pub fn handle_receive_message(&self, params: &HandleReceiveMessageParams) -> Result> { // Return instruction data for the self invoked CPI based on the received message body. translate_message(¶ms.message_body) } } - +// TODO: ensure that CCTP blocks re-played messages sent over the bridge. i.e one pauseDeposit Call cant be replayed. fn translate_message(data: &Vec) -> Result> { match utils::get_solidity_selector(data)? { s if s == utils::encode_solidity_selector("pauseDeposits(bool)") => { diff --git a/programs/svm-spoke/src/lib.rs b/programs/svm-spoke/src/lib.rs index f8ca79499..e6c765743 100644 --- a/programs/svm-spoke/src/lib.rs +++ b/programs/svm-spoke/src/lib.rs @@ -147,6 +147,7 @@ pub mod svm_spoke { } // CCTP methods. + // TODO: consider refactoring this to be consistent with using free functions. pub fn handle_receive_message<'info>( ctx: Context<'_, '_, '_, 'info, HandleReceiveMessage<'info>>, params: HandleReceiveMessageParams