v0.34.0
Release v0.34.0
This release contains fixes for critical issues that we found before the audit. Mainly, these changes pertain to the Sparse Merkle Tree (SMT) and related code. The SMT API was extended to provide more flexibility and to allow users to select the most appropriate method their performance needs. Where possible, sequential SMT updates were replaced with constructors that take in a complete data set.
Added
-
#476: The
fuel_vm::Call
supportsFrom<[u8; Self::LEN]>
andInto<[u8; Self::LEN]>
. -
#484: The
sparse::in_memory::MerkleTree
got new methodsfrom_set
,root_from_set
, andnodes_from_set
methods. These methods allow a more optimal way to build and calculate the SMT when you know all leaves. TheContract::initial_state_root
is much faster now (by ~15 times).
Removed
- #478: The
CheckedMemRange
is replaced by theMemoryRange
.
Changed
-
#477: The
PanicReason::UnknownPanicReason
is0x00
. ThePanicReason
now implementsFrom<u8>
instead ofTryFrom<u8>
and can't return an error anymore. -
#478: The
memcopy
method is updated and returnsMemoryWriteOverlap
instead ofMemoryOverflow
.
Fixed
-
#482: This PR address a security issue where updates to a Sparse Merkle Tree could deliberately overwrite existing leaves by setting the leaf key to the hash of an existing leaf or node. This is done by removing the insertion of the leaf using the leaf key.
-
#484: Fixed bug with not-working
CreateMetadata
.
Breaking
-
#473: CFS and CFSI were not validating
that the new$sp
value isn't below$ssp
, allowing write access to non-owned
memory. This is now fixed, and attempting to set an incorrect$sp
value panics. -
#485: This PR addresses a security
issue where the user may manipulate the structure of the Sparse Merkle Tree.
SMT expects hashed storage key wrapped into aMerkleTreeKey
structure.
The change is breaking because it changes thestate_root
generated by the SMT
and may change theContractId
if theCreate
transaction has non-emptyStoargeSlot
s.
All changes:
- Disallow setting $sp < $ssp using CFS and CFSI instructions by @Dentosal in #473
- MemoryRange rework by @Dentosal in #478
- Return the previous behavior of the data length GTF by @xgreenx in #481
- chore: optimize smt common prefix count by @bvrooman in #475
- refactor: SMT path iter uses leaf key by @bvrooman in #482
- Added a test to show a problem with leaf overriding by @xgreenx in #469
- Minor readibility improvements by @Dentosal in #476
- feat: SMT update set by @bvrooman in #467
- Added more detailed descriptions to README files by @xgreenx in #487
- Use a new
sparse::MerkleTree::from_set
function to calculate state root by @xgreenx in #484 - Changed the API of the
SparseMerkleTree
to acceptMerkleStorageKey
by @xgreenx in #485 - PanicReason rework by @Dentosal in #477
- Use nightly rustfmt with
.rustfmt.toml
fromfuel-core
by @xgreenx in #489 - Bump version to
0.34.0
and finilized the CHANGELOG.md by @xgreenx in #488 - dev-deps on local crate must use path by @Voxelot in #490
Full Changelog: v0.33.0...v0.34.0