Skip to content

Commit

Permalink
Merge branch 'dev_sec_storage' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
henriqueaklein committed Jul 17, 2024
2 parents f1cfca0 + 8eeb659 commit 5088518
Show file tree
Hide file tree
Showing 107 changed files with 834 additions and 292 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ rel/

# IDEs
.idea
.vscode

# Visual Studio
*.vcxproj
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
[submodule "zkPOC"]
path = zkPOC
url = ../zkPOC.git
[submodule "GeniusKDF"]
path = GeniusKDF
url = ../GeniusKDF
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Node Example (Linux)",
"program": "${workspaceFolder}/build/Linux/Debug/example/node_test/node_example",
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
1 change: 1 addition & 0 deletions GeniusKDF
Submodule GeniusKDF added at b5d23f
2 changes: 1 addition & 1 deletion app/integration/AuthorApiFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _AUTHOR_API_FACTORY_HPP_

#include "api/service/author/impl/author_api_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "transaction_pool/transaction_pool.hpp"
#include "crypto/hasher.hpp"
#include "network/extrinsic_gossiper.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/AuthorityUpdateObserverFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _AUTHORITY_UPDATE_OBSERVER_FACTORY_HPP_

#include "verification/authority/impl/authority_manager_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "application/app_state_manager.hpp"
#include "blockchain/block_tree.hpp"
#include "storage/buffer_map_types.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/BlockBuilderManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "authorship/impl/block_builder_factory_impl.hpp"
#include "authorship/impl/block_builder_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "blockchain/block_header_repository.hpp"

namespace sgns
Expand Down
2 changes: 1 addition & 1 deletion app/integration/BlockExecutorFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _BLOCK_EXECUTOR_FACTORY_HPP_

#include "verification/production/impl/block_executor.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "blockchain/block_tree.hpp"
#include "primitives/production_configuration.hpp"
#include "verification/production/production_synchronizer.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/BlockHeaderRepositoryFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define _BLOCK_HEADER_REPOSITORY_FACTORY_HPP_

#include "blockchain/impl/key_value_block_header_repository.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"

