Skip to content

Commit 3c97aab

Browse files
committed
Use openmina_core::log::system_time by default in logs macros
1 parent 4dbd1c8 commit 3c97aab

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

core/src/log.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,49 @@ macro_rules! trace {
4343
($time:expr; $($tts:tt)*) => {
4444
$crate::log_entry!(trace, $time; $($tts)*);
4545
};
46+
($($tts:tt)*) => {
47+
$crate::log_entry!(trace; $($tts)*);
48+
};
4649
}
4750

4851
#[macro_export]
4952
macro_rules! debug {
5053
($time:expr; $($tts:tt)*) => {
5154
$crate::log_entry!(debug, $time; $($tts)*);
5255
};
56+
($($tts:tt)*) => {
57+
$crate::log_entry!(debug; $($tts)*);
58+
};
5359
}
5460

5561
#[macro_export]
5662
macro_rules! info {
5763
($time:expr; $($tts:tt)*) => {
5864
$crate::log_entry!(info, $time; $($tts)*);
5965
};
66+
($($tts:tt)*) => {
67+
$crate::log_entry!(info; $($tts)*);
68+
};
6069
}
6170

6271
#[macro_export]
6372
macro_rules! warn {
6473
($time:expr; $($tts:tt)*) => {
6574
$crate::log_entry!(warn, $time; $($tts)*);
6675
};
76+
($($tts:tt)*) => {
77+
$crate::log_entry!(warn; $($tts)*);
78+
};
6779
}
6880

6981
#[macro_export]
7082
macro_rules! error {
7183
($time:expr; $($tts:tt)*) => {
7284
$crate::log_entry!(error, $time; $($tts)*);
7385
};
86+
($($tts:tt)*) => {
87+
$crate::log_entry!(error; $($tts)*);
88+
};
7489
}
7590

7691
pub const ACTION_TRACE_TARGET: &str = "openmina_core::log::action";

ledger/src/proofs/verification.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,9 @@ pub fn verify_block(
741741
};
742742

743743
let Ok(protocol_state) = ProtocolState::try_from(protocol_state) else {
744-
openmina_core::warn!(openmina_core::log::system_time(); message = format!("verify_block: Protocol state contains invalid field"));
744+
openmina_core::warn!(
745+
message = format!("verify_block: Protocol state contains invalid field")
746+
);
745747
return false; // invalid bigint
746748
};
747749
let protocol_state_hash = MinaHash::hash(&protocol_state);
@@ -751,7 +753,7 @@ pub fn verify_block(
751753
let verified = verify_impl(&protocol_state_hash, protocol_state_proof, &vk).unwrap_or(false);
752754
let ok = accum_check && verified;
753755

754-
openmina_core::info!(openmina_core::log::system_time(); message = format!("verify_block OK={ok:?}"));
756+
openmina_core::info!(message = format!("verify_block OK={ok:?}"));
755757

756758
if !ok {
757759
on_fail::dump_block_verification(header);
@@ -792,7 +794,7 @@ pub fn verify_transaction<'a>(
792794
let verified = batch_verify_impl(inputs.as_slice()).unwrap_or(false);
793795
let ok = accum_check && verified;
794796

795-
openmina_core::info!(openmina_core::log::system_time(); message = format!("verify_transactions OK={ok:?}"));
797+
openmina_core::info!(message = format!("verify_transactions OK={ok:?}"));
796798

797799
if !ok {
798800
on_fail::dump_tx_verification(&inputs);
@@ -822,7 +824,7 @@ pub fn verify_zkapp(
822824

823825
let ok = accum_check && verified;
824826

825-
openmina_core::info!(openmina_core::log::system_time(); message = format!("verify_zkapp OK={ok:?}"));
827+
openmina_core::info!(message = format!("verify_zkapp OK={ok:?}"));
826828

827829
if !ok {
828830
on_fail::dump_zkapp_verification(verification_key, zkapp_statement, sideloaded_proof);
@@ -982,7 +984,6 @@ mod on_fail {
982984

983985
if let Err(e) = dump_to_file_impl(data, filename) {
984986
openmina_core::error!(
985-
openmina_core::log::system_time();
986987
message = "Failed to dump proof verification data",
987988
error = format!("{e:?}")
988989
);
@@ -1007,7 +1008,9 @@ mod on_fail {
10071008
file.write_all(&bin)?;
10081009
file.sync_all()?;
10091010

1010-
openmina_core::error!(openmina_core::log::system_time(); message = format!("proof verication failed, dumped data to {:?}", &filename));
1011+
openmina_core::error!(
1012+
message = format!("proof verication failed, dumped data to {:?}", &filename)
1013+
);
10111014

10121015
Ok(())
10131016
}

0 commit comments

Comments
 (0)