Skip to content

MerkleTree optimization #154

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

Merged
merged 86 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
c2eae4f
remove length check to avoid storage read
NouDaimon Oct 23, 2022
4a35971
add natspec
NouDaimon Oct 23, 2022
5dcf49a
store IMT hashes via assembly
ItsNickBarry Oct 23, 2022
4c5850b
rename rowSize to rowLength, modify lt comparison for clarity
ItsNickBarry Oct 23, 2022
af581c5
remove rootIndex variable
ItsNickBarry Oct 23, 2022
045c652
optimize rowLength calculation
ItsNickBarry Oct 23, 2022
dfebf46
optimize IMT size function
ItsNickBarry Oct 23, 2022
cc90a1d
wrap contents of IMT pop function in unchecked block
ItsNickBarry Oct 24, 2022
ba217cd
remove unused unchecked block
ItsNickBarry Oct 24, 2022
3fdae95
do not recalculate hashes if layer is removed on pop
ItsNickBarry Oct 24, 2022
bff831e
emphasize prallel structure of push and pop functions
ItsNickBarry Oct 24, 2022
761ce87
optimize recursive row length calculation
ItsNickBarry Oct 24, 2022
24b4834
replace lt with not eq comparison
ItsNickBarry Oct 24, 2022
886ba4b
add additional at function revert test
ItsNickBarry Oct 24, 2022
e3116c3
use assembly for height and root functions
ItsNickBarry Oct 24, 2022
511153c
circumvent all Solididity safety features for underlying IMT arrays
ItsNickBarry Oct 24, 2022
ad3f47d
wrap root functionality in assembly block
NouDaimon Oct 24, 2022
d455bb9
remove unrequired mstore operation
NouDaimon Oct 24, 2022
d9c9175
Merge branch 'master' into IMT-optimization
ItsNickBarry Nov 3, 2022
e8d8ebc
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Nov 3, 2022
ea628a8
Merge branch 'master' into IMT-optimization
ItsNickBarry Dec 1, 2022
ba3c5ba
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Dec 1, 2022
5340f02
Merge branch 'master' into IMT-optimization
ItsNickBarry Dec 14, 2022
a594007
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Dec 14, 2022
4f204a3
Merge branch 'master' into IMT-optimization
ItsNickBarry Apr 17, 2023
610d22b
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Apr 17, 2023
9ddd1fd
Merge branch 'master' into IMT-optimization
ItsNickBarry Feb 22, 2025
0e2d727
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Feb 22, 2025
b0adf4d
Merge branch 'master' into IMT-optimization
ItsNickBarry Feb 24, 2025
6535209
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Feb 24, 2025
ece54c2
Merge branch 'master' into IMT-optimization
ItsNickBarry Mar 22, 2025
9131b4f
Merge branch 'IMT-optimization' into IMT-optimization-extreme
ItsNickBarry Mar 22, 2025
1dedd3b
add comments explaining some IMT assembly blocks
ItsNickBarry Mar 22, 2025
fbc5115
panic via assembly rather than inline invalid array indexing
ItsNickBarry Mar 22, 2025
4f1e391
Merge pull request #155 from solidstate-network/IMT-optimization-extreme
ItsNickBarry Mar 22, 2025
3a9de76
Merge branch 'master' into IMT-optimization
ItsNickBarry Mar 28, 2025
f905377
combine adjacent assembly blocks
ItsNickBarry Mar 28, 2025
f831925
remove unused storage reference
ItsNickBarry Mar 28, 2025
d44b6e0
rename t to self within methods
ItsNickBarry Mar 28, 2025
6b30227
draft rewrite IncrementalMerkleTree
ItsNickBarry Mar 28, 2025
446c135
remove test function
ItsNickBarry Mar 28, 2025
15881ae
add NatSpec comments
ItsNickBarry Mar 28, 2025
d39a0ac
mark _set function as private
ItsNickBarry Mar 28, 2025
f099c68
use assembly for hashing
ItsNickBarry Mar 28, 2025
c990147
overwrite tree element in stack and pass along
ItsNickBarry Mar 28, 2025
fa93c90
optimize height function
ItsNickBarry Mar 28, 2025
71c8478
use assembly to write elements to tree
ItsNickBarry Mar 28, 2025
29e3e39
calculate array slot in top-level functions and pass down
ItsNickBarry Mar 28, 2025
01e1c4c
reorder mstore calls
ItsNickBarry Mar 28, 2025
f2500fc
improve left sibling index calculation
ItsNickBarry Mar 28, 2025
24e2663
calculate left sibling index in assembly
ItsNickBarry Mar 28, 2025
c45d1b2
add comments
ItsNickBarry Mar 28, 2025
63f684d
rename len to length
ItsNickBarry Mar 28, 2025
1fcd44f
add internal element lookup function
ItsNickBarry Mar 29, 2025
a44dec9
increase size of underlying data array by 1
ItsNickBarry Mar 29, 2025
a71166d
reduce arithmetic with intermediate variables
ItsNickBarry Mar 29, 2025
0fc9192
add unchecked block to pop function
ItsNickBarry Mar 29, 2025
2a24a15
change _set function argument order
ItsNickBarry Mar 29, 2025
dad43bd
add unchecked block to _set function recursive call
ItsNickBarry Mar 29, 2025
6b1446a
rename length to maxIndex
ItsNickBarry Mar 29, 2025
c57526f
panic if nonexistent index is set
ItsNickBarry Mar 29, 2025
67e7d22
add unchecked block to set function
ItsNickBarry Mar 29, 2025
cfcc1dd
exit pop function if tree is balanced
ItsNickBarry Mar 29, 2025
05d6c2a
panic on pop of empty tree
ItsNickBarry Mar 29, 2025
539a83b
combine return cases
ItsNickBarry Mar 29, 2025
f9eb495
Merge pull request #297 from solidstate-network/IMT-rewrite
ItsNickBarry Mar 29, 2025
0a9a8e0
Merge branch 'panic' into IMT-optimization
ItsNickBarry Mar 29, 2025
fd804e1
use Panic library for errors, use POP_ON_EMPTY_ARRAY error
ItsNickBarry Mar 29, 2025
bd33923
Merge branch 'gas-report-file' into IMT-optimization
ItsNickBarry Mar 29, 2025
7cf3ba4
fix comment about depth
ItsNickBarry Mar 29, 2025
6b1b2cc
rename IncrementalMerkleTree to MerkleTree
ItsNickBarry Mar 30, 2025
266454f
increase MerkleTree test loop lengths to higher power of 2
ItsNickBarry Mar 30, 2025
7752b6d
use bitwise-not instead of subtraction for root calculation
ItsNickBarry Mar 30, 2025
aab3d62
move unnecessary assembly operations to solidity
ItsNickBarry Mar 30, 2025
a138d2e
remove internal calls to size function
ItsNickBarry Mar 30, 2025
3cc4a08
fix comment
ItsNickBarry Mar 30, 2025
00ff228
use assert for invalid tree height call
ItsNickBarry Mar 30, 2025
db95365
replace assertion with Panic library
ItsNickBarry Mar 30, 2025
36e730b
Merge branch 'master' into IMT-optimization
ItsNickBarry Mar 30, 2025
fd340fc
Merge branch 'log2' into IMT-optimization
ItsNickBarry Apr 2, 2025
af2ee75
use log2 function for MerkleTree height calculation
ItsNickBarry Apr 2, 2025
bf695ae
Merge branch 'master' into IMT-optimization
ItsNickBarry Apr 2, 2025
b0ae4ae
Merge branch 'master' into IMT-optimization
ItsNickBarry Apr 5, 2025
00e5a13
Merge branch 'master' into IMT-optimization
ItsNickBarry Apr 5, 2025
6be9753
update barrel file
ItsNickBarry Apr 5, 2025
dd5b6d2
Merge branch 'master' into IMT-optimization
ItsNickBarry Apr 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 0 additions & 179 deletions contracts/data/IncrementalMerkleTree.sol

This file was deleted.

Loading