class BlockHeaderRepositoryFactory
{
Expand Down
6 changes: 3 additions & 3 deletions app/integration/BlockStorageFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _BLOCK_STORAGE_FACTORY_HPP_

#include "blockchain/block_storage.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "storage/trie/trie_storage.hpp"
#include "blockchain/impl/key_value_block_storage.hpp"
#include "application/key_storage.hpp"
Expand Down Expand Up @@ -63,7 +63,7 @@ namespace sgns
{
// handle genesis initialization, which happens when there is not
// authorities and last completed round in the storage
if ( !buff_storage->get( storage::kAuthoritySetKey ) )
if ( !buff_storage->get( storage::GetAuthoritySetKey() ) )
{
// insert authorities
// TODO - Insert authorities here from finalityAPI
Expand All @@ -86,7 +86,7 @@ namespace sgns
weighted_authority.weight );
}
BOOST_ASSERT_MSG( voters.size() != 0, "Finality voters are empty" );
auto authorities_put_res = buff_storage->put( storage::kAuthoritySetKey, base::Buffer( scale::encode( voters ).value() ) );
auto authorities_put_res = buff_storage->put( storage::GetAuthoritySetKey(), base::Buffer( scale::encode( voters ).value() ) );
if ( !authorities_put_res )
{
BOOST_ASSERT_MSG( false, "Could not insert authorities" );
Expand Down
2 changes: 1 addition & 1 deletion app/integration/BlockTreeFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _BLOCK_TREE_FACTORY_HPP_

#include "blockchain/impl/block_tree_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "blockchain/block_header_repository.hpp"
#include "blockchain/block_storage.hpp"
#include "network/extrinsic_observer.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/BlockValidatorFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _BLOCK_VALIDATOR_FACTORY_HPP_

#include "verification/validation/production_block_validator.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "blockchain/block_tree.hpp"
#include "crypto/hasher.hpp"
#include "crypto/sr25519_provider.hpp"
Expand Down
28 changes: 0 additions & 28 deletions app/integration/CComponentFactory.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion app/integration/EnvironmentFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef _ENVIRONMENT_FACTORY_HPP_
#define _ENVIRONMENT_FACTORY_HPP_
#include "verification/finality/impl/environment_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "blockchain/block_tree.hpp"
#include "blockchain/block_header_repository.hpp"
#include "verification/finality/gossiper.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/EpochStorageFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef _EPOCH_STORAGE_HPP_
#define _EPOCH_STORAGE_HPP_
#include "verification/production/impl/epoch_storage_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "storage/buffer_map_types.hpp"

class EpochStorageFactory
Expand Down
2 changes: 1 addition & 1 deletion app/integration/ExtrinsicObserverFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef _EXTRINSIC_OBSERVER_FACTORY_HPP_
#define _EXTRINSIC_OBSERVER_FACTORY_HPP_
#include "network/impl/extrinsic_observer_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "api/service/author/author_api.hpp"

class ExtrinsicObserverFactory
Expand Down
2 changes: 1 addition & 1 deletion app/integration/FinalityFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _FINALITY_FACTORY_HPP_

#include "verification/finality/impl/finality_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "application/app_state_manager.hpp"
#include "verification/finality/environment.hpp"
#include "storage/buffer_map_types.hpp"
Expand Down
18 changes: 0 additions & 18 deletions app/integration/IComponentFactory.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion app/integration/OwnPeerInfoFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _OWN_PEER_INFO_FACTORY_HPP_

#include "network/types/own_peer_info.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "application/key_storage.hpp"
#include <libp2p/injector/host_injector.hpp>
#include "base/outcome_throw.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/PoolModeratorFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _POOL_MODERATOR_FACTORY_HPP_

#include "transaction_pool/impl/pool_moderator_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "clock/clock.hpp"

class PoolModeratorFactory
Expand Down
2 changes: 1 addition & 1 deletion app/integration/ProductionFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef _PRODUCTION_FACTORY_HPP_
#define _PRODUCTION_FACTORY_HPP_

#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "verification/production/impl/production_impl.hpp"
#include "application/app_state_manager.hpp"
#include "verification/production/production_lottery.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/ProductionLotteryFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "verification/production/impl/production_lottery_impl.hpp"
#include "crypto/vrf_provider.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"

class ProductionLotteryFactory
{
Expand Down
2 changes: 1 addition & 1 deletion app/integration/ProductionSynchronizerFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef _PRODUCTION_SYNCHRONIZER_FACTORY_HPP_
#define _PRODUCTION_SYNCHRONIZER_FACTORY_HPP_
#include "verification/production/impl/production_synchronizer_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "application/configuration_storage.hpp"
#include "blockchain/block_tree.hpp"
#include "blockchain/block_header_repository.hpp"
Expand Down
2 changes: 1 addition & 1 deletion app/integration/ProposerFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _PROPOSER_FACTORY_HPP_

#include "authorship/impl/proposer_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "transaction_pool/transaction_pool.hpp"

class ProposerFactory
Expand Down
2 changes: 1 addition & 1 deletion app/integration/TranscationPoolFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _TRANSACTION_POOL_FACTORY_HPP_

#include "transaction_pool/impl/transaction_pool_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "transaction_pool/pool_moderator.hpp"
#include "blockchain/block_header_repository.hpp"

Expand Down
2 changes: 1 addition & 1 deletion app/integration/TrieSerializerFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _TRIE_SERIALIZER_FACTORY_HPP_

#include "storage/trie/serialization/trie_serializer_impl.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"

class TrieSerializerFactory
{
Expand Down
2 changes: 1 addition & 1 deletion app/integration/TrieStorageBackendFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define _TRIE_STORAGE_BACKEND_FACTORY_HPP_
#include "base/buffer.hpp"
#include "blockchain/impl/storage_util.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "storage/trie/impl/trie_storage_backend_impl.hpp"

class TrieStorageBackendFactory
Expand Down
2 changes: 1 addition & 1 deletion app/integration/TrieStorageFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "storage/trie/serialization/trie_serializer.hpp"
#include "storage/changes_trie/changes_tracker.hpp"
#include "application/configuration_storage.hpp"
#include "integration/CComponentFactory.hpp"
#include "singleton/CComponentFactory.hpp"
#include "base/outcome_throw.hpp"

class TrieStorageFactory
Expand Down
33 changes: 33 additions & 0 deletions build/CommonBuildParameters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,31 @@ set(AsyncIOManager_LIBRARY_DIR "${_THIRDPARTY_BUILD_DIR}/AsyncIOManager/lib")
set(AsyncIOManager_DIR "${_THIRDPARTY_BUILD_DIR}/AsyncIOManager/lib/cmake/AsyncIOManager")
find_package(AsyncIOManager CONFIG REQUIRED)
include_directories(${AsyncIOManager_INCLUDE_DIR})
include_directories(
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/algebra/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/block/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/codec/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/containers/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/hash/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/kdf/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/mac/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/math/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/marshalling/algebra/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/marshalling/core/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/marshalling/multiprecision/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/marshalling/zk/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/modes/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/multiprecision/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/passhash/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/pbkdf/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/pkpad/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/pubkey/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/random/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/stream/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/threshold/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/vdf/include"
"${THIRDPARTY_DIR}/zkLLVM/libs/crypto3/libs/zk/include"
)

# --------------------------------------------------------
# Set config of gnus_upnp
Expand All @@ -313,6 +338,9 @@ include_directories(${gnus_upnp_INCLUDE_DIR})
include_directories(
${PROJECT_ROOT}/src
)
include_directories(
${PROJECT_ROOT}/GeniusKDF
)
include_directories(
${PROJECT_ROOT}/app
)
Expand All @@ -338,6 +366,9 @@ link_directories(

add_subdirectory(${PROJECT_ROOT}/src ${CMAKE_BINARY_DIR}/src)

add_subdirectory(${PROJECT_ROOT}/GeniusKDF ${CMAKE_BINARY_DIR}/GeniusKDF)


# add_subdirectory(${PROJECT_ROOT}/app ${CMAKE_BINARY_DIR}/app)
if(TESTING)
enable_testing()
Expand Down Expand Up @@ -393,6 +424,8 @@ install_hfile(${PROJECT_ROOT}/src/transaction_pool)
install_hfile(${PROJECT_ROOT}/src/verification)
install_hfile(${PROJECT_ROOT}/src/account)
install_hfile(${PROJECT_ROOT}/app/integration)
install_hfile(${PROJECT_ROOT}/src/local_secure_storage)
install_hfile(${PROJECT_ROOT}/src/singleton)

# ## install proto header files ###
install_hfile(${CMAKE_CURRENT_BINARY_DIR}/generated/crdt)
Expand Down
8 changes: 3 additions & 5 deletions example/account_handling/AccountHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @author Henrique A. Klein ([email protected])
*/
#include <boost/format.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <rapidjson/document.h>
#include "AccountHelper.hpp"
#include "processing/processing_imagesplit.hpp"
Expand Down Expand Up @@ -42,9 +41,8 @@ static const std::string logger_config( R"(
namespace sgns
{
AccountHelper::AccountHelper( const AccountKey2 &priv_key_data, const DevConfig_st2 &dev_config ) :
account_( std::make_shared<GeniusAccount>( uint256_t{ priv_key_data }, 0, 0 ) ), //
account_( std::make_shared<GeniusAccount>( 0 ) ), //
io_( std::make_shared<boost::asio::io_context>() ), //
node_base_addr_( priv_key_data ), //
dev_config_( dev_config ) //
{
logging_system = std::make_shared<soralog::LoggingSystem>( std::make_shared<soralog::ConfiguratorFromYAML>(
Expand All @@ -68,14 +66,14 @@ namespace sgns
auto logNoise = sgns::base::createLogger( "Noise" );
logNoise->set_level( spdlog::level::trace );

auto pubsubKeyPath = ( boost::format( "SuperGNUSNode.TestNet.%s/pubs_processor" ) % node_base_addr_ ).str();
auto pubsubKeyPath = ( boost::format( "SuperGNUSNode.TestNet.%s/pubs_processor" ) % account_->GetAddress<std::string>() ).str();

pubsub_ = std::make_shared<ipfs_pubsub::GossipPubSub>(
crdt::KeyPairFileStorage( pubsubKeyPath ).GetKeyPair().value() );
pubsub_->Start( 40001, {} );

globaldb_ = std::make_shared<crdt::GlobalDB>(
io_, ( boost::format( "SuperGNUSNode.TestNet.%s" ) % node_base_addr_ ).str(), 40010,
io_, ( boost::format( "SuperGNUSNode.TestNet.%s" ) % account_->GetAddress<std::string>() ).str(), 40010,
std::make_shared<ipfs_pubsub::GossipPubSubTopic>( pubsub_, std::string( PROCESSING_CHANNEL ) ) );

globaldb_->Init( crdt::CrdtOptions::DefaultOptions() );
Expand Down
Loading

0 comments on commit 5088518

Please sign in to comment.