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

Release/3.0.x #175

Merged
merged 37 commits into from
Jun 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9509dd7
check llvm version >= 7 and install automatically
Thaipanda May 1, 2020
748c377
Merge pull request #21 from boscore/release/3.0.x
Frank-AFN May 2, 2020
c9e6641
Remove bytes in flight
Frank-AFN May 5, 2020
7af85d4
Merge pull request #161 from eosiosg/getinfobusyfix
Thaipanda May 6, 2020
a7e2158
Upgrade: name apply context transaction context and plugins
Frank-AFN May 11, 2020
c8c27f4
FIX: unittests
Frank-AFN May 11, 2020
07e60de
fix a potential crash in fetching lib.
May 13, 2020
e7056d2
emit lib in ascending order.
May 13, 2020
e1cf1f3
Merge pull request #162 from boscore/fix-emit-lib
Frank-AFN May 19, 2020
9e01179
fix a potential crash in fetching lib.
May 13, 2020
483b9ea
emit lib in ascending order.
May 13, 2020
6f51cc1
Change abi-serializer-max-time-us to abi-serializer-max-time-ms
Frank-AFN May 19, 2020
931235f
Fix: TODO
Frank-AFN May 20, 2020
e757b8a
Fix: mongodb plugin
Frank-AFN May 20, 2020
5366d8a
Fix: cleos name issue
Frank-AFN May 20, 2020
982cf82
Fix: tests
Frank-AFN May 20, 2020
20c3c17
Add back get block detail in history plugin
Frank-AFN May 20, 2020
03e03c5
Merge pull request #163 from eosiosg/statehistoryplugin
Thaipanda May 27, 2020
d33bb6c
update connected lib channels of plugins
May 27, 2020
1e7fb89
Fix: state history plugin issues
Frank-AFN Jun 3, 2020
7d432d0
Merge pull request #164 from eosiosg/statehistoryplugin
Thaipanda Jun 3, 2020
58ff806
Change: applied transaction channel for statehistory plugin
Frank-AFN Jun 5, 2020
6f91e2c
fix: exclude invalid cert; shuffle view changes before generation; ad…
Jun 5, 2020
ecc2fb6
Merge pull request #166 from boscore/fix-cert-generation
Thaipanda Jun 6, 2020
68ca592
Merge pull request #165 from boscore/plugins-update-lib-channel
Thaipanda Jun 6, 2020
7d5a128
Fix: state history get block from forkdb null
Frank-AFN Jun 6, 2020
064a989
reset docker file
Frank-AFN Jun 6, 2020
dc3b8e4
Merge pull request #167 from eosiosg/statehistoryplugin
Thaipanda Jun 6, 2020
353d311
prepare v3.0.8
Thaipanda Jun 6, 2020
323586e
prepare v3.0.8 (#168)
Thaipanda Jun 6, 2020
c242cbc
Add: account query database
Frank-AFN Jun 10, 2020
87d1c1f
Merge pull request #171 from eosiosg/accountquerydb
Thaipanda Jun 12, 2020
9397c0c
update the version
Thaipanda Jun 12, 2020
57aa42a
Fix: test build bug
Frank-AFN Jun 12, 2020
a78aa0f
Merge pull request #173 from eosiosg/accountquerydb
Thaipanda Jun 12, 2020
39c7e82
Merge branch 'master' into release/3.0.x
Frank-AFN Jun 15, 2020
b3e2280
Merge branch 'develop' into release/3.0.x
Frank-AFN Jun 15, 2020
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: state history get block from forkdb null
Frank-AFN committed Jun 6, 2020
commit 7d5a128839bb1ea2579177a369faa328dab2eb36
24 changes: 24 additions & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
@@ -2482,6 +2482,15 @@ signed_block_ptr controller::fetch_block_by_number( uint32_t block_num )const {
return my->blog.read_block_by_num(block_num);
} FC_CAPTURE_AND_RETHROW( (block_num) ) }

signed_block_ptr controller::fetch_block_by_number_state_history( uint32_t block_num )const { try {
auto blk_state = fetch_block_state_by_number_state_history( block_num );
if( blk_state ) {
return blk_state->block;
}

return my->blog.read_block_by_num(block_num);
} FC_CAPTURE_AND_RETHROW( (block_num) ) }

