Skip to content

Commit

Permalink
Merge pull request #80 from boscore/develop
Browse files Browse the repository at this point in the history
merge develop and prepare for 2.0.3
  • Loading branch information
Thaipanda authored Apr 18, 2019
2 parents 3118500 + d4a7494 commit 58ac720
Show file tree
Hide file tree
Showing 7 changed files with 481 additions and 88 deletions.
7 changes: 6 additions & 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 2)
set(VERSION_MINOR 0)
set(VERSION_PATCH 2)
set(VERSION_PATCH 3)

if(VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
Expand Down Expand Up @@ -126,6 +126,11 @@ FIND_PACKAGE(Boost 1.67 REQUIRED COMPONENTS
locale
iostreams)

# Some new stdlibc++s will #error on <experimental/string_view>; a problem for boost pre-1.69
if( APPLE AND UNIX )
add_definitions(-DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
endif()

if( WIN32 )

message( STATUS "Configuring EOSIO on WIN32")
Expand Down
8 changes: 5 additions & 3 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 v2.0.2 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 v2.0.3 tag, you could do the following:

```bash
docker build -t boscore/bos:v2.0.2 --build-arg branch=v2.0.2 .
docker build -t boscore/bos:v2.0.3 --build-arg branch=v2.0.3 .

```

Expand Down Expand Up @@ -198,4 +198,6 @@ The `blocks` data are stored under `--data-dir` by default, and the wallet files

### About MongoDB Plugin

Currently, the mongodb plugin is disabled in `config.ini` by default, you have to change it manually in `config.ini` or you can mount a `config.ini` file to `/opt/eosio/bin/data-dir/config.ini` in the docker-compose file.
Currently, the mongodb plugin is disabled in `config.ini` by default, you have to change it manually in `config.ini` or you can mount a `config.ini` file to `/opt/eosio/bin/data-dir/config.ini` in the docker-compose file.


18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BOSCore - Born for DApps. Born for Usability.

## BOSCore Version: v2.0.2
### Basic EOSIO Version: v1.6.2
## BOSCore Version: v2.0.3
### Basic EOSIO Version: v1.6.4 (support REX)

# Background
The emergence of EOS has brought new imagination to the blockchain. In just a few months since the main network was launched, the version has undergone dozens of upgrades, not only the stability has been greatly improved, but also the new functions have been gradually realized. The node team is also actively involved in building the EOSIO ecosystem. What is even more exciting is that EOS has attracted more and more development teams. There are already hundreds of DApp running on the EOS main network. The transaction volume and circulation market value far exceed Ethereum, and the space for development is growing broader.
Expand All @@ -23,21 +23,11 @@ As BOS continues to develop, developer rewards will be appropriately adjusted to
2. [Developer Telegram Group](https://t.me/BOSDevelopers)
3. [Community Telegram Group](https://t.me/boscorecommunity)
4. [WhitePaper](https://github.com/boscore/Documentation/blob/master/BOSCoreTechnicalWhitePaper.md)
5. [白皮书](https://github.com/boscore/Documentation/blob/master/zh-CN/BOSCoreTechnicalWhitePaper.md)
5. [白皮书](https://github.com/boscore/Documentation/blob/master/BOSCoreTechnicalWhitePaper_zh.md)

## Start
1. Build from code : `bash ./eosio_build.sh -s BOS`
2. Docker Style,check [Docker](./Docker/README.md)
3. Mac OS X Brew install and uninstall
#### Mac OS X Brew Install
```sh
$ brew tap boscore/bos
$ brew install bos
```
#### Mac OS X Brew Uninstall
```sh
$ brew remove bos
```

## BOSCore Workflow
BOSCore encourage community developer actively participate in contributing the code, members should follow the workflow below.
Expand Down Expand Up @@ -65,3 +55,5 @@ BOSCore bases on EOSIO, so you can also referer:

[EOSIO Developer Portal](https://developers.eos.io).



17 changes: 4 additions & 13 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BOSCore - 更可用的链,为DApp而生。

## BOSCore Version: v2.0.2
### Basic EOSIO Version: v1.6.2
## BOSCore Version: v2.0.3
### Basic EOSIO Version: v1.6.4 (support REX)

# 背景
EOS的出现给区块链带来了新的想象力,主网启动短短几个月以来,版本经历了几十次升级,不仅稳定性得到了很大提高,并且新功能也逐步实现,各个节点团队也积极参与建设EOSIO生态。让人更加兴奋的是,EOS已经吸引了越来越多的开发团队,当前已经有数百个DApp在EOS主网上面运行,其交易量和流通市值远超以太坊,可发展的空间愈来愈广阔。
Expand All @@ -23,21 +23,11 @@ BOS链的代码完全由社区贡献并维护,每个生态参与者都可以
2. [Developer Telegram Group](https://t.me/BOSDevelopers)
3. [Community Telegram Group](https://t.me/boscorecommunity)
4. [WhitePaper](https://github.com/boscore/Documentation/blob/master/BOSCoreTechnicalWhitePaper.md)
5. [白皮书](https://github.com/boscore/Documentation/blob/master/zh-CN/BOSCoreTechnicalWhitePaper.md)
5. [白皮书](https://github.com/boscore/Documentation/blob/master/BOSCoreTechnicalWhitePaper_zh.md)

## 开始
1. 源码直接编译: `bash ./eosio_build.sh -s BOS`
2. Docker方式部署,参看 [Docker](./Docker/README.md)
3. Mac OS X Brew 安装 和 卸载
#### Mac OS X Brew 安装
```sh
$ brew tap boscore/bos
$ brew install bos
```
#### Mac OS X Brew 卸载
```sh
$ brew remove bos
```

## BOSCore 开发流程
BOSCore 鼓励社区开发者参与代码贡献,社区成员应当遵循以下工作流:
Expand Down Expand Up @@ -65,3 +55,4 @@ BOSCore是基于EOSIO技术的扩展,所以EOSIO的相关资料也可以参考

[EOSIO 开发者门户](https://developers.eos.io).


21 changes: 8 additions & 13 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,7 @@ struct controller_impl {

void clear_all_undo() {
// Rewind the database to the last irreversible block
db.with_write_lock([&] {
db.undo_all();
/*
FC_ASSERT(db.revision() == self.head_block_num(),
"Chainbase revision does not match head block num",
("rev", db.revision())("head_block", self.head_block_num()));
*/
});
db.undo_all();
}

void add_contract_tables_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
Expand Down Expand Up @@ -1149,6 +1142,9 @@ struct controller_impl {
transaction_trace_ptr trace;
try {
auto start = fc::time_point::now();
const bool check_auth = !self.skip_auth_check() && !trx->implicit;
// call recover keys so that trx->sig_cpu_usage is set correctly
const flat_set<public_key_type>& recovered_keys = check_auth ? trx->recover_keys( chain_id ) : flat_set<public_key_type>();
if( !explicit_billed_cpu_time ) {
fc::microseconds already_consumed_time( EOS_PERCENT(trx->sig_cpu_usage.count(), conf.sig_cpu_bill_pct) );

Expand Down Expand Up @@ -1180,15 +1176,13 @@ struct controller_impl {
}
trx_context.delay = fc::seconds(trn.delay_sec);

if( !self.skip_auth_check() && !trx->implicit ) {
if( check_auth ) {
authorization.check_authorization(
trn.actions,
trx->recover_keys( chain_id ),
recovered_keys,
{},
trx_context.delay,
[](){}
/*std::bind(&transaction_context::add_cpu_usage_and_check_time, &trx_context,
std::placeholders::_1)*/,
[&trx_context](){ trx_context.checktime(); },
false
);
}
Expand Down Expand Up @@ -1945,6 +1939,7 @@ void controller::abort_block() {

boost::asio::thread_pool& controller::get_thread_pool() {
return my->thread_pool;

}

std::future<block_state_ptr> controller::create_block_state_future( const signed_block_ptr& b ) {
Expand Down
66 changes: 25 additions & 41 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,6 @@ namespace eosio {

const string peer_name();

void txn_send_pending(const vector<transaction_id_type>& ids);
void txn_send(const vector<transaction_id_type>& txn_lis);

void blk_send_branch();
void blk_send(const block_id_type& blkid);
void stop_send();
Expand Down Expand Up @@ -742,6 +739,7 @@ namespace eosio {
void rejected_block(const block_id_type& id);

void recv_block(const connection_ptr& conn, const block_id_type& msg, uint32_t bnum);
void expire_blocks( uint32_t bnum );
void recv_transaction(const connection_ptr& conn, const transaction_id_type& id);
void recv_notice(const connection_ptr& conn, const notice_message& msg, bool generated);

Expand Down Expand Up @@ -848,27 +846,6 @@ namespace eosio {
fc_dlog(logger, "canceling wait on ${p}", ("p",peer_name()));
cancel_wait();
if( read_delay_timer ) read_delay_timer->cancel();
pending_message_buffer.reset();
}

void connection::txn_send_pending(const vector<transaction_id_type>& ids) {
const std::set<transaction_id_type, sha256_less> known_ids(ids.cbegin(), ids.cend());
my_impl->expire_local_txns();
for(auto tx = my_impl->local_txns.begin(); tx != my_impl->local_txns.end(); ++tx ){
const bool found = known_ids.find( tx->id ) != known_ids.cend();
if( !found ) {
queue_write( tx->serialized_txn, true, []( boost::system::error_code ec, std::size_t ) {} );
}
}
}

void connection::txn_send(const vector<transaction_id_type>& ids) {
for(const auto& t : ids) {
auto tx = my_impl->local_txns.get<by_id>().find(t);
if( tx != my_impl->local_txns.end() ) {
queue_write( tx->serialized_txn, true, []( boost::system::error_code ec, std::size_t ) {} );
}
}
}

void connection::blk_send_branch() {
Expand Down Expand Up @@ -1697,11 +1674,23 @@ namespace eosio {
}

void dispatch_manager::rejected_block(const block_id_type& id) {
fc_dlog(logger,"not sending rejected transaction ${tid}",("tid",id));
fc_dlog( logger, "rejected block ${id}", ("id", id) );
auto range = received_blocks.equal_range(id);
received_blocks.erase(range.first, range.second);
}

void dispatch_manager::expire_blocks( uint32_t lib_num ) {
for( auto i = received_blocks.begin(); i != received_blocks.end(); ) {
const block_id_type& blk_id = i->first;
uint32_t blk_num = block_header::num_from_id( blk_id );
if( blk_num <= lib_num ) {
i = received_blocks.erase( i );
} else {
++i;
}
}
}

void dispatch_manager::bcast_transaction(const transaction_metadata_ptr& ptrx) {
std::set<connection_ptr> skips;
const auto& id = ptrx->id;
Expand Down Expand Up @@ -1926,6 +1915,7 @@ namespace eosio {
auto current_endpoint = *endpoint_itr;
++endpoint_itr;
c->connecting = true;
c->pending_message_buffer.reset();
connection_wptr weak_conn = c;
c->socket->async_connect( current_endpoint, [weak_conn, endpoint_itr, this] ( const boost::system::error_code& err ) {
auto c = weak_conn.lock();
Expand Down Expand Up @@ -2129,7 +2119,7 @@ namespace eosio {
conn->pending_message_buffer.get_buffer_sequence_for_boost_async_read(), completion_handler,
[this,weak_conn]( boost::system::error_code ec, std::size_t bytes_transferred ) {
auto conn = weak_conn.lock();
if (!conn) {
if (!conn || !conn->socket || !conn->socket->is_open()) {
return;
}

Expand Down Expand Up @@ -2490,17 +2480,6 @@ namespace eosio {
break;
}
case catch_up : {
if( msg.known_trx.pending > 0) {
// plan to get all except what we already know about.
req.req_trx.mode = catch_up;
send_req = true;
size_t known_sum = local_txns.size();
if( known_sum ) {
for( const auto& t : local_txns.get<by_id>() ) {
req.req_trx.ids.push_back( t.id );
}
}
}
break;
}
case normal: {
Expand Down Expand Up @@ -2558,14 +2537,17 @@ namespace eosio {

switch (msg.req_trx.mode) {
case catch_up :
c->txn_send_pending(msg.req_trx.ids);
break;
case normal :
c->txn_send(msg.req_trx.ids);
break;
case none :
if(msg.req_blocks.mode == none)
c->stop_send();
// no break
case normal :
if( !msg.req_trx.ids.empty() ) {
elog( "Invalid request_message, req_trx.ids.size ${s}", ("s", msg.req_trx.ids.size()) );
close(c);
return;
}
break;
default:;
}
Expand Down Expand Up @@ -2693,6 +2675,7 @@ namespace eosio {
}
else {
sync_master->rejected_block(c, blk_num);
dispatcher->rejected_block( blk_id );
}
}

Expand Down Expand Up @@ -2754,6 +2737,7 @@ namespace eosio {

controller& cc = chain_plug->chain();
uint32_t lib = cc.last_irreversible_block_num();
dispatcher->expire_blocks( lib );
for ( auto &c : connections ) {
auto &stale_txn = c->trx_state.get<by_block_num>();
stale_txn.erase( stale_txn.lower_bound(1), stale_txn.upper_bound(lib) );
Expand Down
Loading

0 comments on commit 58ac720

Please sign in to comment.