Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fuel-merkle to the monorepo #318

Merged
merged 91 commits into from
Jan 24, 2023
Merged

Add fuel-merkle to the monorepo #318

merged 91 commits into from
Jan 24, 2023

Conversation

ControlCplusControlV
Copy link
Contributor

No description provided.

adlerjohn and others added 30 commits May 17, 2021 13:58
* Initial Merkle Tree Implementation

* Delete verify.rs

* Remove unimplemented asmut

* Unpin dependencies

* Remove mod verify

* Add default implementation

* Remove IDE specifics from gitfile

* Pin minimum versions in dependencies

* Fix format with fmt
* Initial Merkle Tree Implementation

* Delete verify.rs

* Remove IDE specifics from gitfile

* Proof set

* Remove unused line

* fmt

* Implement proof and tests

* Refactor

* Simplify loop

* Update merkle_tree.rs

* Convert next_height and next_data to return options

* Refactor proof set

* Clippy

* Verify

* Format fix

* Update merkle_tree.rs

* Update verify.rs

* Semver for Bytes

* Clean up tests

* Format

* Tests

* Refactor tests
* Refactor hash functions into separate file for BMT

* Update merkle_tree.rs

* Refactor NODE and LEAF as u8

* Remove generics

* Remove commented line

* Update mod.rs

* Remove deprecated files

* Lazy static empty sum

* Update Cargo.toml

* Update Cargo.toml

* Update hash.rs

* Return ref to empty sum
* Position struct and tests

* Comment

* Update table comment

* Document

* Update position.rs

* Update comments

* Update comment again

* Fix tests

* Update position.rs
* `Storage` trait and concrete `StorageMap` struct

* Remodel trait after fuel-vm store trait

* Revert names to storage and storage_map

* Change Storage's Key to require `Clone` instead of `Copy`
* Use fuel-data storage trait

* Update storagemap impl

* Update storage_map against updated storage trait

* Update cargo_test.yml

