Skip to content

Commit

Permalink
MOD: program get error hint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Softcloud88 committed Feb 3, 2024
1 parent 35fb81a commit 4bc41d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/state/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum StateError {
#[error("VM json serde error")]
JsonSerdeError(#[from] serde_json::Error),

#[error("Can not load the program")]
#[error("Can not load the program: {0}")]
GetProgramError(String),

#[error("Convert string error")]
Expand Down
4 changes: 3 additions & 1 deletion core/src/state/state_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ impl StateStorage {
.map_err(StateError::GetProgramError)?;
let res = self.db.get_cf(cf, addr_key);
res.map_err(StateError::StorageIoError)?
.ok_or(StateError::ColumnFamilyEmpty)
.ok_or(StateError::GetProgramError(
"program hash get failed".to_string(),
))
}

pub fn save_prophet(&mut self, code_hash: &TreeValue, prophet: &str) -> Result<(), StateError> {
Expand Down
5 changes: 4 additions & 1 deletion zk-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ impl OlaVM {
let bin_program: BinaryProgram = match bincode::deserialize(&contract) {
Ok(data) => data,
Err(e) => {
return Err(StateError::GetProgramError(format!("{:?}", e)));
return Err(StateError::GetProgramError(format!(
"deserialize program error, {:?}",
e
)));
}
};

Expand Down

0 comments on commit 4bc41d1

Please sign in to comment.