Skip to content

Commit

Permalink
Deny clippy::arithmetic_side_effects for fuel-merkle (#729)
Browse files Browse the repository at this point in the history
* Rename Instruction -> Size and reuse it for orientation

* Small refactorings

* Rework path_length_from_key

* Promote key_size_bits to a constant

* More checks

* Simplify, add lints, add comments

* Remove Bit type and GetBit trait

* Make common_prefix_count unable to overflow

* Fix key_size_bits

* Add changelog entry

* Relax lints for tests

* Use Bit alias, remove unused impl

* Revert some tests back to {left,right}_child

* Update fuel-merkle/src/common/position.rs

Co-authored-by: Brandon Vrooman <brandon.vrooman@fuel.sh>

* Address PR comments

* Restore comment

* Document panic on getting a child of a leaf node

* fmt

* Add some tests to show the problem

* Something

* Fix a possible overflow in path_length_from_key for large inputs

* Address PR comments

* Address PR feedback

* Update fuel-merkle/src/common/position.rs

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>

* Fix potential overflow in 'orientation'

* Move sibling and uncle fns under cfg(test)

* Change TreeExtendError into MerkleTreeError

* WIP: Subtree -> VecDeque

* Remove Subtree, use VecDeque instead

* Reverse internal node order in binary MerkleTree to use Vec instead of VecDeque

* Use MerkleRootCalculator in MerkleTree to unify impls

* More docs

* Cleanup

---------

Co-authored-by: Brandon Vrooman <brandon.vrooman@fuel.sh>
Co-authored-by: xgreenx <xgreenx9999@gmail.com>
  • Loading branch information
3 people authored May 15, 2024
1 parent d584b77 commit da27533
Show file tree
Hide file tree
Showing 21 changed files with 639 additions and 569 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

- [#725](https://github.com/FuelLabs/fuel-vm/pull/725): Adds more clippy lints to catch possible integer overflow and casting bugs on compile time.
- [#729](https://github.com/FuelLabs/fuel-vm/pull/729): Adds more clippy lints to `fuel-merkle` to catch possible integer overflow and casting bugs on compile time. It also does some internal refactoring.

### Added

#### Breaking

- [#725](https://github.com/FuelLabs/fuel-vm/pull/725): `UtxoId::from_str` now rejects inputs with multiple `0x` prefixes. Many `::from_str` implementations also reject extra data in the end of the input, instead of silently ignoring it. `UtxoId::from_str` allows a single `:` between the fields. Unused `GasUnit` struct removed.
- [#726](https://github.com/FuelLabs/fuel-vm/pull/726): Removed code related to Binary Merkle Sum Trees (BMSTs). The BMST is deprecated and not used in production environments.
- [#729](https://github.com/FuelLabs/fuel-vm/pull/729): Removed default implementation of `Node::key_size_bits`, implementors must now define it themselves. Also some helper traits have been merged together, or their types changed.

## [Version 0.49.0]

Expand Down
Loading

0 comments on commit da27533

Please sign in to comment.