-
Notifications
You must be signed in to change notification settings - Fork 1
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
[DRAFT, SEE TODO] Multi-domain WIP. #266
base: main
Are you sure you want to change the base?
Conversation
ProtocolContractState::Resharing(state) => { | ||
Ok(state.current_state.key_state.threshold()) | ||
Ok(state.resharing_key.proposed_parameters().threshold()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this threshold come from the old participant set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I don't know what threshold() is intended to be used for so it's kinda impossible to say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is used for voting on contract updates.
} | ||
ProtocolContractState::Resharing(state) => { | ||
AuthenticatedParticipantId::new( | ||
state.resharing_key.proposed_parameters().participants(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too, we should not give the right to vote on contract updates to any participant not yet holding a valid keyshare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I had a different thought but thinking about it again, yeah I think you're right.
self.cleanup_if_timed_out(); | ||
let Some(instance) = self.instance.as_ref() else { | ||
return Err(KeyEventError::NoActiveKeyEvent.into()); | ||
} | ||
// Ensure the key_event_id matches | ||
if self.current_key_event_id() != *key_event_id { | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the cleanup removes the timed out instance, this function will throw an error which is propagated back to the API call. This results in the contract state not changing.
Not throwing an error and persisting the state change would make it easier for the leader to notice when the instance timed out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes you're totally right. I'm just gonna not return error if there's no current instance. Nobody really cares about the return value anyway. And in tests we can always just look at the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I'm still returning error. Because whether we remove the timed out instance has no bearing on anything. A timed out instance must always be treated by everyone as if the instance were removed. Actually removing it is just for the purpose of making the code that follows simpler.
TODO:
Done: