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

Changes to support new block_header_state and block_state #1975

Merged
merged 88 commits into from
Jan 4, 2024

Conversation

greg7mdp
Copy link
Contributor

No description provided.

@greg7mdp greg7mdp changed the base branch from main to hotstuff_integration December 11, 2023 16:34
@greg7mdp greg7mdp marked this pull request as draft December 11, 2023 16:35
@greg7mdp greg7mdp changed the title Changes to suppport new block_header_state and block_state Changes to support new block_header_state and block_state Dec 11, 2023
@greg7mdp greg7mdp linked an issue Dec 11, 2023 that may be closed by this pull request
greg7mdp and others added 12 commits December 14, 2023 10:43
131/150 Test   #98: producer_schedule_hs_unit_test_eos-vm-jit ..........***Failed    1.36 sec
132/150 Test   #97: producer_schedule_hs_unit_test_eos-vm ..............***Failed    1.57 sec
133/150 Test   #96: producer_schedule_hs_unit_test_eos-vm-oc ...........***Failed    2.86 sec
144/150 Test   #21: api_unit_test_eos-vm-oc ............................***Failed   79.26 sec
146/150 Test   #23: api_unit_test_eos-vm-jit ...........................***Failed   96.61 sec
150/150 Test   #22: api_unit_test_eos-vm ...............................***Failed  467.14 sec
…o gh_1941

Also removed tabs and aligned struct members
@ericpassmore
Copy link
Contributor

Note:start
group: IF
category: INTERNALS
summary: Changes to support Instant Finality create a new block_header_state and block_state, and refactoring of code to support both legacy and Instant Finality block structures
Note:end

libraries/chain/block_header_state.cpp Show resolved Hide resolved
libraries/chain/block_state.cpp Show resolved Hide resolved
return bsp->valid_block_signing_authority;
},
[](const block_state_ptr& bsp) -> const block_signing_authority& {
static block_signing_authority bsa; return bsa; //return bsp->header.producer; [greg todo]
Copy link
Member

Choose a reason for hiding this comment

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

Add a warning here so that the remaining work is easy to be found.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the [greg todo] comments instead of warnings, which I think obfuscate the compilation output.

@@ -0,0 +1,27 @@
The following diagram describes Leap block production, as implemented in `libraries/chain/controller.cpp`:
Copy link
Member

Choose a reason for hiding this comment

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

This file probably should be located inside /docs/01_nodeos. But you can move it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed @ericpassmore 's suggestion for the file path, but happy to move it if desirable.

Copy link
Member

Choose a reason for hiding this comment

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

no changes for now.

direction TB
start -- "stage = Ø" --> sb
sb("start_block()"):::fun -- "stage = building_block" --> et
et["execute transactions" ] -- "stage = building_block" --> fb("finalize_block()"):::fun
Copy link
Member

Choose a reason for hiding this comment

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

Does stage still stay in building_block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not understanding exactly what you are asking.

Copy link
Member

@linh2931 linh2931 Jan 4, 2024

Choose a reason for hiding this comment

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

After executing transactions, is the stage still building_block? ("stage = building_block" in the chart)

yes, it is.

// if the _unsigned_block pre-dates block-signing authorities this may be present.
std::optional<producer_authority_schedule> _new_producer_authority_cache;
};
// if the _unsigned_block pre-dates block-signing authorities this may be present.
Copy link
Member

Choose a reason for hiding this comment

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

Remove _ in _unsigned_block

block_id_type id;
pending_block_header_state_legacy pending_block_header_state;
deque<transaction_metadata_ptr> trx_metas;
signed_block_ptr unsigned_block;
Copy link
Member

Choose a reason for hiding this comment

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

I always get confused with unsigned_block having signed_block_ptr as its type. But this is from existing code. No changes needed.


using block_stage_type = std::variant<building_block, assembled_block, completed_block>;
// --------------------------------------------------------------------------------
struct assembled_block_if {
Copy link
Member

Choose a reason for hiding this comment

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

I don't know how to handle this. As if is such common reserved word in the code, it can cause confusion when reading a variable containing if. It is ugly to have a capitalized IF. I start to move away from if and spell out if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it to just assembled_block maybe?

const pending_block_header_state_legacy& get_pending_block_header_state_legacy()const {
if( std::holds_alternative<building_block>(_block_stage) )
return std::get<building_block>(_block_stage)._pending_block_header_state_legacy;
template <class R, class F>
Copy link
Member

Choose a reason for hiding this comment

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

What does R imply for? (F is for function)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

R is the result_type, what F returns.


};

std::variant<building_block_dpos, building_block_if> v;
Copy link
Member

Choose a reason for hiding this comment

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

Is v too short? Not obvious when reading functions 100 line away from it.

Copy link
Contributor Author

@greg7mdp greg7mdp Jan 4, 2024

Choose a reason for hiding this comment

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

I don't think so, it is used only locally within the class building_block.

@greg7mdp greg7mdp merged commit 14963e2 into hotstuff_integration Jan 4, 2024
26 checks passed
@greg7mdp greg7mdp deleted the gh_1941 branch January 4, 2024 20:19
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: Unification: Create new block_header_state and block_state
5 participants