-
Notifications
You must be signed in to change notification settings - Fork 73
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: Unification: Create new block_header_state and block_state #1941
Comments
Here is what we came up with in the meeting: struct building_block_input {
block_id_type previous;
block_timestamp_type timestamp;
account_name producer;
vector<digest_type> new_protocol_feature_activations;
};
// this struct can be extracted from a building block
struct assembled_block_input : public building_block_input {
digest_type transaction_mroot;
digest_type action_mroot;
std::optional<proposer_policy> new_proposer_policy;
std::optional<finalizer_policy> new_finalizer_policy;
std::optional<quorum_certificate> qc; // assert(qc.block_height <= num_from_id(previous));
};
struct block_header_state {
block_header header;
protocol_feature_activation_set_ptr activated_protocol_features;
block_header_state_core core;
incremental_merkle_tree proposal_mtree;
incremental_merkle_tree finality_mtree;
finalizer_policy_ptr finalizer_policy; // finalizer set + threshold + generation, supports `digest()`
proposer_policy_ptr proposer_policy; // producer authority schedule, supports `digest()`
flat_map<uint32_t, proposer_policy_ptr> proposer_policies;
flat_map<uint32_t, finalizer_policy_ptr> finalizer_policies;
digest_type compute_finalizer_digest() const;
block_timestamp_type timestamp() const;
account_name producer() const;
block_id_type previous() const;
uint32_t block_num() const { return num_from_id(previous()) + 1; }
block_header_state next(const assembled_block_input& data) const;
// block descending from this need the provided qc in the block extension
bool is_needed(const quorum_certificate& qc) const {
return !core.last_qc_block_height || qc.block_height > *core.last_qc_block_height;
}
};
struct block_state {
block_header_state bhs; // provides parent link
block_id_type id;
signed_block_ptr block;
digest_type finalizer_digest;
pending_quorum_certificate pending_qc;
};
namespace detail {
f1(const block_header_state_core& prev, uint32_t last_qc_block_height, bool is_last_qc_strong) -> block_header_state_core;
f2(const block_header_state& prev, const block_header_state_core &new_core, const sha256& new_static_leaf,
const std::optional<sha256>& new_dynamic_leaf) -> block_header_state;std::optional<sha256> new_dynamic_leaf)
} struct quorum_certificate {
uint32_t block_height;
valid_quorum_certificate qc;
}; [greg] I think that's rightstruct block_header_state_core {
uint32_t last_final_block_height = 0; // last irreversible (final) block.
std::optional<uint32_t> final_on_strong_qc_block_height; // will become final if this header achives a strong QC.
std::optional<uint32_t> last_qc_block_height; //
block_header_state_core next(uint32_t last_qc_block_height, bool is_last_qc_strong) const;
}; |
This was referenced Dec 15, 2023
heifner
added a commit
that referenced
this issue
Dec 15, 2023
heifner
added a commit
that referenced
this issue
Dec 15, 2023
heifner
added a commit
that referenced
this issue
Dec 20, 2023
heifner
added a commit
that referenced
this issue
Dec 21, 2023
heifner
added a commit
that referenced
this issue
Dec 21, 2023
heifner
added a commit
that referenced
this issue
Dec 21, 2023
heifner
added a commit
that referenced
this issue
Dec 21, 2023
This was referenced Jan 3, 2024
heifner
added a commit
that referenced
this issue
Jan 4, 2024
heifner
added a commit
that referenced
this issue
Jan 4, 2024
heifner
added a commit
that referenced
this issue
Jan 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add new
block_header_state
andblock_state
. Use theblock_state
in a new fork database.The old code in
block_header_state.{hpp,cpp}
andblock_state.{hpp,cpp}
should have been moved toblock_header_state_legacy.{hpp,cpp}
andblock_state_legacy.{hpp,cpp}
, respectively, in #1940. For this issue, put the new code into a newblock_header_state.{hpp,cpp}
andblock_state.{hpp,cpp}
as appropriate.The text was updated successfully, but these errors were encountered: