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

IF: add get_blocks_result_v1 support to SHiP #2349

Merged
merged 12 commits into from
Mar 28, 2024

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Mar 27, 2024

#2321 added SHiP support for IBC. A new get_blocks_request_v1 was introduced to include a field fetch_finality_data, but existing get_blocks_result_v0 was reused to return the result of get_blocks_request_v1. That can cause confusions to the users, and a client's ABI bin_to_json() would add an extra "finality_data": null to the JSON output in Legacy (as finality_data does not exist).

This PR adds get_blocks_result_v1 which stores the result of get_blocks_request_v1; get_blocks_result_v0 is restored to its original use: only storing the result of get_blocks_result_v0.

get_blocks_request_v1 adds extra get_blocks_request_v1 to get_blocks_request_v0; get_blocks_result_v1 adds extra finality_data to get_blocks_result_v0.

struct get_blocks_request_v1 : get_blocks_request_v0 {
   bool                        fetch_finality_data    = false;
};

struct get_blocks_result_v1 : get_blocks_result_v0 {
   std::optional<bytes>        finality_data;
};

Tests are updated to check both get_blocks_result_v0 and get_blocks_result_v1 work.

Resolved #2340

@linh2931 linh2931 linked an issue Mar 28, 2024 that may be closed by this pull request
eosio::check(std::string(result_document[0].GetString()) == "get_blocks_result_v0", "result type doesn't look like get_blocks_result_v0");
if( fetch_finality_data ) {
eosio::check(std::string(result_document[0].GetString()) == "get_blocks_result_v1", "result type doesn't look like get_blocks_result_v1");
}
Copy link
Member

Choose a reason for hiding this comment

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

don't need the if

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad. Missed that one. Thanks.

@linh2931 linh2931 merged commit 7bb4e56 into hotstuff_integration Mar 28, 2024
34 checks passed
@linh2931 linh2931 deleted the ship_get_blocks_result_v1 branch March 28, 2024 21:55
@ericpassmore
Copy link
Contributor

Note:start
group: IF
category: INTERNALS
summary: Adds get_blocks_result_v1 to SHiP as part of IBC support; get_blocks_result_v0 is restored to its original use.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IF: add get_blocks_result_v1 to SHiP
4 participants