AntelopeIO / leap

C++ implementation of the Antelope protocol
Other
116 stars 70 forks source link

IF: Unification: Add block header extension #1911

Closed arhag closed 8 months ago

arhag commented 10 months ago

Depends on https://github.com/AntelopeIO/leap/issues/1881 and https://github.com/AntelopeIO/leap/issues/1941.

The block header extension should carry the new information needed for a proposal:

Example:

 struct instant_finality_extension {
    uint32_t last_qc_block_num {0};  ///< The block height of the most recent ancestor block that has a QC justification
    bool     is_last_qc_strong {false}; ///< whether the QC for the block referenced by last_qc_block_height is strong or weak.
    std::optional<finalizer_policy> new_finalizer_policy;
    std::optional<proposer_policy> new_proposer_policy;
 };

This should replace the extensions finalizer_policy_extension and proposal_info_extension.

Use the status of the pending_quorum_certificate to determine whether you have a valid QC and if so whether it is strong or weak. That determines the values of last_qc_block_num and is_last_qc_strong.

Use the most recent ancestor block that has a valid QC (whether the status is strong, weak_final, or weak_achieved) as the block referenced by last_qc_block_num.

The actual QC does not need to be included yet in a block extension. That will be handled in a separate issue.

arhag commented 8 months ago

Partially done, but to complete we must first wait until at least https://github.com/AntelopeIO/leap/issues/2034 is complete and it would probably be best to wait until https://github.com/AntelopeIO/leap/issues/2046 is also complete.

greg7mdp commented 8 months ago

I have finished this issue in my branch gh_2034.

greg7mdp commented 8 months ago

@linh2931 @arhag I believe we can close this issue as completed by #2077