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

Commit 909e781

Browse files
authored
Merge pull request #686 from GolosChain/golos-v0.18.0
Golos v0.18.0
2 parents ebbbee4 + 0fc934c commit 909e781

File tree

146 files changed

+11539
-8423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+11539
-8423
lines changed

.travis.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,36 @@ before_install:
99
- echo "$TRAVIS_TAG"
1010
- echo "$TRAVIS_BRANCH"
1111

12+
env:
13+
- DOCKERFILE=Dockerfile DOCKERNAME=""
14+
- DOCKERFILE=share/golosd/docker/Dockerfile-test DOCKERNAME="-test"
15+
- DOCKERFILE=share/golosd/docker/Dockerfile-testnet DOCKERNAME="-testnet"
16+
- DOCKERFILE=share/golosd/docker/Dockerfile-lowmem DOCKERNAME="-lowmem"
17+
18+
matrix:
19+
fast_finish: true
20+
1221
script:
13-
- if [ -n "${TRAVIS_TAG}" ]; then
14-
docker build -t goloschain/golos:"$TRAVIS_TAG" . ;
22+
- if [ "$TRAVIS_BRANCH" == "master" ]; then
23+
export DOCKERNAME="latest""$DOCKERNAME";
24+
export EXPORTNAME="latest""$DOCKERNAME";
25+
elif [ -n "$TRAVIS_TAG" ]; then
26+
export DOCKERNAME="$TRAVIS_TAG""$DOCKERNAME";
27+
export EXPORTNAME="$TRAVIS_TAG""$DOCKERNAME";
1528
else
16-
docker build -t goloschain/golos:latest . ;
29+
export DOCKERNAME=develop"$DOCKERNAME";
1730
fi
18-
- docker images
31+
- echo "$DOCKERFILE"
32+
- echo "$DOCKERNAME"
33+
- docker build -t goloschain/golos:"$DOCKERNAME" -f "$DOCKERFILE" .
1934

2035
after_success:
21-
- if [ "$TRAVIS_BRANCH" == "master" ]; then
36+
- echo "$EXPORTNAME"
37+
- docker images
38+
- if [ -n "$EXPORTNAME" ]; then
2239
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
23-
docker push goloschain/golos:latest;
24-
bash deploy/deploy.sh;
40+
docker push goloschain/golos:"$EXPORTNAME";
2541
fi
26-
- if [ -n "$TRAVIS_TAG" ]; then
27-
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
28-
docker push goloschain/golos:"$TRAVIS_TAG";
42+
- if [ "$TRAVIS_BRANCH" == "master" -a "$EXPORTNAME" == "latest" ]; then
43+
bash deploy/deploy.sh;
2944
fi

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ endif()
6565

6666
option(MAX_19_VOTED_WITNESSES "Build source with 19 voted witnesses (ON OR OFF)" OFF)
6767
message(STATUS "MAX_19_VOTED_WITNESSES: ${MAX_19_VOTED_WITNESSES}")
68-
if(BUILD_GOLOS_TESTNET)
68+
if(MAX_19_VOTED_WITNESSES AND BUILD_GOLOS_TESTNET)
69+
message(STATUS " ")
70+
message(STATUS " CONFIGURING FOR 19 VOTED WITNESSES ")
71+
message(STATUS " ")
6972
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTEEMIT_MAX_VOTED_WITNESSES=19")
7073
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSTEEMIT_MAX_VOTED_WITNESSES=19")
7174
endif()

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
FROM phusion/baseimage:0.9.19
22

3-
#ARG STEEMD_BLOCKCHAIN=https://example.com/steemd-blockchain.tbz2
4-
53
ENV LANG=en_US.UTF-8
64

75
RUN \
@@ -35,7 +33,8 @@ ADD . /usr/local/src/golos
3533

3634
RUN \
3735
cd /usr/local/src/golos && \
38-
git submodule update --init --recursive && \
36+
git submodule deinit -f . && \
37+
git submodule update --init --recursive -f && \
3938
mkdir build && \
4039
cd build && \
4140
cmake \

LICENSE.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
Copyright (c) 2017 Golos Core, and contributors.
1+
Copyright (c) 2018 Golos Core, and contributors.
22

