Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Merge branch 'golos-v0.16.5' of https://github.com/GolosChain/golos i…
Browse files Browse the repository at this point in the history
…nto 421-mongodb-plugin
  • Loading branch information
vpavliv committed Feb 28, 2018
2 parents 7a3253b + b594e57 commit 4fcf063
Show file tree
Hide file tree
Showing 134 changed files with 2,904 additions and 3,348 deletions.
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[submodule "libraries/fc"]
path = libraries/fc
[submodule "thirdparty/fc"]
path = thirdparty/fc
url = https://github.com/GolosChain/fc.git
branch = 16.5
[submodule "libraries/chainbase"]
path = libraries/chainbase
[submodule "thirdparty/chainbase"]
path = thirdparty/chainbase
url = https://github.com/GolosChain/chainbase.git
[submodule "libraries/appbase"]
path = libraries/appbase
[submodule "thirdparty/appbase"]
path = thirdparty/appbase
url = https://github.com/GolosChain/appbase.git
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ if(USE_PCH)
include(cotire)
endif(USE_PCH)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/GitVersionGen")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fc/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fc/GitVersionGen")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA2)

Expand All @@ -46,7 +46,8 @@ list(APPEND BOOST_COMPONENTS thread
chrono
unit_test_framework
context
locale)
locale
)

option(Boost_USE_STATIC_LIBS "Build with Boost static libraries usage" TRUE)

