Skip to content

Commit

Permalink
Support padding for the leaves of the merkle tree (#647)
Browse files Browse the repository at this point in the history
* Did some organization in test_hash_api and fixed some edge case that can cause the test to seg-fault

Signed-off-by: Koren-Brand <[email protected]>

* basic test pass

* all tests pass without padding

* basic test pass

* Revert "basic test pass"

This reverts commit 8018c0d.

* basic tests pass

* Initial test for padding in merkle tree. currently crashes when trying to generate a proof of the last (and only) leaf index

Signed-off-by: Koren-Brand <[email protected]>

* bug fix at proof allocation

* output buffer overflow in hash (seems to launch hash twice)

Signed-off-by: Koren-Brand <[email protected]>

* bug fix for the case of 17 hases at the last layer

* formating

* Partial leaf test of zero padding has memory overflow when copying to padded_leaves (during build, init_padded_leaves, line 441)

Signed-off-by: Koren-Brand <[email protected]>

* bug fix T tHe padded vector

* Added interesting cases for zero padding and duplicated the zero padding test for last value padding

Signed-off-by: Koren-Brand <[email protected]>

* format

* input_default -> default_input

* assert changed

* spelling fix

* format

* Weird test with cuda and cpu MerkleTreeLarge - root doesn't match and cuda always has zeros in some parts

Signed-off-by: Koren-Brand <[email protected]>

* Prints now work (Decimal instead of hex)

Signed-off-by: Koren-Brand <[email protected]>

* Fixed stack-use-after-scope error (Accessing root after tree is deleted) and some additional memory leaks in Merkle tree cpu backend as well as the hash tests

Signed-off-by: Koren-Brand <[email protected]>

* formatting

Signed-off-by: Koren-Brand <[email protected]>

* Fixed bug that caused poseidon merkle tree to fail on rust (And added the same test to cpp test_hash_api)

Signed-off-by: Koren-Brand <[email protected]>

* Bug fix in poseidon_tree test in test-hash-api (CPP) where field elements weren't randomized properly

Signed-off-by: Koren-Brand <[email protected]>

* formatting

Signed-off-by: Koren-Brand <[email protected]>

* Fixed the documentation to match the actual function is_valid_tree

Signed-off-by: Koren-Brand <[email protected]>

* other PR changes

Signed-off-by: Koren-Brand <[email protected]>

* fix device that was not defined in scope to s_reference_target in padding tests

Signed-off-by: Koren-Brand <[email protected]>

* use smart pointers

* format

* Standardized the Merkle tree test in test_hash_api.cpp to all use the same test_merkle_tree function

Signed-off-by: Koren-Brand <[email protected]>

* spelling

Signed-off-by: Koren-Brand <[email protected]>

* Statistically possible valid wrong leaves during Merkle tree test has been addressed

Signed-off-by: Koren-Brand <[email protected]>

* formatting

Signed-off-by: Koren-Brand <[email protected]>

---------

Signed-off-by: Koren-Brand <[email protected]>
Co-authored-by: Koren-Brand <[email protected]>
  • Loading branch information
mickeyasa and Koren-Brand authored Nov 17, 2024
1 parent c95c83e commit 1f1d5ef
Show file tree
Hide file tree
Showing 5 changed files with 696 additions and 294 deletions.
8 changes: 6 additions & 2 deletions icicle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ endif()
# Print the selected build type
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

# Prevent build if both SANITIZE and CUDA_BACKEND are enabled
if(SANITIZE AND CUDA_BACKEND)
message(FATAL_ERROR "Address sanitizer and Cuda cannot be enabled at the same time.")
endif()

# Find the ccache program
find_program(CCACHE_PROGRAM ccache)
# If ccache is found, use it as the compiler launcher
Expand Down Expand Up @@ -132,5 +137,4 @@ endif()

if (BUILD_TESTS)
add_subdirectory(tests)
endif()

endif()
Loading

0 comments on commit 1f1d5ef

Please sign in to comment.