Skip to content

Commit

Permalink
Merge pull request #124 from boscore/release/3.0.x
Browse files Browse the repository at this point in the history
release v3.0.2 to master
  • Loading branch information
Thaipanda authored Aug 29, 2019
2 parents e424ec9 + 79bf108 commit b24a643
Show file tree
Hide file tree
Showing 27 changed files with 1,182 additions and 1,176 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 3)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)
set(VERSION_PATCH 2)

if(VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
Expand Down
8 changes: 2 additions & 6 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,22 @@ ARG symbol=SYS

ENV OPENSSL_ROOT_DIR /usr/include/openssl


RUN git clone -b $branch https://github.com/boscore/bos.git --recursive \
&& cd bos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \
&& cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \
-DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" \
-DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DCMAKE_CXX_STANDARD_LIBRARIES="-lpthread" \
&& cmake --build /tmp/build --target install



FROM ubuntu:18.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/lib/* /usr/local/lib/
COPY --from=builder /tmp/build/bin /opt/eosio/bin
COPY --from=builder /tmp/build/contracts /contracts
COPY --from=builder /bos/Docker/config.ini /
COPY --from=builder /etc/eosio-version /etc
COPY --from=builder /bos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh
ENV EOSIO_ROOT=/opt/eosio
RUN chmod +x /opt/eosio/bin/nodeosd.sh
ENV LD_LIBRARY_PATH /usr/local/lib
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
4 changes: 2 additions & 2 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ cd bos/Docker
docker build . -t boscore/bos -s BOS
```

The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v3.0.1 tag, you could do the following:
The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v3.0.2 tag, you could do the following:

```bash
docker build -t boscore/bos:v3.0.1 --build-arg branch=v3.0.1 .
docker build -t boscore/bos:v3.0.2 --build-arg branch=v3.0.2 .

```

Expand Down
6 changes: 0 additions & 6 deletions Docker/nodeosd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ if [ -f '/opt/eosio/bin/data-dir/config.ini' ]; then
cp /config.ini /opt/eosio/bin/data-dir
fi

if [ -d '/opt/eosio/bin/data-dir/contracts' ]; then
echo
else
cp -r /contracts /opt/eosio/bin/data-dir
fi

while :; do
case $1 in
--config-dir=?*)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BOSCore - Born for DApps. Born for Usability.

## BOSCore Version: v3.0.1
## BOSCore Version: v3.0.2
### Basic EOSIO Version: v1.6.6 (support REX)

# Background
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BOSCore - 更可用的链,为DApp而生。

## BOSCore Version: v3.0.1
## BOSCore Version: v3.0.2
### Basic EOSIO Version: v1.6.6 (support REX)

# 背景
Expand Down
1 change: 1 addition & 0 deletions eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
-DCMAKE_C_COMPILER="${C_COMPILER}" -DWASM_ROOT="${WASM_ROOT}" -DCORE_SYMBOL_NAME="${CORE_SYMBOL_NAME}" \
-DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DBUILD_MONGO_DB_PLUGIN=true \
-DENABLE_COVERAGE_TESTING="${ENABLE_COVERAGE_TESTING}" -DBUILD_DOXYGEN="${DOXYGEN}" \
-DCMAKE_CXX_STANDARD_LIBRARIES="-lpthread" \
-DCMAKE_INSTALL_PREFIX="/usr/local/eosio" ${LOCAL_CMAKE_FLAGS} "${SOURCE_DIR}"
then
printf "\\n\\t>>>>>>>>>>>>>>>>>>>> CMAKE building BOSCore has exited with the above error.\\n\\n"
Expand Down
5 changes: 5 additions & 0 deletions libraries/chain/chain_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ void chain_config2::validate() const{
EOS_ASSERT(std::numeric_limits<decltype(resource_greylist.size())>::max() > resource_greylist.size(), action_validate_exception, "Overflow in greylistwhen adding resource greylist!");
}

void chain_config3::validate() const{
EOS_ASSERT( view_change_timeout >= 1, action_validate_exception, "view change timeout must be at least 1");
EOS_ASSERT( pbft_checkpoint_granularity >= 100 && pbft_checkpoint_granularity % 100 == 0, action_validate_exception, "pbft checkpoint granularity must be multiple of 100 blocks");
}

} } // namespace eosio::chain
23 changes: 19 additions & 4 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ using controller_index_set = index_set<
global_property2_multi_index,
dynamic_global_property_multi_index,
upgrade_property_multi_index,
global_property3_multi_index,
block_summary_multi_index,
transaction_multi_index,
generated_transaction_multi_index,
Expand Down Expand Up @@ -455,6 +456,13 @@ struct controller_impl {
wlog("no upo found, generating...");
db.create<upgrade_property_object>([](auto&){});
}

try {
db.get<global_property3_object>();
} catch( const boost::exception& e) {
wlog("no gpo3 found, generating...");
db.create<global_property3_object>([](auto&){});
}
}

~controller_impl() {
Expand Down Expand Up @@ -746,6 +754,7 @@ struct controller_impl {

// *bos end*

db.create<global_property3_object>([](auto&) {});

authorization.initialize_database();
resource_limits.initialize_database();
Expand Down Expand Up @@ -2526,13 +2535,15 @@ void controller::set_pbft_my_prepare(const block_id_type& id) {
}

block_id_type controller::get_pbft_prepared() const {
if (my->pbft_prepared) return my->pbft_prepared->id;
return block_id_type{};
block_id_type pp;
if (my->pbft_prepared) pp = my->pbft_prepared->id;
return pp;
}

block_id_type controller::get_pbft_my_prepare() const {
if (my->my_prepare) return my->my_prepare->id;
return block_id_type{};
block_id_type mp;
if (my->my_prepare) mp = my->my_prepare->id;
return mp;
}

void controller::reset_pbft_my_prepare() {
Expand Down Expand Up @@ -2701,6 +2712,10 @@ const upgrade_property_object& controller::get_upgrade_properties()const {
return my->db.get<upgrade_property_object>();
}

const global_property3_object& controller::get_pbft_properties()const {
return my->db.get<global_property3_object>();
}

bool controller::is_pbft_enabled() const {
return my->pbft_enabled;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/fork_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ namespace eosio { namespace chain {
*
* This will require a search over all forks
*/
void fork_database::set_bft_irreversible( block_id_type id ) {
void fork_database::set_bft_irreversible( const block_id_type& id ) {
auto b = get_block( id );
EOS_ASSERT( b, fork_db_block_not_found, "unable to find block id ${id}", ("id",id));

Expand Down Expand Up @@ -569,7 +569,7 @@ namespace eosio { namespace chain {
my->head = *my->index.get<by_lib_block_num>().begin();
}

void fork_database::set_latest_checkpoint( block_id_type id) {
void fork_database::set_latest_checkpoint( const block_id_type& id) {
auto b = get_block( id );
EOS_ASSERT( b, fork_db_block_not_found, "unable to find block id ${id}", ("id",id));

Expand Down
10 changes: 10 additions & 0 deletions libraries/chain/include/eosio/chain/chain_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ struct chain_config2 {
void validate()const;
};

struct chain_config3 {

uint16_t view_change_timeout = 6; /// the actual wait time will be `num * 5`
uint16_t pbft_checkpoint_granularity = 100; /// the interval of normal checkpoints must be a multiple of 100 * n;

void validate()const;
};

// *bos*
struct guaranteed_minimum_resources {
uint64_t ram_byte;
Expand All @@ -140,3 +148,5 @@ FC_REFLECT(eosio::chain::chain_config,
// *bos*
FC_REFLECT( eosio::chain::chain_config2, (actor_blacklist)(contract_blacklist)(resource_greylist) )
FC_REFLECT( eosio::chain::guaranteed_minimum_resources, (ram_byte)(cpu_us)(net_byte) )

FC_REFLECT( eosio::chain::chain_config3, (view_change_timeout) )
4 changes: 3 additions & 1 deletion libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace eosio { namespace chain {
class global_property_object;
class global_property2_object; // *bos*
class upgrade_property_object;
class global_property3_object; // *bos*
class permission_object;
class account_object;
using resource_limits::resource_limits_manager;
Expand Down Expand Up @@ -305,7 +306,8 @@ namespace eosio { namespace chain {
signal<void(const header_confirmation&)> accepted_confirmation;
signal<void(const int&)> bad_alloc;

const upgrade_property_object& get_upgrade_properties()const;
const upgrade_property_object& get_upgrade_properties()const;
const global_property3_object& get_pbft_properties()const;
bool is_pbft_enabled()const;
bool under_maintenance()const;
void set_upo(uint32_t target_block_num);
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/include/eosio/chain/fork_database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ namespace eosio { namespace chain {
*/
signal<void(block_state_ptr)> irreversible;

void set_bft_irreversible( block_id_type id );
void set_bft_irreversible( const block_id_type& id );

void set_latest_checkpoint( block_id_type id);
void set_latest_checkpoint( const block_id_type& id);

void mark_pbft_prepared_fork(const block_state_ptr& h);

Expand Down
23 changes: 22 additions & 1 deletion libraries/chain/include/eosio/chain/global_property_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ namespace eosio { namespace chain {
block_num_type upgrade_complete_block_num = 0;
};

class global_property3_object : public chainbase::object<global_property3_object_type, global_property3_object>
{
OBJECT_CTOR(global_property3_object)

id_type id;
chain_config3 configuration;
};


/**
* @class dynamic_global_property_object
Expand Down Expand Up @@ -108,6 +116,15 @@ namespace eosio { namespace chain {
>
>
>;

using global_property3_multi_index = chainbase::shared_multi_index_container<
global_property3_object,
indexed_by<
ordered_unique<tag<by_id>,
BOOST_MULTI_INDEX_MEMBER(global_property3_object, global_property3_object::id_type, id)
>
>
>;
}}

CHAINBASE_SET_INDEX_TYPE(eosio::chain::global_property_object, eosio::chain::global_property_multi_index)
Expand All @@ -116,6 +133,7 @@ CHAINBASE_SET_INDEX_TYPE(eosio::chain::dynamic_global_property_object,
// *bos*
CHAINBASE_SET_INDEX_TYPE(eosio::chain::global_property2_object, eosio::chain::global_property2_multi_index)
CHAINBASE_SET_INDEX_TYPE(eosio::chain::upgrade_property_object, eosio::chain::upgrade_property_multi_index)
CHAINBASE_SET_INDEX_TYPE(eosio::chain::global_property3_object, eosio::chain::global_property3_multi_index)

FC_REFLECT(eosio::chain::dynamic_global_property_object,
(global_action_sequence)
Expand All @@ -130,4 +148,7 @@ FC_REFLECT(eosio::chain::global_property2_object,
)
FC_REFLECT(eosio::chain::upgrade_property_object,
(upgrade_target_block_num)(upgrade_complete_block_num)
)
)
FC_REFLECT(eosio::chain::global_property3_object,
(configuration)
)
Loading

0 comments on commit b24a643

Please sign in to comment.