block_state_ptr controller::fetch_block_state_by_id( block_id_type id )const {
auto state = my->fork_db.get_block(id);
return state;
@@ -2492,6 +2501,21 @@ block_state_ptr controller::fetch_block_state_by_number( uint32_t block_num )con
return blk_state;
} FC_CAPTURE_AND_RETHROW( (block_num) ) }

block_state_ptr controller::fetch_block_state_by_number_state_history( uint32_t block_num )const { try {
const auto& rev_blocks = my->reversible_blocks.get_index<reversible_block_index,by_num>();
auto objitr = rev_blocks.find(block_num);

if( objitr == rev_blocks.end() ) {
if( my->read_mode == db_read_mode::IRREVERSIBLE ) {
return my->fork_db.search_on_branch( my->pending->_pending_block_state->id, block_num );
} else {
return block_state_ptr();
}
}

return my->fork_db.get_block( objitr->get_block_id() );
} FC_CAPTURE_AND_RETHROW( (block_num) ) }

block_id_type controller::get_block_id_for_num( uint32_t block_num )const { try {
auto blk_state = my->fork_db.get_block_in_current_chain_by_num( block_num );
if( blk_state ) {
9 changes: 9 additions & 0 deletions libraries/chain/fork_database.cpp
Original file line number Diff line number Diff line change
@@ -293,6 +293,15 @@ namespace eosio { namespace chain {
return result;
} /// fetch_branch_from

block_state_ptr fork_database::search_on_branch( const block_id_type& h, uint32_t block_num )const {
for( auto s = get_block(h); s; s = get_block( s->header.previous ) ) {
if( s->block_num == block_num )
return s;
}

return {};
}

/// remove all of the invalid forks built of this id including this id
void fork_database::remove( const block_id_type& id ) {
vector<block_id_type> remove_queue{id};
2 changes: 2 additions & 0 deletions libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
@@ -233,9 +233,11 @@ namespace eosio { namespace chain {
block_id_type last_irreversible_block_id() const;

signed_block_ptr fetch_block_by_number( uint32_t block_num )const;
signed_block_ptr fetch_block_by_number_state_history( uint32_t block_num )const;
signed_block_ptr fetch_block_by_id( block_id_type id )const;

block_state_ptr fetch_block_state_by_number( uint32_t block_num )const;
block_state_ptr fetch_block_state_by_number_state_history( uint32_t block_num )const;
block_state_ptr fetch_block_state_by_id( block_id_type id )const;

block_id_type get_block_id_for_num( uint32_t block_num )const;
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/fork_database.hpp
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ namespace eosio { namespace chain {
pair< branch_type, branch_type > fetch_branch_from( const block_id_type& first,
const block_id_type& second )const;

block_state_ptr search_on_branch( const block_id_type& h, uint32_t block_num )const;

/**
* If the block is invalid, it will be removed. If it is valid, then blocks older
Original file line number Diff line number Diff line change
@@ -32,6 +32,15 @@ namespace eosio { namespace chain {
fc::raw::unpack( ds, *result );
return result;
}

block_id_type get_block_id()const {
fc::datastream<const char*> ds( packedblock.data(), packedblock.size() );
block_header h;
fc::raw::unpack( ds, h );
// Only need the block id to then look up the block state in fork database, so just unpack the block_header from the stored packed data.
// Avoid calling get_block() since that constructs a new signed_block in heap memory and unpacks the full signed_block from the stored packed data.
return h.id();
}
};

struct by_num;
4 changes: 2 additions & 2 deletions plugins/state_history_plugin/state_history_plugin.cpp
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ struct state_history_plugin_impl : std::enable_shared_from_this<state_history_pl
void get_block(uint32_t block_num, fc::optional<bytes>& result) {
chain::signed_block_ptr p;
try {
p = chain_plug->chain().fetch_block_by_number(block_num);
p = chain_plug->chain().fetch_block_by_number_state_history(block_num);
} catch (...) {
return;
}
@@ -161,7 +161,7 @@ struct state_history_plugin_impl : std::enable_shared_from_this<state_history_pl
if (chain_state_log && block_num >= chain_state_log->begin_block() && block_num < chain_state_log->end_block())
return chain_state_log->get_block_id(block_num);
try {
auto block = chain_plug->chain().fetch_block_by_number(block_num);
auto block = chain_plug->chain().fetch_block_by_number_state_history(block_num);
if (block)
return block->id();
} catch (...) {