* Fetch with cli in CI
…lpers` (#30)

* Refactor `binary` to `tests`

* Cleanup Test imports

* Convert to internal crate `fuel-merkle-test-helpers`

* Format

* Add helper tests to CI

* Update cargo_test.yml

* Fix Run helper tests args

* Clean up test-helpers dependencies

* Update test_data.rs
* Path iterator

* Create node.rs

* Add node to common

* Refactor SZ to SIZE

* Minor adjustment to comments

* Remove unnecessary Debug req for AsPathIterator

* Feedback

* Msb get_bit_at_index_from_msb returns option
* Sparse node and hash

* Add hex to cargo.toml

* Derive `StorageError clone`
* Position methods for left and right child

* Update position.rs

* Use constants for left and right child directions

* Update comment
* Bump bytes from ~1.0 to ~1.1

* Update Cargo.toml

Co-authored-by: John Adler <[email protected]>

Co-authored-by: John Adler <[email protected]>
* Update author.

* Add more fields.

* Update author.
* crates.io workflow
make bytes dep compatible with async-graphql
* Binary Merkle Sum

* Clean up

* Format

* Update verify.rs

* Replace Hash struct and impl with template functions

* Update hash.rs

* refactor

* Refactor join_data_pair to accept fee before data

* Format

* Remove generics from Merkle sum tree

* Refactor join_data_pair and split_data_pair

* White space

* assert sizes in join and split data pair

* BMST lazy static empty sum

* Update lib.rs

* Update to use storage backing

* Path iterator for sum node (WIP)

* Node fmt

* Isolate `root` logic

* Remove unused code

* Refactor

* Simplify lifetimes

* u64 (8 byte) fee

* Remove extraneous variables

* Consolidate on `common` types

* Simplify

* Cosmetic

* Remove unnecessary references to hash

* Fix node fmt

* Update node.rs

* Update node.rs

* Include leaf fee in leaf sum calculation

* update hash comment

* Update sum Node `left_child` and `right_child` to return `Result`

* Remove unused lifetime param

* Return fee in BMST `root` call

* Remove unused `StorageNode`
… and side positions from root to leaf (#55)

* Path set

* Add `height` to `common::Node` interface, add `Position::path_set`

* Position path_set tests

* Move position_iter to new file

* Clean up use statements

* Move position_iter to position_path

* Comments

* Update comments

* Update comments

* PR feedback
* BMT prove uses position path

* Format

* Remove unnecessary storage inserts

* Remove unnecessary mut from Node::create_node

* Remove unnecessary functions

* Update version for breaking change

* Change unnecessary `node_mut()` to `node()` in `join_subtrees()`

* Revert "Update version for breaking change"

This reverts commit db3460510b6861805b5e4a2f3b5eb24d704b10f4.
* Implement `load` for BMT

* Move p2_under to common

* Format

* Build tree from leaf nodes

* Test load error

* Alphabetical order for errors

* remove unnecessary mut

* Simplify

* Remove unnecessary cast
* Add height to sparse node

* Update tests
Brandon Vrooman and others added 3 commits January 14, 2023 01:37
* Configurable storage table

* refactor sum tree

* Minor

* Update Cargo.toml

* Update position.rs

* Update storage_map.rs

* Refactor nodes tables

* Update binary.rs

* Fmt

* Use core over std

* Update binary_proofs.rs

* Revert "Update binary_proofs.rs"

This reverts commit ba38107c6cff3462041b3dbe8b6255431b056dc8.

* Merge fixes

* Fix warnings

* Clean up

* Clean up

* Update merkle_tree.rs

* consistency

* Use match over if else

* Revert "Use match over if else"

This reverts commit c74337a448f48c9eec89d7b436aa03a80e00e886.

* Rearrangement

* BMT Node buffer

* Refactor buffer, add buffer views

* Simplify Node interface

* Clippy

* Remove unnecessary node clones

* Add safety comments

* SMT node buffer update

* Simplify

* Minor

* Simplify

* Simplify

* Fix warning

* Simplify

* Return references instead of copies

* Cosmetic

* Return hash as ref

* Use Binary node buffer for tables

* Replace Schema with constants

* Replace Schema with constants

* Remove serde feature

* Update lib exports

* Clean up

* Update safety notes in BMT buffer

* Replace Buffer with Primitive

* Replace Buffer with Primitive (WIP)

* Passing tests

* cliipy

* clippy for real tho

* Remove Primitive trait

* Refactor primitive

* Refactor primitive

* Simplify

* Simplify

* Clean up

* Make node members private

* Make Node members private

* Use as ref

* Replace uses of Buffer with Primitive

* revert

* Rename uses of buffer to primitive

* Rename uses of buffer to primitive in tests

* Use into for insertion in test

* Fix imports

* Use hex values in test

* chore: Update test table names (#139)

Update table names

* Fix import

* Fix merge side effects
* Refactor

* Refactor

* Infallible storage trait and impl

* Parallel trait usage for getting side nodes

* nostd compliance

* Clippy

* Infallible root

* Add comment docs to root_node

* Fix root_node doc line breaks

* Whitespace

* Fix typo

* Whitespace again

* Remove returned assigned values
@ControlCplusControlV ControlCplusControlV added the enhancement New feature or request label Jan 22, 2023
@ControlCplusControlV ControlCplusControlV requested a review from a team January 22, 2023 19:22
@ControlCplusControlV ControlCplusControlV self-assigned this Jan 22, 2023
This reverts commit df268a9.
This reverts commit 83acb21.
* Removed `'a` lifetime from `Mappable::Key`.
Renamed `GetValue` with `OwnedValue`.
Added the same `OwnedKey` for `Key` to unblock:
```rust
    type Key = Self::OwnedKey;
    type OwnedKey = u64;
    type Value = Self::OwnedValue;
    type OwnedValue = Primitive;
```

Defined two double storage key for `ContractsAssets` and `ContractsState`.
Replaced `(&'a ContractId, &'a AssetId)` with corresponding double storage keys.

* Make clippy happy

* Make clippy happy

* Make clippy happy

* Fix `no_std` compilation

* Remove `AsRef` and `From` for `$first` and `$second`
Voxelot
Voxelot previously approved these changes Jan 24, 2023
@Voxelot Voxelot enabled auto-merge (squash) January 24, 2023 01:24
@Voxelot Voxelot disabled auto-merge January 24, 2023 01:24
@Voxelot Voxelot enabled auto-merge (squash) January 24, 2023 01:29
@Voxelot Voxelot merged commit bd24416 into master Jan 24, 2023
@Voxelot Voxelot deleted the controlc/add_merkle branch January 24, 2023 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants