Report
During the validator startup sequence, the application acquires a lock on the ledger directory by creating/opening a ledger.lock file. Currently, if this operation fails (e.g., due to insufficient directory permissions or a full disk), the application crashes with a Rust panic because of an .unwrap() call in magicblock-api/src/ledger.rs.
Location:
rust
// magicblock-api/src/ledger.rs
pub fn ledger_lockfile(ledger_path: &Path) -> RwLock {
let lockfile = ledger_path.join("ledger.lock");
fd_lock::RwLock::new(
OpenOptions::new()
.write(true)
.create(true)
.truncate(false)
.open(lockfile)
.unwrap(), // Panics if file cannot be created/opened
)
}
Expected Behavior
The validator should catch the std::io::Error and exit gracefully with a user-friendly error message, informing the node operator to check their directory permissions or disk space, rather than terminating with an unhelpful panic backtrace.
Commit / version
ee15b9d
Environment
No response
Report
During the validator startup sequence, the application acquires a lock on the ledger directory by creating/opening a ledger.lock file. Currently, if this operation fails (e.g., due to insufficient directory permissions or a full disk), the application crashes with a Rust panic because of an .unwrap() call in magicblock-api/src/ledger.rs.
Location:
rust
// magicblock-api/src/ledger.rs
pub fn ledger_lockfile(ledger_path: &Path) -> RwLock {
let lockfile = ledger_path.join("ledger.lock");
fd_lock::RwLock::new(
OpenOptions::new()
.write(true)
.create(true)
.truncate(false)
.open(lockfile)
.unwrap(), // Panics if file cannot be created/opened
)
}
Expected Behavior
The validator should catch the std::io::Error and exit gracefully with a user-friendly error message, informing the node operator to check their directory permissions or disk space, rather than terminating with an unhelpful panic backtrace.
Commit / version
ee15b9d
Environment
No response