refactor: remove DutyState to use OperatorState for better parallelism#801
refactor: remove DutyState to use OperatorState for better parallelism#801PoulavBhowmick03 wants to merge 3 commits intosigp:unstablefrom
DutyState to use OperatorState for better parallelism#801Conversation
| } | ||
| // Get or create the operator state first, then check if there's a signer state | ||
| let Some(signer_state) = operator_state.get_signer_state(&msg_slot) else { | ||
| return Ok(()); |
There was a problem hiding this comment.
thanks for the pr! This return Ok() causes validate_round_in_allowed_spread to be skipped for single signer messages when there's no prior state. The old continue fell through to the round
spread check after the loop
perhaps move the round spread check before the early return:
if signers.len() == 1 {
validate_round_in_allowed_spread(consensus_message, validation_context)?;
}
There was a problem hiding this comment.
thanks, i missed that. will make the change
|
Two loops over signers were removed in this PR 1.
|
|
@PoulavBhowmick03 can you please take a look at the above comments and merge from unstable to fix CI? |
The Go code receives a state object that can look up any signer's state via |
Yes sure, working on it rn |
|
Hey @PoulavBhowmick03! Again, thanks for your PR. A problem that I did not think about when creating the original issue is that "Decided messages", i.e. messages with multiple operators as sender, would require holding a write lock on multiple entries of the map after the refactor. This is not possible without risking a deadlock. Decided messages are likely to be removed in future: ssvlabs/SIPs#63 That being said, we might still be able to make this work: Another idea might be a more involved general refactor of message validation, which was previously ported from go-ssv in very straightforward way. I am sure there is a better way to structure the existing code. Apologies that I did not realize that this isn't as straightforward as I thought when creating the issue. Let me know your thoughts! |
Hey! I would need a little time to look into this as well, and the different ways to work around it for now. I will get back to you on this |
Issue Addressed
Fixes #745
Proposed Changes
duty_state_mapfromDashMap<MessageId, DutyState>toDashMap<(MessageId, OperatorId), OperatorState>to enable parallel processing of messagesDutyStatewrapper struct.