Skip to content

Commit

Permalink
wrap blockhash
Browse files Browse the repository at this point in the history
  • Loading branch information
fridrik01 committed Jan 25, 2024
1 parent 63cde01 commit ee3e823
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fendermint/actors/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Manifest {
for &name in REQUIRED_ACTORS.iter() {
let _ = code_by_name
.get(name)
.context(format!("manifest missing required actor {}", name))?;
.with_context(|| format!("manifest missing required actor {}", name))?;
}

Ok(Self { code_by_name })
Expand Down
5 changes: 4 additions & 1 deletion fendermint/vm/interpreter/src/fvm/externs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ where
};

match actor_state.get_block_hash(&bstore, epoch) {
Ok(Some(v)) => Ok(Cid::new_v1(DAG_CBOR, Code::Blake2b256.digest(&v))),
Ok(Some(v)) => match Code::Blake2b256.wrap(&v) {
Ok(w) => Ok(Cid::new_v1(DAG_CBOR, w)),
Err(err) => Err(anyhow!("failed to wrap block hash, error: {}", err)),
},
Ok(None) => Ok(Cid::default()),
Err(err) => Err(err),
}
Expand Down

0 comments on commit ee3e823

Please sign in to comment.