Skip to content

Commit

Permalink
Implement MerkleRootStorage for reference types (#796)
Browse files Browse the repository at this point in the history
* Implement `MerkleRootStorage` for reference types

* Updated CHANGELOG.md
  • Loading branch information
xgreenx authored Jul 25, 2024
1 parent 2604237 commit 00c5b61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added
- [#781](https://github.com/FuelLabs/fuel-vm/pull/781): Added `base_asset_id` to checked metadata.
- [#796](https://github.com/FuelLabs/fuel-vm/pull/796): Added implementation of the `MerkleRootStorage` for references.

### Changed
- [#784](https://github.com/FuelLabs/fuel-vm/pull/784): Avoid storage lookups for side nodes in the SMT.
Expand Down
8 changes: 8 additions & 0 deletions fuel-storage/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ impl<'a, T: StorageWrite<Type> + ?Sized, Type: Mappable> StorageWrite<Type>
}
}

impl<'a, T: MerkleRootStorage<Key, Type> + ?Sized, Key, Type: Mappable>
MerkleRootStorage<Key, Type> for &'a T
{
fn root(&self, key: &Key) -> Result<MerkleRoot, Self::Error> {
<T as MerkleRootStorage<Key, Type>>::root(self, key)
}
}

impl<'a, T: MerkleRootStorage<Key, Type> + ?Sized, Key, Type: Mappable>
MerkleRootStorage<Key, Type> for &'a mut T
{
Expand Down

0 comments on commit 00c5b61

Please sign in to comment.