HotShot
HotShot copied to clipboard
Lr/optimistic vid
trafficstars
Closes #3028
This PR:
DaTaskStatenow optimistically calculates VID shares and updatesConsensusstate when handlingDaProposalValidatedevent and the primary network is down.- moves
calculate_vid_dispersefromcrates/task-impls/src/helpers.rscrate tocrates/types/src/data.rscrate. - adds
calculate_and_update_vidmethod toConsensusto keep the code DRY (now used inDaTaskStateandNetworkResponseState)
This PR does not:
Does not dramatically lower the pessimistic scenario (VID is calculated only when the request arrives) hit rate. This is because we reset the primary network state to up on every view update. This change needs to be implemented to visibly improve the situation.
Key places to review:
crates/task-impls/src/da.rs crates/task-impls/src/response.rs crates/types/src/consensus.rs
How to test this PR:
All the tests should pass.