Skip to content

Commit

Permalink
Update version of starknet type core and fix error with no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT committed Apr 22, 2024
1 parent cec867b commit 055de36
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ serde = { version = "1.0.195", default-features = false, features = [
"derive",
"alloc",
] }
starknet-types-core = { git = "https://github.com/starknet-io/types-rs", branch = "main", default-features = false, features = [
starknet-types-core = { version = "0.1", default-features = false, features = [
"hash",
"parity-scale-codec",
] }
Expand Down
32 changes: 8 additions & 24 deletions ensure_no_std/Cargo.lock

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

26 changes: 12 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,10 @@ where
&mut self,
transactional_bonsai_storage: BonsaiStorage<ChangeID, DB::Transaction, H>,
) -> Result<(), BonsaiStorageError<<DB as BonsaiPersistentDatabase<ChangeID>>::DatabaseError>>
where
<DB as BonsaiDatabase>::DatabaseError: core::fmt::Debug,
{
// memoryze changes
// memorize changes
let MerkleTrees { db, trees, .. } = transactional_bonsai_storage.tries;

self.tries.db_mut().merge(db)?;
Expand All @@ -499,25 +501,21 @@ where
for (k, op) in tree.cache_leaf_modified() {
match op {
crate::trie::merkle_tree::InsertOrRemove::Insert(v) => {
self.insert(&identifier, &bytes_to_bitvec(&k), &v)
self.insert(&identifier, &bytes_to_bitvec(k), v)
.map_err(|e| {
BonsaiStorageError::Merge(format!(
"While merging insert({:?} {}) faced error: {}",
k,
v,
e.to_string()
"While merging insert({:?} {}) faced error: {:?}",
k, v, e
))
})?;
}
crate::trie::merkle_tree::InsertOrRemove::Remove => {
self.remove(&identifier, &bytes_to_bitvec(&k))
.map_err(|e| {
BonsaiStorageError::Merge(format!(
"While merging remove({:?}) faced error: {}",
k,
e.to_string()
))
})?;
self.remove(&identifier, &bytes_to_bitvec(k)).map_err(|e| {
BonsaiStorageError::Merge(format!(
"While merging remove({:?}) faced error: {:?}",
k, e
))
})?;
}
}
}
Expand Down

0 comments on commit 055de36

Please sign in to comment.