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

CYB-225 RANDPA: selective proofs #41

Merged
merged 3 commits into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
128 changes: 47 additions & 81 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,86 +1,52 @@
*.a
*.sw*
*.dylib
*.ll
*.bc
*.wast
*.wast.hpp
*.s
*.dot
*.abi.hpp
*.cmake
# general
*.ninja
*.py[co]
*.sw[op]
/.DS_Store
/.ccache/
/.idea/
/.vscode
/tags
\#*
\.#*
CMakeCache.txt
CMakeFiles
cmake_install.cmake
cmake-build-debug/
cmake-build-release/
Makefile
compile_commands.json
moc_*
*.moc
.ccache

genesis.json
hardfork.hpp

libraries/utilities/git_revision.cpp
libraries/egenesis/egenesis_brief.cpp
libraries/egenesis/egenesis_full.cpp
libraries/egenesis/embed_genesis
libraries/types/type_generator
libraries/types/types_test
libraries/fc/test/crypto/test_cypher_suites
libraries/testing/chain_tester


libraries/wallet/Doxyfile
libraries/wallet/api_documentation.cpp
libraries/wallet/doxygen

libraries/wasm-jit/Source/Programs/Assemble
libraries/wasm-jit/Source/Programs/Disassemble
libraries/wasm-jit/Source/Programs/Test
libraries/wasm-jit/Source/Programs/wavm

programs/cleos/cleos
programs/js_operation_serializer/js_operation_serializer
programs/data-dir
programs/eosio-abigen/eosio-abigen
programs/cleos/config.hpp
programs/eosio-applesedemo/eosio-applesedemo
programs/eosio-launcher/config.hpp
programs/eosio-launcher/eosio-launcher
programs/keosd/keosd
programs/nodeos/config.hpp
programs/nodeos/nodeos

scripts/tn_init.sh

tests/plugin_test
unittests/unit_test

doxygen
haya.doxygen

wallet.json
witness_node_data_dir

*.wallet

*.pyc
*.pyo

