Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dpos pbft bos upgrade: fix snapshot compatibility; add pbft_api plugin; fix bugs #98

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a28493e
fix potential crash when calculating integrity hash
VincentOCL May 14, 2019
8dad318
fix snapshot's container reading in different os.
VincentOCL May 14, 2019
37beebe
reformat snapshot sections; reformat getting block state in pbft_db.
VincentOCL May 15, 2019
ec893e6
Merge branch 'develop' into feature/dpos-pbft-bos-upgrade
oldcold May 15, 2019
1cc5e17
re-struct pbft message; compress pbft new view
May 17, 2019
902177a
add new view primary check; add debug info during prepare (commit) in…
May 18, 2019
cf75956
optimise cal in `should_recv_pbft_msg` and `should_send_pbft_msg`; do…
May 21, 2019
3c45326
generate pbft watermark from forkdb.
May 22, 2019
303c12d
generate pbft watermark from forkdb.
May 22, 2019
0f63be7
Merge remote-tracking branch 'origin/feature/dpos-pbft-bos-upgrade' i…
VincentOCL May 28, 2019
f475fa6
add pbft_api_plugin
May 29, 2019
8a1c39c
increase pbft message deadline
May 30, 2019
56110e0
increase new view message deadline; add prepared & my_prepare in pbft…
May 30, 2019
7b241d5
re-struct pbft message; compress pbft new view
May 17, 2019
3b7068b
fix bug in new view decompression.
May 31, 2019
601c8c6
Merge remote-tracking branch 'origin/feature/dpos-pbft-bos-upgrade-sl…
VincentOCL May 31, 2019
fd444d2
optimise scp sync; move upo creation into `update_pbft_status`;
Jun 2, 2019
a63265f
fix bug in loading old version snapshots.
Jun 3, 2019
45ad108
add message_type in pbft messages; refactor code.
Jun 4, 2019
dde4c39
Merge branch 'feature/dpos-pbft-bos-upgrade-slim' into feature/dpos-p…
VincentOCL Jun 6, 2019
7c9404e
remove pbft controller config; fix net layer bugs.
Jun 6, 2019
74bde5c
bug fix: view change certs generation;
Jun 6, 2019
2ffcf15
retry sending all pending checkpoints;
Jun 7, 2019
299f82f
check all prepares (commits) fall on the same fork during generating …
Jun 8, 2019
01775ea
add pre_prepares in prepared_cert, requesting missing blocks upon vie…
Jun 11, 2019
a3d05a0
bug fix: reset view change state cache properly.
Jun 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix snapshot's container reading in different os.
  • Loading branch information
VincentOCL committed May 14, 2019
commit 8dad3186718b0be44a1ff49d991ca24c51ade1c1
43 changes: 22 additions & 21 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ struct controller_impl {
});
}

struct lscb_branch{};
void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
snapshot->write_section<chain_snapshot_header>([this]( auto &section ){
section.add_row(chain_snapshot_header(), db);
Expand All @@ -562,9 +563,10 @@ struct controller_impl {
snapshot->write_section<batch_pbft_enabled>([this]( auto &section ) {
section.add_row(batch_pbft_enabled{}, db);
});
snapshot->write_section<branch_type>([this, &lscb](auto &section) {

snapshot->write_section<lscb_branch>([this, &lscb](auto &section) {
auto bss = fork_db.fetch_branch_from(fork_db.head()->id, lscb->id).first;
section.add_row(bss, db);
section.template add_row<branch_type>(bss, db);
});
} else {
snapshot->write_section<block_state>([this]( auto &section ) {
Expand Down Expand Up @@ -603,25 +605,24 @@ struct controller_impl {
bool migrated = snapshot->has_section<batch_pbft_snapshot_migration>();
auto upgraded = snapshot->has_section<batch_pbft_enabled>();
if (migrated && upgraded) {

snapshot->read_section<branch_type>([this](auto &section) {
branch_type bss;
section.read_row(bss, db);
if (bss.empty()) elog( "no last stable checkpoint block found in the snapshot, perhaps corrupted");

wlog("${n} fork_db blocks found in the snapshot", ("n", bss.size()));

for (auto i = bss.rbegin(); i != bss.rend(); ++i ) {
if (i == bss.rbegin()) {
fork_db.set(*i);
snapshot_head_block = (*i)->block_num;
} else {
fork_db.add((*i), true, true);
}
fork_db.set_validity((*i), true);
fork_db.mark_in_current_chain((*i), true);
}
head = fork_db.head();
snapshot->read_section<lscb_branch>([this](auto &section) {
branch_type bss;
section.template read_row<branch_type>(bss, db);
if (bss.empty()) elog( "no last stable checkpoint block found in the snapshot, perhaps corrupted");

wlog("${n} fork_db blocks found in the snapshot", ("n", bss.size()));

for (auto i = bss.rbegin(); i != bss.rend(); ++i ) {
if (i == bss.rbegin()) {
fork_db.set(*i);
snapshot_head_block = (*i)->block_num;
} else {
fork_db.add((*i), true, true);
}
fork_db.set_validity((*i), true);
fork_db.mark_in_current_chain((*i), true);
}
head = fork_db.head();
});
} else {
snapshot->read_section<block_state>([this, &migrated](snapshot_reader::section_reader &section) {
Expand Down