Skip to content

Commit

Permalink
Optimized storage lookups for side nodes in the SMT (#784)
Browse files Browse the repository at this point in the history
* Optimized storage lookups for side nodes in the SMT

* Updated CHANGELOG.md

* Make clippy happy
  • Loading branch information
xgreenx authored Jul 4, 2024
1 parent cf63a54 commit c329ea7
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 138 deletions.
2 changes: 2 additions & 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/).
- [#781](https://github.com/FuelLabs/fuel-vm/pull/781): Added `base_asset_id` to checked metadata.

### Changed
- [#784](https://github.com/FuelLabs/fuel-vm/pull/784): Avoid storage lookups for side nodes in the SMT.
- [#787](https://github.com/FuelLabs/fuel-vm/pull/787): Fixed charge functions to profile cost before charging.

#### Breaking
Expand All @@ -24,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [#786](https://github.com/FuelLabs/fuel-vm/pull/786): Fixed the CCP opcode to charge for the length from the input arguments.
- [#785](https://github.com/FuelLabs/fuel-vm/pull/785): Require `ContractCreated` output in the `Create` transaction. The `TransactionBuilder<Create>` has a `add_contract_created` method to simplify the creation of the `ContractCreated` output for tests.


## [Version 0.54.1]

### Changed
Expand Down
7 changes: 7 additions & 0 deletions fuel-merkle/src/common/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ pub trait Node {

pub trait ParentNode: Sized + Node {
type Error;
type ChildKey;

fn key(&self) -> Self::ChildKey;
fn left_child(&self) -> ChildResult<Self>;
fn left_child_key(&self) -> ChildKeyResult<Self>;
fn right_child(&self) -> ChildResult<Self>;
fn right_child_key(&self) -> ChildKeyResult<Self>;
}

#[allow(type_alias_bounds)]
pub type ChildResult<T: ParentNode> = Result<T, ChildError<T::Key, T::Error>>;
#[allow(type_alias_bounds)]
pub type ChildKeyResult<T: ParentNode> =
Result<T::ChildKey, ChildError<T::Key, T::Error>>;

#[derive(Debug, Clone, derive_more::Display)]
pub enum ChildError<Key, E>
Expand Down
Loading

0 comments on commit c329ea7

Please sign in to comment.