HotShot
HotShot copied to clipboard
[VALIDATED_STATE] - Avoid duplication of state computation
What is this task and why do we need to work on it?
All nodes calculate the new state when calling validate_and_apply_header. A leader calculates the state one more time in BlockHeader::new because it needs the state to get the header. I.e., we calculate the new state twice in the leader node.
BlockHeader::newwill have to duplicate some of thevalidate_and_apply_headerlogic to include the new state commitment in the header.- The full
validate_and_apply_header.
This duplication is not obvious in hotshot since we only define the trait and the validate_and_apply_header function is implemented in the sequencer.
What work will need to be done to complete this task?
There may be multiple ways to avoid the duplication. One way could be passing the calculated new state from the parent task, so that the leader can just take it rather than calculating it again in validate_and_apply_header.
Are there any other details to include?
No response
What are the acceptance criteria to close this issue?
The state isn't unnecessarily computed twice.
Branch work will be merged to (if not the default branch)
No response