-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/hotstuff_integration' into GH-2102…
…-vote-processing
- Loading branch information
Showing
29 changed files
with
317 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM ubuntu:jammy | ||
ENV TZ="America/New_York" | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get upgrade -y && \ | ||
apt-get install -y build-essential \ | ||
cmake \ | ||
git \ | ||
jq \ | ||
libcurl4-openssl-dev \ | ||
libgmp-dev \ | ||
llvm-11-dev \ | ||
lsb-release \ | ||
ninja-build \ | ||
python3-numpy \ | ||
software-properties-common \ | ||
file \ | ||
wget \ | ||
zlib1g-dev \ | ||
zstd | ||
|
||
RUN yes | bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" llvm.sh 18 | ||
|
||
#make sure no confusion on what llvm library leap's cmake should pick up on | ||
RUN rm -rf /usr/lib/llvm-18/lib/cmake | ||
|
||
ENV LEAP_PLATFORM_HAS_EXTRAS_CMAKE=1 | ||
COPY <<-EOF /extras.cmake | ||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE) | ||
|
||
set(CMAKE_C_COMPILER "clang-18" CACHE STRING "") | ||
set(CMAKE_CXX_COMPILER "clang++-18" CACHE STRING "") | ||
set(CMAKE_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer" CACHE STRING "") | ||
set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer" CACHE STRING "") | ||
EOF | ||
|
||
ENV ASAN_OPTIONS=detect_leaks=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <benchmark.hpp> | ||
#include <eosio/chain/incremental_merkle.hpp> | ||
#include <eosio/chain/incremental_merkle_legacy.hpp> | ||
#include <random> | ||
|
||
namespace eosio::benchmark { | ||
|
||
using namespace eosio::chain; | ||
|
||
std::vector<digest_type> create_test_digests(size_t n) { | ||
std::vector<digest_type> v; | ||
v.reserve(n); | ||
for (size_t i=0; i<n; ++i) | ||
v.push_back(fc::sha256::hash(std::string{"Node"} + std::to_string(i))); | ||
return v; | ||
} | ||
|
||
void benchmark_calc_merkle(uint32_t size_boost) { | ||
using namespace std::string_literals; | ||
const size_t num_digests = size_boost * 1000ull; // don't use exact powers of 2 as it is a special case | ||
|
||
const std::vector<digest_type> digests = create_test_digests(num_digests); | ||
const deque<digest_type> deq { digests.begin(), digests.end() }; | ||
|
||
auto num_str = std::to_string(size_boost); | ||
while(num_str.size() < 4) | ||
num_str.insert(0, 1, ' '); | ||
auto msg_header = "Calc, "s + num_str + ",000 digests, "s; | ||
uint32_t num_runs = std::min(get_num_runs(), std::max(1u, get_num_runs() / size_boost)); | ||
benchmarking(msg_header + "legacy: ", [&]() { calculate_merkle_legacy(deq); }, num_runs); | ||
benchmarking(msg_header + "savanna:", [&]() { calculate_merkle(digests.begin(), digests.end()); }, num_runs); | ||
} | ||
|
||
void benchmark_incr_merkle(uint32_t size_boost) { | ||
using namespace std::string_literals; | ||
const size_t num_digests = size_boost * 1000ull; // don't use exact powers of 2 as it is a special case | ||
|
||
const std::vector<digest_type> digests = create_test_digests(num_digests); | ||
|
||
auto num_str = std::to_string(size_boost); | ||
while(num_str.size() < 4) | ||
num_str.insert(0, 1, ' '); | ||
auto msg_header = "Incr, "s + num_str + ",000 digests, "s; | ||
uint32_t num_runs = std::min(get_num_runs(), std::max(1u, get_num_runs() / size_boost)); | ||
|
||
auto incr = [&](const auto& incr_tree) { | ||
auto work_tree = incr_tree; | ||
for (const auto& d : digests) | ||
work_tree.append(d); | ||
return work_tree.get_root(); | ||
}; | ||
|
||
benchmarking(msg_header + "legacy: ", [&]() { incr(incremental_merkle_tree_legacy()); }, num_runs); | ||
benchmarking(msg_header + "savanna:", [&]() { incr(incremental_merkle_tree()); }, num_runs); | ||
} | ||
|
||
// register benchmarking functions | ||
void merkle_benchmarking() { | ||
benchmark_calc_merkle(1000); // calculate_merkle of very large sequence (1,000,000 digests) | ||
benchmark_calc_merkle(50); // calculate_merkle of large sequence (50,000 digests) | ||
benchmark_calc_merkle(1); // calculate_merkle of small sequence (1000 digests) | ||
std::cout << "\n"; | ||
|
||
benchmark_incr_merkle(100); // incremental_merkle of very large sequence (100,000 digests) | ||
benchmark_incr_merkle(25); // incremental_merkle of large sequence (25,000 digests) | ||
benchmark_incr_merkle(1); // incremental_merkle of small sequence (1000 digests) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.