Skip to content

Commit cebeee7

Browse files
authored
Merge pull request #54 from lambdaclass/replace_eprintln_calls
Replace `eprintln!` calls with Logger calls
2 parents 555e28c + 5adec30 commit cebeee7

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

operator/mina/lib/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,26 @@ pub extern "C" fn verify_mina_state_ffi(
4646
pub_input_len: usize,
4747
) -> bool {
4848
let Some(proof_buffer_slice) = proof_buffer.get(..proof_len) else {
49-
eprintln!("Proof length argument is greater than max proof size");
49+
error!("Proof length argument is greater than max proof size");
5050
return false;
5151
};
5252

5353
let Some(pub_input_buffer_slice) = pub_input_buffer.get(..pub_input_len) else {
54-
eprintln!("Public input length argument is greater than max public input size");
54+
error!("Public input length argument is greater than max public input size");
5555
return false;
5656
};
5757

5858
let proof: MinaStateProof = match bincode::deserialize(proof_buffer_slice) {
5959
Ok(proof) => proof,
6060
Err(err) => {
61-
eprintln!("Failed to deserialize state proof: {}", err);
61+
error!("Failed to deserialize state proof: {}", err);
6262
return false;
6363
}
6464
};
6565
let pub_inputs: MinaStatePubInputs = match bincode::deserialize(pub_input_buffer_slice) {
6666
Ok(pub_inputs) => pub_inputs,
6767
Err(err) => {
68-
eprintln!("Failed to deserialize state pub inputs: {}", err);
68+
error!("Failed to deserialize state pub inputs: {}", err);
6969
return false;
7070
}
7171
};
@@ -75,7 +75,7 @@ pub extern "C" fn verify_mina_state_ffi(
7575
match check_pub_inputs(&proof, &pub_inputs) {
7676
Ok(validated_data) => validated_data,
7777
Err(err) => {
78-
eprintln!("Failed to check pub inputs: {err}");
78+
error!("Failed to check pub inputs: {err}");
7979
return false;
8080
}
8181
};
@@ -84,12 +84,12 @@ pub extern "C" fn verify_mina_state_ffi(
8484
let secure_chain = match select_secure_chain(&candidate_tip_state, &bridge_tip_state) {
8585
Ok(res) => res,
8686
Err(err) => {
87-
eprintln!("Failed consensus checks for candidate tip: {err}");
87+
error!("Failed consensus checks for candidate tip: {err}");
8888
return false;
8989
}
9090
};
9191
if secure_chain == ChainResult::Bridge {
92-
eprintln!("Failed consensus checks for candidate tip: bridge's tip is more secure");
92+
error!("Failed consensus checks for candidate tip: bridge's tip is more secure");
9393
return false;
9494
}
9595

operator/mina_account/lib/src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use alloy::sol_types::SolValue;
2+
use log::error;
23
use merkle_verifier::verify_merkle_proof;
34
use mina_bridge_core::{
45
proof::account_proof::{MinaAccountProof, MinaAccountPubInputs},
@@ -20,12 +21,12 @@ pub extern "C" fn verify_account_inclusion_ffi(
2021
pub_input_len: usize,
2122
) -> bool {
2223
let Some(proof_buffer_slice) = proof_buffer.get(..proof_len) else {
23-
eprintln!("Proof length argument is greater than max proof size");
24+
error!("Proof length argument is greater than max proof size");
2425
return false;
2526
};
2627

2728
let Some(pub_input_buffer_slice) = pub_input_buffer.get(..pub_input_len) else {
28-
eprintln!("Public input length argument is greater than max public input size");
29+
error!("Public input length argument is greater than max public input size");
2930
return false;
3031
};
3132

@@ -35,7 +36,7 @@ pub extern "C" fn verify_account_inclusion_ffi(
3536
} = match bincode::deserialize(proof_buffer_slice) {
3637
Ok(proof) => proof,
3738
Err(err) => {
38-
eprintln!("Failed to deserialize account proof: {}", err);
39+
error!("Failed to deserialize account proof: {}", err);
3940
return false;
4041
}
4142
};
@@ -45,21 +46,21 @@ pub extern "C" fn verify_account_inclusion_ffi(
4546
} = match bincode::deserialize(pub_input_buffer_slice) {
4647
Ok(pub_inputs) => pub_inputs,
4748
Err(err) => {
48-
eprintln!("Failed to deserialize account pub inputs: {}", err);
49+
error!("Failed to deserialize account pub inputs: {}", err);
4950
return false;
5051
}
5152
};
5253

5354
let expected_encoded_account = match MinaAccountValidation::Account::try_from(&account) {
5455
Ok(account) => account,
5556
Err(err) => {
56-
eprintln!("Failed to convert Mina account to Solidity struct: {}", err);
57+
error!("Failed to convert Mina account to Solidity struct: {}", err);
5758
return false;
5859
}
5960
}
6061
.abi_encode();
6162
if expected_encoded_account != encoded_account {
62-
eprintln!("ABI encoded account in public inputs doesn't match the account on the proof");
63+
error!("ABI encoded account in public inputs doesn't match the account on the proof");
6364
return false;
6465
}
6566

0 commit comments

Comments
 (0)