Skip to content

Commit

Permalink
Merge pull request EOSIO#119 from boscore/release/3.0.x
Browse files Browse the repository at this point in the history
v3.0.1 into develop
  • Loading branch information
Thaipanda authored Jul 22, 2019
2 parents 04f7f93 + c94fa01 commit ca45e59
Show file tree
Hide file tree
Showing 12 changed files with 709 additions and 232 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 0)
set(VERSION_PATCH 1)

if(VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
Expand Down
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.0 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.1 tag, you could do the following:

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

```

Expand Down
8 changes: 7 additions & 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.0
## BOSCore Version: v3.0.1
### Basic EOSIO Version: v1.6.6 (support REX)

# Background
Expand Down Expand Up @@ -29,6 +29,12 @@ As BOS continues to develop, developer rewards will be appropriately adjusted to
1. Build from code : `bash ./eosio_build.sh -s BOS`
2. Docker Style,check [Docker](./Docker/README.md)

## Tips:
- HTTP&P2P endpoints can be get from the [validator](https://validate.eosnation.io/bos/reports/endpoints.html) by EOS Nation
- BOS Mainnet [genesis.json](https://github.com/boscore/bosres/blob/master/genesis.json)
- BOS Mainnet [Genesis](https://github.com/boscore/bosres/blob/master/BOS_Genesis.md)
- EOS Mainnet [snapshot](https://github.com/boscore/bos-airdrop-snapshots/blob/master/README.md)

## BOSCore Workflow
BOSCore encourage community developer actively participate in contributing the code, members should follow the workflow below.
![BOSCore Workflow](./images/bos-workflow.png)
Expand Down
8 changes: 7 additions & 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.0
## BOSCore Version: v3.0.1
### Basic EOSIO Version: v1.6.6 (support REX)

# 背景
Expand Down Expand Up @@ -29,6 +29,12 @@ BOS链的代码完全由社区贡献并维护,每个生态参与者都可以
1. 源码直接编译: `bash ./eosio_build.sh -s BOS`
2. Docker方式部署,参看 [Docker](./Docker/README.md)

## Tips:
- HTTP&P2P 列表可以从 EOS Nation 提供的[验证页面](https://validate.eosnation.io/bos/reports/endpoints.html)获取
- BOS Mainnet [genesis.json](https://github.com/boscore/bosres/blob/master/genesis.json)
- BOS Mainnet [创世纪](https://github.com/boscore/bosres/blob/master/BOS_Genesis.md)
- EOS Mainnet [账户空投信息](https://github.com/boscore/bos-airdrop-snapshots/blob/master/README.md)

## BOSCore 开发流程
BOSCore 鼓励社区开发者参与代码贡献,社区成员应当遵循以下工作流:
![BOSCore Workflow](./images/bos-workflow.png)
Expand Down
72 changes: 36 additions & 36 deletions libraries/chain/include/eosio/chain/pbft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ namespace eosio {
return current;
}

void on_prepare(pbft_metadata_ptr<pbft_prepare> e);
void on_commit(pbft_metadata_ptr<pbft_commit> e);
void on_view_change(pbft_metadata_ptr<pbft_view_change> e);
void on_new_view(const pbft_metadata_ptr<pbft_new_view> &e);
void on_prepare(const pbft_metadata_ptr<pbft_prepare>& e);
void on_commit(const pbft_metadata_ptr<pbft_commit>& e);
void on_view_change(const pbft_metadata_ptr<pbft_view_change>& e);
void on_new_view(const pbft_metadata_ptr<pbft_new_view>& e);

void send_prepare();
void send_commit();
void send_view_change();

void transit_to_committed_state(psm_state_ptr s, bool to_new_view);
void transit_to_prepared_state(psm_state_ptr s);
void transit_to_view_change_state(psm_state_ptr s);
void transit_to_committed_state(const psm_state_ptr& s, bool to_new_view);
void transit_to_prepared_state(const psm_state_ptr& s);
void transit_to_view_change_state(const psm_state_ptr& s);
void transit_to_new_view(const pbft_metadata_ptr<pbft_new_view>& e, const psm_state_ptr& s);

void do_send_view_change();
Expand Down Expand Up @@ -106,13 +106,13 @@ namespace eosio {
psm_state();
~psm_state();

virtual void on_prepare(psm_machine_ptr m, pbft_metadata_ptr<pbft_prepare> e, pbft_database &pbft_db) = 0;
virtual void on_commit(psm_machine_ptr m, pbft_metadata_ptr<pbft_commit> e, pbft_database &pbft_db) = 0;
virtual void on_view_change(psm_machine_ptr m, pbft_metadata_ptr<pbft_view_change> e, pbft_database &pbft_db) = 0;
virtual void on_prepare(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_prepare>& e, pbft_database &pbft_db) = 0;
virtual void on_commit(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_commit>& e, pbft_database &pbft_db) = 0;
virtual void on_view_change(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_view_change>& e, pbft_database &pbft_db) = 0;

virtual void send_prepare(psm_machine_ptr m, pbft_database &pbft_db) = 0;
virtual void send_commit(psm_machine_ptr m, pbft_database &pbft_db) = 0;
virtual void send_view_change(psm_machine_ptr m, pbft_database &pbft_db) = 0;
virtual void send_prepare(const psm_machine_ptr& m, pbft_database &pbft_db) = 0;
virtual void send_commit(const psm_machine_ptr& m, pbft_database &pbft_db) = 0;
virtual void send_view_change(const psm_machine_ptr& m, pbft_database &pbft_db) = 0;

virtual const char* get_name() = 0;
std::shared_ptr<psm_state> get_self() { return shared_from_this(); };
Expand All @@ -124,13 +124,13 @@ namespace eosio {
psm_prepared_state();
~psm_prepared_state();

void on_prepare(psm_machine_ptr m, pbft_metadata_ptr<pbft_prepare> e, pbft_database &pbft_db) override;
void on_commit(psm_machine_ptr m, pbft_metadata_ptr<pbft_commit> e, pbft_database &pbft_db) override;
void on_view_change(psm_machine_ptr m, pbft_metadata_ptr<pbft_view_change> e, pbft_database &pbft_db) override;
void on_prepare(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_prepare>& e, pbft_database &pbft_db) override;
void on_commit(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_commit>& e, pbft_database &pbft_db) override;
void on_view_change(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_view_change>& e, pbft_database &pbft_db) override;

void send_prepare(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_commit(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_view_change(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_prepare(const psm_machine_ptr& m, pbft_database &pbft_db) override;
void send_commit(const psm_machine_ptr& m, pbft_database &pbft_db) override;
void send_view_change(const psm_machine_ptr& m, pbft_database &pbft_db) override;

bool pending_commit_local;

Expand All @@ -142,13 +142,13 @@ namespace eosio {
psm_committed_state();
~psm_committed_state();

void on_prepare(psm_machine_ptr m, pbft_metadata_ptr<pbft_prepare> e, pbft_database &pbft_db) override;
void on_commit(psm_machine_ptr m, pbft_metadata_ptr<pbft_commit> e, pbft_database &pbft_db) override;
void on_view_change(psm_machine_ptr m, pbft_metadata_ptr<pbft_view_change> e, pbft_database &pbft_db) override;
void on_prepare(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_prepare>& e, pbft_database &pbft_db) override;
void on_commit(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_commit>& e, pbft_database &pbft_db) override;
void on_view_change(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_view_change>& e, pbft_database &pbft_db) override;

void send_prepare(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_commit(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_view_change(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_prepare(const psm_machine_ptr& m, pbft_database &pbft_db) override;
void send_commit(const psm_machine_ptr& m, pbft_database &pbft_db) override;
void send_view_change(const psm_machine_ptr& m, pbft_database &pbft_db) override;

const char* get_name() override { return "{==== COMMITTED ====}"; }
};
Expand All @@ -158,13 +158,13 @@ namespace eosio {
psm_view_change_state();
~psm_view_change_state();

void on_prepare(psm_machine_ptr m, pbft_metadata_ptr<pbft_prepare> e, pbft_database &pbft_db) override;
void on_commit(psm_machine_ptr m, pbft_metadata_ptr<pbft_commit> e, pbft_database &pbft_db) override;
void on_view_change(psm_machine_ptr m, pbft_metadata_ptr<pbft_view_change> e, pbft_database &pbft_db) override;
void on_prepare(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_prepare>& e, pbft_database &pbft_db) override;
void on_commit(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_commit>& e, pbft_database &pbft_db) override;
void on_view_change(const psm_machine_ptr& m, const pbft_metadata_ptr<pbft_view_change>& e, pbft_database &pbft_db) override;

void send_prepare(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_commit(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_view_change(psm_machine_ptr m, pbft_database &pbft_db) override;
void send_prepare(const psm_machine_ptr& m, pbft_database &pbft_db) override;
void send_commit(const psm_machine_ptr& m, pbft_database &pbft_db) override;
void send_view_change(const psm_machine_ptr& m, pbft_database &pbft_db) override;

const char* get_name() override { return "{==== VIEW CHANGE ====}"; }
};
Expand All @@ -184,11 +184,11 @@ namespace eosio {
void maybe_pbft_view_change();
void maybe_pbft_checkpoint();

void on_pbft_prepare(pbft_metadata_ptr<pbft_prepare> p);
void on_pbft_commit(pbft_metadata_ptr<pbft_commit> c);
void on_pbft_view_change(pbft_metadata_ptr<pbft_view_change> vc);
void on_pbft_new_view(const pbft_metadata_ptr<pbft_new_view> &nv);
void on_pbft_checkpoint(const pbft_metadata_ptr<pbft_checkpoint> &cp);
void on_pbft_prepare(const pbft_metadata_ptr<pbft_prepare>& p);
void on_pbft_commit(const pbft_metadata_ptr<pbft_commit>& c);
void on_pbft_view_change(const pbft_metadata_ptr<pbft_view_change>& vc);
void on_pbft_new_view(const pbft_metadata_ptr<pbft_new_view>& nv);
void on_pbft_checkpoint(const pbft_metadata_ptr<pbft_checkpoint>& cp);

private:
fc::path datadir;
Expand Down
31 changes: 15 additions & 16 deletions libraries/chain/include/eosio/chain/pbft_database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace eosio {

template<typename pbft_message_body>
struct pbft_message_metadata {
explicit pbft_message_metadata(pbft_message_body m, chain_id_type chain_id): msg{m} {
explicit pbft_message_metadata(pbft_message_body m, chain_id_type& chain_id): msg{m} {
try {
sender_key = crypto::public_key(msg.sender_signature, msg.digest(chain_id), true);
} catch (fc::exception & /*e*/) {
Expand Down Expand Up @@ -110,6 +110,8 @@ namespace eosio {
}
};

using pbft_prepare_ptr = std::shared_ptr<pbft_prepare>;

struct pbft_commit {
explicit pbft_commit() = default;

Expand Down Expand Up @@ -166,6 +168,8 @@ namespace eosio {
}
};

using pbft_checkpoint_ptr = std::shared_ptr<pbft_checkpoint>;

struct pbft_stable_checkpoint {
explicit pbft_stable_checkpoint() = default;

Expand Down Expand Up @@ -252,6 +256,8 @@ namespace eosio {
}
};

using pbft_view_change_ptr = std::shared_ptr<pbft_view_change>;

struct pbft_view_changed_certificate {
explicit pbft_view_changed_certificate() = default;

Expand Down Expand Up @@ -301,6 +307,8 @@ namespace eosio {
}
};

using pbft_new_view_ptr = std::shared_ptr<pbft_new_view>;

struct pbft_state {
block_id_type block_id;
block_num_type block_num = 0;
Expand Down Expand Up @@ -465,7 +473,7 @@ namespace eosio {
bool should_recv_pbft_msg(const public_key_type &pub_key);

bool pending_pbft_lib();
chain_id_type get_chain_id() {return chain_id;}
chain_id_type& get_chain_id() {return chain_id;}
pbft_stable_checkpoint get_stable_checkpoint_by_id(const block_id_type &block_id, bool incl_blk_extn = true);
pbft_stable_checkpoint fetch_stable_checkpoint_from_blk_extn(const signed_block_ptr &b);
block_info_type cal_pending_stable_checkpoint() const;
Expand All @@ -481,20 +489,11 @@ namespace eosio {
flat_map<public_key_type, uint32_t> get_pbft_fork_schedules() const;


signal<void(const pbft_prepare &)> pbft_outgoing_prepare;
signal<void(const pbft_prepare &)> pbft_incoming_prepare;

signal<void(const pbft_commit &)> pbft_outgoing_commit;
signal<void(const pbft_commit &)> pbft_incoming_commit;

signal<void(const pbft_view_change &)> pbft_outgoing_view_change;
signal<void(const pbft_view_change &)> pbft_incoming_view_change;

signal<void(const pbft_new_view &)> pbft_outgoing_new_view;
signal<void(const pbft_new_view &)> pbft_incoming_new_view;

signal<void(const pbft_checkpoint &)> pbft_outgoing_checkpoint;
signal<void(const pbft_checkpoint &)> pbft_incoming_checkpoint;
signal<void(const pbft_prepare_ptr &)> pbft_outgoing_prepare;
signal<void(const pbft_commit_ptr &)> pbft_outgoing_commit;
signal<void(const pbft_view_change_ptr &)> pbft_outgoing_view_change;
signal<void(const pbft_new_view_ptr &)> pbft_outgoing_new_view;
signal<void(const pbft_checkpoint_ptr &)> pbft_outgoing_checkpoint;

private:
controller &ctrl;
Expand Down
Loading

0 comments on commit ca45e59

Please sign in to comment.