FuelLabs / fuel-vm

Fuel v2 interpreter in Rust
Other
344 stars 77 forks source link

Remove unnecessary look up for old values #783

Closed xgreenx closed 6 days ago

xgreenx commented 1 week ago

The change adds new replace and take methods into the StorageMutate traits. These new methods work as the old ones. Old methods were changed to not return the value.

Most of all, places that were using insert and remove don't need an old value. This helps to remove unnecessary lookups to the storage. An example is the Sparse Merkle tree. It only inserts new nodes and removes old nodes without handling the old values since it is not important for the tree.

I helped to decrease lookups to the storage in the testnet by 30%.

Checklist

Before requesting review