-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from hyperledger/develop
Develop
- Loading branch information
Showing
253 changed files
with
25,607 additions
and
10,000 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 |
---|---|---|
|
@@ -20,3 +20,4 @@ config/sumeragi.json | |
cmake-build-debu/* | ||
docker/build/iroha.tar | ||
cmake-build-debug/* | ||
external/* |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,20 +1,39 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
PROJECT(iroha CXX) | ||
PROJECT(iroha C CXX) | ||
|
||
ENABLE_LANGUAGE(C) | ||
find_package(Threads) | ||
|
||
SET(CMAKE_CXX_FLAGS "-g -Wall -std=c++1y") | ||
SET(CMAKE_CXX_FLAGS "-g -std=c++1y -Wall -fPIC") | ||
SET(CMAKE_CXX_FLAGS_RELEASE "-O3") | ||
SET(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0") | ||
SET(CMAKE_SHARED_LINKER_FLAGS "-lpthread -lssl") | ||
SET(CMAKE_CXX_FLAGS_DEBUG "-Wextra -Wno-unused-parameter -O0") | ||
#SET(CMAKE_SHARED_LINKER_FLAGS "-lpthread -lssl") | ||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) | ||
|
||
option(BENCHMARKING "Build benchmarks" OFF) | ||
option(TESTING "Build tests" ON) | ||
|
||
# set default CMAKE_BUILD_TYPE=Debug | ||
if (NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
message(STATUS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") | ||
message(STATUS "-DTESTING=${TESTING}") | ||
message(STATUS "-DBENCHMARKING=${BENCHMARKING}") | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}/core) | ||
include("dependencies.cmake") | ||
|
||
add_subdirectory(protos) | ||
|
||
add_subdirectory(core) | ||
add_subdirectory(peer) | ||
add_subdirectory(tools) | ||
add_subdirectory(smart_contract) | ||
|
||
if(NOT without-test) | ||
if(TESTING) | ||
enable_testing() | ||
include(test/gtest.cmake) | ||
add_subdirectory(test) | ||
endif() | ||
endif() | ||
|
||
|
||
if(BENCHMARKING) | ||
add_subdirectory(benchmark) | ||
endif() |
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,3 @@ | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/benchmark) | ||
|
||
add_subdirectory(crypto) |
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,29 @@ | ||
# Benchmark | ||
|
||
If you want to do benchmarks of some iroha components, put them in this folder. | ||
|
||
We use [google benchmark](https://github.com/google/benchmark). | ||
|
||
To enable build of benchmarks, specify an option `-DBENCHMARKING=ON` during configure step: | ||
|
||
``` | ||
$ cmake -DBENCHMARKING=ON .. | ||
``` | ||
|
||
**Note**: changing `CMAKE_BUILD_TYPE` from `Debug` to `Release` can significantly speedup execution, thus heavily changing benchmark results. | ||
|
||
To build iroha and benchmarks in release mode, type: | ||
``` | ||
$ cmake -DBENCHMARKING=ON -DCMAKE_BUILD_TYPE=Release .. | ||
``` | ||
|
||
**Note**: all code inside benchmark function influences on the benchmark results. | ||
|
||
|
||
# How to write benchmark | ||
|
||
1. Include `#include <benchmark/benchmark.h>`. | ||
|
||
2. Refer to official [google guilde](https://github.com/google/benchmark#example-usage). | ||
|
||
Also, try to preserve namespacing by making directories inside `benchmark` directory. |
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,11 @@ | ||
include_directories( | ||
${PROJECT_SOURCE_DIR}/core | ||
) | ||
|
||
add_executable(hash_benchmark | ||
hash.cpp | ||
) | ||
target_link_libraries(hash_benchmark | ||
benchmark | ||
hash | ||
) |
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,43 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2016 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <benchmark/benchmark.h> | ||
#include <algorithm> | ||
#include <crypto/hash.hpp> | ||
|
||
|
||
static void HASH_Sha3_256_with_keccak(benchmark::State& state) { | ||
std::string s = "0123456789"; // length = 10 | ||
while (state.KeepRunning()) { | ||
hash::sha3_256_hex(s); | ||
} | ||
} | ||
|
||
static void HASH_Sha3_512_with_keccak(benchmark::State& state) { | ||
std::string s = "0123456789"; // length = 10 | ||
while (state.KeepRunning()) { | ||
hash::sha3_512_hex(s); | ||
} | ||
} | ||
|
||
/** | ||
* These two tests show the number of hashes calculated per sec. | ||
*/ | ||
BENCHMARK(HASH_Sha3_256_with_keccak); | ||
BENCHMARK(HASH_Sha3_512_with_keccak); | ||
|
||
BENCHMARK_MAIN(); |
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,8 @@ | ||
# Note | ||
|
||
Whenever you change `config.json`, don't forget to change according [`config.json`](../docker/build/config/config.json) in `docker` directory. | ||
|
||
`config.json` in this folder is used if you use [local build](https://github.com/hyperledger/iroha/blob/master/docs/how_to_build.rst) (without docker), | ||
but `config.json` in `docker/build/config/config.json` is used inside docker images. | ||
|
||
The reason behind this is that docker can not use files outside its build scope (which is the directory with Dockerfile). |
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
{ | ||
"database_path":"/tmp/iroha_ledger", | ||
"java_class_path":"java_tests", | ||
"java_class_path_local":"smart_contract/java_tests", | ||
"java_library_path":"lib", | ||
"java_library_path_local":"build/lib", | ||
"java_policy_path":"jvm/java.policy.txt", | ||
"concurrency": 0, | ||
"max_faulty_peers" : 1, | ||
"pool_worker_queue_size": 1024 | ||
"pool_worker_queue_size": 1024, | ||
"http_port": 1204, | ||
"grpc_port": 50051 | ||
} |
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 |
---|---|---|
@@ -1,10 +1,7 @@ | ||
include_directories(".") | ||
|
||
add_subdirectory(consensus) | ||
add_subdirectory(model) | ||
add_subdirectory(repository) | ||
add_subdirectory(infra) | ||
add_subdirectory(util) | ||
add_subdirectory(vendor) | ||
add_subdirectory(crypto) | ||
add_subdirectory(validation) | ||
add_subdirectory(transaction_builder) |
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 |
---|---|---|
@@ -1,32 +1,12 @@ | ||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) | ||
|
||
include_directories( | ||
"${PROJECT_SOURCE_DIR}/core" | ||
"${PROJECT_SOURCE_DIR}/core/vendor/thread_pool_cpp/thread_pool" | ||
) | ||
|
||
ADD_LIBRARY(sumeragi STATIC | ||
sumeragi.cpp | ||
) | ||
|
||
target_link_libraries( | ||
sumeragi | ||
target_link_libraries(sumeragi | ||
config_manager | ||
connection_with_grpc | ||
signature | ||
event_repository | ||
commands | ||
objects | ||
) | ||
|
||
ADD_LIBRARY(consensus_event STATIC | ||
consensus_event.cpp | ||
) | ||
|
||
target_link_libraries(consensus_event | ||
config_manager | ||
commands | ||
objects | ||
validator | ||
hash | ||
thread_pool | ||
executor | ||
merkle_transaction_repository | ||
) |
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 |
---|---|---|
@@ -1,3 +0,0 @@ | ||
include_directories( | ||
"${PROJECT_SOURCE_DIR}/core" | ||
) | ||
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.