build/*
build-debug/*

etc/eosio/node_*
var/lib/node_*
.vscode
.idea/
# project-specific
*.abi.hpp
*.bc
*.dot
*.dylib
*.iws
.DS_Store

.vagrant
*.ll
*.wallet
*.wast
*.wast.hpp
/build/
/build-debug/

/doxygen
/haya.doxygen

/genesis.json

/libraries/fc/test/crypto/test_cypher_suites
/libraries/testing/chain_tester
/libraries/types/type_generator
/libraries/types/types_test
/libraries/utilities/git_revision.cpp
/libraries/wallet/Doxyfile
/libraries/wallet/api_documentation.cpp
/libraries/wallet/doxygen
/libraries/wasm-jit/Source/Programs/Assemble
/libraries/wasm-jit/Source/Programs/Disassemble
/libraries/wasm-jit/Source/Programs/Test
/libraries/wasm-jit/Source/Programs/wavm

/programs/haya-cli/config.hpp
/programs/haya-launcher/config.hpp
/programs/haya-node/config.hpp
/programs/haya-wallet/config.hpp

/scripts/tn_init.sh

/tests/plugin_test
/unittests/unit_test
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if(CCACHE_FOUND)
message(WARNING "CCACHE FOUND")
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
set(CMAKE_C_COMPILER_LAUNCHER ccache)
endif(CCACHE_FOUND)
endif()

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(WARNING "CMAKE_INSTALL_PREFIX is set to default path of ${CMAKE_INSTALL_PREFIX}, resetting to ${CMAKE_INSTALL_PREFIX}/${PROJECT}")
Expand Down Expand Up @@ -124,7 +124,7 @@ IF( WIN32 )
SET(BOOST_ROOT $ENV{BOOST_ROOT})
set(Boost_USE_MULTITHREADED ON)
set(BOOST_ALL_DYN_LINK OFF) # force dynamic linking for all libraries
ENDIF(WIN32)
ENDIF()
FIND_PACKAGE(Boost 1.67 REQUIRED COMPONENTS
date_time
filesystem
Expand Down Expand Up @@ -176,13 +176,13 @@ if( WIN32 )
SET(TCL_LIBS "${TCL_LIBS}${TCL_LIB_PATH}/${TCL_LIB_NAME}g${TCL_LIB_EXT}")
SET(TCL_LIBRARY ${TCL_LIBS})

else( WIN32 ) # Apple AND Linux
else() # Apple AND UNIX

if( APPLE )
# Apple Specific Options Here
message( STATUS "Configuring EOSIO on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" )
else( APPLE )
else() # UNIX
# Linux Specific Options Here
message( STATUS "Configuring EOSIO on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
Expand All @@ -195,7 +195,7 @@ else( WIN32 ) # Apple AND Linux
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization" )
endif()
endif()
endif( APPLE )
endif()

if( "${CMAKE_GENERATOR}" STREQUAL "Ninja" )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
Expand Down Expand Up @@ -242,6 +242,9 @@ endif()

message( STATUS "Using '${EOSIO_ROOT_KEY}' as public key for 'eosio' account" )

message(STATUS "CFLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "CXXFLAGS: ${CMAKE_CXX_FLAGS}")

add_subdirectory( libraries )
add_subdirectory( plugins )
add_subdirectory( programs )
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default: help

.PHONY: help
help:
@echo "Targets:"
@echo
@echo " tags -- regerate tags via ctags"


.PHONY: tags
tags:
ctags -R --exclude=plugins/telemetry_plugin/lib/prometheus-cpp/3rdparty .
5 changes: 1 addition & 4 deletions plugins/randpa_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
file(GLOB HEADERS "include/eosio/randpa_plugin/*.hpp")
add_library( randpa_plugin
randpa_plugin.cpp
${HEADERS} )
add_library( randpa_plugin randpa_plugin.cpp )

target_link_libraries( randpa_plugin telemetry_plugin chain_plugin eosio_chain appbase fc net_plugin http_plugin)
target_include_directories( randpa_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "types.hpp"
#include <fc/reflect/reflect.hpp>

namespace randpa_finality {
#include <fc/reflect/reflect.hpp>

using std::vector;
#include <typeinfo>

namespace randpa_finality {

template<class T>
class network_msg {
Expand All @@ -22,7 +22,10 @@ class network_msg {
}

digest_type hash() const {
return digest_type::hash(data);
digest_type::encoder e;
fc::raw::pack(e, data);
fc::raw::pack(e, typeid(T).name());
return e.result();
}

public_key_type public_key() const {
Expand All @@ -35,10 +38,6 @@ class network_msg {
};


struct block_get_conf_type {
block_id_type block_id;
};

struct handshake_type {
block_id_type lib;
};
Expand All @@ -50,19 +49,26 @@ struct handshake_ans_type {
struct prevote_type {
uint32_t round_num;
block_id_type base_block;
vector<block_id_type> blocks;
std::vector<block_id_type> blocks;
};

struct precommit_type {
uint32_t round_num;
block_id_type block_id;
};

struct finality_notice_type {
uint32_t round_num;
block_id_type best_block;
};

struct finality_req_proof_type {
uint32_t round_num;
};

using handshake_msg = network_msg<handshake_type>;
using handshake_ans_msg = network_msg<handshake_ans_type>;

using block_get_conf_msg = network_msg<block_get_conf_type>;

using prevote_msg = network_msg<prevote_type>;
using precommit_msg = network_msg<precommit_type>;

Expand All @@ -74,19 +80,27 @@ struct proof_type {
};

using proof_msg = network_msg<proof_type>;
using finality_notice_msg = network_msg<finality_notice_type>;
using finality_req_proof_msg = network_msg<finality_req_proof_type>;

using randpa_net_msg_data = ::fc::static_variant<handshake_msg, handshake_ans_msg,
prevote_msg, precommit_msg, proof_msg>;

using randpa_net_msg_data = ::fc::static_variant<handshake_msg,
handshake_ans_msg,
prevote_msg,
precommit_msg,
proof_msg,
finality_notice_msg,
finality_req_proof_msg>;

} //namespace randpa_finality

FC_REFLECT(randpa_finality::handshake_type, (lib))
FC_REFLECT(randpa_finality::handshake_ans_type, (lib))

FC_REFLECT(randpa_finality::prevote_type, (round_num)(base_block)(blocks))
FC_REFLECT(randpa_finality::precommit_type, (round_num)(block_id))
FC_REFLECT(randpa_finality::proof_type, (round_num)(best_block)(prevotes)(precommits));

FC_REFLECT(randpa_finality::block_get_conf_type, (block_id))
FC_REFLECT(randpa_finality::handshake_type, (lib))
FC_REFLECT(randpa_finality::handshake_ans_type, (lib))
FC_REFLECT(randpa_finality::proof_type, (round_num)(best_block)(prevotes)(precommits))
FC_REFLECT(randpa_finality::finality_notice_type, (round_num)(best_block))
FC_REFLECT(randpa_finality::finality_req_proof_type, (round_num))

FC_REFLECT_TEMPLATE((typename T), randpa_finality::network_msg<T>, (data)(signature))
Loading