From 553a08ee1d65b99d16993298e297e142302f7f40 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Wed, 8 Jan 2025 17:12:48 -0300 Subject: [PATCH 1/3] add msg to errors --- .../src/communication/messaging.rs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/batcher/aligned-sdk/src/communication/messaging.rs b/batcher/aligned-sdk/src/communication/messaging.rs index 7f3ad921c9..426a3ea343 100644 --- a/batcher/aligned-sdk/src/communication/messaging.rs +++ b/batcher/aligned-sdk/src/communication/messaging.rs @@ -175,41 +175,41 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with invalid nonce"); + error!("Batcher responded with invalid nonce. Funds have not been spent."); Err(SubmitError::InvalidNonce) } Ok(SubmitProofResponseMessage::InvalidSignature) => { - error!("Batcher responded with invalid signature"); + error!("Batcher responded with invalid signature. Funds have not been spent."); Err(SubmitError::InvalidSignature) } Ok(SubmitProofResponseMessage::ProofTooLarge) => { - error!("Batcher responded with proof too large"); + error!("Batcher responded with proof too large. Funds have not been spent."); Err(SubmitError::ProofTooLarge) } Ok(SubmitProofResponseMessage::InvalidMaxFee) => { - error!("Batcher responded with invalid max fee"); + error!("Batcher responded with invalid max fee. Funds have not been spent."); Err(SubmitError::InvalidMaxFee) } Ok(SubmitProofResponseMessage::InsufficientBalance(addr)) => { - error!("Batcher responded with insufficient balance"); + error!("Batcher responded with insufficient balance. Funds have not been spent."); Err(SubmitError::InsufficientBalance(addr)) } Ok(SubmitProofResponseMessage::InvalidChainId) => { - error!("Batcher responded with invalid chain id"); + error!("Batcher responded with invalid chain id. Funds have not been spent."); Err(SubmitError::InvalidChainId) } Ok(SubmitProofResponseMessage::InvalidReplacementMessage) => { - error!("Batcher responded with invalid replacement message"); + error!("Batcher responded with invalid replacement message. Funds have not been spent."); Err(SubmitError::InvalidReplacementMessage) } Ok(SubmitProofResponseMessage::AddToBatchError) => { - error!("Batcher responded with add to batch error"); + error!("Batcher responded with add to batch error. Funds have not been spent."); Err(SubmitError::AddToBatchError) } Ok(SubmitProofResponseMessage::EthRpcError) => { - error!("Batcher experienced Eth RPC connection error"); + error!("Batcher experienced Eth RPC connection error. Funds have not been spent."); Err(SubmitError::EthereumProviderError( - "Batcher experienced Eth RPC connection error".to_string(), + "Batcher experienced Eth RPC connection error. Funds have not been spent.".to_string(), )) } Ok(SubmitProofResponseMessage::InvalidPaymentServiceAddress( @@ -217,7 +217,7 @@ async fn handle_batcher_response(msg: Message) -> Result { error!( - "Batcher responded with invalid payment service address: {:?}, expected: {:?}", + "Batcher responded with invalid payment service address: {:?}, expected: {:?}. Funds have not been spent.", received_addr, expected_addr ); Err(SubmitError::InvalidPaymentServiceAddress( @@ -226,11 +226,11 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with invalid proof: {}", reason); + error!("Batcher responded with invalid proof: {}. Funds have not been spent.", reason); Err(SubmitError::InvalidProof(reason)) } Ok(SubmitProofResponseMessage::CreateNewTaskError(merkle_root, error)) => { - error!("Batcher responded with create new task error: {}", error); + error!("Batcher responded with create new task error: {}. Funds have not been spent.", error); Err(SubmitError::BatchSubmissionFailed( "Could not create task with merkle root ".to_owned() + &merkle_root @@ -239,22 +239,22 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with protocol version instead of batch inclusion data"); + error!("Batcher responded with protocol version instead of batch inclusion data. Funds have not been spent."); Err(SubmitError::UnexpectedBatcherResponse( - "Batcher responded with protocol version instead of batch inclusion data" + "Batcher responded with protocol version instead of batch inclusion data. Funds have not been spent." .to_string(), )) } Ok(SubmitProofResponseMessage::BatchReset) => { - error!("Batcher responded with batch reset"); + error!("Batcher responded with batch reset. Funds have not been spent."); Err(SubmitError::ProofQueueFlushed) } Ok(SubmitProofResponseMessage::Error(e)) => { - error!("Batcher responded with error: {}", e); + error!("Batcher responded with error: {}. Funds have not been spent.", e); Err(SubmitError::GenericError(e)) } Err(e) => { - error!("Error while deserializing batch inclusion data: {}", e); + error!("Error while deserializing batch inclusion data: {}. Funds have not been spent.", e); Err(SubmitError::SerializationError(e)) } } From 7fd3ee2ac6d0f6c090c039d0b2d3ebfd27943279 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Wed, 8 Jan 2025 17:19:05 -0300 Subject: [PATCH 2/3] fmt --- .../src/communication/messaging.rs | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/batcher/aligned-sdk/src/communication/messaging.rs b/batcher/aligned-sdk/src/communication/messaging.rs index 426a3ea343..f71486c462 100644 --- a/batcher/aligned-sdk/src/communication/messaging.rs +++ b/batcher/aligned-sdk/src/communication/messaging.rs @@ -199,7 +199,9 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with invalid replacement message. Funds have not been spent."); + error!( + "Batcher responded with invalid replacement message. Funds have not been spent." + ); Err(SubmitError::InvalidReplacementMessage) } Ok(SubmitProofResponseMessage::AddToBatchError) => { @@ -209,7 +211,8 @@ async fn handle_batcher_response(msg: Message) -> Result { error!("Batcher experienced Eth RPC connection error. Funds have not been spent."); Err(SubmitError::EthereumProviderError( - "Batcher experienced Eth RPC connection error. Funds have not been spent.".to_string(), + "Batcher experienced Eth RPC connection error. Funds have not been spent." + .to_string(), )) } Ok(SubmitProofResponseMessage::InvalidPaymentServiceAddress( @@ -226,11 +229,17 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with invalid proof: {}. Funds have not been spent.", reason); + error!( + "Batcher responded with invalid proof: {}. Funds have not been spent.", + reason + ); Err(SubmitError::InvalidProof(reason)) } Ok(SubmitProofResponseMessage::CreateNewTaskError(merkle_root, error)) => { - error!("Batcher responded with create new task error: {}. Funds have not been spent.", error); + error!( + "Batcher responded with create new task error: {}. Funds have not been spent.", + error + ); Err(SubmitError::BatchSubmissionFailed( "Could not create task with merkle root ".to_owned() + &merkle_root @@ -250,11 +259,17 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with error: {}. Funds have not been spent.", e); + error!( + "Batcher responded with error: {}. Funds have not been spent.", + e + ); Err(SubmitError::GenericError(e)) } Err(e) => { - error!("Error while deserializing batch inclusion data: {}. Funds have not been spent.", e); + error!( + "Error while deserializing batch inclusion data: {}. Funds have not been spent.", + e + ); Err(SubmitError::SerializationError(e)) } } From 9155ded95d56834e523f9be7085b563916c43f3a Mon Sep 17 00:00:00 2001 From: Uriel Mihura <43704209+uri-99@users.noreply.github.com> Date: Thu, 9 Jan 2025 17:37:29 -0300 Subject: [PATCH 3/3] Update batcher/aligned-sdk/src/communication/messaging.rs --- batcher/aligned-sdk/src/communication/messaging.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/communication/messaging.rs b/batcher/aligned-sdk/src/communication/messaging.rs index f71486c462..8677ff1b44 100644 --- a/batcher/aligned-sdk/src/communication/messaging.rs +++ b/batcher/aligned-sdk/src/communication/messaging.rs @@ -191,7 +191,7 @@ async fn handle_batcher_response(msg: Message) -> Result { - error!("Batcher responded with insufficient balance. Funds have not been spent."); + error!("Batcher responded with insufficient balance. Funds have not been spent for submittions which had insufficient balance."); Err(SubmitError::InsufficientBalance(addr)) } Ok(SubmitProofResponseMessage::InvalidChainId) => {