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: Remove proposal msg #1929

Closed
wants to merge 9 commits into from
Closed

Conversation

fcecin
Copy link

@fcecin fcecin commented Nov 23, 2023

NOTE: This is being submitted a Draft PR -- this is not intended for merging at this time; this is for discussions, and if someone wants to inspect the code and critique it.

This PR will implement part 2 of 2 of #1910 , completely removing proposal network messages. hs_proposal_message has been renamed to hs_proposal as @linh2931 had suggested.

As part of this PR, the beat() entrypoint into the IF engine has been completely removed: this has been done because the side-effect of beat() was to send out a proposal message to the network -- which does not exist anymore. So, instead of notifying the IF engine that "a block has been produced" through void beat(void), we will need to create two other pacemaker methods (pseudo-code):

  • qc signed_block_produced(block_id), which is called by Leap when it needs a QC to put into a signed_block that is being produced and is going out, and
  • void signed_block_received(qc, block_id), which is called by Leap when it receives a signed_block from the network that has some block_id and a QC in it.

Both these methods will create and/or update proposal entries in the IF engine's proposal store.

The first effectively replaces the beat pattern, and the second replaces the on-incoming-proposal-message(msg) pattern.

Once these methods are implemented, ensuring the parameters and return values are modeled correctly and are sufficient information, we then need to find where in Leap to call them and do so.

This commit just completely disconnects IF (chain_pacemaker/qc_chain) from the rest of Leap.

From here:
(1) delete hs_proposal_message (and fix tests)
(2) delete chained_mode == false logic (and fix tests)
(3) add the new IF methods for the signed_block-produced/sent and signed_block-received callsites to use
(4) connect the new callbacks to the rest of Leap
- Removed chained_mode config, now it is assumed to be always true
- Removed all sending/receiving of hs_proposal_message from qc_chain and the pacemakers,
  now it is just an entry in the qc_chain proposal store
- test_pacemaker::beat() now calls qc_chain directly to create a proposal and receive
  it at all test qc_chains
- added test_create_proposal() and test_receive_proposal() to qc_chain, so that
  test_pacemaker can drive the creation and distribution of proposals

TODO:
(1) Fix all unit tests, which are all now broken because of chained mode
(2) Add methods to chain_pacemaker to be called from signed_block production and receipt
(3) Call (2) from the right places outside of IF
- chained_mode variable removed
- removed (chained_mode == false) code path in qc_chain::process_vote()
- fixed asserts in test_hotstuff.cpp to reflect chained mode outcome, without
  modifying test logic (this reduces test coverage, which will be restored later)
…_proposal_msg

IF_force_chained had received hotstuff_integration in it, and now this receives
IF_force_chained so it is up to date with the lastest changes, as well as having
the test_hotstuff.cpp unit tests working.
@fcecin fcecin linked an issue Nov 23, 2023 that may be closed by this pull request
@fcecin fcecin self-assigned this Nov 23, 2023
- quorum_certificate_message on_block_proposal(const chain::block_id_type& block_id);
- void on_block_receipt(const chain::block_id_type& block_id, const quorum_certificate_message& qc);
@fcecin
Copy link
Author

fcecin commented Nov 23, 2023

I don't know how a signed_block QC is converted to an hs_proposal and vice-versa, so commit 69af81a is as far as I can get on this issue for now. What is left to do in this PR is to fill in the body of the two new entry points, and then connect them to the rest of Leap.

@@ -131,6 +131,25 @@ namespace eosio { namespace hotstuff {
warn_hs_message = std::move(warning_hs_message);
}

// signed_block is being produced and needs a QC to be put in it before it is broadcast
quorum_certificate_message chain_pacemaker::on_block_proposal(const chain::block_id_type& block_id) {
Copy link
Member

Choose a reason for hiding this comment

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

The name on_block_proposal implies on receiving a block proposal. Can it be renamed?

Copy link
Author

Choose a reason for hiding this comment

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

Perhaps on_proposing_block, or on_producing_block?

Copy link
Member

Choose a reason for hiding this comment

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

on_producing_block?

- on_block_proposal -> on_producing_block
- on_block_receipt -> on_received_block
- on_producing_block() returns an hs_proposal (the entire finality entry) which
  should provide the information that needs to go into the produced block
- on_received_block() takes the entire signed_block, which should provide the
  information required to assemble an hs_proposal for internal consumption by
  the IF engine
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: Deprecate proposal and new_block messages
3 participants