HotShot
HotShot copied to clipboard
[Tech Debt] - Cleanup leaf commitment calculation
What is this task and why do we need to work on it?
Currently, we calculate commits in consensus by constructing a Leaf and manually filling in fields from the QuorumProposal, then calling leaf.commit(). This makes it unclear what fields are used in the commit calculation (e.g. some fields in Leaf don't actually affect the calculation, such as proposer_id and block_payload).
We should replace commit() with a calculate_commitment(...) function with explicit arguments.
What work will need to be done to complete this task?
No response
Are there any other details to include?
No response
What are the acceptance criteria to close this issue?
Leaf should no longer implement Committable. Instances of leaf.commit() should be replaced with calculate_commitment(...) with explicit arguments.
Branch work will be merged to (if not the default branch)
No response
To compute a commitment to a Leaf, we must use the Commitment type:
pub struct Commitment<T: ?Sized + Committable>(Array, PhantomData<fn(&T)>);
So it is problematic to remove the Committable trait since we'd be unable to have a commitment to a leaf type at all.