Skip to content

Commit

Permalink
Fix suggestions
Browse files Browse the repository at this point in the history
- use RUST_LOG
- simplify functions
- convert sled errors to custom db error
- deprecate audit module
- reduce cloning and replace with ref usage
- add zeroize type for wallet bytes
  • Loading branch information
saefstroem committed May 10, 2024
1 parent 6ed7e83 commit e889da7
Show file tree
Hide file tree
Showing 13 changed files with 321 additions and 131 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
target
acceptevm.log
201 changes: 200 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ sha2 = "0.10.8"
tokio = "1.37.0"
uuid = {version="1.8.0",features=["v4"]}
reqwest = "0.12.4"
log4rs = "1.3.0"
log = "0.4.21"
zeroize = {version="1.7.0",features=["zeroize_derive"]}
25 changes: 0 additions & 25 deletions src/audit/mod.rs

This file was deleted.

14 changes: 5 additions & 9 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use std::time::{SystemTime, UNIX_EPOCH};
use thiserror::Error;

/// Retrieve the current unix time in nanoseconds
pub fn get_unix_time_millis() -> u128 {
let now = SystemTime::now();
let duration = now.duration_since(UNIX_EPOCH).unwrap_or_else(|_| {
println!("Failed computing UNIX timestamp during admin login!");
Duration::from_secs(0)
});
let duration = now.duration_since(UNIX_EPOCH).unwrap_or_default();
duration.as_millis()
}
/// Retrieve the current unix time in nanoseconds
pub fn get_unix_time_seconds() -> u64 {
let now = SystemTime::now();
let duration = now.duration_since(UNIX_EPOCH).unwrap_or_else(|_| {
println!("Failed computing UNIX timestamp during admin login!");
Duration::from_secs(0)
});
let duration = now.duration_since(UNIX_EPOCH).unwrap_or_default();
duration.as_secs()
}

Expand All @@ -36,4 +30,6 @@ pub enum DatabaseError {
Serialize,
#[error("Could not delete from database")]
NoDelete,
#[error("Database internal error: {0}")]
SledError(#[from] sled::Error),
}
Loading

0 comments on commit e889da7

Please sign in to comment.