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

modify (simplify) state_history plugin's thread logic; add get_status_request_v1 #236

Merged
merged 22 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ca9ff7a
ship session threading refactor
spoonincode Apr 30, 2024
7389114
ship_client: alternate v0 and v1 requests
spoonincode Apr 30, 2024
63f76d0
add workarounds for gcc 10.x coro limitations
spoonincode Apr 30, 2024
b2e28f7
Merge remote-tracking branch 'spring/main' into HEAD
spoonincode May 6, 2024
6c281de
fix thread mixup around connections set
spoonincode May 6, 2024
87d59b3
disable copy ctor of session
spoonincode May 6, 2024
63aa492
a different workaround for GCC10 coro ICE
spoonincode May 10, 2024
01e43b4
use custom HTTP header field with nodeos version
spoonincode May 16, 2024
da90a82
Merge remote-tracking branch 'spring/main' into HEAD
spoonincode May 28, 2024
43c97c0
Merge remote-tracking branch 'spring/main' into HEAD
spoonincode Jun 4, 2024
2a6b8dd
chain_id does not need to be a binary ext
spoonincode Jun 4, 2024
a22de6c
remove ship plugin/session tests for now
spoonincode Jun 4, 2024
767a5c7
fix thread mixup around connections set, again
spoonincode Jun 4, 2024
020ceed
comment tweak
spoonincode Jun 4, 2024
18bea83
Merge remote-tracking branch 'spring/main' into HEAD
spoonincode Jun 4, 2024
598e4b2
remove unneeded plugin_started check
spoonincode Jun 6, 2024
637fff2
fill_current_status_result() must be called on main thread
spoonincode Jun 6, 2024
7501c2a
just use fetch_block_by_number() directly
spoonincode Jun 6, 2024
dba4740
require session's SocketType be tcp or stream_protocol
spoonincode Jun 6, 2024
edb242d
comment only changes
spoonincode Jun 7, 2024
8df3664
move some session members to documented thread scope they only use cu…
spoonincode Jun 10, 2024
e984468
move on_done back to it's orginal member location
spoonincode Jun 10, 2024
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
20 changes: 18 additions & 2 deletions libraries/state_history/abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ extern const char* const state_history_plugin_abi = R"({
{
"name": "get_status_request_v0", "fields": []
},
{
"name": "get_status_request_v1", "fields": []
},
{
"name": "block_position", "fields": [
{ "name": "block_num", "type": "uint32" },
Expand All @@ -21,6 +24,19 @@ extern const char* const state_history_plugin_abi = R"({
{ "name": "chain_id", "type": "checksum256$" }
]
},
{
"name": "get_status_result_v1", "fields": [
{ "name": "head", "type": "block_position" },
{ "name": "last_irreversible", "type": "block_position" },
{ "name": "trace_begin_block", "type": "uint32" },
{ "name": "trace_end_block", "type": "uint32" },
{ "name": "chain_state_begin_block", "type": "uint32" },
{ "name": "chain_state_end_block", "type": "uint32" },
{ "name": "chain_id", "type": "checksum256" },
{ "name": "finality_data_begin_block", "type": "uint32" },
{ "name": "finality_data_end_block", "type": "uint32" }
]
},
{
"name": "get_blocks_request_v0", "fields": [
{ "name": "start_block_num", "type": "uint32" },
Expand Down Expand Up @@ -586,8 +602,8 @@ extern const char* const state_history_plugin_abi = R"({
{ "new_type_name": "transaction_id", "type": "checksum256" }
],
"variants": [
{ "name": "request", "types": ["get_status_request_v0", "get_blocks_request_v0", "get_blocks_ack_request_v0", "get_blocks_request_v1"] },
{ "name": "result", "types": ["get_status_result_v0", "get_blocks_result_v0", "get_blocks_result_v1"] },
{ "name": "request", "types": ["get_status_request_v0", "get_blocks_request_v0", "get_blocks_ack_request_v0", "get_blocks_request_v1", "get_status_request_v1"] },
{ "name": "result", "types": ["get_status_result_v0", "get_blocks_result_v0", "get_blocks_result_v1", "get_status_result_v1"] },

{ "name": "action_receipt", "types": ["action_receipt_v0"] },
{ "name": "action_trace", "types": ["action_trace_v0", "action_trace_v1"] },
Expand Down
13 changes: 11 additions & 2 deletions libraries/state_history/include/eosio/state_history/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ struct block_position {

struct get_status_request_v0 {};

struct get_status_request_v1 : get_status_request_v0 {};

struct get_status_result_v0 {
block_position head = {};
block_position last_irreversible = {};
Expand All @@ -93,6 +95,11 @@ struct get_status_result_v0 {
fc::sha256 chain_id = {};
};

struct get_status_result_v1 : get_status_result_v0 {
uint32_t finality_data_begin_block = 0;
uint32_t finality_data_end_block = 0;
};

struct get_blocks_request_v0 {
uint32_t start_block_num = 0;
uint32_t end_block_num = 0;
Expand Down Expand Up @@ -129,8 +136,8 @@ struct get_blocks_result_v1 : get_blocks_result_v0 {
std::optional<bytes> finality_data;
};

linh2931 marked this conversation as resolved.
Show resolved Hide resolved
using state_request = std::variant<get_status_request_v0, get_blocks_request_v0, get_blocks_ack_request_v0, get_blocks_request_v1>;
using state_result = std::variant<get_status_result_v0, get_blocks_result_v0, get_blocks_result_v1>;
using state_request = std::variant<get_status_request_v0, get_blocks_request_v0, get_blocks_ack_request_v0, get_blocks_request_v1, get_status_request_v1>;
using state_result = std::variant<get_status_result_v0, get_blocks_result_v0, get_blocks_result_v1, get_status_result_v1>;
using get_blocks_request = std::variant<get_blocks_request_v0, get_blocks_request_v1>;
using get_blocks_result = std::variant<get_blocks_result_v0, get_blocks_result_v1>;

Expand All @@ -141,7 +148,9 @@ using get_blocks_result = std::variant<get_blocks_result_v0, get_blocks_result_v
FC_REFLECT(eosio::state_history::table_delta, (struct_version)(name)(rows));
FC_REFLECT(eosio::state_history::block_position, (block_num)(block_id));
FC_REFLECT_EMPTY(eosio::state_history::get_status_request_v0);
FC_REFLECT_DERIVED(eosio::state_history::get_status_request_v1, (eosio::state_history::get_status_request_v0), )
FC_REFLECT(eosio::state_history::get_status_result_v0, (head)(last_irreversible)(trace_begin_block)(trace_end_block)(chain_state_begin_block)(chain_state_end_block)(chain_id));
FC_REFLECT_DERIVED(eosio::state_history::get_status_result_v1, (eosio::state_history::get_status_result_v0), (finality_data_begin_block)(finality_data_end_block));
FC_REFLECT(eosio::state_history::get_blocks_request_v0, (start_block_num)(end_block_num)(max_messages_in_flight)(have_positions)(irreversible_only)(fetch_block)(fetch_traces)(fetch_deltas));
FC_REFLECT_DERIVED(eosio::state_history::get_blocks_request_v1, (eosio::state_history::get_blocks_request_v0), (fetch_finality_data));
FC_REFLECT(eosio::state_history::get_blocks_ack_request_v0, (num_messages));
Expand Down
4 changes: 3 additions & 1 deletion plugins/state_history_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ add_library( state_history_plugin
target_link_libraries( state_history_plugin state_history chain_plugin eosio_chain appbase )
target_include_directories( state_history_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )

add_subdirectory(tests)
linh2931 marked this conversation as resolved.
Show resolved Hide resolved
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11 )
target_compile_options( state_history_plugin PRIVATE "-fcoroutines" )
endif()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The situation with gcc 10 and corountines is certainly a bit... eyebrow raising. So far I've not seen any indications it is malfunctioning in our usage.

Loading
Loading