Skip to content

Commit

Permalink
Update block construction document and store only qc in `assembled_bl…
Browse files Browse the repository at this point in the history
…ock_if`
  • Loading branch information
greg7mdp committed Jan 8, 2024
1 parent d007945 commit 228fb87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ struct assembled_block {
deque<transaction_metadata_ptr> trx_metas; // Comes from building_block::pending_trx_metas
// Carried over to put into block_state (optimization for fork reorgs)
deque<transaction_receipt> trx_receipts; // Comes from building_block::pending_trx_receipts
std::optional<qc_data_t> qc_data; // QC to add as block extension to new block
std::optional<quorum_certificate> qc; // QC to add as block extension to new block

block_header_state& get_bhs() { return bhs; }
};
Expand Down Expand Up @@ -761,7 +761,8 @@ struct building_block {
qc_data ? qc_data->qc_info : std::optional<qc_info_t>{} };

assembled_block::assembled_block_if ab{bb.active_producer_authority, bb.parent.next(bhs_input),
bb.pending_trx_metas, bb.pending_trx_receipts, qc_data};
bb.pending_trx_metas, bb.pending_trx_receipts,
qc_data ? std::move(qc_data->qc) : std::optional<quorum_certificate>{}};

return assembled_block{.v = std::move(ab)};
}},
Expand Down
9 changes: 5 additions & 4 deletions libraries/chain/hotstuff/block_construction_data_flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,17 @@ struct building_block_input {
When done with building the block, from `building_block` we can extract:

```c++
struct qc_info_t {
uint32_t last_qc_block_num; // The block height of the most recent ancestor block that has a QC justification
bool is_last_qc_strong; // Whether the QC for the block referenced by last_qc_block_height is strong or weak.
};

struct block_header_state_input : public building_block_input {
digest_type transaction_mroot; // Comes from std::get<checksum256_type>(building_block::trx_mroot_or_receipt_digests)
digest_type action_mroot; // Compute root from building_block::action_receipt_digests
std::optional<proposer_policy> new_proposer_policy; // Comes from building_block::new_proposer_policy
std::optional<finalizer_policy> new_finalizer_policy; // Comes from building_block::new_finalizer_policy
std::optional<quorum_certificate> qc; // Comes from traversing branch from parent and calling get_best_qc()
// assert(qc->block_num <= num_from_id(previous));
uint32_t last_qc_block_num;
bool is_last_qc_strong;
std::optional<qc_info_t> qc_info;
// ... ?
};
```
Expand Down

0 comments on commit 228fb87

Please sign in to comment.