Expand Down Expand Up @@ -205,10 +206,18 @@ if(ENABLE_COVERAGE_TESTING)
set(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
endif()

set(ENABLE_TESTING FALSE CACHE BOOL "Run unit tests for Golos")

if (ENABLE_TESTING)
enable_testing()
endif()

# external_plugins needs to be compiled first because libraries/app depends on GOLOSIT_EXTERNAL_PLUGINS being fully populated
add_subdirectory(thirdparty)
add_subdirectory(libraries)
add_subdirectory(plugins)
add_subdirectory(programs)
#add_subdirectory(tests)
add_subdirectory(tests)

if(ENABLE_INSTALLER)

Expand Down
45 changes: 4 additions & 41 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,6 @@ RUN \

ADD . /usr/local/src/golos

#RUN \
# cd /usr/local/src/golos && \
# git submodule update --init --recursive && \
# mkdir build && \
# cd build && \
# cmake \
# -DCMAKE_BUILD_TYPE=Release \
# -DBUILD_GOLOS_TESTNET=TRUE \
# -DLOW_MEMORY_NODE=FALSE \
# -DCLEAR_VOTES=TRUE \
# .. && \
# make -j$(nproc) chain_test && \
# ./tests/chain_test && \
# cd /usr/local/src/golos && \
# doxygen && \
# programs/build_helpers/check_reflect.py && \
# rm -rf /usr/local/src/golos/build

#RUN \
# cd /usr/local/src/golos && \
# git submodule update --init --recursive && \
# mkdir build && \
# cd build && \
# cmake \
# -DCMAKE_BUILD_TYPE=Debug \
# -DENABLE_COVERAGE_TESTING=TRUE \
# -DBUILD_GOLOS_TESTNET=TRUE \
# -DLOW_MEMORY_NODE=FALSE \
# -DCLEAR_VOTES=TRUE \
# .. && \
# make -j$(nproc) chain_test && \
# ./tests/chain_test && \
# mkdir -p /var/cobertura && \
# gcovr --object-directory="../" --root=../ --xml-pretty --gcov-exclude=".*tests.*" --gcov-exclude=".*fc.*" --output="/var/cobertura/coverage.xml" && \
# cd /usr/local/src/golos && \
# rm -rf /usr/local/src/golos/build

RUN \
cd /usr/local/src/golos && \
git submodule update --init --recursive && \
Expand Down Expand Up @@ -147,7 +110,7 @@ RUN mkdir /var/cache/golosd && \
ENV HOME /var/lib/golosd
RUN chown golosd:golosd -R /var/lib/golosd

ADD programs/golosd/snapshot5392323.json /var/lib/golosd
ADD share/golosd/snapshot5392323.json /var/lib/golosd

# rpc service:
# http
Expand All @@ -158,11 +121,11 @@ EXPOSE 8091
EXPOSE 2001

RUN mkdir -p /etc/service/golosd
ADD contribution/golosd.sh /etc/service/golosd/run
ADD share/golosd/golosd.sh /etc/service/golosd/run
RUN chmod +x /etc/service/golosd/run

# add seednodes from documentation to image
ADD documentation/seednodes /etc/golosd/seednodes
ADD share/golosd/seednodes /etc/golosd/seednodes

# the following adds lots of logging info to stdout
ADD contribution/config.ini /etc/golosd/config.ini
ADD share/golosd/config/config.ini /etc/golosd/config.ini
90 changes: 0 additions & 90 deletions contribution/golosd.sh

This file was deleted.

4 changes: 0 additions & 4 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
add_subdirectory(appbase)
add_subdirectory(fc)
add_subdirectory(chainbase)
add_subdirectory(chain)
add_subdirectory(protocol)
add_subdirectory(network)
add_subdirectory(time)
add_subdirectory(utilities)
add_subdirectory(plugins)
add_subdirectory(wallet)
62 changes: 30 additions & 32 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,7 @@ namespace golos {

// TODO: Move this to _push_block() so session is restored.
if (!(skip & skip_block_size_check)) {
FC_ASSERT(fc::raw::pack_size(pending_block) <=
STEEMIT_MAX_BLOCK_SIZE);
FC_ASSERT(fc::raw::pack_size(pending_block) <= STEEMIT_MAX_BLOCK_SIZE);
}

push_block(pending_block, skip);
Expand Down Expand Up @@ -1042,8 +1041,7 @@ namespace golos {
return genesis_time + slot_num * interval;
}

int64_t head_block_abs_slot =
head_block_time().sec_since_epoch() / interval;
int64_t head_block_abs_slot = head_block_time().sec_since_epoch() / interval;
fc::time_point_sec head_slot_time(head_block_abs_slot * interval);

// "slot 0" is head_slot_time
Expand Down Expand Up @@ -1109,18 +1107,18 @@ namespace golos {
const auto &cprops = get_dynamic_global_properties();

/**
* The ratio of total_vesting_shares / total_vesting_fund_steem should not
* change as the result of the user adding funds
*
* V / C = (V+Vn) / (C+Cn)
*
* Simplifies to Vn = (V * Cn ) / C
*
* If Cn equals o.amount, then we must solve for Vn to know how many new vesting shares
* the user should receive.
*
* 128 bit math is requred due to multiplying of 64 bit numbers. This is done in asset and price.
*/
* The ratio of total_vesting_shares / total_vesting_fund_steem should not
* change as the result of the user adding funds
*
* V / C = (V+Vn) / (C+Cn)
*
* Simplifies to Vn = (V * Cn ) / C
*
* If Cn equals o.amount, then we must solve for Vn to know how many new vesting shares
* the user should receive.
*
* 128 bit math is requred due to multiplying of 64 bit numbers. This is done in asset and price.
*/
asset new_vesting = steem * cprops.get_vesting_share_price();

modify(to_account, [&](account_object &to) {
Expand Down Expand Up @@ -3143,11 +3141,11 @@ namespace golos {

for (const auto &trx : next_block.transactions) {
/* We do not need to push the undo state for each transaction
* because they either all apply and are valid or the
* entire block fails to apply. We only need an "undo" state
* for transactions when validating broadcast transactions or
* when building a block.
*/
* because they either all apply and are valid or the
* entire block fails to apply. We only need an "undo" state
* for transactions when validating broadcast transactions or
* when building a block.
*/
apply_transaction(trx, skip);
++_current_trx_in_block;
}
Expand Down Expand Up @@ -3497,18 +3495,18 @@ namespace golos {
dgp.average_block_size =
(99 * dgp.average_block_size + block_size) / 100;

/**
* About once per minute the average network use is consulted and used to
* adjust the reserve ratio. Anything above 50% usage reduces the ratio by
* half which should instantly bring the network from 50% to 25% use unless
* the demand comes from users who have surplus capacity. In other words,
* a 50% reduction in reserve ratio does not result in a 50% reduction in usage,
* it will only impact users who where attempting to use more than 50% of their
* capacity.
/*
* About once per minute the average network use is consulted and used to adjust
* the reserve ratio. Anything above 25% usage (since STEEMIT_HARDFORK_0_12__179)
* reduces the ratio by half which should instantly bring the network from 50% to
* 25% use unless the demand comes from users who have surplus capacity. In other
* words, a 50% reduction in reserve ratio does not result in a 50% reduction in
* usage, it will only impact users who where attempting to use more than 50% of
* their capacity.
*
* When the reserve ratio is at its max (10,000) a 50% reduction will take 3 to
* 4 days to return back to maximum. When it is at its minimum it will return
* back to its prior level in just a few minutes.
* When the reserve ratio is at its max (check STEEMIT_MAX_RESERVE_RATIO) a 50%
* reduction will take 3 to 4 days to return back to maximum. When it is at its
* minimum it will return back to its prior level in just a few minutes.
*
* If the network reserve ratio falls under 100 then it is probably time to
* increase the capacity of the network.
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/steem_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ namespace golos {
props.get_vesting_share_price();
min_vests.amount.value *= 10;

FC_ASSERT(account.vesting_shares > min_vests ||
FC_ASSERT(account.vesting_shares.amount > min_vests.amount ||
(_db.has_hardfork(STEEMIT_HARDFORK_0_16__562) &&
o.vesting_shares.amount == 0),
"Account registered by another account requires 10x account creation fee worth of Golos Power before it can be powered down.");
Expand Down
7 changes: 3 additions & 4 deletions libraries/protocol/include/golos/protocol/asset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ namespace golos {
}

friend bool operator==(const asset &a, const asset &b) {
return std::tie(a.symbol, a.amount) ==
std::tie(b.symbol, b.amount);
FC_ASSERT(a.symbol == b.symbol);
return a.amount == b.amount;
}

friend bool operator<(const asset &a, const asset &b) {
FC_ASSERT(a.symbol == b.symbol);
return std::tie(a.amount, a.symbol) <
std::tie(b.amount, b.symbol);
return a.amount < b.amount;
}

friend bool operator<=(const asset &a, const asset &b) {
Expand Down
6 changes: 3 additions & 3 deletions libraries/protocol/include/golos/protocol/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define STEEMIT_INIT_PUBLIC_KEY_STR (std::string(golos::protocol::public_key_type(STEEMIT_INIT_PRIVATE_KEY.get_public_key())))
#define STEEMIT_CHAIN_ID (fc::sha256::hash(BLOCKCHAIN_NAME))

#define VESTS_SYMBOL (uint64_t(6) | (uint64_t('G') << 8) | (uint64_t('E') << 16) | (uint64_t('S') << 24) | (uint64_t('T') << 32) | (uint64_t('S') << 40)) ///< VESTS with 6 digits of precision
#define STEEM_SYMBOL (uint64_t(3) | (uint64_t('G') << 8) | (uint64_t('O') << 16) | (uint64_t('L') << 24) | (uint64_t('O') << 32) | (uint64_t('S') << 40)) ///< STEEM with 3 digits of precision
#define VESTS_SYMBOL (uint64_t(6) | (uint64_t('G') << 8) | (uint64_t('E') << 16) | (uint64_t('S') << 24) | (uint64_t('T') << 32) | (uint64_t('S') << 40)) ///< GESTS with 6 digits of precision
#define STEEM_SYMBOL (uint64_t(3) | (uint64_t('G') << 8) | (uint64_t('O') << 16) | (uint64_t('L') << 24) | (uint64_t('O') << 32) | (uint64_t('S') << 40)) ///< GOLOS with 3 digits of precision
#define SBD_SYMBOL (uint64_t(3) | (uint64_t('G') << 8) | (uint64_t('B') << 16) | (uint64_t('G') << 24) ) ///< Test Backed Dollars with 3 digits of precision
#define STMD_SYMBOL (uint64_t(3) | (uint64_t('S') << 8) | (uint64_t('T') << 16) | (uint64_t('M') << 24) | (uint64_t('D') << 32) ) ///< Test Dollars with 3 digits of precision

Expand Down Expand Up @@ -47,7 +47,7 @@
#define STEEMIT_INIT_MINER_NAME "cyberfounder"
#define STEEMIT_NUM_INIT_MINERS 1
#define STEEMIT_INIT_TIME (fc::time_point_sec());
#define STEEMIT_MAX_VOTED_WITNESSES 1
#define STEEMIT_MAX_VOTED_WITNESSES 19
#define STEEMIT_MAX_MINER_WITNESSES 1
#define STEEMIT_MAX_RUNNER_WITNESSES 1
#define STEEMIT_MAX_WITNESSES (STEEMIT_MAX_VOTED_WITNESSES+STEEMIT_MAX_MINER_WITNESSES+STEEMIT_MAX_RUNNER_WITNESSES) /// 21 is more than enough
Expand Down

0 comments on commit 4fcf063

Please sign in to comment.