33
The following license applies to code contained within this repository that
4-
is created by Golos Core. Other copy right holders have licensed dependencies such
5-
as Graphene, FC, and Boost under their own individual licenses.
4+
is created by Golos Core. Other copyright holders have licensed dependencies
5+
such as Graphene, FC, and Boost under their own individual licenses.
66

7-
Redistribution and use in source and binary forms, with or without
8-
modification, are permitted provided that the following conditions are met:
7+
The MIT License
98

10-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12-
3. The currency symbols, 'GOLOS' and 'GBG' are not changed and no new currency symbols are added.
13-
4. The STEEMIT_INIT_PUBLIC_KEY_STR is not changed from GLS7KVuKX87DK44xmhAD92hqJeR8Acd1TBKCtVnGLC5VDpER5CtWE,
14-
and the software is not modified in any way that would bypass the need for the corresponding private to start
15-
a new blockchain.
16-
5. The software is not used with any forks of the Golos blockchain that are not recognized by Golos Foundation in writing.
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
1718

1819
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1920
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

documentation/testing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ operation_time_tests // Tests of Golos operations that include a time based comp
1313
serialization_tests // Tests related of serialization
1414
```
1515

16+
## Configuration (draft)
17+
18+
Some config options:
19+
* `log_level` — allows setting the log level. Available values: `all`, `success`, `test_suite`, `message`, `warning`, . `error`, `cpp_exception`, `system_error`, `fatal_error`, `nothing`. Sample usage: `--log-level=test_suite`
20+
* `report_level` — allows setting the level of detailization for the testing results report. Available values: `no`, `confirm`, `short`, `detailed`. Sample usage: `--report_level=detailed`
21+
* `run_test` — specifies which test units to run. You can specify individual test (separated with comma) or test cases. Sample usage: `--run_test=operation_tests/delegation`
22+
23+
For more info about runtime config check [Boost.Tests documentation](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/utf/user-guide/runtime-config/reference.html).
24+
25+
1626
# Code Coverage Testing
1727

1828
If you have not done so, install lcov `brew install lcov`

libraries/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
add_subdirectory(api)
12
add_subdirectory(chain)
23
add_subdirectory(protocol)
34
add_subdirectory(network)

libraries/api/CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
set(CURRENT_TARGET api)
2+
3+
list(APPEND CURRENT_TARGET_HEADERS
4+
include/golos/api/account_api_object.hpp
5+
include/golos/api/comment_api_object.hpp
6+
include/golos/api/chain_api_properties.hpp
7+
include/golos/api/witness_api_object.hpp
8+
include/golos/api/discussion.hpp
9+
include/golos/api/vote_state.hpp
10+
include/golos/api/account_vote.hpp
11+
include/golos/api/discussion_helper.hpp
12+
)
13+
14+
list(APPEND CURRENT_TARGET_SOURCES
15+
account_api_object.cpp
16+
discussion_helper.cpp
17+
comment_api_object.cpp
18+
chain_api_properties.cpp
19+
witness_api_object.cpp
20+
)
21+
22+
if(BUILD_SHARED_LIBRARIES)
23+
add_library(golos_${CURRENT_TARGET} SHARED
24+
${CURRENT_TARGET_HEADERS}
25+
${CURRENT_TARGET_SOURCES}
26+
)
27+
else()
28+
add_library(golos_${CURRENT_TARGET} STATIC
29+
${CURRENT_TARGET_HEADERS}
30+
${CURRENT_TARGET_SOURCES}
31+
)
32+
endif()
33+
34+
add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET})
35+
set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET})
36+
37+
target_link_libraries(
38+
golos_${CURRENT_TARGET}
39+
golos_chain
40+
golos_protocol
41+
graphene_utilities
42+
fc
43+
)
44+
45+
target_include_directories(golos_${CURRENT_TARGET}
46+
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
47+
48+
install(TARGETS
49+
golos_${CURRENT_TARGET}
50+
51+
RUNTIME DESTINATION bin
52+
LIBRARY DESTINATION lib
53+
ARCHIVE DESTINATION lib
54+
)

libraries/api/account_api_object.cpp

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#include <golos/api/account_api_object.hpp>
2+
3+
namespace golos { namespace api {
4+
5+
using golos::chain::by_account;
6+
using golos::chain::by_account_bandwidth_type;
7+
using golos::chain::account_bandwidth_object;
8+
using golos::chain::account_authority_object;
9+
using golos::chain::account_metadata_object;
10+
using golos::chain::bandwidth_type;
11+
12+
account_api_object::account_api_object(const account_object& a, const golos::chain::database& db)
13+
: id(a.id), name(a.name), memo_key(a.memo_key), proxy(a.proxy),
14+
last_account_update(a.last_account_update), created(a.created), mined(a.mined),
15+
owner_challenged(a.owner_challenged), active_challenged(a.active_challenged),
16+
last_owner_proved(a.last_owner_proved), last_active_proved(a.last_active_proved),
17+
recovery_account(a.recovery_account), reset_account(a.reset_account),
18+
last_account_recovery(a.last_account_recovery), comment_count(a.comment_count),
19+
lifetime_vote_count(a.lifetime_vote_count), post_count(a.post_count), can_vote(a.can_vote),
20+
voting_power(a.voting_power), last_vote_time(a.last_vote_time),
21+
balance(a.balance), savings_balance(a.savings_balance),
22+
sbd_balance(a.sbd_balance), sbd_seconds(a.sbd_seconds),
23+
sbd_seconds_last_update(a.sbd_seconds_last_update),
24+
sbd_last_interest_payment(a.sbd_last_interest_payment),
25+
savings_sbd_balance(a.savings_sbd_balance), savings_sbd_seconds(a.savings_sbd_seconds),
26+
savings_sbd_seconds_last_update(a.savings_sbd_seconds_last_update),
27+
savings_sbd_last_interest_payment(a.savings_sbd_last_interest_payment),
28+
savings_withdraw_requests(a.savings_withdraw_requests),
29+
curation_rewards(a.curation_rewards), posting_rewards(a.posting_rewards),
30+
vesting_shares(a.vesting_shares),
31+
delegated_vesting_shares(a.delegated_vesting_shares), received_vesting_shares(a.received_vesting_shares),
32+
vesting_withdraw_rate(a.vesting_withdraw_rate), next_vesting_withdrawal(a.next_vesting_withdrawal),
33+
withdrawn(a.withdrawn), to_withdraw(a.to_withdraw), withdraw_routes(a.withdraw_routes),
34+
witnesses_voted_for(a.witnesses_voted_for), last_post(a.last_post) {
35+
size_t n = a.proxied_vsf_votes.size();
36+
proxied_vsf_votes.reserve(n);
37+
for (size_t i = 0; i < n; i++) {
38+
proxied_vsf_votes.push_back(a.proxied_vsf_votes[i]);
39+
}
40+
41+
const auto& auth = db.get<account_authority_object, by_account>(name);
42+
owner = authority(auth.owner);
43+
active = authority(auth.active);
44+
posting = authority(auth.posting);
45+
last_owner_update = auth.last_owner_update;
46+
47+
#ifndef IS_LOW_MEM
48+
const auto& meta = db.get<account_metadata_object, by_account>(name);
49+
json_metadata = golos::chain::to_string(meta.json_metadata);
50+
#endif
51+
52+
auto old_forum = db.find<account_bandwidth_object, by_account_bandwidth_type>(
53+
std::make_tuple(name, bandwidth_type::old_forum));
54+
if (old_forum != nullptr) {
55+
average_bandwidth = old_forum->average_bandwidth;
56+
lifetime_bandwidth = old_forum->lifetime_bandwidth;
57+
last_bandwidth_update = old_forum->last_bandwidth_update;
58+
}
59+
60+
auto old_market = db.find<account_bandwidth_object, by_account_bandwidth_type>(
61+
std::make_tuple(name, bandwidth_type::old_market));
62+
if (old_market != nullptr) {
63+
average_market_bandwidth = old_market->average_bandwidth;
64+
last_market_bandwidth_update = old_market->last_bandwidth_update;
65+
}
66+
67+
auto post = db.find<account_bandwidth_object, by_account_bandwidth_type>(
68+
std::make_tuple(name, bandwidth_type::post));
69+
if (post != nullptr) {
70+
last_root_post = post->last_bandwidth_update;
71+
post_bandwidth = post->average_bandwidth;
72+
}
73+
74+
auto forum = db.find<account_bandwidth_object, by_account_bandwidth_type>(
75+
std::make_tuple(name, bandwidth_type::forum));
76+
if (forum != nullptr) {
77+
new_average_bandwidth = forum->average_bandwidth;
78+
}
79+
80+
auto market = db.find<account_bandwidth_object, by_account_bandwidth_type>(
81+
std::make_tuple(name, bandwidth_type::market));
82+
if (market != nullptr) {
83+
new_average_market_bandwidth = market->average_bandwidth;
84+
}
85+
}
86+
87+
account_api_object::account_api_object() {}
88+
89+
} } // golos::api
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <golos/api/chain_api_properties.hpp>
2+
3+
namespace golos { namespace api {
4+
5+
chain_api_properties::chain_api_properties(
6+
const chain_properties& src,
7+
const database& db
8+
) : account_creation_fee(src.account_creation_fee),
9+
maximum_block_size(src.maximum_block_size),
10+
sbd_interest_rate(src.sbd_interest_rate)
11+
{
12+
if (db.has_hardfork(STEEMIT_HARDFORK_0_18__673)) {
13+
create_account_with_golos_modifier = src.create_account_with_golos_modifier;
14+
create_account_delegation_ratio = src.create_account_delegation_ratio;
15+
create_account_delegation_time = src.create_account_delegation_time;
16+
min_delegation_multiplier = src.min_delegation_multiplier;
17+
}
18+
}
19+
20+
} } // golos::api

libraries/api/comment_api_object.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <golos/api/comment_api_object.hpp>
2+
3+
namespace golos { namespace api {
4+
5+
using namespace golos::chain;
6+
7+
comment_api_object::comment_api_object(const golos::chain::comment_object &o, const golos::chain::database &db)
8+
: id(o.id),
9+
parent_author(o.parent_author),
10+
parent_permlink(to_string(o.parent_permlink)),
11+
author(o.author),
12+
permlink(to_string(o.permlink)),
13+
last_update(o.last_update),
14+
created(o.created),
15+
active(o.active),
16+
last_payout(o.last_payout),
17+
depth(o.depth),
18+
children(o.children),
19+
children_rshares2(o.children_rshares2),
20+
net_rshares(o.net_rshares),
21+
abs_rshares(o.abs_rshares),
22+
vote_rshares(o.vote_rshares),
23+
children_abs_rshares(o.children_abs_rshares),
24+
cashout_time(o.cashout_time),
25+
max_cashout_time(o.max_cashout_time),
26+
total_vote_weight(o.total_vote_weight),
27+
reward_weight(o.reward_weight),
28+
total_payout_value(o.total_payout_value),
29+
curator_payout_value(o.curator_payout_value),
30+
author_rewards(o.author_rewards),
31+
net_votes(o.net_votes),
32+
mode(o.mode),
33+
root_comment(o.root_comment),
34+
max_accepted_payout(o.max_accepted_payout),
35+
percent_steem_dollars(o.percent_steem_dollars),
36+
allow_replies(o.allow_replies),
37+
allow_votes(o.allow_votes),
38+
allow_curation_rewards(o.allow_curation_rewards) {
39+
40+
for (auto& route : o.beneficiaries) {
41+
beneficiaries.push_back(route);
42+
}
43+
#ifndef IS_LOW_MEM
44+
auto& content = db.get_comment_content(o.id);
45+
46+
title = to_string(content.title);
47+
body = to_string(content.body);
48+
json_metadata = to_string(content.json_metadata);
49+
#endif
50+
if (o.parent_author == STEEMIT_ROOT_POST_PARENT) {
51+
category = to_string(o.parent_permlink);
52+
} else {
53+
category = to_string(db.get<comment_object, by_id>(o.root_comment).parent_permlink);
54+
}
55+
}
56+
57+
comment_api_object::comment_api_object() = default;
58+
59+
} } // golos::api

0 commit comments

Comments
 (0)